Mercurial > hg > Gears > GearsAgda
changeset 523:8fbc3ef749b6
separate Agda
author | ryokka |
---|---|
date | Fri, 05 Jan 2018 16:39:43 +0900 |
parents | f63a9a081b61 |
children | 5f684d39832e |
files | Dockerfile RedBlackTree.agda doc/Cerium_on_Gears.mm doc/ChangeLog.txt doc/CodeSegmentFlow.graffle doc/Context.graffle doc/DataSegment.graffle doc/GearBoxExample.graffle doc/GearsOS.mm doc/GearsOS_arch.graffle doc/GearsProgramming.mm doc/Interface.mm doc/List.graffle doc/allocate.graffle doc/dependency.graffle doc/gears_structure.graffle doc/scheduler.graffle doc/synchronizedQueue.graffle src/CMakeLists.txt src/include/allocate.h src/include/context.h src/include/origin_cs.h src/llrb/CMakeLists.txt src/llrb/allocate.c src/llrb/compare.c src/llrb/include/llrbContext.h src/llrb/include/stack.h src/llrb/llrb.c src/llrb/llrbContext.c src/llrb/main.c src/llrb/origin_cs.c src/llrb/stack.c src/parallel_execution/Atomic.h src/parallel_execution/AtomicReference.cbc src/parallel_execution/Buffer.h src/parallel_execution/CMakeLists.txt src/parallel_execution/CPUWorker.cbc src/parallel_execution/CUDAExecutor.cbc src/parallel_execution/CUDAWorker.cbc src/parallel_execution/CodeGear.h src/parallel_execution/Executor.h src/parallel_execution/Iterator.h src/parallel_execution/Lock.h src/parallel_execution/LockImpl.cbc src/parallel_execution/MultiDimIterator.cbc src/parallel_execution/Queue.h src/parallel_execution/RedBlackTree.agda src/parallel_execution/RedBlackTree.cbc src/parallel_execution/RedBlackTreeReWright.cbc src/parallel_execution/Semaphore.h src/parallel_execution/SemaphoreImpl.cbc src/parallel_execution/SingleLinkedQueue.cbc src/parallel_execution/SingleLinkedStack.cbc src/parallel_execution/SpinLock.cbc src/parallel_execution/Stack.h src/parallel_execution/SynchronizedQueue.cbc src/parallel_execution/TaskIterator.cbc src/parallel_execution/TaskManager.h src/parallel_execution/TaskManagerImpl.cbc src/parallel_execution/Timer.h src/parallel_execution/TimerImpl.cbc src/parallel_execution/Todo src/parallel_execution/Tree.h src/parallel_execution/Worker.h src/parallel_execution/compare.c src/parallel_execution/context.h src/parallel_execution/cuda.c src/parallel_execution/examples/bitonicSort/CUDAbitonicSwap.cu src/parallel_execution/examples/bitonicSort/SortArray.cbc src/parallel_execution/examples/bitonicSort/bitonicSort.cbc src/parallel_execution/examples/bitonicSort/bitonicSwap.cbc src/parallel_execution/examples/bitonicSort/makeArray.cbc src/parallel_execution/examples/bitonicSort/printArray.cbc src/parallel_execution/examples/bitonicSort/sort.cbc src/parallel_execution/examples/boundedBuffer/BoundedBuffer.cbc src/parallel_execution/examples/boundedBuffer/SemaphoreImpl.cbc src/parallel_execution/examples/boundedBuffer/consumer.cbc src/parallel_execution/examples/boundedBuffer/initBuffer.cbc src/parallel_execution/examples/boundedBuffer/main.cbc src/parallel_execution/examples/boundedBuffer/producer.cbc src/parallel_execution/examples/calc/add.cbc src/parallel_execution/examples/calc/calc.cbc src/parallel_execution/examples/calc/initIntegerDataGears.cbc src/parallel_execution/examples/calc/mult.cbc src/parallel_execution/examples/twice/CUDAtwice.cu src/parallel_execution/examples/twice/createArray.cbc src/parallel_execution/examples/twice/main.cbc src/parallel_execution/examples/twice/printArray.cbc src/parallel_execution/examples/twice/twice.cbc src/parallel_execution/generate_context.pl src/parallel_execution/generate_stub.pl src/parallel_execution/helper_cuda.h src/parallel_execution/helper_string.h src/parallel_execution/main.cbc src/parallel_execution/stack.agda src/parallel_execution/test/cbc_stack_test.c src/parallel_execution/test/multiDimIterator_test.cbc src/parallel_execution/test/printIterator.cbc src/parallel_execution/test/queue_test.cbc src/parallel_execution/test/rbTree_test.cbc src/parallel_execution/test/stack_test.cbc src/parallel_execution/verifier/llrbContextWithVerifier.c src/parallel_execution/verifier/llrbContextWithVerifier.h src/parallel_execution/verifier/verify_put_cs.c src/test/CMakeLists.txt src/test/Cudasample_cpu.cu src/test/Cudasample_gpu.cu src/test/OpenCL_gpu.c src/test/helper_cuda.h src/test/helper_string.h src/test/main.cu src/test/multiply.cu src/test/test.c src/test/twice.cc src/test/vectorAddDrv.cc src/test/vectorAdd_kernel.cu stack.agda |
diffstat | 117 files changed, 400 insertions(+), 20606 deletions(-) [+] |
line wrap: on
line diff
--- a/Dockerfile Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -# docker build -t gears . # build container -# docker run gears # launch container and attach - -FROM fedora:23 - -WORKDIR /root -RUN dnf update -y -RUN dnf install -y gcc gcc-c++ mercurial git vim zsh tar findutils make gdb cmake -RUN hg clone http://firefly.cr.ie.u-ryukyu.ac.jp/hg/CbC/CbC_llvm -RUN mkdir /root/llvm_build -WORKDIR /root/llvm_build -RUN /root/CbC_llvm/configure --enable-assertions -RUN make -j 2 -RUN make install -ENV CBC_COMPILER /usr/local/bin/clang -WORKDIR /root -RUN git clone https://github.com/choller/llcov - -CMD zsh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RedBlackTree.agda Fri Jan 05 16:39:43 2018 +0900 @@ -0,0 +1,145 @@ +module RedBlackTree where + +open import stack +open import Level + +record TreeMethods {n m : Level } {a : Set n } {t : Set m } (treeImpl : Set n ) : Set (m Level.⊔ n) where + field + putImpl : treeImpl -> a -> (treeImpl -> t) -> t + getImpl : treeImpl -> (treeImpl -> Maybe a -> t) -> t +open TreeMethods + +record Tree {n m : Level } {a : Set n } {t : Set m } (treeImpl : Set n ) : Set (m Level.⊔ n) where + field + tree : treeImpl + treeMethods : TreeMethods {n} {m} {a} {t} treeImpl + putTree : a -> (Tree treeImpl -> t) -> t + putTree d next = putImpl (treeMethods ) tree d (\t1 -> next (record {tree = t1 ; treeMethods = treeMethods} )) + getTree : (Tree treeImpl -> Maybe a -> t) -> t + getTree next = getImpl (treeMethods ) tree (\t1 d -> next (record {tree = t1 ; treeMethods = treeMethods} ) d ) + +open Tree + +data Color {n : Level } : Set n where + Red : Color + Black : Color + +data CompareResult {n : Level } : Set n where + LT : CompareResult + GT : CompareResult + EQ : CompareResult + +record Node {n : Level } (a k : Set n) : Set n where + inductive + field + key : k + value : a + right : Maybe (Node a k) + left : Maybe (Node a k) + color : Color {n} +open Node + +record RedBlackTree {n m : Level } {t : Set m} (a k si : Set n) : Set (m Level.⊔ n) where + field + root : Maybe (Node a k) + nodeStack : Stack {n} {m} (Node a k) {t} si + compare : k -> k -> CompareResult {n} + +open RedBlackTree + +open Stack + +-- +-- put new node at parent node, and rebuild tree to the top +-- +{-# TERMINATING #-} -- https://agda.readthedocs.io/en/v2.5.3/language/termination-checking.html +replaceNode : {n m : Level } {t : Set m } {a k si : Set n} -> RedBlackTree {n} {m} {t} a k si -> Stack (Node a k) si -> Node a k -> Node a k -> (RedBlackTree {n} {m} {t} a k si -> t) -> t +replaceNode {n} {m} {t} {a} {k} {si} tree s parent n0 next = popStack s ( + \s grandParent -> replaceNode1 s grandParent ( compare tree (key parent) (key n0) ) ) + where + replaceNode1 : Stack (Node a k) si -> Maybe ( Node a k ) -> CompareResult -> t + replaceNode1 s Nothing LT = next ( record tree { root = Just ( record parent { left = Just n0 ; color = Black } ) } ) + replaceNode1 s Nothing GT = next ( record tree { root = Just ( record parent { right = Just n0 ; color = Black } ) } ) + replaceNode1 s Nothing EQ = next ( record tree { root = Just ( record parent { right = Just n0 ; color = Black } ) } ) + replaceNode1 s (Just grandParent) result with result + ... | LT = replaceNode tree s grandParent ( record parent { left = Just n0 } ) next + ... | GT = replaceNode tree s grandParent ( record parent { right = Just n0 } ) next + ... | EQ = next tree + +rotateRight : {n m : Level } {t : Set m } {a k si : Set n} -> RedBlackTree {n} {m} {t} a k si -> Stack (Node a k) {t} si -> Node a k -> Node a k -> Node a k -> (RedBlackTree {n} {m} {t} a k si -> t) -> t +rotateRight {n} {m} {t} {a} {k} {si} tree s n0 parent grandParent next = {!!} + +rotateLeft : {n m : Level } {t : Set m } {a k si : Set n} -> RedBlackTree {n} {m} {t} a k si -> Stack (Node a k) {t} si -> Node a k -> Node a k -> Node a k -> (RedBlackTree {n} {m} {t} a k si -> t) -> t +rotateLeft {n} {m} {t} {a} {k} {si} tree s n0 parent grandParent next = {!!} + +insertCase5 : {n m : Level } {t : Set m } {a k si : Set n} -> RedBlackTree {n} {m} {t} a k si -> Stack (Node a k) {t} si -> Node a k -> Node a k -> Node a k -> (RedBlackTree {n} {m} {t} a k si -> t) -> t +insertCase5 {n} {m} {t} {a} {k} {si} tree s n0 parent grandParent next = {!!} + +insertCase4 : {n m : Level } {t : Set m } {a k si : Set n} -> RedBlackTree {n} {m} {t} a k si -> Stack (Node a k) {t} si -> Node a k -> Node a k -> Node a k -> (RedBlackTree {n} {m} {t} a k si -> t) -> t +insertCase4 {n} {m} {t} {a} {k} {si} tree s n0 parent grandParent next = {!!} + +{-# TERMINATING #-} +insertNode : {n m : Level } {t : Set m } {a k si : Set n} -> RedBlackTree {n} {m} {t} a k si -> Stack (Node a k) {t} si -> Node a k -> (RedBlackTree {n} {m} {t} a k si -> t) -> t +insertNode {n} {m} {t} {a} {k} {si} tree s n0 next = get2Stack s (\ s d1 d2 -> insertCase1 s n0 d1 d2 ) + where + insertCase1 : Stack (Node a k) si -> Node a k -> Maybe (Node a k) -> Maybe (Node a k) -> t -- placed here to allow mutual recursion + -- http://agda.readthedocs.io/en/v2.5.2/language/mutual-recursion.html + insertCase3 : Stack (Node a k) si -> Node a k -> Node a k -> Node a k -> t + insertCase3 s n0 parent grandParent with left grandParent | right grandParent + ... | Nothing | Nothing = insertCase4 tree s n0 parent grandParent next + ... | Nothing | Just uncle = insertCase4 tree s n0 parent grandParent next + ... | Just uncle | _ with compare tree ( key uncle ) ( key parent ) + ... | EQ = insertCase4 tree s n0 parent grandParent next + ... | _ with color uncle + ... | Red = pop2Stack s ( \s p0 p1 -> insertCase1 s ( + record grandParent { color = Red ; left = Just ( record parent { color = Black ; left = Just n0 } ) ; right = Just ( record uncle { color = Black } ) }) p0 p1 ) + ... | Black = insertCase4 tree s n0 parent grandParent next + insertCase2 : Stack (Node a k) si -> Node a k -> Node a k -> Node a k -> t + insertCase2 s n0 parent grandParent with color parent + ... | Black = replaceNode tree s grandParent n0 next + ... | Red = insertCase3 s n0 parent grandParent + insertCase1 s n0 Nothing Nothing = next tree + insertCase1 s n0 Nothing (Just grandParent) = replaceNode tree s grandParent n0 next + insertCase1 s n0 (Just grandParent) Nothing = replaceNode tree s grandParent n0 next + insertCase1 s n0 (Just parent) (Just grandParent) = insertCase2 s n0 parent grandParent + where + +findNode : {n m : Level } {a k si : Set n} {t : Set m} -> RedBlackTree {n} {m} {t} a k si -> Stack (Node a k) si -> (Node a k) -> (Node a k) -> (RedBlackTree {n} {m} {t} a k si -> Stack (Node a k) si -> Node a k -> t) -> t +findNode {n} {m} {a} {k} {si} {t} tree s n0 n1 next = pushStack s n1 (\ s -> findNode1 s n1) + where + findNode2 : Stack (Node a k) si -> (Maybe (Node a k)) -> t + findNode2 s Nothing = next tree s n0 + findNode2 s (Just n) = findNode tree s n0 n next + findNode1 : Stack (Node a k) si -> (Node a k) -> t + findNode1 s n1 with (compare tree (key n0) (key n1)) + ... | EQ = next tree s n0 + ... | GT = findNode2 s (right n1) + ... | LT = findNode2 s (left n1) + + +leafNode : {n : Level } {a k : Set n} -> k -> a -> Node a k +leafNode k1 value = record { + key = k1 ; + value = value ; + right = Nothing ; + left = Nothing ; + color = Black + } + +putRedBlackTree : {n m : Level } {a k si : Set n} {t : Set m} -> RedBlackTree {n} {m} {t} a k si -> k -> a -> (RedBlackTree {n} {m} {t} a k si -> t) -> t +putRedBlackTree {n} {m} {a} {k} {si} {t} tree k1 value next with (root tree) +... | Nothing = next (record tree {root = Just (leafNode k1 value) }) +... | Just n2 = findNode tree (nodeStack tree) (leafNode k1 value) n2 (\ tree1 s n1 -> insertNode tree1 s n1 next) + +getRedBlackTree : {n m : Level } {a k si : Set n} {t : Set m} -> RedBlackTree {n} {m} {t} a k si -> k -> (RedBlackTree {n} {m} {t} a k si -> (Maybe (Node a k)) -> t) -> t +getRedBlackTree {_} {_} {a} {k} {_} {t} tree k1 cs = checkNode (root tree) + where + checkNode : Maybe (Node a k) -> t + checkNode Nothing = cs tree Nothing + checkNode (Just n) = search n + where + search : Node a k -> t + search n with compare tree k1 (key n) + search n | LT = checkNode (left n) + search n | GT = checkNode (right n) + search n | EQ = cs tree (Just n)
--- a/doc/Cerium_on_Gears.mm Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -<map version="1.0.1"> -<!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net --> -<node CREATED="1435308827952" ID="ID_131842877" MODIFIED="1435309957718" TEXT="Cerium on Gears"> -<node CREATED="1435308839544" ID="ID_1530623033" MODIFIED="1435308850391" POSITION="right" TEXT="cerium api"> -<node CREATED="1435308850393" ID="ID_771810602" MODIFIED="1435308853069" TEXT="create task"/> -<node CREATED="1435308853639" ID="ID_823697037" MODIFIED="1435308855797" TEXT="set input"/> -<node CREATED="1435308856222" ID="ID_870389873" MODIFIED="1435308859077" TEXT="set output"/> -<node CREATED="1435308859542" ID="ID_1165664665" MODIFIED="1435308861141" TEXT="wait for"/> -<node CREATED="1435308861654" ID="ID_1136492416" MODIFIED="1435308864365" TEXT="aset cpu"/> -</node> -<node CREATED="1435308879270" ID="ID_1778771194" MODIFIED="1435308886484" POSITION="left" TEXT="data segmentの中身が重要"> -<node CREATED="1435308887547" ID="ID_47150659" MODIFIED="1435308893083" TEXT="待ち合わせするDS"/> -<node CREATED="1435308893954" ID="ID_1795329909" MODIFIED="1435308898243" TEXT="出力するDS"/> -</node> -<node CREATED="1435308950534" ID="ID_1871831352" MODIFIED="1435308956875" POSITION="right" TEXT="stackをどれくらい取るか"> -<node CREATED="1435308956876" ID="ID_947936114" MODIFIED="1435308968225" TEXT="DSを使う位なら大丈夫"/> -<node CREATED="1435308968664" ID="ID_1618545981" MODIFIED="1435308983424" TEXT="ライブラリを呼ぶ場合に重要"/> -</node> -<node CREATED="1435309121221" ID="ID_1162276288" MODIFIED="1435309122451" POSITION="left" TEXT="allocate"> -<node CREATED="1435309100165" ID="ID_553961118" MODIFIED="1435309169731" TEXT="idsをodsはallocate"/> -<node CREATED="1435309146987" ID="ID_1150211352" MODIFIED="1435309173121" TEXT="他のDSを含めたallocate"/> -</node> -<node CREATED="1435309184094" ID="ID_1163048841" MODIFIED="1435309190960" POSITION="right" TEXT="待ち合わせ"> -<node CREATED="1435309190961" ID="ID_926746897" MODIFIED="1435309310205" TEXT="必要なidsを揃える"/> -<node CREATED="1435309356508" ID="ID_561850496" MODIFIED="1435309398097" TEXT="iDSはpersistentとtemporaryがある"> -<node CREATED="1435309794476" ID="ID_942197716" MODIFIED="1435309816682" TEXT="persistentなDSのAPIはAlice参照"/> -</node> -<node CREATED="1435309402946" ID="ID_987543601" MODIFIED="1435309414753" TEXT="最初はtemporaryなDSが処理を行って終わり"/> -</node> -<node CREATED="1435309821416" ID="ID_1476250155" MODIFIED="1435309824065" POSITION="left" TEXT="create task"> -<node CREATED="1435309824624" ID="ID_564912499" MODIFIED="1435309846006" TEXT="schedulerへのアクセス"> -<node CREATED="1435309846007" ID="ID_155507674" MODIFIED="1435309857416" TEXT="アクセスはパラメータで指定する"/> -</node> -<node CREATED="1435309858848" ID="ID_718589347" MODIFIED="1435309871215" TEXT="contextは共通(とりあえずmany coreで)"/> -<node CREATED="1435309873057" ID="ID_465190157" MODIFIED="1435310606993" TEXT="create taskを読んだときはDsは全部用意していない"> -<node CREATED="1435309900384" ID="ID_1324744496" MODIFIED="1435309908462" TEXT="queueに使うDSを保存させる"/> -</node> -<node CREATED="1435309964946" ID="ID_1958597373" MODIFIED="1435309999179" TEXT="あるodsからidsを要して全部Readyになったらactive queueにいれる"> -<node CREATED="1435310018787" ID="ID_988326162" MODIFIED="1435310057457" TEXT="ceriumは一度Listにしているが、今はcontextをいれる"/> -</node> -<node CREATED="1435310066968" ID="ID_980999504" MODIFIED="1435310099743" TEXT="用意できたらcoreにtaskをふり分ける"/> -<node CREATED="1435310478346" ID="ID_1423861354" MODIFIED="1435310489729" TEXT="新しいcontextを作ってinputのqueueにいれるだけ"/> -</node> -<node CREATED="1435310119606" ID="ID_128065003" MODIFIED="1435310125271" POSITION="right" TEXT="scheduler"> -<node CREATED="1435310125768" ID="ID_1272208047" MODIFIED="1435310146422" TEXT="schedulerはsynchronized queueを持っている"/> -<node CREATED="1435310152015" ID="ID_427259960" MODIFIED="1435310170940" TEXT="pipelineにする?(これはまたあとで)"/> -<node CREATED="1435310179093" ID="ID_1872835868" MODIFIED="1435310189484" TEXT="他のDSを用意している間に他のDSを実行する"/> -<node CREATED="1435310195930" ID="ID_1403963109" MODIFIED="1435310201765" TEXT="writeしたのを教える必要がある"> -<node CREATED="1435310201766" ID="ID_602537190" MODIFIED="1435310213427" TEXT="many coreを勝手に書き換える(Casでatomicに)"/> -<node CREATED="1435310220332" ID="ID_923547780" MODIFIED="1435310228059" TEXT="synchronized queueでmainのtaskに戻す"/> -<node CREATED="1435310230199" ID="ID_530379005" MODIFIED="1435310275368" TEXT="それぞれのschedulerで勝手に書くのが面白い"/> -</node> -<node CREATED="1435310333829" ID="ID_1432559517" MODIFIED="1435310387909" TEXT="待ってるtaskのpoolをschedulerが勝手にIDSをactive queueにいれる(schedulerが待ちtaskを取り合う)"> -<node CREATED="1435310391704" ID="ID_1668940684" MODIFIED="1435310421467" TEXT="実装はpoolingでもよいしsynchronized queueでもよい"/> -<node CREATED="1435310422341" ID="ID_1365380151" MODIFIED="1435310439995" TEXT="GPUでやった場合はよくわからない"/> -<node CREATED="1435310440433" ID="ID_1863232092" MODIFIED="1435310457178" TEXT="単一のschedulerにtaskを取り合う"/> -</node> -</node> -<node CREATED="1435310492109" ID="ID_17177" MODIFIED="1435310561719" POSITION="left" TEXT="example"> -<node CREATED="1435310526215" ID="ID_90616463" MODIFIED="1435310557599" TEXT="temporaryなds同士の演算"/> -<node CREATED="1435310562447" ID="ID_1893745957" MODIFIED="1435310566406" TEXT="sort"/> -<node CREATED="1435310566919" ID="ID_370953203" MODIFIED="1435310568718" TEXT="word count"/> -</node> -<node CREATED="1435655123173" ID="ID_476222881" MODIFIED="1435655128583" POSITION="right" TEXT="active task list"/> -<node CREATED="1435655131078" ID="ID_1089114952" MODIFIED="1435655136126" POSITION="left" TEXT="wait task list"> -<node CREATED="1435655137399" ID="ID_459495369" MODIFIED="1435655144883" TEXT="wait fo"/> -</node> -</node> -</map>
--- a/doc/ChangeLog.txt Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -Mon Apr 13 20:13:54 JST 2015 kkb - - version 管理も built in であるべき - プログラムを走らせるときに使うコードセグメントの集合は決まってる - unix の command に相当 - context がすべて知っている必要がある - プログラムの走り方で dynamic loding liblary が変わる - Reflection を意識したプログラミング - -Fri Apr 10 17:52:46 JST 2015 Tatsuki IHA - - context.hにdata segmentの型を定義 - code segmentのaddressはcontextが持つ - 呼ぶcode segmentはenumで持つ - code segmentにはdefaultで一つdata segmentを持つ
--- a/doc/Context.graffle Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,301 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>ActiveLayerIndex</key> - <integer>0</integer> - <key>ApplicationVersion</key> - <array> - <string>com.omnigroup.OmniGraffle</string> - <string>139.18.0.187838</string> - </array> - <key>AutoAdjust</key> - <true/> - <key>BackgroundGraphic</key> - <dict> - <key>Bounds</key> - <string>{{0, 0}, {559, 783}}</string> - <key>Class</key> - <string>SolidGraphic</string> - <key>ID</key> - <integer>2</integer> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <key>BaseZoom</key> - <integer>0</integer> - <key>CanvasOrigin</key> - <string>{0, 0}</string> - <key>ColumnAlign</key> - <integer>1</integer> - <key>ColumnSpacing</key> - <real>36</real> - <key>CreationDate</key> - <string>2015-02-17 15:18:26 +0000</string> - <key>Creator</key> - <string>kkb</string> - <key>DisplayScale</key> - <string>1 0/72 in = 1.0000 in</string> - <key>GraphDocumentVersion</key> - <integer>8</integer> - <key>GraphicsList</key> - <array> - <dict> - <key>Class</key> - <string>TableGroup</string> - <key>Graphics</key> - <array> - <dict> - <key>Bounds</key> - <string>{{75, 106}, {190, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>37</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1344\cocoasubrtf720 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 Context/Process/HTask}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - <dict> - <key>Bounds</key> - <string>{{75, 120}, {190, 42}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>38</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Align</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1344\cocoasubrtf720 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720 - -\f0\fs24 \cf0 in\ -out\ -code segment}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - </array> - <key>GridH</key> - <array> - <integer>37</integer> - <integer>38</integer> - <array/> - </array> - <key>ID</key> - <integer>36</integer> - </dict> - </array> - <key>GridInfo</key> - <dict/> - <key>GuidesLocked</key> - <string>NO</string> - <key>GuidesVisible</key> - <string>YES</string> - <key>HPages</key> - <integer>1</integer> - <key>ImageCounter</key> - <integer>3</integer> - <key>KeepToScale</key> - <false/> - <key>Layers</key> - <array> - <dict> - <key>Lock</key> - <string>NO</string> - <key>Name</key> - <string>Layer 1</string> - <key>Print</key> - <string>YES</string> - <key>View</key> - <string>YES</string> - </dict> - </array> - <key>LayoutInfo</key> - <dict> - <key>Animate</key> - <string>NO</string> - <key>circoMinDist</key> - <real>18</real> - <key>circoSeparation</key> - <real>0.0</real> - <key>layoutEngine</key> - <string>dot</string> - <key>neatoSeparation</key> - <real>0.0</real> - <key>twopiSeparation</key> - <real>0.0</real> - </dict> - <key>LinksVisible</key> - <string>NO</string> - <key>MagnetsVisible</key> - <string>NO</string> - <key>MasterSheets</key> - <array/> - <key>ModificationDate</key> - <string>2015-03-15 06:53:19 +0000</string> - <key>Modifier</key> - <string>kkb</string> - <key>NotesVisible</key> - <string>NO</string> - <key>Orientation</key> - <integer>2</integer> - <key>OriginVisible</key> - <string>NO</string> - <key>PageBreaks</key> - <string>YES</string> - <key>PrintInfo</key> - <dict> - <key>NSBottomMargin</key> - <array> - <string>float</string> - <string>41</string> - </array> - <key>NSHorizonalPagination</key> - <array> - <string>coded</string> - <string>BAtzdHJlYW10eXBlZIHoA4QBQISEhAhOU051bWJlcgCEhAdOU1ZhbHVlAISECE5TT2JqZWN0AIWEASqEhAFxlwCG</string> - </array> - <key>NSLeftMargin</key> - <array> - <string>float</string> - <string>18</string> - </array> - <key>NSPaperSize</key> - <array> - <string>size</string> - <string>{595, 842}</string> - </array> - <key>NSPrintReverseOrientation</key> - <array> - <string>int</string> - <string>0</string> - </array> - <key>NSRightMargin</key> - <array> - <string>float</string> - <string>18</string> - </array> - <key>NSTopMargin</key> - <array> - <string>float</string> - <string>18</string> - </array> - </dict> - <key>PrintOnePage</key> - <false/> - <key>ReadOnly</key> - <string>NO</string> - <key>RowAlign</key> - <integer>1</integer> - <key>RowSpacing</key> - <real>36</real> - <key>SheetTitle</key> - <string>Canvas 1</string> - <key>SmartAlignmentGuidesActive</key> - <string>YES</string> - <key>SmartDistanceGuidesActive</key> - <string>YES</string> - <key>UniqueID</key> - <integer>1</integer> - <key>UseEntirePage</key> - <false/> - <key>VPages</key> - <integer>1</integer> - <key>WindowInfo</key> - <dict> - <key>CurrentSheet</key> - <integer>0</integer> - <key>ExpandedCanvases</key> - <array> - <dict> - <key>name</key> - <string>Canvas 1</string> - </dict> - </array> - <key>Frame</key> - <string>{{1619, 633}, {693, 925}}</string> - <key>ListView</key> - <true/> - <key>OutlineWidth</key> - <integer>142</integer> - <key>RightSidebar</key> - <false/> - <key>ShowRuler</key> - <true/> - <key>Sidebar</key> - <true/> - <key>SidebarWidth</key> - <integer>120</integer> - <key>VisibleRegion</key> - <string>{{0, 0}, {558, 783}}</string> - <key>Zoom</key> - <real>1</real> - <key>ZoomValues</key> - <array> - <array> - <string>Canvas 1</string> - <real>1</real> - <real>1</real> - </array> - </array> - </dict> -</dict> -</plist>
--- a/doc/DataSegment.graffle Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,506 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>ActiveLayerIndex</key> - <integer>0</integer> - <key>ApplicationVersion</key> - <array> - <string>com.omnigroup.OmniGraffle</string> - <string>139.18.0.187838</string> - </array> - <key>AutoAdjust</key> - <true/> - <key>BackgroundGraphic</key> - <dict> - <key>Bounds</key> - <string>{{0, 0}, {559, 783}}</string> - <key>Class</key> - <string>SolidGraphic</string> - <key>ID</key> - <integer>2</integer> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <key>BaseZoom</key> - <integer>0</integer> - <key>CanvasOrigin</key> - <string>{0, 0}</string> - <key>ColumnAlign</key> - <integer>1</integer> - <key>ColumnSpacing</key> - <real>36</real> - <key>CreationDate</key> - <string>2015-03-15 06:30:40 +0000</string> - <key>Creator</key> - <string>kkb</string> - <key>DisplayScale</key> - <string>1 0/72 in = 1 0/72 in</string> - <key>GraphDocumentVersion</key> - <integer>8</integer> - <key>GraphicsList</key> - <array> - <dict> - <key>Class</key> - <string>TableGroup</string> - <key>Graphics</key> - <array> - <dict> - <key>Bounds</key> - <string>{{107, 283}, {190, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>43</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1344\cocoasubrtf720 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 Meta Data Segment 1}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - <dict> - <key>Bounds</key> - <string>{{107, 297}, {190, 42}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>44</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Align</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1344\cocoasubrtf720 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720 - -\f0\fs24 \cf0 DataSegment* \ -__code*\ -signature*}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - </array> - <key>GridH</key> - <array> - <integer>43</integer> - <integer>44</integer> - <array/> - </array> - <key>ID</key> - <integer>42</integer> - </dict> - <dict> - <key>Bounds</key> - <string>{{21, 245}, {98, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>41</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Pad</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1344\cocoasubrtf720 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 Meta}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>40</integer> - <key>Points</key> - <array> - <string>{21, 211}</string> - <string>{505, 211}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>0</string> - <key>Legacy</key> - <true/> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{21, 54}, {98, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>39</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Pad</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1344\cocoasubrtf720 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 Normal}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>TableGroup</string> - <key>Graphics</key> - <array> - <dict> - <key>Bounds</key> - <string>{{107, 103}, {190, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>37</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1344\cocoasubrtf720 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 Data Segment 1}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - <dict> - <key>Bounds</key> - <string>{{107, 117}, {190, 28}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>38</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Align</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1344\cocoasubrtf720 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720 - -\f0\fs24 \cf0 int\ -char}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - </array> - <key>GridH</key> - <array> - <integer>37</integer> - <integer>38</integer> - <array/> - </array> - <key>ID</key> - <integer>36</integer> - </dict> - </array> - <key>GridInfo</key> - <dict/> - <key>GuidesLocked</key> - <string>NO</string> - <key>GuidesVisible</key> - <string>YES</string> - <key>HPages</key> - <integer>1</integer> - <key>ImageCounter</key> - <integer>1</integer> - <key>KeepToScale</key> - <false/> - <key>Layers</key> - <array> - <dict> - <key>Lock</key> - <string>NO</string> - <key>Name</key> - <string>Layer 1</string> - <key>Print</key> - <string>YES</string> - <key>View</key> - <string>YES</string> - </dict> - </array> - <key>LayoutInfo</key> - <dict> - <key>Animate</key> - <string>NO</string> - <key>circoMinDist</key> - <real>18</real> - <key>circoSeparation</key> - <real>0.0</real> - <key>layoutEngine</key> - <string>dot</string> - <key>neatoSeparation</key> - <real>0.0</real> - <key>twopiSeparation</key> - <real>0.0</real> - </dict> - <key>LinksVisible</key> - <string>NO</string> - <key>MagnetsVisible</key> - <string>NO</string> - <key>MasterSheets</key> - <array/> - <key>ModificationDate</key> - <string>2015-03-15 06:45:10 +0000</string> - <key>Modifier</key> - <string>kkb</string> - <key>NotesVisible</key> - <string>NO</string> - <key>Orientation</key> - <integer>2</integer> - <key>OriginVisible</key> - <string>NO</string> - <key>PageBreaks</key> - <string>YES</string> - <key>PrintInfo</key> - <dict> - <key>NSBottomMargin</key> - <array> - <string>float</string> - <string>41</string> - </array> - <key>NSHorizonalPagination</key> - <array> - <string>coded</string> - <string>BAtzdHJlYW10eXBlZIHoA4QBQISEhAhOU051bWJlcgCEhAdOU1ZhbHVlAISECE5TT2JqZWN0AIWEASqEhAFxlwCG</string> - </array> - <key>NSLeftMargin</key> - <array> - <string>float</string> - <string>18</string> - </array> - <key>NSPaperSize</key> - <array> - <string>size</string> - <string>{595, 842}</string> - </array> - <key>NSPrintReverseOrientation</key> - <array> - <string>int</string> - <string>0</string> - </array> - <key>NSRightMargin</key> - <array> - <string>float</string> - <string>18</string> - </array> - <key>NSTopMargin</key> - <array> - <string>float</string> - <string>18</string> - </array> - </dict> - <key>PrintOnePage</key> - <false/> - <key>ReadOnly</key> - <string>NO</string> - <key>RowAlign</key> - <integer>1</integer> - <key>RowSpacing</key> - <real>36</real> - <key>SheetTitle</key> - <string>Canvas 1</string> - <key>SmartAlignmentGuidesActive</key> - <string>YES</string> - <key>SmartDistanceGuidesActive</key> - <string>YES</string> - <key>UniqueID</key> - <integer>1</integer> - <key>UseEntirePage</key> - <false/> - <key>VPages</key> - <integer>1</integer> - <key>WindowInfo</key> - <dict> - <key>CurrentSheet</key> - <integer>0</integer> - <key>ExpandedCanvases</key> - <array> - <dict> - <key>name</key> - <string>Canvas 1</string> - </dict> - </array> - <key>Frame</key> - <string>{{795, 91}, {693, 925}}</string> - <key>ListView</key> - <true/> - <key>OutlineWidth</key> - <integer>142</integer> - <key>RightSidebar</key> - <false/> - <key>ShowRuler</key> - <true/> - <key>Sidebar</key> - <true/> - <key>SidebarWidth</key> - <integer>120</integer> - <key>VisibleRegion</key> - <string>{{0, 0}, {558, 783}}</string> - <key>Zoom</key> - <real>1</real> - <key>ZoomValues</key> - <array> - <array> - <string>Canvas 1</string> - <real>1</real> - <real>1</real> - </array> - </array> - </dict> -</dict> -</plist>
--- a/doc/GearBoxExample.graffle Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1916 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>ApplicationVersion</key> - <array> - <string>com.omnigroup.OmniGraffle</string> - <string>139.18.0.187838</string> - </array> - <key>CreationDate</key> - <string>2015-05-04 06:18:09 +0000</string> - <key>Creator</key> - <string>Tatsuki IHA</string> - <key>GraphDocumentVersion</key> - <integer>8</integer> - <key>GuidesLocked</key> - <string>NO</string> - <key>GuidesVisible</key> - <string>YES</string> - <key>ImageCounter</key> - <integer>1</integer> - <key>LinksVisible</key> - <string>NO</string> - <key>MagnetsVisible</key> - <string>NO</string> - <key>MasterSheets</key> - <array/> - <key>ModificationDate</key> - <string>2015-05-04 06:41:46 +0000</string> - <key>Modifier</key> - <string>Tatsuki IHA</string> - <key>NotesVisible</key> - <string>NO</string> - <key>OriginVisible</key> - <string>NO</string> - <key>PageBreaks</key> - <string>YES</string> - <key>PrintInfo</key> - <dict> - <key>NSBottomMargin</key> - <array> - <string>float</string> - <string>41</string> - </array> - <key>NSHorizonalPagination</key> - <array> - <string>coded</string> - <string>BAtzdHJlYW10eXBlZIHoA4QBQISEhAhOU051bWJlcgCEhAdOU1ZhbHVlAISECE5TT2JqZWN0AIWEASqEhAFxlwCG</string> - </array> - <key>NSLeftMargin</key> - <array> - <string>float</string> - <string>18</string> - </array> - <key>NSPaperSize</key> - <array> - <string>size</string> - <string>{594.99997329711914, 842}</string> - </array> - <key>NSPrintReverseOrientation</key> - <array> - <string>int</string> - <string>0</string> - </array> - <key>NSRightMargin</key> - <array> - <string>float</string> - <string>18</string> - </array> - <key>NSTopMargin</key> - <array> - <string>float</string> - <string>18</string> - </array> - </dict> - <key>ReadOnly</key> - <string>NO</string> - <key>Sheets</key> - <array> - <dict> - <key>ActiveLayerIndex</key> - <integer>0</integer> - <key>AutoAdjust</key> - <true/> - <key>BackgroundGraphic</key> - <dict> - <key>Bounds</key> - <string>{{0, 0}, {558.99997329711914, 783}}</string> - <key>Class</key> - <string>SolidGraphic</string> - <key>ID</key> - <integer>2</integer> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <key>BaseZoom</key> - <integer>0</integer> - <key>CanvasOrigin</key> - <string>{0, 0}</string> - <key>ColumnAlign</key> - <integer>1</integer> - <key>ColumnSpacing</key> - <real>36</real> - <key>DisplayScale</key> - <string>1 0/72 in = 1.0000 in</string> - <key>GraphicsList</key> - <array> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>8</integer> - </dict> - <key>ID</key> - <integer>43</integer> - <key>Points</key> - <array> - <string>{223.50215235012584, 162.75020370511052}</string> - <string>{183.49998664855957, 159}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>40</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>40</integer> - </dict> - <key>ID</key> - <integer>42</integer> - <key>Points</key> - <array> - <string>{375.49995613098145, 159}</string> - <string>{335.49778661492263, 162.75020391369949}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>37</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>TableGroup</string> - <key>Graphics</key> - <array> - <dict> - <key>Bounds</key> - <string>{{223.99996948242188, 161}, {111, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>40</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 data segment 2}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - <dict> - <key>Bounds</key> - <string>{{223.99996948242188, 175}, {111, 28}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>41</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Align</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720 - -\f0\fs24 \cf0 \ -}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - </array> - <key>GridH</key> - <array> - <integer>40</integer> - <integer>41</integer> - <array/> - </array> - <key>ID</key> - <integer>39</integer> - </dict> - <dict> - <key>Bounds</key> - <string>{{414.49996948242188, 286}, {33, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>6</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 end}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{108.99998474121094, 36}, {38, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>5</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 start}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>38</integer> - <key>Points</key> - <array> - <string>{431.04225592022601, 180}</string> - <string>{430.49995613098145, 234}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - </dict> - <dict> - <key>Class</key> - <string>Group</string> - <key>Graphics</key> - <array> - <dict> - <key>Bounds</key> - <string>{{420.49995613098145, 238.5}, {21, 21}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>24</integer> - <key>Shape</key> - <string>Circle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Color</key> - <dict> - <key>b</key> - <string>0</string> - <key>g</key> - <string>0</string> - <key>r</key> - <string>0</string> - </dict> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{415.99995613098145, 234}, {30, 30}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>3</integer> - <key>Shape</key> - <string>Circle</string> - <key>Style</key> - <dict/> - </dict> - </array> - <key>ID</key> - <integer>1</integer> - </dict> - <dict> - <key>Bounds</key> - <string>{{375.49995613098145, 138}, {111, 42}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>37</integer> - <key>Magnets</key> - <array> - <string>{0, 1}</string> - <string>{0, -1}</string> - <string>{1, 0}</string> - <string>{-1, 0}</string> - </array> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>CornerRadius</key> - <real>5</real> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 code segment 2}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>36</integer> - <key>Points</key> - <array> - <string>{335.48908011958167, 149.89405544557314}</string> - <string>{375.99998664855957, 158.5}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>35</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>TableGroup</string> - <key>Graphics</key> - <array> - <dict> - <key>Bounds</key> - <string>{{223.9999942779541, 110}, {111, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>34</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 data segment 1}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - <dict> - <key>Bounds</key> - <string>{{223.9999942779541, 124}, {111, 28}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>35</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Align</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720 - -\f0\fs24 \cf0 \ -}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - </array> - <key>GridH</key> - <array> - <integer>34</integer> - <integer>35</integer> - <array/> - </array> - <key>ID</key> - <integer>33</integer> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>35</integer> - </dict> - <key>ID</key> - <integer>10</integer> - <key>Points</key> - <array> - <string>{183.49998664855957, 159}</string> - <string>{223.51154427454037, 150.24747246490509}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>8</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>8</integer> - <key>Info</key> - <integer>2</integer> - </dict> - <key>ID</key> - <integer>9</integer> - <key>Points</key> - <array> - <string>{128.54228643780414, 84}</string> - <string>{127.99998664855957, 138}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{72.49998664855957, 138}, {111, 42}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>8</integer> - <key>Magnets</key> - <array> - <string>{0, 1}</string> - <string>{0, -1}</string> - <string>{1, 0}</string> - <string>{-1, 0}</string> - </array> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>CornerRadius</key> - <real>5</real> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 code segment 1}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{117.49998664855957, 63}, {21, 21}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>4</integer> - <key>Shape</key> - <string>Circle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Color</key> - <dict> - <key>b</key> - <string>0</string> - <key>g</key> - <string>0</string> - <key>r</key> - <string>0</string> - </dict> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - </array> - <key>GridInfo</key> - <dict/> - <key>HPages</key> - <integer>1</integer> - <key>KeepToScale</key> - <false/> - <key>Layers</key> - <array> - <dict> - <key>Lock</key> - <string>NO</string> - <key>Name</key> - <string>Layer 1</string> - <key>Print</key> - <string>YES</string> - <key>View</key> - <string>YES</string> - </dict> - </array> - <key>LayoutInfo</key> - <dict> - <key>Animate</key> - <string>NO</string> - <key>circoMinDist</key> - <real>18</real> - <key>circoSeparation</key> - <real>0.0</real> - <key>layoutEngine</key> - <string>dot</string> - <key>neatoSeparation</key> - <real>0.0</real> - <key>twopiSeparation</key> - <real>0.0</real> - </dict> - <key>Orientation</key> - <integer>2</integer> - <key>PrintOnePage</key> - <false/> - <key>RowAlign</key> - <integer>1</integer> - <key>RowSpacing</key> - <real>36</real> - <key>SheetTitle</key> - <string>example</string> - <key>UniqueID</key> - <integer>1</integer> - <key>VPages</key> - <integer>1</integer> - </dict> - <dict> - <key>ActiveLayerIndex</key> - <integer>0</integer> - <key>AutoAdjust</key> - <true/> - <key>BackgroundGraphic</key> - <dict> - <key>Bounds</key> - <string>{{0, 0}, {558.99997329711914, 783}}</string> - <key>Class</key> - <string>SolidGraphic</string> - <key>ID</key> - <integer>2</integer> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <key>BaseZoom</key> - <integer>0</integer> - <key>CanvasOrigin</key> - <string>{0, 0}</string> - <key>ColumnAlign</key> - <integer>1</integer> - <key>ColumnSpacing</key> - <real>36</real> - <key>DisplayScale</key> - <string>1 0/72 in = 1.0000 in</string> - <key>GraphicsList</key> - <array> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>8</integer> - <key>Info</key> - <integer>1</integer> - </dict> - <key>ID</key> - <integer>59</integer> - <key>Points</key> - <array> - <string>{127.42646217346191, 221.25010681152344}</string> - <string>{127.99998664855957, 180}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>57</integer> - </dict> - <key>ID</key> - <integer>58</integer> - <key>Points</key> - <array> - <string>{127.99967208086677, 304.50000009137023}</string> - <string>{127.97279128802096, 263.75010672015321}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>47</integer> - <key>Info</key> - <integer>2</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>TableGroup</string> - <key>Graphics</key> - <array> - <dict> - <key>Bounds</key> - <string>{{72.463226318359375, 221.25010681152344}, {111, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>56</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 data segment 2}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - <dict> - <key>Bounds</key> - <string>{{72.463226318359375, 235.25010681152344}, {111, 28}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>57</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Align</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720 - -\f0\fs24 \cf0 \ -}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - </array> - <key>GridH</key> - <array> - <integer>56</integer> - <integer>57</integer> - <array/> - </array> - <key>ID</key> - <integer>55</integer> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>54</integer> - <key>Points</key> - <array> - <string>{224, 325.91665649414062}</string> - <string>{183.99997287473553, 325.49998954491912}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>41</integer> - </dict> - <key>ID</key> - <integer>53</integer> - <key>Points</key> - <array> - <string>{375.5, 326}</string> - <string>{335.49997287473553, 325.58333305077849}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>46</integer> - <key>Info</key> - <integer>4</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>52</integer> - <key>Points</key> - <array> - <string>{430.5, 263.5}</string> - <string>{430.5, 304.5}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>49</integer> - </dict> - <key>ID</key> - <integer>51</integer> - <key>Points</key> - <array> - <string>{431, 180}</string> - <string>{431, 221}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>37</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>TableGroup</string> - <key>Graphics</key> - <array> - <dict> - <key>Bounds</key> - <string>{{375.5, 221.5}, {111, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>49</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 data segment 1}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - <dict> - <key>Bounds</key> - <string>{{375.5, 235.5}, {111, 28}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>50</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Align</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720 - -\f0\fs24 \cf0 \ -}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - </array> - <key>GridH</key> - <array> - <integer>49</integer> - <integer>50</integer> - <array/> - </array> - <key>ID</key> - <integer>48</integer> - </dict> - <dict> - <key>Bounds</key> - <string>{{72.500001907348633, 305}, {111, 42}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>47</integer> - <key>Magnets</key> - <array> - <string>{0, 1}</string> - <string>{0, -1}</string> - <string>{1, 0}</string> - <string>{-1, 0}</string> - </array> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>CornerRadius</key> - <real>5</real> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 M : code segment 2}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{375.5, 305}, {111, 42}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>46</integer> - <key>Magnets</key> - <array> - <string>{0, 1}</string> - <string>{0, -1}</string> - <string>{1, 0}</string> - <string>{-1, 0}</string> - </array> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>CornerRadius</key> - <real>5</real> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 code segment 2}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>37</integer> - </dict> - <key>ID</key> - <integer>45</integer> - <key>Points</key> - <array> - <string>{335.49985336964573, 158.5}</string> - <string>{375.5, 159}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>35</integer> - </dict> - <key>ID</key> - <integer>44</integer> - <key>Points</key> - <array> - <string>{183.49998664855957, 159}</string> - <string>{223.50010276133571, 159.83333568612193}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>8</integer> - <key>Info</key> - <integer>3</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>TableGroup</string> - <key>Graphics</key> - <array> - <dict> - <key>Bounds</key> - <string>{{224, 297}, {111, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>40</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 data segment 2}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - <dict> - <key>Bounds</key> - <string>{{224, 311}, {111, 28}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>41</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Align</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720 - -\f0\fs24 \cf0 \ -}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - </array> - <key>GridH</key> - <array> - <integer>40</integer> - <integer>41</integer> - <array/> - </array> - <key>ID</key> - <integer>39</integer> - </dict> - <dict> - <key>Bounds</key> - <string>{{111.5, 443}, {33, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>6</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 end}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{108.99998474121094, 37}, {38, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>5</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 start}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>38</integer> - <key>Points</key> - <array> - <string>{128.04228643780414, 347}</string> - <string>{127.49998664855957, 401}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - </dict> - <dict> - <key>Class</key> - <string>Group</string> - <key>Graphics</key> - <array> - <dict> - <key>Bounds</key> - <string>{{117.49998664855957, 405.5}, {21, 21}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>24</integer> - <key>Shape</key> - <string>Circle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Color</key> - <dict> - <key>b</key> - <string>0</string> - <key>g</key> - <string>0</string> - <key>r</key> - <string>0</string> - </dict> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{112.99998664855957, 401}, {30, 30}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>3</integer> - <key>Shape</key> - <string>Circle</string> - <key>Style</key> - <dict/> - </dict> - </array> - <key>ID</key> - <integer>1</integer> - </dict> - <dict> - <key>Bounds</key> - <string>{{375.5, 138}, {111, 42}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>37</integer> - <key>Magnets</key> - <array> - <string>{0, 1}</string> - <string>{0, -1}</string> - <string>{1, 0}</string> - <string>{-1, 0}</string> - </array> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>CornerRadius</key> - <real>5</real> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 M : code segment 1}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>TableGroup</string> - <key>Graphics</key> - <array> - <dict> - <key>Bounds</key> - <string>{{223.9999942779541, 133}, {111, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>34</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 data segment 1}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - <dict> - <key>Bounds</key> - <string>{{223.9999942779541, 147}, {111, 28}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>35</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Align</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720 - -\f0\fs24 \cf0 \ -}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - </array> - <key>GridH</key> - <array> - <integer>34</integer> - <integer>35</integer> - <array/> - </array> - <key>ID</key> - <integer>33</integer> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>8</integer> - <key>Info</key> - <integer>2</integer> - </dict> - <key>ID</key> - <integer>9</integer> - <key>Points</key> - <array> - <string>{128.54228643780414, 84}</string> - <string>{127.99998664855957, 138}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{72.49998664855957, 138}, {111, 42}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>8</integer> - <key>Magnets</key> - <array> - <string>{0, 1}</string> - <string>{0, -1}</string> - <string>{1, 0}</string> - <string>{-1, 0}</string> - </array> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>CornerRadius</key> - <real>5</real> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 code segment 1}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{118.99998664855957, 63}, {21, 21}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>4</integer> - <key>Shape</key> - <string>Circle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Color</key> - <dict> - <key>b</key> - <string>0</string> - <key>g</key> - <string>0</string> - <key>r</key> - <string>0</string> - </dict> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - </array> - <key>GridInfo</key> - <dict/> - <key>HPages</key> - <integer>1</integer> - <key>KeepToScale</key> - <false/> - <key>Layers</key> - <array> - <dict> - <key>Lock</key> - <string>NO</string> - <key>Name</key> - <string>Layer 1</string> - <key>Print</key> - <string>YES</string> - <key>View</key> - <string>YES</string> - </dict> - </array> - <key>LayoutInfo</key> - <dict> - <key>Animate</key> - <string>NO</string> - <key>circoMinDist</key> - <real>18</real> - <key>circoSeparation</key> - <real>0.0</real> - <key>layoutEngine</key> - <string>dot</string> - <key>neatoSeparation</key> - <real>0.0</real> - <key>twopiSeparation</key> - <real>0.0</real> - </dict> - <key>Orientation</key> - <integer>2</integer> - <key>PrintOnePage</key> - <false/> - <key>RowAlign</key> - <integer>1</integer> - <key>RowSpacing</key> - <real>36</real> - <key>SheetTitle</key> - <string>meta example</string> - <key>UniqueID</key> - <integer>2</integer> - <key>VPages</key> - <integer>1</integer> - </dict> - </array> - <key>SmartAlignmentGuidesActive</key> - <string>YES</string> - <key>SmartDistanceGuidesActive</key> - <string>YES</string> - <key>UseEntirePage</key> - <false/> - <key>WindowInfo</key> - <dict> - <key>CurrentSheet</key> - <integer>1</integer> - <key>ExpandedCanvases</key> - <array> - <dict> - <key>name</key> - <string>example</string> - </dict> - </array> - <key>Frame</key> - <string>{{2507, 112}, {693, 925}}</string> - <key>ListView</key> - <true/> - <key>OutlineWidth</key> - <integer>142</integer> - <key>RightSidebar</key> - <false/> - <key>ShowRuler</key> - <true/> - <key>Sidebar</key> - <true/> - <key>SidebarWidth</key> - <integer>120</integer> - <key>VisibleRegion</key> - <string>{{0, 0}, {558, 783}}</string> - <key>Zoom</key> - <real>1</real> - <key>ZoomValues</key> - <array> - <array> - <string>example</string> - <real>1</real> - <real>1</real> - </array> - <array> - <string>meta example</string> - <real>1</real> - <real>1</real> - </array> - </array> - </dict> -</dict> -</plist>
--- a/doc/GearsOS.mm Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,185 +0,0 @@ -<map version="1.0.1"> -<!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net --> -<node CREATED="1426152933167" ID="ID_1394936235" MODIFIED="1426155741172" TEXT="GearsOS"> -<node CREATED="1426152966934" ID="ID_926214418" MODIFIED="1426153027700" POSITION="right" TEXT="Member"> -<node CREATED="1426152983515" ID="ID_315863972" MODIFIED="1426153034164" TEXT="kokubo"> -<node CREATED="1426157329277" ID="ID_967617319" MODIFIED="1426157360912" TEXT="OS"/> -</node> -<node CREATED="1426153040121" ID="ID_1490408945" MODIFIED="1426153055980" TEXT="kohagura"> -<node CREATED="1426157344434" ID="ID_1301091078" MODIFIED="1426157348748" TEXT="Game Engine"/> -</node> -<node CREATED="1426153086427" ID="ID_271352674" MODIFIED="1426153088812" TEXT="uehara"> -<node CREATED="1426157351698" ID="ID_414616265" MODIFIED="1426157355988" TEXT="Game Engine"/> -</node> -<node CREATED="1426157318773" ID="ID_1658827704" MODIFIED="1426157322972" TEXT="atton"> -<node CREATED="1426157364821" ID="ID_1532498971" MODIFIED="1426157371348" TEXT="model checking"/> -</node> -</node> -<node CREATED="1426153119258" ID="ID_53279667" MODIFIED="1426153327907" POSITION="right" TEXT="language"> -<node CREATED="1426153145562" ID="ID_1355656507" MODIFIED="1426153147340" TEXT="CbC"/> -<node CREATED="1426153153171" ID="ID_1511264970" MODIFIED="1426153161508" TEXT="new CbC"> -<node CREATED="1426153163027" ID="ID_759638038" MODIFIED="1426153173012" TEXT="no prototype"/> -<node CREATED="1426153184219" ID="ID_1430583325" MODIFIED="1426153227180" TEXT="automatic generation of Data Segment(Data Gears)"> -<node CREATED="1426153231121" ID="ID_700105794" MODIFIED="1426153237363" TEXT="spwan CbC"/> -</node> -</node> -<node CREATED="1426153274251" ID="ID_78468290" MODIFIED="1426153279700" TEXT="python script version"/> -</node> -<node CREATED="1426153322268" ID="ID_1071082360" MODIFIED="1426153325292" POSITION="right" TEXT="build tools"> -<node CREATED="1426153329857" ID="ID_826335459" MODIFIED="1426153335756" TEXT="CMake"/> -<node CREATED="1426153336401" ID="ID_923090507" MODIFIED="1426153343388" TEXT="Auto tools"/> -<node CREATED="1426153350195" ID="ID_655815813" MODIFIED="1426153359260" TEXT="IDE"> -<node CREATED="1426153389677" ID="ID_778711395" MODIFIED="1426153394028" TEXT="IntelliJ"/> -</node> -</node> -<node CREATED="1426154537515" ID="ID_365848952" MODIFIED="1426156294511" POSITION="right" TEXT="development"> -<node CREATED="1426154560883" ID="ID_1901328801" MODIFIED="1426154627384" TEXT="early prototype"> -<node CREATED="1426154582077" ID="ID_1888549243" MODIFIED="1426154603220" TEXT="3 month"/> -<node CREATED="1426154629243" ID="ID_464270918" MODIFIED="1426154849492" TEXT="1. Allocator"> -<node CREATED="1426157491597" ID="ID_807395376" MODIFIED="1426157532940" TEXT="DataGears* getGear(int size)"> -<node CREATED="1426157572156" ID="ID_991868194" MODIFIED="1426157574148" TEXT="malloc"> -<node CREATED="1426157578361" ID="ID_291148740" MODIFIED="1426157585148" TEXT="meta getGear"/> -</node> -</node> -</node> -<node CREATED="1426409063316" ID="ID_1899250473" MODIFIED="1426409071500" TEXT="1.1 List"> -<node CREATED="1426409095822" ID="ID_1785436904" MODIFIED="1426409103076" TEXT="create"/> -<node CREATED="1426409073273" ID="ID_1742724689" MODIFIED="1426409080204" TEXT="copy"/> -<node CREATED="1426409081042" ID="ID_182541638" MODIFIED="1426409083564" TEXT="append"/> -<node CREATED="1426409105800" ID="ID_1064006824" MODIFIED="1426409109036" TEXT="reverse"/> -</node> -<node CREATED="1426154724851" ID="ID_295772151" MODIFIED="1426156325656" TEXT="2. DataBase"> -<node CREATED="1426157645997" ID="ID_262918456" MODIFIED="1426157659805" TEXT="AVL Tree"/> -<node CREATED="1426157661326" ID="ID_563061658" MODIFIED="1426157665276" TEXT="key"> -<node CREATED="1426157665868" ID="ID_79635745" MODIFIED="1426157667540" TEXT="string"> -<node CREATED="1426157670677" ID="ID_375812324" MODIFIED="1426157682692" TEXT="Data Gears"/> -</node> -</node> -</node> -<node CREATED="1426154651552" ID="ID_370250011" MODIFIED="1426154807974" TEXT="3. Syncronized Queue"/> -<node CREATED="1426154712139" ID="ID_1667993532" MODIFIED="1426155207228" TEXT="4. Worker"/> -<node CREATED="1426154752805" ID="ID_1626191390" MODIFIED="1426154865727" TEXT="5. Simple Example"> -<node CREATED="1426154769709" ID="ID_1222841837" MODIFIED="1426154834220" TEXT="Sort"/> -</node> -</node> -<node CREATED="1426154871340" ID="ID_860185644" MODIFIED="1426154889286" TEXT="Gears Programming Style"> -<node CREATED="1426154891777" ID="ID_1029912550" MODIFIED="1426154899276" TEXT="Data Gears"> -<node CREATED="1426154909445" ID="ID_1269120432" MODIFIED="1426154913988" TEXT="C Struct"/> -<node CREATED="1426154980177" ID="ID_1056927698" MODIFIED="1426154983524" TEXT="Meta Gears"> -<node CREATED="1426154918611" ID="ID_76961203" MODIFIED="1426154922596" TEXT="Signature"/> -</node> -</node> -<node CREATED="1426154899923" ID="ID_97366629" MODIFIED="1426154903556" TEXT="Code Gears"> -<node CREATED="1426154940433" ID="ID_200663807" MODIFIED="1426154947364" TEXT="Input Gears"/> -<node CREATED="1426154948433" ID="ID_1435437719" MODIFIED="1426154952652" TEXT="Output Gears"/> -<node CREATED="1426154963132" ID="ID_1536120296" MODIFIED="1426154969060" TEXT="Meta Gears"/> -</node> -<node CREATED="1426156865749" ID="ID_7930485" MODIFIED="1426156876788" TEXT="Model Checking"> -<node CREATED="1426156952525" ID="ID_779877247" MODIFIED="1426156973639" TEXT="AVL Tree Model checking"/> -</node> -</node> -<node CREATED="1426155169668" ID="ID_725052821" MODIFIED="1426155183396" TEXT="Worker"> -<node CREATED="1426155002891" ID="ID_791942587" MODIFIED="1426155013980" TEXT="Context Gears"> -<node CREATED="1426155019548" ID="ID_1811887181" MODIFIED="1426155025740" TEXT="htask"> -<node CREATED="1426155041276" ID="ID_1363363970" MODIFIED="1426155043260" TEXT="input"/> -<node CREATED="1426155043640" ID="ID_299145546" MODIFIED="1426155044756" TEXT="output"/> -<node CREATED="1426155049410" ID="ID_1300888330" MODIFIED="1426155051300" TEXT="task"/> -</node> -<node CREATED="1426155113077" ID="ID_918979021" MODIFIED="1426155141892" TEXT="Gears Dependency"/> -</node> -</node> -<node CREATED="1426155217688" ID="ID_1636644002" MODIFIED="1426155220132" TEXT="DataBase"> -<node CREATED="1426155226188" ID="ID_1806060214" MODIFIED="1426155233412" TEXT="Code Gears"/> -<node CREATED="1426155234424" ID="ID_1356661761" MODIFIED="1426155247116" TEXT="Persistent Data Gears"/> -<node CREATED="1426155265668" ID="ID_283754374" MODIFIED="1426155269164" TEXT="AVL Tree"/> -<node CREATED="1426155275113" ID="ID_1182453147" MODIFIED="1426155384260" TEXT="non Destructed"/> -</node> -</node> -<node CREATED="1426155398723" ID="ID_1514777935" MODIFIED="1426155408740" POSITION="right" TEXT="Feature"> -<node CREATED="1426155423877" ID="ID_188930462" MODIFIED="1426155454396" TEXT="inherent Parallel"/> -<node CREATED="1426155458907" ID="ID_604916009" MODIFIED="1426155480644" TEXT="Distributed Open Computation"/> -<node CREATED="1426155488461" ID="ID_1043965627" MODIFIED="1426155604552" TEXT="Meta Computation"> -<node CREATED="1426155512325" ID="ID_1252599336" MODIFIED="1426155555164" TEXT="Software evolution"/> -<node CREATED="1426155566909" ID="ID_557282183" MODIFIED="1426155571924" TEXT="Open System"/> -</node> -<node CREATED="1426155587059" ID="ID_58101192" MODIFIED="1426155602084" TEXT="Real-time"/> -<node CREATED="1426155618321" ID="ID_520602045" MODIFIED="1426155624420" TEXT="Multi Language"/> -<node CREATED="1426155632277" ID="ID_223519948" MODIFIED="1426155642972" TEXT="Version Management"/> -<node CREATED="1426156755795" ID="ID_1441690163" MODIFIED="1426156773100" TEXT="Reliability"> -<node CREATED="1426156788522" ID="ID_854392582" MODIFIED="1426156837908" TEXT="Separated Data Segment"/> -<node CREATED="1426156807481" ID="ID_1118801883" MODIFIED="1426156818708" TEXT="Model checking"/> -<node CREATED="1426156819876" ID="ID_1150871307" MODIFIED="1426156825516" TEXT="Proof System"/> -</node> -<node CREATED="1426157270285" ID="ID_1262373678" MODIFIED="1426157275860" TEXT="Power Management"/> -</node> -<node CREATED="1426153400356" ID="ID_696309465" MODIFIED="1426153419804" POSITION="left" TEXT="Component"> -<node CREATED="1426153422221" ID="ID_170447910" MODIFIED="1426153441117" TEXT="multi thread Memory allocator"/> -<node CREATED="1426153448892" ID="ID_1900502755" MODIFIED="1426153457804" TEXT="multi thread Worker"> -<node CREATED="1426153613977" ID="ID_1645792182" MODIFIED="1426153617756" TEXT="pipeline"/> -</node> -<node CREATED="1426153458716" ID="ID_1124613383" MODIFIED="1426153488468" TEXT="Syncronized Queue"/> -<node CREATED="1426153490725" ID="ID_426141298" MODIFIED="1426153518972" TEXT="Persistent Data Segment DataBase"/> -<node CREATED="1426153534498" ID="ID_35994479" MODIFIED="1426153558980" TEXT="Segmentation and Paging"/> -<node CREATED="1426153594957" ID="ID_1850375021" MODIFIED="1426153609052" TEXT="Meta computation Manager"/> -<node CREATED="1426153636133" ID="ID_1010534239" MODIFIED="1426153656316" TEXT="Code Segment Manager"/> -<node CREATED="1426153749589" ID="ID_1391099215" MODIFIED="1426153776636" TEXT="Remote Data Segment Manager"> -<node CREATED="1426153777954" ID="ID_189259534" MODIFIED="1426153782636" TEXT="network"/> -<node CREATED="1426153786269" ID="ID_765224759" MODIFIED="1426153796700" TEXT="network driver"/> -</node> -<node CREATED="1426154466067" ID="ID_1935735577" MODIFIED="1426154484121" TEXT="Language Runtime"> -<node CREATED="1426154485042" ID="ID_750402783" MODIFIED="1426154487332" TEXT="LLVM"/> -</node> -</node> -<node CREATED="1426153727000" ID="ID_1201066571" MODIFIED="1426153731420" POSITION="left" TEXT="Target Application"> -<node CREATED="1426153732779" ID="ID_1276834998" MODIFIED="1426153813588" TEXT="Parallel"> -<node CREATED="1426153831245" ID="ID_1795258059" MODIFIED="1426153844396" TEXT="Shared Memory Base"/> -<node CREATED="1426153845205" ID="ID_124400642" MODIFIED="1426153861148" TEXT="Shared nothing"/> -</node> -<node CREATED="1426153814625" ID="ID_957965095" MODIFIED="1426153820588" TEXT="Distributed"> -<node CREATED="1426153903914" ID="ID_1148137834" MODIFIED="1426153905660" TEXT="Open"> -<node CREATED="1426153930901" ID="ID_1261167193" MODIFIED="1426153939716" TEXT="Web Server"/> -</node> -<node CREATED="1426153905940" ID="ID_104926031" MODIFIED="1426153910252" TEXT="Close"> -<node CREATED="1426153918797" ID="ID_1026709537" MODIFIED="1426153925124" TEXT="hadoop?"/> -</node> -</node> -<node CREATED="1426154001205" ID="ID_820959932" MODIFIED="1426154008028" TEXT="Game Framework"> -<node CREATED="1426154055549" ID="ID_1090149281" MODIFIED="1426154077788" TEXT="Scene Graph Engine"/> -<node CREATED="1426154090346" ID="ID_705558919" MODIFIED="1426154102292" TEXT="Rendering Engine"> -<node CREATED="1426154102915" ID="ID_402944114" MODIFIED="1426154105948" TEXT="OpenGL"/> -</node> -<node CREATED="1426154111684" ID="ID_1790478825" MODIFIED="1426154122564" TEXT="Network Comminucation"/> -</node> -<node CREATED="1426154170325" ID="ID_1343322314" MODIFIED="1426154176372" TEXT="Simple Examples"> -<node CREATED="1426154177397" ID="ID_149902551" MODIFIED="1426154182044" TEXT="WordCount"/> -<node CREATED="1426154182613" ID="ID_1170950426" MODIFIED="1426154184180" TEXT="Sort"/> -<node CREATED="1426154184820" ID="ID_227037195" MODIFIED="1426154186860" TEXT="FFT"/> -<node CREATED="1426154194373" ID="ID_743768242" MODIFIED="1426154195868" TEXT="grep"/> -</node> -</node> -<node CREATED="1426154241672" ID="ID_1732591315" MODIFIED="1426154262292" POSITION="left" TEXT="Target Architecture"> -<node CREATED="1426154268221" ID="ID_1750857503" MODIFIED="1426154277612" TEXT="Cell"> -<node CREATED="1426154278477" ID="ID_1838269808" MODIFIED="1426154282028" TEXT="X"/> -</node> -<node CREATED="1426154287485" ID="ID_1994697303" MODIFIED="1426154292228" TEXT="Xeon Phi"/> -<node CREATED="1426154295730" ID="ID_404288782" MODIFIED="1426154399112" TEXT="Intel CPU"> -<node CREATED="1426154320649" ID="ID_1294744639" MODIFIED="1426154326260" TEXT="Xeon"/> -<node CREATED="1426154326889" ID="ID_1671534233" MODIFIED="1426154332260" TEXT="Core ix"/> -</node> -<node CREATED="1426154388209" ID="ID_766793265" MODIFIED="1426154389356" TEXT="ARM"/> -<node CREATED="1426154362117" ID="ID_101910456" MODIFIED="1426154364468" TEXT="FPGA"/> -<node CREATED="1426154365632" ID="ID_1185664664" MODIFIED="1426154421092" TEXT="NVIDIA"/> -<node CREATED="1426154401101" ID="ID_1582370381" MODIFIED="1426154406700" TEXT="Power PC"/> -</node> -<node CREATED="1426503430814" ID="ID_755387002" MODIFIED="1426503434221" POSITION="left" TEXT="Theory"> -<node CREATED="1426503434222" ID="ID_1097315101" MODIFIED="1426503438416" TEXT="Monad"/> -<node CREATED="1426503439614" ID="ID_1402116978" MODIFIED="1426503447930" TEXT="Operational semantics"/> -<node CREATED="1426503451465" ID="ID_838122665" MODIFIED="1426503457120" TEXT="Model Checking"/> -<node CREATED="1426503458321" ID="ID_672360813" MODIFIED="1426503462888" TEXT="Proof Syste"> -<node CREATED="1426503510409" ID="ID_61060240" MODIFIED="1426503537584" TEXT="Linear Logic"/> -<node CREATED="1426503540072" ID="ID_92514386" MODIFIED="1426503546144" TEXT="System F"/> -</node> -<node CREATED="1426503465113" ID="ID_1206595312" MODIFIED="1426503469936" TEXT="Dependent type"/> -</node> -</node> -</map>
--- a/doc/GearsOS_arch.graffle Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1866 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>ActiveLayerIndex</key> - <integer>0</integer> - <key>ApplicationVersion</key> - <array> - <string>com.omnigroup.OmniGraffle</string> - <string>139.18.0.187838</string> - </array> - <key>AutoAdjust</key> - <true/> - <key>BackgroundGraphic</key> - <dict> - <key>Bounds</key> - <string>{{0, 0}, {1118, 783}}</string> - <key>Class</key> - <string>SolidGraphic</string> - <key>ID</key> - <integer>2</integer> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <key>BaseZoom</key> - <integer>0</integer> - <key>CanvasOrigin</key> - <string>{0, 0}</string> - <key>ColumnAlign</key> - <integer>1</integer> - <key>ColumnSpacing</key> - <real>36</real> - <key>CreationDate</key> - <string>2015-05-06 12:15:09 +0000</string> - <key>Creator</key> - <string>kkb</string> - <key>DisplayScale</key> - <string>1 0/72 in = 1.0000 in</string> - <key>GraphDocumentVersion</key> - <integer>8</integer> - <key>GraphicsList</key> - <array> - <dict> - <key>Class</key> - <string>Group</string> - <key>Graphics</key> - <array> - <dict> - <key>Bounds</key> - <string>{{487, 387}, {66, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>148</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Pad</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 pointer}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{517, 278.04542541503918}, {66, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>149</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Pad</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 goto}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{625, 445.117431640625}, {115, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>150</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Pad</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 Temporal Data Gear}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{625, 428.117431640625}, {115, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>151</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Pad</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 Temporal Data Gear}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{625, 410}, {115, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>152</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Pad</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 Temporal Data Gear}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>159</integer> - </dict> - <key>ID</key> - <integer>153</integer> - <key>Points</key> - <array> - <string>{478.21863675031523, 362.20520265171882}</string> - <string>{594.78136057069594, 405.55697719473693}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>FilledArrow</string> - <key>Legacy</key> - <true/> - <key>Pattern</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>160</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>154</integer> - <key>Points</key> - <array> - <string>{618.37499999999989, 409.61743185433227}</string> - <string>{618.37499999999989, 426.61743222053235}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>NegativeControls</string> - <key>Legacy</key> - <true/> - <key>TailArrow</key> - <string>NegativeControls</string> - </dict> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>155</integer> - <key>Points</key> - <array> - <string>{618.37499999999989, 443.61743148813241}</string> - <string>{618.37499999999989, 460.61743185433232}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>NegativeControls</string> - <key>Legacy</key> - <true/> - <key>TailArrow</key> - <string>NegativeControls</string> - </dict> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>156</integer> - <key>Points</key> - <array> - <string>{618.37499999999989, 426.6174318122105}</string> - <string>{618.37499999999989, 443.61743217841041}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>NegativeControls</string> - <key>Legacy</key> - <true/> - <key>TailArrow</key> - <string>NegativeControls</string> - </dict> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>157</integer> - <key>Points</key> - <array> - <string>{604, 409.007568359375}</string> - <string>{604, 460.007568359375}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>NegativeControls</string> - <key>Legacy</key> - <true/> - <key>TailArrow</key> - <string>FilledArrow</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{584.625, 477.617431640625}, {176, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>158</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Pad</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 memory}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{595.25000000000023, 401.007568359375}, {154.75, 67}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>159</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{424.24999901761652, 337.07452548890376}, {53.5, 30.015151977539062}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>160</integer> - <key>Line</key> - <dict> - <key>ID</key> - <integer>162</integer> - <key>Position</key> - <real>0.8249744176864624</real> - <key>RotationType</key> - <integer>0</integer> - </dict> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 context}</string> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{431.99999999999977, 436.00000000000006}, {176, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>161</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Pad</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 Worker}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>166</integer> - </dict> - <key>ID</key> - <integer>162</integer> - <key>Points</key> - <array> - <string>{487.6373629440061, 243.93544826469429}</string> - <string>{448.1091003417971, 233}</string> - <string>{414.1091003417971, 289}</string> - <string>{443.60910034179653, 350}</string> - <string>{489.18166043264989, 336.52187917772261}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>0</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>FilledArrow</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>165</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>166</integer> - </dict> - <key>ID</key> - <integer>163</integer> - <key>Points</key> - <array> - <string>{533.10911435610967, 274.51516072232459}</string> - <string>{533.10911435610967, 305.53029521029288}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>FilledArrow</string> - <key>Legacy</key> - <true/> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>165</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>165</integer> - </dict> - <key>ID</key> - <integer>164</integer> - <key>Points</key> - <array> - <string>{533.10910873370131, 207}</string> - <string>{533.10910873370131, 238.51514324504049}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>FilledArrow</string> - <key>Legacy</key> - <true/> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>167</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{469.1091003417971, 239.01515197753895}, {128, 35}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>165</integer> - <key>Shape</key> - <string>Circle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 Code Gear}</string> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{469.1091003417971, 306.03030395507801}, {128, 35}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>166</integer> - <key>Shape</key> - <string>Circle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 Meta Code Gear}</string> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{500.10910034179688, 193}, {66, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>167</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Pad</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 Data Gear}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{11.999999999999659, 410}, {66, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>168</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Pad</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 copy}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>169</integer> - <key>Points</key> - <array> - <string>{42.5, 387}</string> - <string>{49.5, 407}</string> - <string>{71.5, 410}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>0</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>FilledArrow</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{325.99999999999977, 319}, {66, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>170</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Pad</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 store}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{325.99999999999977, 201.49999237060553}, {66, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>171</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Pad</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 read}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>172</integer> - <key>Points</key> - <array> - <string>{324.99999999999983, 342}</string> - <string>{392.99999999999972, 342}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>0</string> - <key>Legacy</key> - <true/> - <key>TailArrow</key> - <string>FilledArrow</string> - </dict> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>173</integer> - <key>Points</key> - <array> - <string>{324.99999999999983, 222.99996692238005}</string> - <string>{392.99999999999972, 222.99996692238005}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>FilledArrow</string> - <key>Legacy</key> - <true/> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{393.49999999999966, 139}, {253.00000000000014, 282.99999999999989}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>174</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{436.49999999999943, 104}, {253.00000000000014, 282.99999999999989}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>175</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{480.49999999999989, 67}, {253.00000000000014, 282.99999999999989}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>176</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Class</key> - <string>Group</string> - <key>Graphics</key> - <array> - <dict> - <key>Bounds</key> - <string>{{140.04924011230443, 219.98726987838751}, {90.3162841796875, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>FontInfo</key> - <dict> - <key>Color</key> - <dict> - <key>b</key> - <string>0</string> - <key>g</key> - <string>0</string> - <key>r</key> - <string>1</string> - </dict> - </dict> - <key>ID</key> - <integer>178</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Pad</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;\red255\green0\blue0;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf2 Meta Data Gear}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{184.84185791015599, 165.74242401123053}, {66, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>179</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Pad</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 Data Gear}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>181</integer> - </dict> - <key>ID</key> - <integer>180</integer> - <key>Points</key> - <array> - <string>{260.63904413799833, 263.95532240098333}</string> - <string>{280.67900017936921, 297.04476486031871}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>Color</key> - <dict> - <key>b</key> - <string>0</string> - <key>g</key> - <string>0</string> - <key>r</key> - <string>1</string> - </dict> - <key>HeadArrow</key> - <string>0</string> - <key>Legacy</key> - <true/> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>192</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{275.01515151515122, 295.55045454545473}, {25.047348484848513, 25.64151515151514}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>181</integer> - <key>Shape</key> - <string>Circle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>183</integer> - </dict> - <key>ID</key> - <integer>182</integer> - <key>Points</key> - <array> - <string>{246.60852778601273, 263.75146804005476}</string> - <string>{225.01280748159624, 297.24861517565887}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>Color</key> - <dict> - <key>b</key> - <string>0</string> - <key>g</key> - <string>0</string> - <key>r</key> - <string>1</string> - </dict> - <key>HeadArrow</key> - <string>0</string> - <key>Legacy</key> - <true/> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>192</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{205.31818181818156, 295.55045454545473}, {25.047348484848513, 25.64151515151514}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>183</integer> - <key>Shape</key> - <string>Circle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>189</integer> - </dict> - <key>ID</key> - <integer>184</integer> - <key>Points</key> - <array> - <string>{169.80478370166296, 263.34126189283182}</string> - <string>{144.99834329838677, 297.65881143385616}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>Color</key> - <dict> - <key>b</key> - <string>0</string> - <key>g</key> - <string>0</string> - <key>r</key> - <string>1</string> - </dict> - <key>HeadArrow</key> - <string>0</string> - <key>Legacy</key> - <true/> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>193</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>187</integer> - </dict> - <key>ID</key> - <integer>185</integer> - <key>Points</key> - <array> - <string>{144.84289549965422, 319.19965217661098}</string> - <string>{165.60387963053429, 348.8259453571161}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>Color</key> - <dict> - <key>b</key> - <string>0</string> - <key>g</key> - <string>0</string> - <key>r</key> - <string>1</string> - </dict> - <key>HeadArrow</key> - <string>0</string> - <key>Legacy</key> - <true/> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>189</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>188</integer> - </dict> - <key>ID</key> - <integer>186</integer> - <key>Points</key> - <array> - <string>{129.09588004179938, 318.7553353748965}</string> - <string>{105.12017528879785, 349.27023962899653}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>Color</key> - <dict> - <key>b</key> - <string>0</string> - <key>g</key> - <string>0</string> - <key>r</key> - <string>1</string> - </dict> - <key>HeadArrow</key> - <string>0</string> - <key>Legacy</key> - <true/> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>189</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{160.66856060605991, 346.83348484848455}, {25.047348484848513, 25.64151515151514}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>187</integer> - <key>Shape</key> - <string>Circle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{84.437499999999631, 346.83348484848455}, {25.047348484848513, 25.64151515151514}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>188</integer> - <key>Shape</key> - <string>Circle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{124.73106060606054, 295.55045454545473}, {25.047348484848513, 25.64151515151514}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>189</integer> - <key>Shape</key> - <string>Circle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>192</integer> - </dict> - <key>ID</key> - <integer>190</integer> - <key>Points</key> - <array> - <string>{225.43001671177532, 212.1741976311564}</string> - <string>{246.19100084265605, 241.80049081166203}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>Color</key> - <dict> - <key>b</key> - <string>0</string> - <key>g</key> - <string>0</string> - <key>r</key> - <string>1</string> - </dict> - <key>HeadArrow</key> - <string>0</string> - <key>Legacy</key> - <true/> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>194</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>193</integer> - </dict> - <key>ID</key> - <integer>191</integer> - <key>Points</key> - <array> - <string>{209.68300125392042, 211.72988082944192}</string> - <string>{185.70729650091866, 242.24478508354238}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>Color</key> - <dict> - <key>b</key> - <string>0</string> - <key>g</key> - <string>0</string> - <key>r</key> - <string>1</string> - </dict> - <key>HeadArrow</key> - <string>0</string> - <key>Legacy</key> - <true/> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>194</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{241.25568181818173, 239.80803030303042}, {25.047348484848513, 25.64151515151514}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>192</integer> - <key>Shape</key> - <string>Circle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{165.02462121212042, 239.80803030303042}, {25.047348484848513, 25.64151515151514}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>193</integer> - <key>Shape</key> - <string>Circle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{205.31818181818156, 188.52500000000018}, {25.047348484848513, 25.64151515151514}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>194</integer> - <key>Shape</key> - <string>Circle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{71.499999999999687, 139.00000000000011}, {253.00000000000014, 282.99999999999989}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>195</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - </array> - <key>ID</key> - <integer>177</integer> - </dict> - <dict> - <key>Bounds</key> - <string>{{32.999999999999716, 104}, {253.00000000000014, 282.99999999999989}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>196</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{109.99999999999979, 436.00000000000006}, {176, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>197</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Pad</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 Persistent Data Gear}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - </array> - <key>ID</key> - <integer>147</integer> - </dict> - </array> - <key>GridInfo</key> - <dict/> - <key>GuidesLocked</key> - <string>NO</string> - <key>GuidesVisible</key> - <string>YES</string> - <key>HPages</key> - <integer>2</integer> - <key>ImageCounter</key> - <integer>1</integer> - <key>KeepToScale</key> - <false/> - <key>Layers</key> - <array> - <dict> - <key>Lock</key> - <string>NO</string> - <key>Name</key> - <string>Layer 1</string> - <key>Print</key> - <string>YES</string> - <key>View</key> - <string>YES</string> - </dict> - </array> - <key>LayoutInfo</key> - <dict> - <key>Animate</key> - <string>NO</string> - <key>circoMinDist</key> - <real>18</real> - <key>circoSeparation</key> - <real>0.0</real> - <key>layoutEngine</key> - <string>dot</string> - <key>neatoSeparation</key> - <real>0.0</real> - <key>twopiSeparation</key> - <real>0.0</real> - </dict> - <key>LinksVisible</key> - <string>NO</string> - <key>MagnetsVisible</key> - <string>NO</string> - <key>MasterSheets</key> - <array/> - <key>ModificationDate</key> - <string>2015-05-06 13:15:37 +0000</string> - <key>Modifier</key> - <string>kkb</string> - <key>NotesVisible</key> - <string>NO</string> - <key>Orientation</key> - <integer>2</integer> - <key>OriginVisible</key> - <string>NO</string> - <key>PageBreaks</key> - <string>YES</string> - <key>PrintInfo</key> - <dict> - <key>NSBottomMargin</key> - <array> - <string>float</string> - <string>41</string> - </array> - <key>NSHorizonalPagination</key> - <array> - <string>coded</string> - <string>BAtzdHJlYW10eXBlZIHoA4QBQISEhAhOU051bWJlcgCEhAdOU1ZhbHVlAISECE5TT2JqZWN0AIWEASqEhAFxlwCG</string> - </array> - <key>NSLeftMargin</key> - <array> - <string>float</string> - <string>18</string> - </array> - <key>NSPaperSize</key> - <array> - <string>size</string> - <string>{595, 842}</string> - </array> - <key>NSPrintReverseOrientation</key> - <array> - <string>int</string> - <string>0</string> - </array> - <key>NSRightMargin</key> - <array> - <string>float</string> - <string>18</string> - </array> - <key>NSTopMargin</key> - <array> - <string>float</string> - <string>18</string> - </array> - </dict> - <key>PrintOnePage</key> - <false/> - <key>ReadOnly</key> - <string>NO</string> - <key>RowAlign</key> - <integer>1</integer> - <key>RowSpacing</key> - <real>36</real> - <key>SheetTitle</key> - <string>Canvas 1</string> - <key>SmartAlignmentGuidesActive</key> - <string>YES</string> - <key>SmartDistanceGuidesActive</key> - <string>YES</string> - <key>UniqueID</key> - <integer>1</integer> - <key>UseEntirePage</key> - <false/> - <key>VPages</key> - <integer>1</integer> - <key>WindowInfo</key> - <dict> - <key>CurrentSheet</key> - <integer>0</integer> - <key>ExpandedCanvases</key> - <array> - <dict> - <key>name</key> - <string>Canvas 1</string> - </dict> - </array> - <key>Frame</key> - <string>{{433, 832}, {1003, 925}}</string> - <key>ListView</key> - <true/> - <key>OutlineWidth</key> - <integer>142</integer> - <key>RightSidebar</key> - <false/> - <key>ShowRuler</key> - <true/> - <key>Sidebar</key> - <true/> - <key>SidebarWidth</key> - <integer>120</integer> - <key>VisibleRegion</key> - <string>{{0, 0}, {868, 783}}</string> - <key>Zoom</key> - <real>1</real> - <key>ZoomValues</key> - <array> - <array> - <string>Canvas 1</string> - <real>1</real> - <real>1</real> - </array> - </array> - </dict> -</dict> -</plist>
--- a/doc/GearsProgramming.mm Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,163 +0,0 @@ -<map version="1.0.1"> -<!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net --> -<node CREATED="1474197634182" ID="ID_1179238297" MODIFIED="1474197647879" TEXT="GearsProgramming"> -<node CREATED="1474197648409" ID="ID_47965276" MODIFIED="1474197703546" POSITION="right" TEXT="Aim"> -<node CREATED="1474197704094" ID="ID_142691674" MODIFIED="1474197711701" TEXT="Low Level"/> -<node CREATED="1474197712163" ID="ID_829698610" MODIFIED="1474197717141" TEXT="System Description"/> -<node CREATED="1474197718094" ID="ID_1348601349" MODIFIED="1474197723668" TEXT="Specification"> -<node CREATED="1474197724195" ID="ID_1585379923" MODIFIED="1474197726892" TEXT="Executable"/> -</node> -<node CREATED="1474197728470" ID="ID_1420640086" MODIFIED="1474197736836" TEXT="Reliability"/> -<node CREATED="1474197744164" ID="ID_923556279" MODIFIED="1474197748746" TEXT="Resusability"/> -<node CREATED="1474197754510" ID="ID_845392329" MODIFIED="1474197764018" TEXT="Sharabiliity"> -<node CREATED="1474197764019" ID="ID_13244712" MODIFIED="1474197775128" TEXT="compressed code"/> -</node> -<node CREATED="1474197776958" ID="ID_888410684" MODIFIED="1474197781169" TEXT="Meta Programming"> -<node CREATED="1474197783057" ID="ID_798676678" MODIFIED="1474197785552" TEXT="Concurrency"> -<node CREATED="1474197829239" ID="ID_321601829" MODIFIED="1474197832797" TEXT="GPGPU"/> -<node CREATED="1474197833549" ID="ID_1355018406" MODIFIED="1474197836357" TEXT="Many Core"/> -</node> -<node CREATED="1474197837846" ID="ID_398225374" MODIFIED="1474197841709" TEXT="real-time"/> -<node CREATED="1474197845817" ID="ID_653836902" MODIFIED="1474197850768" TEXT="power control"> -<node CREATED="1474197857407" ID="ID_1356386994" MODIFIED="1474197860046" TEXT="Gating"/> -</node> -<node CREATED="1474197787022" ID="ID_676510162" MODIFIED="1474197794312" TEXT="Openess"/> -<node CREATED="1474197801445" ID="ID_1717330620" MODIFIED="1474197810167" TEXT="Model Checking"/> -<node CREATED="1474197820271" ID="ID_1649483207" MODIFIED="1474197824689" TEXT="Multi level"/> -</node> -</node> -<node CREATED="1474197869871" ID="ID_1207255364" MODIFIED="1474197875726" POSITION="right" TEXT="Syntax"> -<node CREATED="1474197876535" ID="ID_1956219957" MODIFIED="1474197882518" TEXT="Continuation based C"> -<node CREATED="1474197882519" ID="ID_1872250400" MODIFIED="1474197888117" TEXT="Code Gears"/> -</node> -<node CREATED="1474197893191" ID="ID_1406675689" MODIFIED="1474197899447" TEXT="Normal C"> -<node CREATED="1474197899448" ID="ID_1715610883" MODIFIED="1474197906029" TEXT="Function call"/> -</node> -<node CREATED="1474197909291" ID="ID_1091472346" MODIFIED="1474197924325" TEXT="Data Gears"> -<node CREATED="1474197925526" ID="ID_1219681812" MODIFIED="1474197944244" TEXT="__data "> -<node CREATED="1474198185798" ID="ID_621686816" MODIFIED="1474198194405" TEXT="union of all __data"/> -</node> -<node CREATED="1475222208725" ID="ID_103598500" MODIFIED="1475222218374" TEXT="new reallocated data"> -<node CREATED="1475222219650" ID="ID_70340214" MODIFIED="1475222255052" TEXT="__code code1 (struct Node* +newnode)"/> -</node> -</node> -<node CREATED="1474197974286" ID="ID_662409265" MODIFIED="1474198073009" TEXT="Glue"> -<node CREATED="1474198073010" ID="ID_1757613329" MODIFIED="1474198094236" TEXT="syntax betwen __code and __code"/> -<node CREATED="1474198095095" ID="ID_281252827" MODIFIED="1474198105489" TEXT="__code and __data"/> -</node> -<node CREATED="1474198131976" ID="ID_1267124086" MODIFIED="1474198137254" TEXT="Gear Box"/> -</node> -<node CREATED="1474198122709" ID="ID_744036408" MODIFIED="1474198346148" POSITION="right" TEXT="Implementation"> -<node CREATED="1474198209252" ID="ID_1893547455" MODIFIED="1474198237037" TEXT="Lightweight thread"> -<node CREATED="1474198264005" ID="ID_965179556" MODIFIED="1474198267228" TEXT="context"/> -</node> -<node CREATED="1474198249436" ID="ID_1253885787" MODIFIED="1474198253419" TEXT="Process"> -<node CREATED="1474198272936" ID="ID_931390957" MODIFIED="1474198278267" TEXT="memory space"/> -</node> -<node CREATED="1474198240739" ID="ID_1410320897" MODIFIED="1474198247331" TEXT="Communication"> -<node CREATED="1474198281223" ID="ID_1363307501" MODIFIED="1474198287347" TEXT="Synchronized Queue"/> -</node> -<node CREATED="1474198290090" ID="ID_1532250757" MODIFIED="1474198292905" TEXT="Database"> -<node CREATED="1474198292905" ID="ID_1407581044" MODIFIED="1474198299955" TEXT="Tree"/> -</node> -<node CREATED="1474198301438" ID="ID_1966031794" MODIFIED="1474198305844" TEXT="Memory Management"> -<node CREATED="1474198305845" ID="ID_316448348" MODIFIED="1474198307930" TEXT="new"/> -</node> -</node> -<node CREATED="1474198367056" ID="ID_866729066" MODIFIED="1474198375419" POSITION="left" TEXT="Technique"> -<node CREATED="1474198376074" ID="ID_370932013" MODIFIED="1474198382807" TEXT="normal function call"> -<node CREATED="1474198387452" ID="ID_376192865" MODIFIED="1474198393396" TEXT="with meta computation"> -<node CREATED="1474198396890" ID="ID_1749082632" MODIFIED="1474198399547" TEXT="goto meta"/> -</node> -<node CREATED="1474198455800" ID="ID_349859250" MODIFIED="1474198461982" TEXT="using stack"/> -<node CREATED="1474198469608" ID="ID_601591441" MODIFIED="1474198481919" TEXT="one level stack on data gears"/> -<node CREATED="1474198486772" ID="ID_1465200140" MODIFIED="1474198499012" TEXT="context continuation"> -<node CREATED="1474198500212" ID="ID_1360776710" MODIFIED="1474198505906" TEXT="thread terminator"/> -</node> -<node CREATED="1474199009015" ID="ID_172813638" MODIFIED="1474199027286" TEXT="pointer operation is not allowwed in object level"/> -</node> -<node CREATED="1474198412158" ID="ID_1400824129" MODIFIED="1474198415636" TEXT="memory allocation"> -<node CREATED="1474198416060" ID="ID_1719487559" MODIFIED="1474198422118" TEXT="as a meta computation"> -<node CREATED="1474198565267" ID="ID_1115374966" MODIFIED="1474198575734" TEXT="not in __code"/> -</node> -<node CREATED="1474198596040" ID="ID_1088700962" MODIFIED="1474198602311" TEXT="life time control"> -<node CREATED="1474198424894" ID="ID_676251796" MODIFIED="1474198430177" TEXT="allocate"/> -<node CREATED="1474198431834" ID="ID_756555299" MODIFIED="1474198433977" TEXT="retain"/> -<node CREATED="1474198434592" ID="ID_1238321945" MODIFIED="1474198437608" TEXT="release"/> -</node> -<node CREATED="1474198620293" ID="ID_729415034" MODIFIED="1474198623064" TEXT="release"> -<node CREATED="1474198624010" ID="ID_362410868" MODIFIED="1474198631817" TEXT="at the end of thread"/> -</node> -<node CREATED="1474198636298" ID="ID_224271521" MODIFIED="1474198643792" TEXT="persistent data"> -<node CREATED="1474198644158" ID="ID_1029213760" MODIFIED="1474198649480" TEXT="copy"/> -<node CREATED="1474198656834" ID="ID_2335859" MODIFIED="1474198660352" TEXT="marking"/> -</node> -<node CREATED="1475222429498" ID="ID_996754987" MODIFIED="1475222434637" TEXT="allocation"> -<node CREATED="1475222438030" ID="ID_1725059176" MODIFIED="1475222463661" TEXT="linear"/> -<node CREATED="1475222440174" ID="ID_509239417" MODIFIED="1475222449481" TEXT="fixed size free list"/> -</node> -</node> -<node CREATED="1474198526000" ID="ID_725539372" MODIFIED="1474198529302" TEXT="system call"> -<node CREATED="1474198534590" ID="ID_1783733449" MODIFIED="1474198541963" TEXT="as a meta computation"/> -<node CREATED="1474198548234" ID="ID_151081133" MODIFIED="1474198551889" TEXT="continuation"/> -</node> -<node CREATED="1474198873319" ID="ID_572818507" MODIFIED="1474198897011" TEXT="context local variable"> -<node CREATED="1474198910329" ID="ID_1049695430" MODIFIED="1474198929104" TEXT="no stack base tree walk"/> -<node CREATED="1474198931425" ID="ID_483868789" MODIFIED="1474198945873" TEXT="not destory original tree"/> -<node CREATED="1474198966619" ID="ID_1607279117" MODIFIED="1474198979692" TEXT="modify only newly created data gears"/> -</node> -</node> -<node CREATED="1474198691359" ID="ID_1150677739" MODIFIED="1474198695904" POSITION="left" TEXT="red black tree"> -<node CREATED="1474198696376" ID="ID_1548561439" MODIFIED="1474198706929" TEXT="remove push_stack/pop_stack"> -<node CREATED="1474198708513" ID="ID_1466655383" MODIFIED="1474198716640" TEXT="at meta computation"/> -</node> -<node CREATED="1474198719260" ID="ID_802423799" MODIFIED="1474198729727" TEXT="bring parent and grand parent"/> -<node CREATED="1474198741329" ID="ID_1605372662" MODIFIED="1474198744775" TEXT="verification"> -<node CREATED="1474198745128" ID="ID_1290247827" MODIFIED="1474198753263" TEXT="unbounded modecl checking"/> -<node CREATED="1474198754215" ID="ID_936929898" MODIFIED="1474198759071" TEXT="proof"> -<node CREATED="1474198767338" ID="ID_91607209" MODIFIED="1474198774329" TEXT="as a type system of Gears"/> -<node CREATED="1474198859317" ID="ID_652735276" MODIFIED="1474198862870" TEXT="using Agda"/> -<node CREATED="1474198776282" ID="ID_1815424645" MODIFIED="1474198779391" TEXT="dependent type"/> -<node CREATED="1474198784176" ID="ID_1701729941" MODIFIED="1474198787212" TEXT="first class type"/> -</node> -</node> -</node> -<node CREATED="1475221311884" ID="ID_1604114386" MODIFIED="1475221322601" POSITION="left" TEXT="Data Gears"> -<node CREATED="1475221325273" ID="ID_654063909" MODIFIED="1475221328320" TEXT="type filed"/> -<node CREATED="1475221341209" ID="ID_1960993895" MODIFIED="1475221345560" TEXT="abstract data type"> -<node CREATED="1475221350184" ID="ID_1030098093" MODIFIED="1475221361000" TEXT="next"/> -<node CREATED="1475221453297" ID="ID_1140689489" MODIFIED="1475221458656" TEXT="goto stack_push"/> -<node CREATED="1475221370341" ID="ID_1218169664" MODIFIED="1475221371296" TEXT="API"> -<node CREATED="1475221375697" ID="ID_1513779759" MODIFIED="1475221400088" TEXT="named code gears enum"/> -<node CREATED="1475221409143" ID="ID_1928905221" MODIFIED="1475221411056" TEXT="queue"> -<node CREATED="1475221413140" ID="ID_595594618" MODIFIED="1475221414024" TEXT="get"/> -<node CREATED="1475221414865" ID="ID_1822559160" MODIFIED="1475221415856" TEXT="put"/> -</node> -<node CREATED="1475221417497" ID="ID_1938143003" MODIFIED="1475221418704" TEXT="stack"> -<node CREATED="1475221420863" ID="ID_1779448950" MODIFIED="1475221421872" TEXT="push"/> -<node CREATED="1475221422485" ID="ID_1763085239" MODIFIED="1475221423240" TEXT="pop"/> -</node> -</node> -</node> -<node CREATED="1475221587087" ID="ID_1837630230" MODIFIED="1475221593320" TEXT="memory allocation"> -<node CREATED="1475221597121" ID="ID_238895177" MODIFIED="1475221612239" TEXT="at meta level"/> -<node CREATED="1475221624479" ID="ID_1975291351" MODIFIED="1475221644391" TEXT="allocate sized memory and asign type filed"/> -<node CREATED="1475221651952" ID="ID_1469233342" MODIFIED="1475221657711" TEXT="derving show"/> -</node> -</node> -<node CREATED="1474198812557" ID="ID_854426122" MODIFIED="1474198817326" POSITION="left" TEXT="synchronized Queue"> -<node CREATED="1474198817755" ID="ID_992292686" MODIFIED="1474198824598" TEXT="CAS (check and set)"/> -<node CREATED="1474198836380" ID="ID_1816598683" MODIFIED="1474198839107" TEXT="verification"> -<node CREATED="1474198840372" ID="ID_1894747913" MODIFIED="1474198844003" TEXT="fairness"/> -<node CREATED="1474198851664" ID="ID_534775243" MODIFIED="1474198852918" TEXT="proof"/> -</node> -</node> -<node CREATED="1474199046705" ID="ID_387917714" MODIFIED="1474199050469" POSITION="left" TEXT="model checking"> -<node CREATED="1474199052561" ID="ID_50046953" MODIFIED="1474199056078" TEXT="abstract"/> -<node CREATED="1474199056610" ID="ID_1291295694" MODIFIED="1474199058645" TEXT="unbounded"/> -<node CREATED="1474199070086" ID="ID_82199320" MODIFIED="1474199079349" TEXT="keeping argument value only"> -<node CREATED="1474199081110" ID="ID_350806499" MODIFIED="1474199105860" TEXT="does not follow pointers in meta level"/> -</node> -</node> -</node> -</map>
--- a/doc/Interface.mm Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -Interfaceのtypedef はコールフレームを定義する -Interfaceの呼び出しの時に使える引数はtypedefに定義されている必要がある -... は呼び出し側のコールフレームを保存するのに使う - - -typedef struct Stack<Type, Impl>{ - Type* stack; - Type* data; - Type* data1; - __code whenEmpty(...); - __code clear(Impl* stack,__code next(...)); - __code push(Impl* stack,Type* data, __code next(...)); - __code pop(Impl* stack, __code next(Type* data, ...)); - __code pop2(Impl* stack, __code next(Type* data, Type* data1, ...)); - __code isEmpty(Impl* stack, __code next(...), __code whenEmpty(...)); - __code get(Impl* stack, __code next(Type* data, ...)); - __code get2(Impl* stack, __code next(Type* data, Type* data1, ...)); - __code next(...); -} Stack; - -呼び出し方の例 - goto nodeStack->push(newNode, replaceNode1); -newNode はdataに対応する replaceNode1はnextに対応する。 -replaceNode1のコールフレームは...に格納される。 -つまり、replaceNode1はCodeGearのクロージャに相当する。 - -Interfaceから値を返す場合は継続経由で値を返す -__code get2(Impl* stack, __code next(Type* data, Type* data1, ...)); -継続の型はInterfaceで定義されていて、この型に合うCodeGearを引数として渡す - goto nodeStack->get2(insertCase1,tree) //意味的にはtreeの後ろに... - - -__code insertCase1(struct Node *parent, struct Node *grandparent, struct RedBlackTree* tree) { //こっちも後ろに...があるはず - -goto next(data, data1, ...); - -createはinterfaceの実装を定義する -interfaceのメソッドの番号をここで指定する - -implimentation側のDataGearは格納される実装依存の状態を持つ - - - struct SingleLinkedStack { - struct Element* top; - } SingleLinkedStack; - -Stack* createSingleLinkedStack(struct Context* context) { - struct Stack* stack = new Stack(); - struct SingleLinkedStack* singleLinkedStack = new SingleLinkedStack(); - stack->stack = (union Data*)singleLinkedStack; - singleLinkedStack->top = NULL; - stack->push = C_pushSingleLinkedStack; - stack->pop = C_popSingleLinkedStack; - stack->pop2 = C_pop2SingleLinkedStack; - stack->get = C_getSingleLinkedStack; - stack->get2 = C_get2SingleLinkedStack; - stack->isEmpty = C_isEmptySingleLinkedStack; - stack->clear = C_clearSingleLinkedStack; - return stack; -} - - -実装内部で使うCodeGearの引数はコールフレームで決まる -コールフレームに含まれない中間変数を使っても良いが、辻褄は合ってる必要はある -一般的にはコールフレームに含まれている引数しか書けない -実装側の引数を書いても良い(ようにするか?) - -実装の状態にアクセスする時にはコールフレーム内の実装を表すDataGearから取り出してくる - - -__code replaceNode1(struct RedBlackTree* tree, struct Node* node, __code next(...)) { - -呼び出しの例 - goto insertNode(tree, tree->nodeStack, node); - - -
--- a/doc/allocate.graffle Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1543 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>ActiveLayerIndex</key> - <integer>0</integer> - <key>ApplicationVersion</key> - <array> - <string>com.omnigroup.OmniGraffle</string> - <string>139.18.0.187838</string> - </array> - <key>AutoAdjust</key> - <true/> - <key>BackgroundGraphic</key> - <dict> - <key>Bounds</key> - <string>{{0, 0}, {559, 783}}</string> - <key>Class</key> - <string>SolidGraphic</string> - <key>ID</key> - <integer>2</integer> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <key>BaseZoom</key> - <integer>0</integer> - <key>CanvasOrigin</key> - <string>{0, 0}</string> - <key>ColumnAlign</key> - <integer>1</integer> - <key>ColumnSpacing</key> - <real>36</real> - <key>CreationDate</key> - <string>2015-04-07 04:20:51 +0000</string> - <key>Creator</key> - <string>kkb</string> - <key>DisplayScale</key> - <string>1 0/72 in = 1 0/72 in</string> - <key>GraphDocumentVersion</key> - <integer>8</integer> - <key>GraphicsList</key> - <array> - <dict> - <key>AllowConnections</key> - <string>NO</string> - <key>AllowLabelDrop</key> - <false/> - <key>AllowToConnect</key> - <false/> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>85</integer> - <key>Points</key> - <array> - <string>{198, 261}</string> - <string>{297, 297}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>0</string> - <key>Legacy</key> - <true/> - <key>Pattern</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - </dict> - <dict> - <key>AllowConnections</key> - <string>NO</string> - <key>AllowLabelDrop</key> - <false/> - <key>AllowToConnect</key> - <false/> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>84</integer> - <key>Points</key> - <array> - <string>{198, 216}</string> - <string>{297, 252}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>0</string> - <key>Legacy</key> - <true/> - <key>Pattern</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{288, 234}, {36, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>83</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Pad</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1344\cocoasubrtf720 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 mds 2}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{297, 252}, {18, 45}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>82</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>AllowConnections</key> - <string>NO</string> - <key>AllowLabelDrop</key> - <false/> - <key>AllowToConnect</key> - <false/> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>81</integer> - <key>Points</key> - <array> - <string>{198, 216}</string> - <string>{297, 225}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>0</string> - <key>Legacy</key> - <true/> - <key>Pattern</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - </dict> - <dict> - <key>AllowConnections</key> - <string>NO</string> - <key>AllowLabelDrop</key> - <false/> - <key>AllowToConnect</key> - <false/> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>80</integer> - <key>Points</key> - <array> - <string>{198, 198}</string> - <string>{297, 207}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>0</string> - <key>Legacy</key> - <true/> - <key>Pattern</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{288, 186.5}, {36, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>79</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Pad</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1344\cocoasubrtf720 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 mds 1}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{297, 207}, {18, 18}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>78</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>AllowConnections</key> - <string>NO</string> - <key>AllowLabelDrop</key> - <false/> - <key>AllowToConnect</key> - <false/> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>77</integer> - <key>Points</key> - <array> - <string>{198, 180}</string> - <string>{297, 180}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>0</string> - <key>Legacy</key> - <true/> - <key>Pattern</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - </dict> - <dict> - <key>AllowConnections</key> - <string>NO</string> - <key>AllowLabelDrop</key> - <false/> - <key>AllowToConnect</key> - <false/> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>76</integer> - <key>Points</key> - <array> - <string>{198, 135}</string> - <string>{297, 135}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>0</string> - <key>Legacy</key> - <true/> - <key>Pattern</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{288, 117}, {36, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>74</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Pad</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1344\cocoasubrtf720 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 ds 2}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{288, 67}, {36, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>73</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Pad</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1344\cocoasubrtf720 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 ds 1}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>72</integer> - <key>Points</key> - <array> - <string>{198, 135}</string> - <string>{297, 108}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>0</string> - <key>Legacy</key> - <true/> - <key>Pattern</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - </dict> - <dict> - <key>AllowConnections</key> - <string>NO</string> - <key>AllowLabelDrop</key> - <false/> - <key>AllowToConnect</key> - <false/> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>71</integer> - <key>Points</key> - <array> - <string>{198, 117}</string> - <string>{297, 90}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>0</string> - <key>Legacy</key> - <true/> - <key>Pattern</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{297, 135}, {18, 45}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>70</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{297, 90}, {18, 18}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>69</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{0, 468}, {63, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>68</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Pad</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1344\cocoasubrtf720 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 mds_heap}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{9, 387}, {54, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>67</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Pad</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1344\cocoasubrtf720 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 ds_heap}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{9, 324}, {54, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>66</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Pad</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1344\cocoasubrtf720 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 context}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{0, 258.5}, {63, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>65</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Pad</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1344\cocoasubrtf720 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 mds_heap}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{9, 177.5}, {54, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>64</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Pad</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1344\cocoasubrtf720 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 ds_heap}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{9, 117}, {54, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>63</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Pad</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1344\cocoasubrtf720 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 context}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>AllowConnections</key> - <string>NO</string> - <key>AllowLabelDrop</key> - <false/> - <key>AllowToConnect</key> - <false/> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>62</integer> - <key>Points</key> - <array> - <string>{81, 513}</string> - <string>{180, 531}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>0</string> - <key>Legacy</key> - <true/> - <key>Pattern</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - </dict> - <dict> - <key>AllowConnections</key> - <string>NO</string> - <key>AllowLabelDrop</key> - <false/> - <key>AllowToConnect</key> - <false/> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>61</integer> - <key>Points</key> - <array> - <string>{81, 306}</string> - <string>{180, 324}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>0</string> - <key>Legacy</key> - <true/> - <key>Pattern</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>60</integer> - <key>Points</key> - <array> - <string>{81, 306}</string> - <string>{180, 279}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>0</string> - <key>Legacy</key> - <true/> - <key>Pattern</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - </dict> - <dict> - <key>AllowConnections</key> - <string>NO</string> - <key>AllowLabelDrop</key> - <false/> - <key>AllowToConnect</key> - <false/> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>59</integer> - <key>Points</key> - <array> - <string>{81, 99}</string> - <string>{180, 72}</string> - </array> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>0</string> - <key>Legacy</key> - <true/> - <key>Pattern</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{180, 450}, {18, 81}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>51</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{180, 369}, {18, 81}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>50</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{180, 324}, {18, 45}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>49</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{180, 198}, {18, 81}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>48</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{180, 117}, {18, 81}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>47</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{180, 72}, {18, 45}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>46</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{63, 432}, {18, 81}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>45</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{63, 351}, {18, 81}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>44</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{63, 306}, {18, 45}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>43</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{63, 225}, {18, 81}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>41</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{63, 144}, {18, 81}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>40</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{63, 99}, {18, 45}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>39</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{144, 299}, {90, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>18</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Pad</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1344\cocoasubrtf720 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 worker 2}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{144, 49}, {90, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>17</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Pad</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1344\cocoasubrtf720 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 worker 1}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{27, 76}, {90, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>4</integer> - <key>Shape</key> - <string>Rectangle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Pad</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg1252\cocoartf1344\cocoasubrtf720 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs24 \cf0 main}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - </array> - <key>GridInfo</key> - <dict> - <key>ShowsGrid</key> - <string>YES</string> - <key>SnapsToGrid</key> - <string>YES</string> - </dict> - <key>GuidesLocked</key> - <string>NO</string> - <key>GuidesVisible</key> - <string>YES</string> - <key>HPages</key> - <integer>1</integer> - <key>ImageCounter</key> - <integer>1</integer> - <key>KeepToScale</key> - <false/> - <key>Layers</key> - <array> - <dict> - <key>Lock</key> - <string>NO</string> - <key>Name</key> - <string>Layer 1</string> - <key>Print</key> - <string>YES</string> - <key>View</key> - <string>YES</string> - </dict> - </array> - <key>LayoutInfo</key> - <dict> - <key>Animate</key> - <string>NO</string> - <key>circoMinDist</key> - <real>18</real> - <key>circoSeparation</key> - <real>0.0</real> - <key>dotRankSep</key> - <real>0.0</real> - <key>layoutEngine</key> - <string>dot</string> - <key>neatoSeparation</key> - <real>0.0</real> - <key>twopiSeparation</key> - <real>0.0</real> - </dict> - <key>LinksVisible</key> - <string>NO</string> - <key>MagnetsVisible</key> - <string>NO</string> - <key>MasterSheets</key> - <array/> - <key>ModificationDate</key> - <string>2015-04-07 05:07:49 +0000</string> - <key>Modifier</key> - <string>kkb</string> - <key>NotesVisible</key> - <string>NO</string> - <key>Orientation</key> - <integer>2</integer> - <key>OriginVisible</key> - <string>NO</string> - <key>PageBreaks</key> - <string>YES</string> - <key>PrintInfo</key> - <dict> - <key>NSBottomMargin</key> - <array> - <string>float</string> - <string>41</string> - </array> - <key>NSHorizonalPagination</key> - <array> - <string>coded</string> - <string>BAtzdHJlYW10eXBlZIHoA4QBQISEhAhOU051bWJlcgCEhAdOU1ZhbHVlAISECE5TT2JqZWN0AIWEASqEhAFxlwCG</string> - </array> - <key>NSLeftMargin</key> - <array> - <string>float</string> - <string>18</string> - </array> - <key>NSPaperSize</key> - <array> - <string>size</string> - <string>{595, 842}</string> - </array> - <key>NSPrintReverseOrientation</key> - <array> - <string>int</string> - <string>0</string> - </array> - <key>NSRightMargin</key> - <array> - <string>float</string> - <string>18</string> - </array> - <key>NSTopMargin</key> - <array> - <string>float</string> - <string>18</string> - </array> - </dict> - <key>PrintOnePage</key> - <false/> - <key>ReadOnly</key> - <string>NO</string> - <key>RowAlign</key> - <integer>1</integer> - <key>RowSpacing</key> - <real>36</real> - <key>SheetTitle</key> - <string>Canvas 1</string> - <key>SmartAlignmentGuidesActive</key> - <string>YES</string> - <key>SmartDistanceGuidesActive</key> - <string>YES</string> - <key>UniqueID</key> - <integer>1</integer> - <key>UseEntirePage</key> - <false/> - <key>VPages</key> - <integer>1</integer> - <key>WindowInfo</key> - <dict> - <key>CurrentSheet</key> - <integer>0</integer> - <key>ExpandedCanvases</key> - <array> - <dict> - <key>name</key> - <string>Canvas 1</string> - </dict> - </array> - <key>Frame</key> - <string>{{616, 555}, {693, 925}}</string> - <key>ListView</key> - <true/> - <key>OutlineWidth</key> - <integer>142</integer> - <key>RightSidebar</key> - <false/> - <key>ShowRuler</key> - <true/> - <key>Sidebar</key> - <true/> - <key>SidebarWidth</key> - <integer>120</integer> - <key>VisibleRegion</key> - <string>{{0, 0}, {558, 783}}</string> - <key>Zoom</key> - <real>1</real> - <key>ZoomValues</key> - <array> - <array> - <string>Canvas 1</string> - <real>1</real> - <real>1</real> - </array> - </array> - </dict> -</dict> -</plist>
--- a/doc/synchronizedQueue.graffle Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2536 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>ActiveLayerIndex</key> - <integer>0</integer> - <key>ApplicationVersion</key> - <array> - <string>com.omnigroup.OmniGraffle6</string> - <string>159.11.0.228015</string> - </array> - <key>AutoAdjust</key> - <true/> - <key>BackgroundGraphic</key> - <dict> - <key>Bounds</key> - <string>{{0, 0}, {1118, 783}}</string> - <key>Class</key> - <string>SolidGraphic</string> - <key>ID</key> - <integer>2</integer> - <key>Style</key> - <dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <key>BaseZoom</key> - <integer>0</integer> - <key>CanvasOrigin</key> - <string>{0, 0}</string> - <key>ColumnAlign</key> - <integer>1</integer> - <key>ColumnSpacing</key> - <real>36</real> - <key>CreationDate</key> - <string>2015-05-04 06:37:26 +0000</string> - <key>Creator</key> - <string>Tatsuki IHA</string> - <key>DisplayScale</key> - <string>1 in = 1.00000 in</string> - <key>GraphDocumentVersion</key> - <integer>12</integer> - <key>GraphicsList</key> - <array> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>103</integer> - <key>Info</key> - <integer>2</integer> - </dict> - <key>ID</key> - <integer>104</integer> - <key>Points</key> - <array> - <string>{654.31997136771679, 372.25999866425991}</string> - <string>{653.81998662650585, 410.63499866425991}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>93</integer> - <key>Info</key> - <integer>1</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{598.31998662650585, 410.63499866425991}, {111, 42}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>103</integer> - <key>Magnets</key> - <array> - <string>{0, 1}</string> - <string>{0, -1}</string> - <string>{1, 0}</string> - <string>{-1, 0}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Color</key> - <dict> - <key>b</key> - <string>0</string> - <key>g</key> - <string>0</string> - <key>r</key> - <string>1</string> - </dict> - <key>CornerRadius</key> - <real>5</real> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg65001\cocoartf1344\cocoasubrtf720 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;\red255\green0\blue0;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf2 over flow}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>101</integer> - <key>Info</key> - <integer>2</integer> - </dict> - <key>ID</key> - <integer>102</integer> - <key>Points</key> - <array> - <string>{128.49996948242188, 366.5}</string> - <string>{128.49997711181641, 404.875}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>61</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{72.999977111816406, 404.875}, {111, 42}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>101</integer> - <key>Magnets</key> - <array> - <string>{0, 1}</string> - <string>{0, -1}</string> - <string>{1, 0}</string> - <string>{-1, 0}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Color</key> - <dict> - <key>b</key> - <string>0</string> - <key>g</key> - <string>0</string> - <key>r</key> - <string>1</string> - </dict> - <key>CornerRadius</key> - <real>5</real> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg65001\cocoartf1344\cocoasubrtf720 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;\red255\green0\blue0;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf2 empty}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>99</integer> - <key>Points</key> - <array> - <string>{653.31998662650585, 246.00999866425991}</string> - <string>{653.31998662650585, 204.25999866425991}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>97</integer> - </dict> - <key>ID</key> - <integer>98</integer> - <key>Points</key> - <array> - <string>{654.31997136771679, 330.25999866425991}</string> - <string>{654.31997136771679, 290.50999866425985}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>93</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>TableGroup</string> - <key>Graphics</key> - <array> - <dict> - <key>Bounds</key> - <string>{{598.81997899711132, 246.00999866425991}, {110.99999237060547, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>96</integer> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg65001\cocoartf1344\cocoasubrtf720 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 data segment 2}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - <dict> - <key>Bounds</key> - <string>{{598.81997899711132, 260.00999866425991}, {110.99999237060547, 30}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>97</integer> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Align</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg65001\cocoartf1344\cocoasubrtf720 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720 - -\f0\fs24 \cf0 \ -}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - </array> - <key>GridH</key> - <array> - <integer>96</integer> - <integer>97</integer> - <array/> - </array> - <key>ID</key> - <integer>95</integer> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>94</integer> - <key>Points</key> - <array> - <string>{749.81997136771679, 354.67665515840054}</string> - <string>{709.81996524681813, 354.25998833691187}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{598.81997136771679, 330.25999866425991}, {111, 42}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>93</integer> - <key>Magnets</key> - <array> - <string>{0, 1}</string> - <string>{0, -1}</string> - <string>{1, 0}</string> - <string>{-1, 0}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>CornerRadius</key> - <real>5</real> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg65001\cocoartf1344\cocoasubrtf720 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 M : put}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>TableGroup</string> - <key>Graphics</key> - <array> - <dict> - <key>Bounds</key> - <string>{{749.81997899711132, 325.75999866425991}, {111, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>91</integer> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg65001\cocoartf1344\cocoasubrtf720 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 data segment 2}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - <dict> - <key>Bounds</key> - <string>{{749.81997899711132, 339.75999866425991}, {111, 30}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>92</integer> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Align</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg65001\cocoartf1344\cocoasubrtf720 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720 - -\f0\fs24 \cf0 \ -}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - </array> - <key>GridH</key> - <array> - <integer>91</integer> - <integer>92</integer> - <array/> - </array> - <key>ID</key> - <integer>90</integer> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>92</integer> - </dict> - <key>ID</key> - <integer>89</integer> - <key>Points</key> - <array> - <string>{901.31995801627636, 354.75999866425991}</string> - <string>{861.31997899711132, 354.75999866425991}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>87</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>88</integer> - <key>Points</key> - <array> - <string>{956.31995801627636, 290.25999866425991}</string> - <string>{956.31995801627636, 333.75999866425991}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{901.31995801627636, 333.75999866425991}, {111, 42}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>87</integer> - <key>Magnets</key> - <array> - <string>{0, 1}</string> - <string>{0, -1}</string> - <string>{1, 0}</string> - <string>{-1, 0}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>CornerRadius</key> - <real>5</real> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg65001\cocoartf1344\cocoasubrtf720 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 put}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>84</integer> - </dict> - <key>ID</key> - <integer>86</integer> - <key>Points</key> - <array> - <string>{956.81995801627636, 203.75999866425991}</string> - <string>{956.81995801627636, 247.25999866425991}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>76</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>TableGroup</string> - <key>Graphics</key> - <array> - <dict> - <key>Bounds</key> - <string>{{901.31997518241405, 247.75999866425991}, {111, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>84</integer> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg65001\cocoartf1344\cocoasubrtf720 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 data segment 1}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - <dict> - <key>Bounds</key> - <string>{{901.31997518241405, 261.75999866425991}, {111, 30}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>85</integer> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Align</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg65001\cocoartf1344\cocoasubrtf720 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720 - -\f0\fs24 \cf0 \ -}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - </array> - <key>GridH</key> - <array> - <integer>84</integer> - <integer>85</integer> - <array/> - </array> - <key>ID</key> - <integer>83</integer> - </dict> - <dict> - <key>Bounds</key> - <string>{{1046.8200018852949, 219.75999866425991}, {33, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>82</integer> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg65001\cocoartf1344\cocoasubrtf720 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 end}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{634.81998662650585, 59.759998664259911}, {38, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>81</integer> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg65001\cocoartf1344\cocoasubrtf720 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 start}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>80</integer> - <key>Points</key> - <array> - <string>{1012.3199580162764, 182.75999866425991}</string> - <string>{1049.8200018852949, 181.75999866425991}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>76</integer> - <key>Info</key> - <integer>3</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>Group</string> - <key>Graphics</key> - <array> - <dict> - <key>Bounds</key> - <string>{{1052.8199885338545, 172.25999866425991}, {21, 21}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>78</integer> - <key>Shape</key> - <string>Circle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Color</key> - <dict> - <key>b</key> - <string>0</string> - <key>g</key> - <string>0</string> - <key>r</key> - <string>0</string> - </dict> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{1048.3199885338545, 167.75999866425991}, {30, 30}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>79</integer> - <key>Shape</key> - <string>Circle</string> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - </array> - <key>ID</key> - <integer>77</integer> - </dict> - <dict> - <key>Bounds</key> - <string>{{901.31995801627636, 161.75999866425991}, {111, 42}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>76</integer> - <key>Magnets</key> - <array> - <string>{0, 1}</string> - <string>{0, -1}</string> - <string>{1, 0}</string> - <string>{-1, 0}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>CornerRadius</key> - <real>5</real> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg65001\cocoartf1344\cocoasubrtf720 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 M : sender}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>75</integer> - <key>Points</key> - <array> - <string>{861.31991478906843, 182.88953340220792}</string> - <string>{901.81998853385448, 182.25999866425991}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>74</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>TableGroup</string> - <key>Graphics</key> - <array> - <dict> - <key>Bounds</key> - <string>{{749.81997518241405, 141.75999866425991}, {111, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>73</integer> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg65001\cocoartf1344\cocoasubrtf720 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 data segment 1}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - <dict> - <key>Bounds</key> - <string>{{749.81997518241405, 155.75999866425991}, {111, 56}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>74</integer> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Align</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg65001\cocoartf1344\cocoasubrtf720 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720 - -\f0\fs24 \cf0 first\ -last\ -count\ -}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - </array> - <key>GridH</key> - <array> - <integer>73</integer> - <integer>74</integer> - <array/> - </array> - <key>ID</key> - <integer>72</integer> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>74</integer> - </dict> - <key>ID</key> - <integer>71</integer> - <key>Points</key> - <array> - <string>{709.31998853385448, 182.75999866425991}</string> - <string>{749.3200023069503, 183.17666553234531}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>69</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>69</integer> - <key>Info</key> - <integer>2</integer> - </dict> - <key>ID</key> - <integer>70</integer> - <key>Points</key> - <array> - <string>{654.36228832309905, 107.75999866425991}</string> - <string>{653.81998853385448, 161.75999866425991}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{598.31998853385448, 161.75999866425991}, {111, 42}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>69</integer> - <key>Magnets</key> - <array> - <string>{0, 1}</string> - <string>{0, -1}</string> - <string>{1, 0}</string> - <string>{-1, 0}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>CornerRadius</key> - <real>5</real> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg65001\cocoartf1344\cocoasubrtf720 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 sender}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{643.31998853385448, 86.759998664259911}, {21, 21}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>68</integer> - <key>Shape</key> - <string>Circle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Color</key> - <dict> - <key>b</key> - <string>0</string> - <key>g</key> - <string>0</string> - <key>r</key> - <string>0</string> - </dict> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>67</integer> - <key>Points</key> - <array> - <string>{127.49998474121094, 240.25}</string> - <string>{127.49998474121094, 198.5}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>65</integer> - </dict> - <key>ID</key> - <integer>66</integer> - <key>Points</key> - <array> - <string>{128.49996948242188, 324.5}</string> - <string>{128.49996948242188, 284.75}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>61</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>TableGroup</string> - <key>Graphics</key> - <array> - <dict> - <key>Bounds</key> - <string>{{72.999977111816406, 240.25}, {111, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>64</integer> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg65001\cocoartf1344\cocoasubrtf720 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 data segment 2}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - <dict> - <key>Bounds</key> - <string>{{72.999977111816406, 254.25}, {111, 30}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>65</integer> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Align</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg65001\cocoartf1344\cocoasubrtf720 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720 - -\f0\fs24 \cf0 \ -}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - </array> - <key>GridH</key> - <array> - <integer>64</integer> - <integer>65</integer> - <array/> - </array> - <key>ID</key> - <integer>63</integer> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>62</integer> - <key>Points</key> - <array> - <string>{223.99996948242188, 348.91665649414062}</string> - <string>{183.99996336152327, 348.49998967265191}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{72.999969482421875, 324.5}, {111, 42}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>61</integer> - <key>Magnets</key> - <array> - <string>{0, 1}</string> - <string>{0, -1}</string> - <string>{1, 0}</string> - <string>{-1, 0}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>CornerRadius</key> - <real>5</real> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg65001\cocoartf1344\cocoasubrtf720 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 M : get}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>TableGroup</string> - <key>Graphics</key> - <array> - <dict> - <key>Bounds</key> - <string>{{223.99997711181641, 320}, {111, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>57</integer> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg65001\cocoartf1344\cocoasubrtf720 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 data segment 2}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - <dict> - <key>Bounds</key> - <string>{{223.99997711181641, 334}, {111, 30}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>59</integer> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Align</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg65001\cocoartf1344\cocoasubrtf720 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720 - -\f0\fs24 \cf0 \ -}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - </array> - <key>GridH</key> - <array> - <integer>57</integer> - <integer>59</integer> - <array/> - </array> - <key>ID</key> - <integer>56</integer> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>59</integer> - </dict> - <key>ID</key> - <integer>60</integer> - <key>Points</key> - <array> - <string>{375.49995613098145, 349}</string> - <string>{335.49997711181641, 349}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>53</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>54</integer> - <key>Points</key> - <array> - <string>{430.49995613098145, 284.5}</string> - <string>{430.49995613098145, 328}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{375.49995613098145, 328}, {111, 42}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>53</integer> - <key>Magnets</key> - <array> - <string>{0, 1}</string> - <string>{0, -1}</string> - <string>{1, 0}</string> - <string>{-1, 0}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>CornerRadius</key> - <real>5</real> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg65001\cocoartf1344\cocoasubrtf720 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 get}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>50</integer> - </dict> - <key>ID</key> - <integer>52</integer> - <key>Points</key> - <array> - <string>{430.99995613098145, 198}</string> - <string>{430.99995613098145, 241.5}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>37</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>TableGroup</string> - <key>Graphics</key> - <array> - <dict> - <key>Bounds</key> - <string>{{375.49997329711914, 242}, {111, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>50</integer> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg65001\cocoartf1344\cocoasubrtf720 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 data segment 1}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - <dict> - <key>Bounds</key> - <string>{{375.49997329711914, 256}, {111, 30}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>51</integer> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Align</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg65001\cocoartf1344\cocoasubrtf720 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720 - -\f0\fs24 \cf0 \ -}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - </array> - <key>GridH</key> - <array> - <integer>50</integer> - <integer>51</integer> - <array/> - </array> - <key>ID</key> - <integer>49</integer> - </dict> - <dict> - <key>Bounds</key> - <string>{{521, 214}, {33, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>6</integer> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg65001\cocoartf1344\cocoasubrtf720 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 end}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{108.99998474121094, 54}, {38, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>5</integer> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg65001\cocoartf1344\cocoasubrtf720 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 start}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>38</integer> - <key>Points</key> - <array> - <string>{486.49995613098145, 177}</string> - <string>{524, 176}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>37</integer> - <key>Info</key> - <integer>3</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>Group</string> - <key>Graphics</key> - <array> - <dict> - <key>Bounds</key> - <string>{{526.99998664855957, 166.5}, {21, 21}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>24</integer> - <key>Shape</key> - <string>Circle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Color</key> - <dict> - <key>b</key> - <string>0</string> - <key>g</key> - <string>0</string> - <key>r</key> - <string>0</string> - </dict> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{522.49998664855957, 162}, {30, 30}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>3</integer> - <key>Shape</key> - <string>Circle</string> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - </array> - <key>ID</key> - <integer>1</integer> - </dict> - <dict> - <key>Bounds</key> - <string>{{375.49995613098145, 156}, {111, 42}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>37</integer> - <key>Magnets</key> - <array> - <string>{0, 1}</string> - <string>{0, -1}</string> - <string>{1, 0}</string> - <string>{-1, 0}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>CornerRadius</key> - <real>5</real> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg65001\cocoartf1344\cocoasubrtf720 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 M : receiver}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>ID</key> - <integer>36</integer> - <key>Points</key> - <array> - <string>{335.49991290377352, 177.12953473794801}</string> - <string>{375.99998664855957, 176.5}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>35</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>TableGroup</string> - <key>Graphics</key> - <array> - <dict> - <key>Bounds</key> - <string>{{223.99997329711914, 136}, {111, 14}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>34</integer> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg65001\cocoartf1344\cocoasubrtf720 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 data segment 1}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - <dict> - <key>Bounds</key> - <string>{{223.99997329711914, 150}, {111, 56}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>FitText</key> - <string>Vertical</string> - <key>Flow</key> - <string>Resize</string> - <key>ID</key> - <integer>35</integer> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>GradientCenter</key> - <string>{-0.29411799999999999, -0.264706}</string> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Align</key> - <integer>0</integer> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg65001\cocoartf1344\cocoasubrtf720 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720 - -\f0\fs24 \cf0 first\ -last\ -count\ -}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - <key>TextPlacement</key> - <integer>0</integer> - </dict> - </array> - <key>GridH</key> - <array> - <integer>34</integer> - <integer>35</integer> - <array/> - </array> - <key>ID</key> - <integer>33</integer> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>35</integer> - </dict> - <key>ID</key> - <integer>10</integer> - <key>Points</key> - <array> - <string>{183.49998664855957, 177}</string> - <string>{223.50000042165541, 177.4166668680854}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - <key>Tail</key> - <dict> - <key>ID</key> - <integer>8</integer> - </dict> - </dict> - <dict> - <key>Class</key> - <string>LineGraphic</string> - <key>Head</key> - <dict> - <key>ID</key> - <integer>8</integer> - <key>Info</key> - <integer>2</integer> - </dict> - <key>ID</key> - <integer>9</integer> - <key>Points</key> - <array> - <string>{128.54228643780414, 102}</string> - <string>{127.99998664855957, 156}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>HeadArrow</key> - <string>StickArrow</string> - <key>Legacy</key> - <true/> - <key>LineType</key> - <integer>1</integer> - <key>TailArrow</key> - <string>0</string> - </dict> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{72.49998664855957, 156}, {111, 42}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>8</integer> - <key>Magnets</key> - <array> - <string>{0, 1}</string> - <string>{0, -1}</string> - <string>{1, 0}</string> - <string>{-1, 0}</string> - </array> - <key>Style</key> - <dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - <key>stroke</key> - <dict> - <key>CornerRadius</key> - <real>5</real> - </dict> - </dict> - <key>Text</key> - <dict> - <key>Text</key> - <string>{\rtf1\ansi\ansicpg65001\cocoartf1344\cocoasubrtf720 -{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc - -\f0\b\fs24 \cf0 receiver}</string> - <key>VerticalPad</key> - <integer>0</integer> - </dict> - </dict> - <dict> - <key>Bounds</key> - <string>{{117.49998664855957, 81}, {21, 21}}</string> - <key>Class</key> - <string>ShapedGraphic</string> - <key>ID</key> - <integer>4</integer> - <key>Shape</key> - <string>Circle</string> - <key>Style</key> - <dict> - <key>fill</key> - <dict> - <key>Color</key> - <dict> - <key>b</key> - <string>0</string> - <key>g</key> - <string>0</string> - <key>r</key> - <string>0</string> - </dict> - </dict> - <key>shadow</key> - <dict> - <key>Draws</key> - <string>NO</string> - </dict> - </dict> - </dict> - </array> - <key>GridInfo</key> - <dict/> - <key>GuidesLocked</key> - <string>NO</string> - <key>GuidesVisible</key> - <string>YES</string> - <key>HPages</key> - <integer>2</integer> - <key>ImageCounter</key> - <integer>1</integer> - <key>KeepToScale</key> - <false/> - <key>Layers</key> - <array> - <dict> - <key>Lock</key> - <string>NO</string> - <key>Name</key> - <string>Layer 1</string> - <key>Print</key> - <string>YES</string> - <key>View</key> - <string>YES</string> - </dict> - </array> - <key>LayoutInfo</key> - <dict> - <key>Animate</key> - <string>NO</string> - <key>circoMinDist</key> - <real>18</real> - <key>circoSeparation</key> - <real>0.0</real> - <key>layoutEngine</key> - <string>dot</string> - <key>neatoLineLength</key> - <real>0.20000000298023224</real> - <key>neatoSeparation</key> - <real>0.0</real> - <key>twopiSeparation</key> - <real>0.0</real> - </dict> - <key>LinksVisible</key> - <string>NO</string> - <key>MagnetsVisible</key> - <string>NO</string> - <key>MasterSheets</key> - <array/> - <key>ModificationDate</key> - <string>2015-05-24 17:35:18 +0000</string> - <key>Modifier</key> - <string>one</string> - <key>NotesVisible</key> - <string>NO</string> - <key>Orientation</key> - <integer>2</integer> - <key>OriginVisible</key> - <string>NO</string> - <key>PageBreaks</key> - <string>YES</string> - <key>PrintInfo</key> - <dict> - <key>NSBottomMargin</key> - <array> - <string>float</string> - <string>41</string> - </array> - <key>NSHorizonalPagination</key> - <array> - <string>coded</string> - <string>BAtzdHJlYW10eXBlZIHoA4QBQISEhAhOU051bWJlcgCEhAdOU1ZhbHVlAISECE5TT2JqZWN0AIWEASqEhAFxlwCG</string> - </array> - <key>NSLeftMargin</key> - <array> - <string>float</string> - <string>18</string> - </array> - <key>NSPaperSize</key> - <array> - <string>size</string> - <string>{595, 842}</string> - </array> - <key>NSPrintReverseOrientation</key> - <array> - <string>coded</string> - <string>BAtzdHJlYW10eXBlZIHoA4QBQISEhAhOU051bWJlcgCEhAdOU1ZhbHVlAISECE5TT2JqZWN0AIWEASqEhAFxlwCG</string> - </array> - <key>NSRightMargin</key> - <array> - <string>float</string> - <string>18</string> - </array> - <key>NSTopMargin</key> - <array> - <string>float</string> - <string>18</string> - </array> - </dict> - <key>PrintOnePage</key> - <false/> - <key>ReadOnly</key> - <string>NO</string> - <key>RowAlign</key> - <integer>1</integer> - <key>RowSpacing</key> - <real>36</real> - <key>SheetTitle</key> - <string>sender receiver</string> - <key>SmartAlignmentGuidesActive</key> - <string>YES</string> - <key>SmartDistanceGuidesActive</key> - <string>YES</string> - <key>UniqueID</key> - <integer>1</integer> - <key>UseEntirePage</key> - <false/> - <key>VPages</key> - <integer>1</integer> - <key>WindowInfo</key> - <dict> - <key>CurrentSheet</key> - <integer>0</integer> - <key>Expanded_Canvases</key> - <array/> - <key>Frame</key> - <string>{{597, 594}, {1325, 925}}</string> - <key>ShowInfo</key> - <true/> - <key>ShowRuler</key> - <true/> - <key>Sidebar</key> - <true/> - <key>SidebarWidth</key> - <integer>200</integer> - <key>TopSlabHeight</key> - <real>250</real> - <key>VisibleRegion</key> - <string>{{248, 15}, {811, 768}}</string> - <key>Zoom</key> - <real>1</real> - <key>ZoomValues</key> - <array> - <array> - <string>sender receiver</string> - <real>1</real> - <real>1</real> - </array> - </array> - </dict> -</dict> -</plist>
--- a/src/CMakeLists.txt Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -cmake_minimum_required(VERSION 3.3) - -# output compile log -set(CMAKE_VERBOSE_MAKEFILE 1) - -# set compiler -set(CMAKE_C_COMPILER $ENV{CBC_COMPILER}) - -# compile option -add_definitions("-Wall -g -O0") - -include_directories(include) -include_directories($ENV{CUDA_PATH}) -add_subdirectory(allocate) -add_subdirectory(list) -add_subdirectory(llrb) -add_subdirectory(synchronizedQueue) -add_subdirectory(parallel_execution)
--- a/src/include/allocate.h Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -__code allocate(); -__code meta_allocate(); - -__code allocate(struct Context* context) { - goto meta_allocate(context); -} - -__code meta_allocate(struct Context* context) { - context->data[++context->dataNum] = context->heap; - context->heap += context->data[0]->allocate.size; - - goto meta(context, context->next[--context->current]); -}
--- a/src/include/context.h Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -typedef struct Context_st { - void* ds; - void* mds; - void* ds_heap; - void* mds_heap; - __code (*next)(); - void* head; -} Context;
--- a/src/include/origin_cs.h Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -extern __code start_code(struct Context* context, enum Code next); -extern __code exit_code(struct Context* context); -extern __code meta(struct Context* context, enum Code next);
--- a/src/llrb/CMakeLists.txt Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -cmake_minimum_required(VERSION 2.8) - -add_definitions("-Wall -g -O0") - -set(CMAKE_C_COMPILER $ENV{CbC_Clang}/clang) - -include_directories(include) -add_executable(llrb - main.c - llrb.c - llrbContext.c - allocate.c - compare.c - stack.c - origin_cs.c -) - - -add_executable(llrb_with_put_verify - main.c - llrb.c - llrbContext.c - allocate.c - compare.c - stack.c - verifier/llrbContextWithVerifier.c - verifier/verify_put_cs.c -)
--- a/src/llrb/allocate.c Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -#include "llrbContext.h" - -void allocator(struct Context* context) { - context->data[++context->dataNum] = context->heap; - context->heap += context->data[Allocate]->allocate.size; -}
--- a/src/llrb/compare.c Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -#include "llrbContext.h" - -void compare(struct Context* context, struct Tree* tree, int key1, int key2) { - if (key1 == key2) { - tree->result = EQ; - } else if (key1 < key2) { - tree->result = GT; - } else { - tree->result = LT; - } -}
--- a/src/llrb/include/llrbContext.h Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -/* Context definition for llrb example */ -#include "stack.h" - -#define ALLOCATE_SIZE 1000 - -enum Code { - Code1, - Code2, - Code3, - Code4, - Code5, - Find, - Not_find, - Code6, - Allocator, - Put, - Replace, - Insert, - Compare, - RotateL, - RotateR, - SetTree, - InsertCase1, - InsertCase2, - InsertCase3, - InsertCase4, - InsertCase4_1, - InsertCase4_2, - InsertCase5, - StackClear, - Get, - Search, - Delete, - Delete1, - Delete2, - Delete3, - Replace_d1, - Replace_d2, - FindMax1, - FindMax2, - DeleteCase1, - DeleteCase2, - DeleteCase3, - DeleteCase4, - DeleteCase5, - DeleteCase6, - Exit, -}; - -enum Relational { - EQ, - GT, - LT, -}; - -enum UniqueData { - Allocate, - Tree, - Node, -}; - -struct Context { - enum Code next; - int codeNum; - __code (**code) (struct Context*); - void* heapStart; - void* heap; - long heapLimit; - int dataNum; - stack_ptr code_stack; - stack_ptr node_stack; - union Data **data; -}; - -union Data { - struct Comparable { // inteface - enum Code compare; - union Data* data; - } compare; - struct Count { - enum Code next; - long i; - } count; - struct Tree { - enum Code next; - struct Node* root; - struct Node* current; - struct Node* deleted; - int result; - } tree; - struct Node { - // need to tree - enum Code next; - int key; // comparable data segment - int value; - struct Node* left; - struct Node* right; - // need to balancing - enum Color { - Red, - Black, - } color; - } node; - struct Allocate { - enum Code next; - long size; - } allocate; -};
--- a/src/llrb/include/stack.h Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -#include <stdlib.h> - -typedef struct { - size_t size; - int max; - int num; - void* data; -} stack, *stack_ptr; - -extern stack_ptr stack_init(); -extern stack_ptr stack_realloc(); -extern void stack_free(); -extern int stack_push(); -extern int stack_pop(); -extern int isMax(); -extern int isEmpty();
--- a/src/llrb/llrb.c Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,669 +0,0 @@ -#include <stdio.h> - -#include "llrbContext.h" -#include "origin_cs.h" - -extern void allocator(struct Context* context); -extern void compare(struct Context* context, struct Tree* tree, int key1, int key2); - -extern int num; - -__code put(struct Context* context, struct Tree* tree, struct Node* root, struct Allocate* allocate) { - allocate->size = sizeof(struct Node); - allocator(context); - - stack_push(context->code_stack, &context->next); - - context->next = StackClear; - stack_push(context->code_stack, &context->next); - - tree->root = &context->data[context->dataNum]->node; - - if (root) { - tree->current = root; - compare(context, tree, tree->current->key, context->data[Node]->node.key); - - goto meta(context, Replace); - } - - goto meta(context, Insert); -} - -__code put_stub(struct Context* context) { - goto put(context, &context->data[Tree]->tree, context->data[Tree]->tree.root, &context->data[Allocate]->allocate); -} - -__code replaceNode(struct Context* context, struct Tree* tree, struct Node* oldNode, struct Node* newNode, int result) { - *newNode = *oldNode; - stack_push(context->node_stack, &newNode); - - if (result == EQ) { - newNode->value = context->data[Node]->node.value; - - stack_pop(context->code_stack, &context->next); - goto meta(context, context->next); - } else if (result == GT) { - tree->current = oldNode->right; - newNode->right = context->heap; - } else { - tree->current = oldNode->left; - newNode->left = context->heap; - } - - context->data[Allocate]->allocate.size = sizeof(struct Node); - allocator(context); - - if (tree->current) { - compare(context, tree, tree->current->key, context->data[Node]->node.key); - goto meta(context, Replace); - } - - goto meta(context, Insert); -} - -__code replaceNode_stub(struct Context* context) { - goto replaceNode(context, &context->data[Tree]->tree, context->data[Tree]->tree.current, &context->data[context->dataNum]->node, context->data[Tree]->tree.result); -} - -__code insertNode(struct Context* context, struct Tree* tree, struct Node* node, struct Node* newNode) { - node->color = Red; - *newNode = *node; - - tree->current = newNode; - - goto meta(context, InsertCase1); -} - -__code insertNode_stub(struct Context* context) { - goto insertNode(context, &context->data[Tree]->tree, &context->data[Node]->node, &context->data[context->dataNum]->node); -} - -__code insertCase1(struct Context* context, struct Tree* tree, struct Node* current) { - if (!isEmpty(context->node_stack)) - goto meta(context, InsertCase2); - - tree->root->color = Black; - - stack_pop(context->code_stack, &context->next); - goto meta(context, context->next); -} - -__code insert1_stub(struct Context* context) { - goto insertCase1(context, &context->data[Tree]->tree, context->data[Tree]->tree.current); -} - -__code insertCase2(struct Context* context, struct Node* current) { - struct Node* parent; - stack_pop(context->node_stack, &parent); - - if (parent->color == Black) { - stack_pop(context->code_stack, &context->next); - goto meta(context, context->next); - } - - stack_push(context->node_stack, &parent); - goto meta(context, InsertCase3); -} - -__code insert2_stub(struct Context* context) { - goto insertCase2(context, context->data[Tree]->tree.current); -} - -__code insertCase3(struct Context* context, struct Tree* tree, struct Node* current) { - struct Node* parent; - struct Node* uncle; - struct Node* grandparent; - - stack_pop(context->node_stack, &parent); - stack_pop(context->node_stack, &grandparent); - - if (grandparent->left == parent) - uncle = grandparent->right; - else - uncle = grandparent->left; - - if (uncle && (uncle->color == Red)) { - parent->color = Black; - uncle->color = Black; - grandparent->color = Red; - tree->current = grandparent; - goto meta(context, InsertCase1); - } - - stack_push(context->node_stack, &grandparent); - stack_push(context->node_stack, &parent); - - goto meta(context, InsertCase4); -} - -__code insert3_stub(struct Context* context) { - goto insertCase3(context, &context->data[Tree]->tree, context->data[Tree]->tree.current); -} - -__code insertCase4(struct Context* context, struct Tree* tree, struct Node* current) { - struct Node* parent; - struct Node* grandparent; - - stack_pop(context->node_stack, &parent); - stack_pop(context->node_stack, &grandparent); - - stack_push(context->node_stack, &grandparent); - - tree->current = parent; - - if ((current == parent->right) && (parent == grandparent->left)) { - context->next = InsertCase4_1; - - stack_push(context->code_stack, &context->next); - goto meta(context, RotateL); - } else if ((current == parent->left) && (parent == grandparent->right)) { - context->next = InsertCase4_2; - - stack_push(context->code_stack, &context->next); - goto meta(context, RotateR); - } - - stack_push(context->node_stack, &parent); - tree->current = current; - goto meta(context, InsertCase5); -} - -__code insert4_stub(struct Context* context) { - goto insertCase4(context, &context->data[Tree]->tree, context->data[Tree]->tree.current); -} - -__code insertCase4_1(struct Context* context, struct Tree* tree) { - stack_push(context->node_stack, &tree->current); - tree->current = tree->current->left; - goto meta(context, InsertCase5); -} - -__code insert4_1_stub(struct Context* context) { - goto insertCase4_1(context, &context->data[Tree]->tree); -} - -__code insertCase4_2(struct Context* context, struct Tree* tree) { - stack_push(context->node_stack, &tree->current); - tree->current = tree->current->right; - goto meta(context, InsertCase5); -} - -__code insert4_2_stub(struct Context* context) { - goto insertCase4_2(context, &context->data[Tree]->tree); -} - -__code insertCase5(struct Context* context, struct Tree* tree, struct Node* current) { - struct Node* parent; - struct Node* grandparent; - - stack_pop(context->node_stack, &parent); - stack_pop(context->node_stack, &grandparent); - - parent->color = Black; - grandparent->color = Red; - - tree->current = grandparent; - - if ((current == parent->left) && (parent == grandparent->left)) - goto meta(context, RotateR); - else - goto meta(context, RotateL); -} - -__code insert5_stub(struct Context* context) { - goto insertCase5(context, &context->data[Tree]->tree, context->data[Tree]->tree.current); -} - -__code rotateLeft(struct Context* context, struct Node* node, struct Tree* tree) { - struct Node* tmp = node->right; - struct Node* parent = 0; - - stack_pop(context->node_stack, &parent); - - if (parent) { - if (node == parent->left) - parent->left = tmp; - else - parent->right = tmp; - } else { - tree->root = tmp; - } - - stack_push(context->node_stack, &parent); - - node->right = tmp->left; - tmp->left = node; - tree->current = tmp; - - stack_pop(context->code_stack, &context->next); - goto meta(context, context->next); -} - -__code rotateLeft_stub(struct Context* context) { - goto rotateLeft(context, context->data[Tree]->tree.current, &context->data[Tree]->tree); -} - -__code rotateRight(struct Context* context, struct Node* node, struct Tree* tree) { - struct Node* tmp = node->left; - struct Node* parent = 0; - - stack_pop(context->node_stack, &parent); - - if (parent) { - if (node == parent->left) - parent->left = tmp; - else - parent->right = tmp; - } else { - tree->root = tmp; - } - - stack_push(context->node_stack, &parent); - - node->left = tmp->right; - tmp->right = node; - tree->current = tmp; - - stack_pop(context->code_stack, &context->next); - goto meta(context, context->next); -} - -__code rotateRight_stub(struct Context* context) { - goto rotateRight(context, context->data[Tree]->tree.current, &context->data[Tree]->tree); -} - -__code stackClear(struct Context* context, stack_ptr node_stack, struct Tree* tree) { - if (stack_pop(node_stack, &tree->current) == 0) - goto meta(context, StackClear); - - tree->current = 0; - - stack_pop(context->code_stack, &context->next); - goto meta(context, context->next); -} - -__code stackClear_stub(struct Context* context) { - goto stackClear(context, context->node_stack, &context->data[Tree]->tree); -} - - -/* /\* __code get(struct Context* context, struct Tree* tree) { *\/ */ -/* /\* if (tree->root) { *\/ */ -/* /\* tree->current = tree->root; *\/ */ - -/* /\* goto meta(context, Search); *\/ */ -/* /\* } *\/ */ - -/* /\* stack_pop(context->code_stack, &context->next); *\/ */ -/* /\* goto meta(context, context->next); *\/ */ -/* /\* } *\/ */ - -/* /\* __code get_stub(struct Context* context) { *\/ */ -/* /\* goto get(context, &context->data[Tree]->tree); *\/ */ -/* /\* } *\/ */ - -/* /\* __code search(struct Context* context, struct Tree* tree, struct Node* node) { *\/ */ -/* /\* compare(context, tree, tree->current->key, node->key); *\/ */ - -/* /\* if (tree->result == EQ) { *\/ */ -/* /\* *node = *tree->current; *\/ */ - -/* /\* goto meta(context, context->next); *\/ */ -/* /\* } else if (tree->result == GT) { *\/ */ -/* /\* tree->current = tree->current->right; *\/ */ -/* /\* } else { *\/ */ -/* /\* tree->current = tree->current->left; *\/ */ -/* /\* } *\/ */ - -/* /\* if (tree->current) *\/ */ -/* /\* goto meta(context, Search); *\/ */ - -/* /\* stack_pop(context->code_stack, &context->next); *\/ */ -/* /\* goto meta(context, context->next); *\/ */ -/* /\* } *\/ */ - -/* /\* __code search_stub(struct Context* context) { *\/ */ -/* /\* goto search(context, &context->data[Tree]->tree, &context->data[Node]->node); *\/ */ -/* /\* } *\/ */ - -/* /\* __code delete(struct Context* context, struct Tree* tree) { *\/ */ -/* /\* if (tree->root) { *\/ */ -/* /\* stack_push(context->code_stack, &context->next); *\/ */ -/* /\* context->next = Delete1; *\/ */ -/* /\* goto meta(context, Get); *\/ */ -/* /\* } *\/ */ - -/* /\* goto meta(context, context->next); *\/ */ -/* /\* } *\/ */ - -/* /\* __code delete_stub(struct Context* context) { *\/ */ -/* /\* goto delete(context, &context->data[Tree]->tree); *\/ */ -/* /\* } *\/ */ - -/* /\* __code delete1(struct Context* context, struct Tree* tree, struct Allocate* allocate) { *\/ */ -/* /\* allocate->size = sizeof(struct Node); *\/ */ -/* /\* allocator(context); *\/ */ - -/* /\* struct Node* root = tree->root; *\/ */ - -/* /\* tree->root = &context->data[context->dataNum]->node; *\/ */ -/* /\* tree->current = root; *\/ */ - -/* /\* compare(context, tree, tree->current->key, context->data[Node]->node.key); *\/ */ - -/* /\* goto meta(context, Replace_d1); *\/ */ -/* /\* } *\/ */ - -/* /\* __code delete1_stub(struct Context* context) { *\/ */ -/* /\* goto delete1(context, &context->data[Tree]->tree, &context->data[Allocate]->allocate); *\/ */ -/* /\* } *\/ */ - -/* /\* __code delete2(struct Context* context, struct Node* current) { *\/ */ -/* /\* if (current->color == Black) { *\/ */ -/* /\* struct Node* child = current->right == NULL ? current->left : current->right; *\/ */ -/* /\* current->color = child == NULL ? Black : child->color; *\/ */ - -/* /\* goto meta(context, DeleteCase1); *\/ */ -/* /\* } *\/ */ - -/* /\* goto meta(context, Delete3); *\/ */ -/* /\* } *\/ */ - -/* /\* __code delete2_stub(struct Context* context) { *\/ */ -/* /\* goto delete2(context, context->data[Tree]->tree.current); *\/ */ -/* /\* } *\/ */ - -/* /\* __code delete3(struct Context* context, struct Tree* tree, struct Node* current) { *\/ */ -/* /\* struct Node* tmp = current->right == NULL ? current->left : current->right; *\/ */ - -/* /\* if (current->parent) { *\/ */ -/* /\* if (current == current->parent->left) *\/ */ -/* /\* current->parent->left = tmp; *\/ */ -/* /\* else *\/ */ -/* /\* current->parent->right = tmp; *\/ */ -/* /\* } else { *\/ */ -/* /\* tree->root = tmp; *\/ */ -/* /\* } *\/ */ - -/* /\* if (tmp) *\/ */ -/* /\* tmp->parent = current->parent; *\/ */ - -/* /\* if (current->parent == NULL && tmp) *\/ */ -/* /\* tmp->color = Black; *\/ */ - -/* /\* current == current->parent->left ? (current->parent->left = NULL) : (current->parent->right = NULL); *\/ */ - -/* /\* stack_pop(context->code_stack, &context->next); *\/ */ -/* /\* goto meta(context, context->next); *\/ */ -/* /\* } *\/ */ - -/* /\* __code delete3_stub(struct Context* context) { *\/ */ -/* /\* goto delete3(context, &context->data[Tree]->tree, context->data[Tree]->tree.current); *\/ */ -/* /\* } *\/ */ - -/* /\* __code replaceNodeForDelete1(struct Context* context, struct Tree* tree, struct Node* oldNode, struct Node* newNode, int result) { *\/ */ -/* /\* *newNode = *oldNode; *\/ */ - -/* /\* if (result == EQ) *\/ */ -/* /\* goto meta(context, Replace_d2); *\/ */ -/* /\* else if (result == GT) *\/ */ -/* /\* tree->current = newNode->right; *\/ */ -/* /\* else *\/ */ -/* /\* tree->current = newNode->left; *\/ */ - -/* /\* tree->current->parent = newNode; *\/ */ - -/* /\* if (tree->current->left == NULL && tree->current->right == NULL) *\/ */ -/* /\* goto meta(context, Delete2); *\/ */ - -/* /\* if (result == GT) *\/ */ -/* /\* newNode->right = context->heap; *\/ */ -/* /\* else if (result == LT) *\/ */ -/* /\* newNode->left = context->heap; *\/ */ - -/* /\* allocator(context); *\/ */ - -/* /\* compare(context, tree, tree->current->key, context->data[Node]->node.key); *\/ */ - -/* /\* goto meta(context, Replace_d1); *\/ */ -/* /\* } *\/ */ - -/* /\* __code replaceNodeForDelete1_stub(struct Context* context) { *\/ */ -/* /\* goto replaceNodeForDelete1(context, &context->data[Tree]->tree, context->data[Tree]->tree.current, &context->data[context->dataNum]->node, context->data[Tree]->tree.result); *\/ */ -/* /\* } *\/ */ - -/* /\* __code replaceNodeForDelete2(struct Context* context, struct Tree* tree, struct Node* newNode) { *\/ */ -/* /\* if (tree->current->left && tree->current->right) { *\/ */ -/* /\* newNode->left->parent = newNode; *\/ */ -/* /\* tree->current = newNode->left; *\/ */ -/* /\* newNode->left = context->heap; *\/ */ -/* /\* tree->deleted = newNode; *\/ */ - -/* /\* allocator(context); *\/ */ -/* /\* tree->current->parent = newNode; *\/ */ - -/* /\* goto meta(context, FindMax1); *\/ */ -/* /\* } *\/ */ - -/* /\* goto meta(context, Delete2); *\/ */ -/* /\* } *\/ */ - -/* /\* __code replaceNodeForDelete2_stub(struct Context* context) { *\/ */ -/* /\* goto replaceNodeForDelete2(context, &context->data[Tree]->tree, &context->data[context->dataNum]->node); *\/ */ -/* /\* } *\/ */ - -/* /\* __code findMax1(struct Context* context, struct Tree* tree, struct Node* oldNode, struct Node* newNode) { *\/ */ -/* /\* *newNode = *oldNode; *\/ */ - -/* /\* if (newNode->right) *\/ */ -/* /\* goto meta(context, FindMax2); *\/ */ - -/* /\* tree->deleted->key = newNode->key; *\/ */ -/* /\* tree->deleted->value = newNode->value; *\/ */ - -/* /\* tree->current = newNode; *\/ */ - -/* /\* goto meta(context, Delete2); *\/ */ -/* /\* } *\/ */ - -/* /\* __code findMax1_stub(struct Context* context) { *\/ */ -/* /\* goto findMax1(context, &context->data[Tree]->tree, context->data[Tree]->tree.current, &context->data[context->dataNum]->node); *\/ */ -/* /\* } *\/ */ - - -/* /\* __code findMax2(struct Context* context, struct Tree* tree, struct Node* oldNode, struct Node* newNode) { *\/ */ -/* /\* *newNode = *oldNode; *\/ */ - -/* /\* if (newNode->right->right) { *\/ */ -/* /\* tree->current = newNode->right; *\/ */ -/* /\* newNode->right = context->heap; *\/ */ - -/* /\* allocator(context); *\/ */ -/* /\* tree->current->parent = newNode; *\/ */ - -/* /\* goto meta(context, FindMax2); *\/ */ -/* /\* } *\/ */ - -/* /\* tree->deleted->key = newNode->right->key; *\/ */ -/* /\* tree->deleted->value = newNode->right->value; *\/ */ - -/* /\* tree->current = newNode; *\/ */ - -/* /\* goto meta(context, Delete2); *\/ */ -/* /\* } *\/ */ - -/* /\* __code findMax2_stub(struct Context* context) { *\/ */ -/* /\* goto findMax2(context, &context->data[Tree]->tree, context->data[Tree]->tree.current, &context->data[context->dataNum]->node); *\/ */ -/* /\* } *\/ */ - -/* /\* __code deleteCase1(struct Context* context, struct Node* current) { *\/ */ -/* /\* if (current->parent) *\/ */ -/* /\* goto meta(context, DeleteCase2); *\/ */ - -/* /\* goto meta(context, Delete3); *\/ */ -/* /\* } *\/ */ - -/* /\* __code deleteCase1_stub(struct Context* context) { *\/ */ -/* /\* goto deleteCase1(context, context->data[Tree]->tree.current); *\/ */ -/* /\* } *\/ */ - -/* /\* __code deleteCase2(struct Context* context, struct Tree* tree, struct Node* current) { *\/ */ -/* /\* struct Node* sibling = current == current->parent->left ? current->parent->right : current->parent->left; *\/ */ - -/* /\* if ((sibling == NULL ? Black : sibling->color) == Red) { *\/ */ -/* /\* current->parent->color = Red; *\/ */ -/* /\* sibling->color = Black; *\/ */ - -/* /\* current == current->parent->left ? (current->parent->left = context->heap) : (current->parent->right = context->heap); *\/ */ -/* /\* allocator(context); *\/ */ -/* /\* context->data[context->dataNum]->node = *sibling; *\/ */ - -/* /\* tree->current = current->parent; *\/ */ - -/* /\* context->next = DeleteCase3; *\/ */ -/* /\* stack_push(context->code_stack, &context->next); *\/ */ - -/* /\* if (current == current->parent->left) *\/ */ -/* /\* goto meta(context, RotateL); *\/ */ -/* /\* else *\/ */ -/* /\* goto meta(context, RotateR); *\/ */ -/* /\* } *\/ */ - -/* /\* goto meta(context, DeleteCase3); *\/ */ -/* /\* } *\/ */ - -/* /\* __code deleteCase2_stub(struct Context* context) { *\/ */ -/* /\* goto deleteCase2(context, &context->data[Tree]->tree, context->data[Tree]->tree.current); *\/ */ -/* /\* } *\/ */ - -/* /\* __code deleteCase3(struct Context* context, struct Tree* tree, struct Node* current) { *\/ */ -/* /\* struct Node* sibling = current == current->parent->left ? current->parent->right : current->parent->left; *\/ */ - -/* /\* if (current->parent->color == Black && *\/ */ -/* /\* (sibling == NULL ? Black : sibling->color) == Black && *\/ */ -/* /\* (sibling->left == NULL ? Black : sibling->left->color) == Black && *\/ */ -/* /\* (sibling->right == NULL ? Black : sibling->right->color) == Black) { *\/ */ -/* /\* sibling->color = Red; *\/ */ - -/* /\* tree->current = current->parent; *\/ */ -/* /\* goto meta(context, DeleteCase1); *\/ */ -/* /\* } *\/ */ - -/* /\* goto meta(context, DeleteCase4); *\/ */ -/* /\* } *\/ */ - -/* /\* __code deleteCase3_stub(struct Context* context) { *\/ */ -/* /\* goto deleteCase3(context, &context->data[Tree]->tree, context->data[Tree]->tree.current); *\/ */ -/* /\* } *\/ */ - -/* /\* __code deleteCase4(struct Context* context, struct Node* current) { *\/ */ -/* /\* struct Node* sibling = current == current->parent->left ? current->parent->right : current->parent->left; *\/ */ - -/* /\* if (current->parent->color == Red && *\/ */ -/* /\* (sibling == NULL ? Black : sibling->color) == Black && *\/ */ -/* /\* (sibling->left == NULL ? Black : sibling->left->color) == Black && *\/ */ -/* /\* (sibling->right == NULL ? Black : sibling->right->color) == Black) { *\/ */ -/* /\* sibling->color = Red; *\/ */ -/* /\* current->parent->color = Black; *\/ */ - -/* /\* goto meta(context, Delete3); *\/ */ -/* /\* } *\/ */ - -/* /\* goto meta(context, DeleteCase5); *\/ */ -/* /\* } *\/ */ - -/* /\* __code deleteCase4_stub(struct Context* context) { *\/ */ -/* /\* goto deleteCase4(context, context->data[Tree]->tree.current); *\/ */ -/* /\* } *\/ */ - -/* /\* __code deleteCase5(struct Context* context, struct Tree* tree, struct Node* current) { *\/ */ -/* /\* struct Node* sibling = current == current->parent->left ? current->parent->right : current->parent->left; *\/ */ -/* /\* sibling->parent = current->parent; *\/ */ - -/* /\* if (current == current->parent->left && *\/ */ -/* /\* (sibling == NULL ? Black : sibling->color) == Black && *\/ */ -/* /\* (sibling->left == NULL ? Black : sibling->left->color) == Red && *\/ */ -/* /\* (sibling->right == NULL ? Black : sibling->right->color) == Black) { *\/ */ -/* /\* sibling->color = Red; *\/ */ -/* /\* sibling->left->color = Black; *\/ */ - -/* /\* sibling == sibling->parent->left ? (sibling->parent->left = context->heap) : (sibling->parent->right = context->heap); *\/ */ -/* /\* allocator(context); *\/ */ -/* /\* struct Node* tmp = &context->data[context->dataNum]->node; *\/ */ -/* /\* *tmp = *sibling; *\/ */ -/* /\* tmp->parent = current; *\/ */ - -/* /\* tmp->left = context->heap; *\/ */ -/* /\* allocator(context); *\/ */ -/* /\* context->data[context->dataNum]->node = *sibling->left; *\/ */ -/* /\* context->data[context->dataNum]->node.parent = tmp; *\/ */ - -/* /\* tree->current = tmp; *\/ */ - -/* /\* context->next = DeleteCase6; *\/ */ -/* /\* stack_push(context->code_stack, &context->next); *\/ */ - -/* /\* goto meta(context, RotateR); *\/ */ -/* /\* } else if (current == current->parent->right && *\/ */ -/* /\* (sibling == NULL ? Black : sibling->color) == Black && *\/ */ -/* /\* (sibling->left == NULL ? Black : sibling->left->color) == Black && *\/ */ -/* /\* (sibling->right == NULL ? Black : sibling->right->color) == Red) { *\/ */ -/* /\* sibling->color = Red; *\/ */ -/* /\* sibling->right->color = Black; *\/ */ - -/* /\* sibling == sibling->parent->left ? (sibling->parent->left = context->heap) : (sibling->parent->right = context->heap); *\/ */ -/* /\* allocator(context); *\/ */ -/* /\* struct Node* tmp = &context->data[context->dataNum]->node; *\/ */ -/* /\* *tmp = *sibling; *\/ */ -/* /\* tmp->parent = current; *\/ */ - -/* /\* tmp->right = context->heap; *\/ */ -/* /\* allocator(context); *\/ */ -/* /\* context->data[context->dataNum]->node = *sibling->right; *\/ */ -/* /\* context->data[context->dataNum]->node.parent = tmp; *\/ */ - -/* /\* tree->current = tmp; *\/ */ - -/* /\* context->next = DeleteCase6; *\/ */ -/* /\* stack_push(context->code_stack, &context->next); *\/ */ -/* /\* goto meta(context, RotateL); *\/ */ -/* /\* } *\/ */ - -/* /\* goto meta(context, DeleteCase6); *\/ */ -/* /\* } *\/ */ - -/* /\* __code deleteCase5_stub(struct Context* context) { *\/ */ -/* /\* goto deleteCase5(context, &context->data[Tree]->tree, context->data[Tree]->tree.current); *\/ */ -/* /\* } *\/ */ - -/* /\* __code deleteCase6(struct Context* context, struct Tree* tree, struct Node* current) { *\/ */ -/* /\* struct Node* sibling = current == current->parent->left ? current->parent->right : current->parent->left; *\/ */ - -/* /\* sibling == sibling->parent->left ? (sibling->parent->left = context->heap) : (sibling->parent->right = context->heap); *\/ */ -/* /\* allocator(context); *\/ */ -/* /\* struct Node* tmp = &context->data[context->dataNum]->node; *\/ */ -/* /\* *tmp = *sibling; *\/ */ -/* /\* tmp->parent = current; *\/ */ - -/* /\* tmp->color = current->parent->color; *\/ */ -/* /\* current->parent->color = Black; *\/ */ - -/* /\* context->next = Delete3; *\/ */ -/* /\* stack_push(context->code_stack, &context->next); *\/ */ - -/* /\* if (current == current->parent->left) { *\/ */ -/* /\* tmp->right->color = Black; *\/ */ -/* /\* tree->current = current->parent; *\/ */ - -/* /\* goto meta(context, RotateL); *\/ */ -/* /\* } else { *\/ */ -/* /\* tmp->left->color = Black; *\/ */ -/* /\* tree->current = current->parent; *\/ */ - -/* /\* goto meta(context, RotateR); *\/ */ -/* /\* } *\/ */ -/* /\* } *\/ */ - -/* /\* __code deleteCase6_stub(struct Context* context) { *\/ */ -/* /\* goto deleteCase6(context, &context->data[Tree]->tree, context->data[Tree]->tree.current); *\/ */ -/* /\* } *\/ */
--- a/src/llrb/llrbContext.c Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +0,0 @@ -#include <stdlib.h> - -#include "llrbContext.h" - -extern __code code1_stub(struct Context*); -extern __code code2_stub(struct Context*); -extern __code code3_stub(struct Context*); -extern __code code4(struct Context*); -extern __code code5(struct Context*); -extern __code find(struct Context*); -extern __code not_find(struct Context*); -extern __code code6(struct Context*); -extern __code meta(struct Context*); -extern __code put_stub(struct Context*); -extern __code replaceNode_stub(struct Context*); -extern __code insertNode_stub(struct Context*); -extern __code rotateLeft_stub(struct Context*); -extern __code rotateRight_stub(struct Context*); -extern __code colorFlip_stub(struct Context*); -extern __code fixUp_stub(struct Context*); -extern __code changeReference_stub(struct Context*); -extern __code insert1_stub(struct Context*); -extern __code insert2_stub(struct Context*); -extern __code insert3_stub(struct Context*); -extern __code insert4_stub(struct Context*); -extern __code insert4_1_stub(struct Context*); -extern __code insert4_2_stub(struct Context*); -extern __code insert5_stub(struct Context*); -extern __code stackClear_stub(struct Context*); -extern __code get_stub(struct Context*); -extern __code search_stub(struct Context*); -extern __code delete_stub(struct Context*); -extern __code delete1_stub(struct Context*); -extern __code delete2_stub(struct Context*); -extern __code delete3_stub(struct Context*); -extern __code replaceNodeForDelete1_stub(struct Context*); -extern __code replaceNodeForDelete2_stub(struct Context*); -extern __code findMax1_stub(struct Context*); -extern __code findMax2_stub(struct Context*); -extern __code deleteCase1_stub(struct Context*); -extern __code deleteCase2_stub(struct Context*); -extern __code deleteCase3_stub(struct Context*); -extern __code deleteCase4_stub(struct Context*); -extern __code deleteCase5_stub(struct Context*); -extern __code deleteCase6_stub(struct Context*); -extern __code exit_code(struct Context*); - -__code initLLRBContext(struct Context* context, int num) { - context->heapLimit = sizeof(union Data)*ALLOCATE_SIZE; - context->code = malloc(sizeof(__code*)*ALLOCATE_SIZE); - context->data = malloc(sizeof(union Data*)*ALLOCATE_SIZE); - context->heapStart = malloc(context->heapLimit); - - context->codeNum = Exit; - - context->code[Code1] = code1_stub; - context->code[Code2] = code2_stub; - context->code[Code3] = code3_stub; - context->code[Code4] = code4; - context->code[Code5] = code5; - context->code[Find] = find; - context->code[Not_find] = not_find; - context->code[Code6] = code6; - context->code[Put] = put_stub; - context->code[Replace] = replaceNode_stub; - context->code[Insert] = insertNode_stub; - context->code[RotateL] = rotateLeft_stub; - context->code[RotateR] = rotateRight_stub; - context->code[InsertCase1] = insert1_stub; - context->code[InsertCase2] = insert2_stub; - context->code[InsertCase3] = insert3_stub; - context->code[InsertCase4] = insert4_stub; - context->code[InsertCase4_1] = insert4_1_stub; - context->code[InsertCase4_2] = insert4_2_stub; - context->code[InsertCase5] = insert5_stub; - context->code[StackClear] = stackClear_stub; - /* context->code[Get] = get_stub; */ - /* context->code[Search] = search_stub; */ - /* context->code[Delete] = delete_stub; */ - /* context->code[Delete1] = delete1_stub; */ - /* context->code[Delete2] = delete2_stub; */ - /* context->code[Delete3] = delete3_stub; */ - /* context->code[Replace_d1] = replaceNodeForDelete1_stub; */ - /* context->code[Replace_d2] = replaceNodeForDelete2_stub; */ - /* context->code[FindMax1] = findMax1_stub; */ - /* context->code[FindMax2] = findMax2_stub; */ - /* context->code[DeleteCase1] = deleteCase1_stub; */ - /* context->code[DeleteCase2] = deleteCase2_stub; */ - /* context->code[DeleteCase3] = deleteCase3_stub; */ - /* context->code[DeleteCase4] = deleteCase4_stub; */ - /* context->code[DeleteCase5] = deleteCase5_stub; */ - /* context->code[DeleteCase6] = deleteCase6_stub; */ - context->code[Exit] = exit_code; - - context->heap = context->heapStart; - - context->data[Allocate] = context->heap; - context->heap += sizeof(struct Allocate); - - context->data[Tree] = context->heap; - context->heap += sizeof(struct Tree); - - context->data[Node] = context->heap; - context->heap += sizeof(struct Node); - - context->dataNum = Node; - - struct Tree* tree = &context->data[Tree]->tree; - tree->root = 0; - tree->current = 0; - tree->deleted = 0; - - context->node_stack = stack_init(sizeof(struct Node*), 100); - context->code_stack = stack_init(sizeof(enum Code), 100); -}
--- a/src/llrb/main.c Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,136 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <sys/time.h> - -#include "llrbContext.h" -#include "origin_cs.h" - -static double st_time; -static double ed_time; -static clock_t c1,c2; - -int num; - -extern __code initLLRBContext(struct Context* context, int); -extern void allocator(struct Context* context); - -static double getTime() { - struct timeval tv; - gettimeofday(&tv, NULL); - return tv.tv_sec + (double)tv.tv_usec*1e-6; -} - -void print_tree(struct Node* node, int n) { - if (node != 0) { - print_tree(node->left, n+1); - for (int i=0;i<n;i++) - printf(" "); - printf("key=%d value=%d color=%s\t%p\n", node->key, node->value,/* n, */node->color==0? "R":"B", node); - print_tree(node->right, n+1); - } -} - -/* -__code code1(Allocate allocate) { - allocate.size = sizeof(long); - allocate.next = Code2; - goto Allocate(allocate); -} -*/ - -__code code1(struct Context* context, struct Allocate *allocate) { - allocate->size = sizeof(struct Count); - allocator(context); - goto meta(context, Code2); -} - -__code code1_stub(struct Context* context) { - goto code1(context, &context->data[Allocate]->allocate); -} - -/* -__code code2(Allocate allocate, Count count) { - count.count = 0; - goto code3(count); -} -*/ - -__code code2(struct Context* context, struct Count* count) { - count->i = num; - goto meta(context, Code3); -} - -__code code2_stub(struct Context* context) { - goto code2(context, &context->data[context->dataNum]->count); -} - -__code code3(struct Context* context, struct Node* node, struct Count* count) { - if (count->i == 0) { - goto meta(context, Code4); - } - - print_tree(context->data[Tree]->tree.root, 0); - puts(""); - context->next = Code3; - node->key = rand()%100+1; - node->value = count->i; - - count->i--; - goto meta(context, Put); -} - -__code code3_stub(struct Context* context) { - goto code3(context, &context->data[Node]->node, &context->data[3]->count); -} - -__code code4(struct Context* context) { - puts("---before---"); - print_tree(context->data[Tree]->tree.root, 0); - - struct Node* node = &context->data[Node]->node; - node->key = 4; - - context->next = Code5; - - goto meta(context, Exit); -} - -__code code5(struct Context* context) { - puts("---after---"); - print_tree(context->data[Tree]->tree.root, 0); - puts("--Number of Data--"); - printf("%d\n", context->dataNum); - - goto meta(context, Exit); -} - -__code find(struct Context* context) { - context->data[Node]->node.key = 2; - context->next = Not_find; - - goto meta(context, Get); -} - -__code not_find(struct Context* context) { - context->data[Node]->node.key = 10; - context->next = Code6; - - printf("%p\n", context->data[Tree]->tree.current); - context->data[Tree]->tree.current = 0; - goto meta(context, Get); -} - -__code code6(struct Context* context) { - printf("%p\n", context->data[Tree]->tree.current); - - stack_free(context->node_stack); - - goto meta(context, Exit); -} - -int main(int argc, char** argv) { - num = (int)atoi(argv[1]); - struct Context* context = (struct Context*)malloc(sizeof(struct Context)); - initLLRBContext(context, num); - goto start_code(context, Code1); -}
--- a/src/llrb/origin_cs.c Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -#include <stdlib.h> -#include "llrbContext.h" - -__code meta(struct Context* context, enum Code next) { - goto (context->code[next])(context); -} - -__code start_code(struct Context* context, enum Code next) { - goto meta(context, next); -} - -__code exit_code(struct Context* context) { - free(context->code); - free(context->data); - free(context->heapStart); - goto exit(0); -}
--- a/src/llrb/stack.c Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -#include <string.h> -#include "stack.h" - -stack_ptr stack_init(size_t size, int max) { - stack_ptr stack_ptr; - - if ((stack_ptr = calloc(1, sizeof(stack))) == NULL) - return NULL; - - if ((stack_ptr->data = calloc(max, size)) == NULL) { - free(stack_ptr); - return NULL; - } - - stack_ptr->size = size; - stack_ptr->max = max; - stack_ptr->num = 0; - - return stack_ptr; -} - -stack_ptr stack_realloc(stack_ptr stack_ptr, int max) { - if (stack_ptr == NULL) - return NULL; - - if ((stack_ptr->data = realloc(stack_ptr->data, stack_ptr->size*max)) == NULL) - return NULL; - - stack_ptr->max = max; - - return stack_ptr; -} - -void stack_free(stack_ptr stack_ptr) { - if (stack_ptr != NULL && stack_ptr->data != NULL) { - free(stack_ptr->data); - free(stack_ptr); - } -} - -int stack_push(stack_ptr stack_ptr, void* data) { - if (stack_ptr->max <= stack_ptr->num) - return -1; - - memcpy((char*)stack_ptr->data+stack_ptr->num*stack_ptr->size, data, stack_ptr->size); - stack_ptr->num++; - - return 0; -} - -int stack_pop(stack_ptr stack_ptr, void* data) { - if (stack_ptr->num == 0) - return -1; - - stack_ptr->num--; - - memcpy(data, (char*)stack_ptr->data+stack_ptr->num*stack_ptr->size, stack_ptr->size); - - return 0; -} - -int isMax(const stack_ptr stack_ptr) { - return stack_ptr->max<=stack_ptr->num; -} - -int isEmpty(const stack_ptr stack_ptr) { - return stack_ptr->num<=0; -}
--- a/src/parallel_execution/Atomic.h Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -typedef struct Atomic<Impl>{ - union Data* atomic; - union Data** ptr; - union Data* oldData; - union Data* newData; - __code checkAndSet(Impl* atomic, union Data** ptr, union Data* oldData, union Data* newData, __code next(...), __code fail(...)); - __code next(...); - __code fail(...); -} Atomic;
--- a/src/parallel_execution/AtomicReference.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -#include "../context.h" -#interface "Atomic.h" -#include <stdio.h> - -Atomic* createAtomicReference(struct Context* context) { - struct Atomic* atomic = new Atomic(); - struct AtomicReference* atomicReference = new AtomicReference(); - atomic->atomic = (union Data*)atomicReference; - atomic->checkAndSet = C_checkAndSetAtomicReference; - return atomic; -} - -__code checkAndSetAtomicReference(struct AtomicReference* atomic, union Data** ptr, union Data* oldData, union Data* newData, __code next(...), __code fail(...)) { - if (__sync_bool_compare_and_swap(ptr, oldData, newData)) { - goto next(...); - } - goto fail(...); -}
--- a/src/parallel_execution/Buffer.h Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -typedef struct Buffer<Impl>{ - union Data* buffer; - union Data* data; - __code put(Impl* buffer, union Data* data, __code next(...)); - __code take(Impl* buffer, __code next(union Data*, ...)); - __code next(...); -} Buffer;
--- a/src/parallel_execution/CMakeLists.txt Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,142 +0,0 @@ -cmake_minimum_required(VERSION 3.8) - -set(USE_CUDA,0) -# -DUSE_CUDA -# add_definitions("-Wall -g -O") - -set(CMAKE_C_COMPILER $ENV{CBC_COMPILER}) -add_definitions("-Wall -g") - -# -DCMAKE_BUILD_TYPE=Debug -set(CMAKE_C_FLAGS_DEBUG "-O0") - -if (${USE_CUDA}) - include_directories("/usr/local/cuda/include") - set(NVCCFLAG "-std=c++11" "-g" "-O0" ) - if (UNIX AND NOT APPLE) # LINUX - set(CUDA_LINK_FLAGS "-L/usr/local/cuda/lib64 -lcuda -lcudart") - elseif (APPLE) - set(CUDA_LINK_FLAGS "-framework CUDA -lc++ -Wl,-search_paths_first -Wl,-headerpad_max_install_names /usr/local/cuda/lib/libcudart_static.a -Wl,-rpath,/usr/local/cuda/lib") - endif() - find_package(CUDA REQUIRED) - SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CUDA_LINK_FLAGS}" ) -endif() - -macro( GearsCommand ) - set( _OPTIONS_ARGS ) - set( _ONE_VALUE_ARGS TARGET ) - set( _MULTI_VALUE_ARGS SOURCES ) - cmake_parse_arguments( _Gears "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} ) - - set (_Gears_CSOURCES) - foreach(i ${_Gears_SOURCES}) - if (${i} MATCHES "\\.cbc") - string(REGEX REPLACE "(.*).cbc" "c/\\1.c" j ${i}) - add_custom_command ( - OUTPUT ${j} - DEPENDS ${i} - COMMAND "perl" "generate_stub.pl" "-o" ${j} ${i} - ) - elseif (${i} MATCHES "\\.cu") - string(REGEX REPLACE "(.*).cu" "c/\\1.ptx" j ${i}) - add_custom_command ( - OUTPUT ${j} - DEPENDS ${i} - COMMAND nvcc ${NVCCFLAG} -c -ptx -o ${j} ${i} - ) - else() - set(j ${i}) - endif() - list(APPEND _Gears_CSOURCES ${j}) - endforeach(i) - - add_custom_command ( - OUTPUT c/${_Gears_TARGET}-context.c - DEPENDS ${_Gears_CSOURCES} - COMMAND "perl" "generate_context.pl" "-o" ${_Gears_TARGET} ${_Gears_CSOURCES} - ) - add_executable(${_Gears_TARGET} ${_Gears_CSOURCES} c/${_Gears_TARGET}-context.c) - target_link_libraries(${_Gears_TARGET} m pthread) -endmacro() - - -GearsCommand( - TARGET - twice - SOURCES - examples/twice/main.cbc examples/twice/createArray.cbc examples/twice/twice.cbc examples/twice/printArray.cbc CPUWorker.cbc TaskManagerImpl.cbc SingleLinkedQueue.cbc SynchronizedQueue.cbc TimerImpl.cbc MultiDimIterator.cbc AtomicReference.cbc -) - -GearsCommand( - TARGET - calc - SOURCES - examples/calc/calc.cbc examples/calc/add.cbc examples/calc/mult.cbc examples/calc/initIntegerDataGears.cbc CPUWorker.cbc TaskManagerImpl.cbc SingleLinkedQueue.cbc SynchronizedQueue.cbc AtomicReference.cbc -) - -GearsCommand( - TARGET - bitonicSort - SOURCES - examples/bitonicSort/bitonicSort.cbc examples/bitonicSort/bitonicSwap.cbc examples/bitonicSort/makeArray.cbc examples/bitonicSort/printArray.cbc CPUWorker.cbc TaskManagerImpl.cbc SingleLinkedQueue.cbc SynchronizedQueue.cbc MultiDimIterator.cbc TimerImpl.cbc AtomicReference.cbc -) - -if (${USE_CUDA}) - GearsCommand( - TARGET - CUDAtwice - SOURCES - examples/twice/main.cbc examples/twice/twice.cbc examples/twice/CUDAtwice.cu examples/twice/createArray.cbc examples/twice/printArray.cbc CPUWorker.cbc TimerImpl.cbc examples/twice/twice.cbc TaskManagerImpl.cbc SingleLinkedQueue.cbc SynchronizedQueue.cbc CUDAWorker.cbc cuda.c MultiDimIterator.cbc CUDAExecutor.cbc AtomicReference.cbc - ) - set_target_properties(CUDAtwice PROPERTIES COMPILE_FLAGS "-Wall -g -DUSE_CUDAWorker=1") - - GearsCommand( - TARGET - CUDAbitonicSort - SOURCES - examples/bitonicSort/bitonicSort.cbc examples/bitonicSort/bitonicSwap.cbc examples/bitonicSort/CUDAbitonicSwap.cu examples/bitonicSort/makeArray.cbc examples/bitonicSort/printArray.cbc CPUWorker.cbc CUDAWorker.cbc TaskManagerImpl.cbc SingleLinkedQueue.cbc SynchronizedQueue.cbc cuda.c MultiDimIterator.cbc TimerImpl.cbc CUDAExecutor.cbc AtomicReference.cbc - ) - set_target_properties(CUDAbitonicSort PROPERTIES COMPILE_FLAGS "-Wall -g -DUSE_CUDAWorker=1") -endif() - -GearsCommand( - TARGET - queue_test - SOURCES - test/queue_test.cbc SingleLinkedQueue.cbc -) - -GearsCommand( - TARGET - stack_test - SOURCES - test/stack_test.cbc SingleLinkedStack.cbc SingleLinkedQueue.cbc -) - -GearsCommand( - TARGET - multiDimIterator_test - SOURCES - test/multiDimIterator_test.cbc test/printIterator.cbc CPUWorker.cbc TaskManagerImpl.cbc SingleLinkedQueue.cbc SynchronizedQueue.cbc MultiDimIterator.cbc AtomicReference.cbc -) - -GearsCommand( - TARGET - sort - SOURCES - examples/bitonicSort/sort.cbc -) - -GearsCommand( - TARGET - rbtree - SOURCES - SingleLinkedQueue.cbc test/rbTree_test.cbc RedBlackTree.cbc SingleLinkedStack.cbc -) - -GearsCommand( - TARGET - boundedBuffer - SOURCES - examples/boundedBuffer/main.cbc examples/boundedBuffer/initBuffer.cbc examples/boundedBuffer/SemaphoreImpl.cbc examples/boundedBuffer/BoundedBuffer.cbc examples/boundedBuffer/consumer.cbc examples/boundedBuffer/producer.cbc SpinLock.cbc CPUWorker.cbc TaskManagerImpl.cbc SingleLinkedQueue.cbc SynchronizedQueue.cbc MultiDimIterator.cbc AtomicReference.cbc -)
--- a/src/parallel_execution/CPUWorker.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +0,0 @@ -#include "../context.h" -#interface "TaskManager.h" -#interface "Worker.h" -#interface "Iterator.h" -#interface "Queue.h" - -static void startWorker(Worker* worker); - -Worker* createCPUWorker(struct Context* context, int id, Queue* queue) { - struct Worker* worker = new Worker(); - struct CPUWorker* cpuWorker = new CPUWorker(); - worker->worker = (union Data*)cpuWorker; - worker->tasks = queue; - cpuWorker->id = id; - cpuWorker->loopCounter = 0; - worker->taskReceive = C_taskReceiveCPUWorker; - worker->shutdown = C_shutdownCPUWorker; - pthread_create(&worker->thread, NULL, (void*)&startWorker, worker); - return worker; -} - -static void startWorker(struct Worker* worker) { - struct CPUWorker* cpuWorker = &worker->worker->CPUWorker; - cpuWorker->context = NEW(struct Context); - initContext(cpuWorker->context); - Gearef(cpuWorker->context, Worker)->worker = (union Data*)worker; - Gearef(cpuWorker->context, Worker)->tasks = worker->tasks; - goto meta(cpuWorker->context, worker->taskReceive); -} - -__code taskReceiveCPUWorker(struct CPUWorker* worker, struct Queue* tasks) { - goto tasks->take(getTaskCPUWorker); -} - -__code getTaskCPUWorker(struct CPUWorker* cpuWorker, struct Context* task, struct Worker* worker) { - if (!task) { - goto worker->shutdown(); // end thread - } - task->worker = worker; - enum Code taskCg = task->next; - task->next = C_odgCommitCPUWorker; // commit outputDG after task exec - goto meta(task, taskCg); // switch task context -} - -__code getTaskCPUWorker_stub(struct Context* context) { - CPUWorker* cpuWorker = (CPUWorker*)GearImpl(context, Worker, worker); - Worker* worker = &Gearef(context,Worker)->worker->Worker; - struct Context* task = &Gearef(context, Queue)->data->Context; - goto getTaskCPUWorker(context, cpuWorker, task, worker); -} - -__code odgCommitCPUWorker(struct CPUWorker* worker, struct Context* task) { - if (task->iterate) { - struct Iterator* iterator = task->iterator; - goto iterator->barrier(task, odgCommitCPUWorker1, odgCommitCPUWorker6); - } else { - goto odgCommitCPUWorker1(); - } -} - -__code odgCommitCPUWorker_stub(struct Context* context) { - // switch worker context - struct Context* workerContext = context->worker->worker->CPUWorker.context; - Gearef(workerContext, Worker)->worker = (union Data*)context->worker; - Gearef(workerContext, Worker)->task = context; - CPUWorker* cpuWorker = (CPUWorker*)GearImpl(workerContext, Worker, worker); - goto odgCommitCPUWorker(workerContext, - cpuWorker, - context); -} - -__code odgCommitCPUWorker1(struct CPUWorker* worker, struct Context* task) { - int i = worker->loopCounter; - if (task->odg+i < task->maxOdg) { - goto odgCommitCPUWorker2(); - } - worker->loopCounter = 0; - struct TaskManager* taskManager = task->taskManager; - goto taskManager->decrementTaskCount(odgCommitCPUWorker6); -} - -__code odgCommitCPUWorker2(struct CPUWorker* worker, struct Context* task) { - int i = worker->loopCounter; - struct Queue* queue = GET_WAIT_LIST(task->data[task->odg+i]); - goto queue->isEmpty(odgCommitCPUWorker3, odgCommitCPUWorker5); -} - -__code odgCommitCPUWorker3(struct CPUWorker* worker, struct Context* task) { - int i = worker->loopCounter; - struct Queue* queue = GET_WAIT_LIST(task->data[task->odg+i]); - goto queue->take(odgCommitCPUWorker4); -} - -__code odgCommitCPUWorker4(struct CPUWorker* worker, struct Context* task, struct Context* waitTask) { - if (__sync_fetch_and_sub(&waitTask->idgCount, 1) == 1) { // atomic decrement idg counter(__sync_fetch_and_sub function return initial value of waitTask->idgCount point) - struct TaskManager* taskManager = waitTask->taskManager; - goto taskManager->spawn(waitTask, odgCommitCPUWorker2); - } - goto odgCommitCPUWorker2(); -} - -__code odgCommitCPUWorker4_stub(struct Context* context) { - CPUWorker* cpuWorker = (CPUWorker*)GearImpl(context, Worker, worker); - struct Context* task = Gearef(context, Worker)->task; - struct Context* waitTask = &Gearef(context, Queue)->data->Context; - goto odgCommitCPUWorker4(context, - cpuWorker, - task, - waitTask); -} - -__code odgCommitCPUWorker5(struct CPUWorker* worker, struct Context* task) { - worker->loopCounter++; - goto odgCommitCPUWorker1(); -} - -__code odgCommitCPUWorker6(struct CPUWorker* worker, struct Context* task) { - struct Worker* taskWorker = task->worker; - goto taskWorker->taskReceive(taskWorker->tasks); -} - -__code shutdownCPUWorker(struct CPUWorker* worker) { - goto exit_code(); -}
--- a/src/parallel_execution/CUDAExecutor.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -#include "../context.h" -#interface "Executor.h" -#include <stdio.h> - -Executor* createCUDAExecutor(struct Context* context, CUdevice device) { - struct Executor* executor = new Executor(); - struct CUDAExecutor* cudaExecutor = new CUDAExecutor(); - checkCudaErrors(cuDeviceGetAttribute(&cudaExecutor->maxThreadPerBlock, CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK, device)); - executor->executor = (union Data*)cudaExecutor; - executor->read = C_readCUDAExecutor; - executor->exec = C_execCUDAExecutor; - executor->write = C_writeCUDAExecutor; - return executor; -} - -__code readCUDAExecutor(struct CUDAExecutor* executor, struct Context* task, __code next(...)) { - struct CUDABuffer* buffer = executor->buffer; - int paramLen = buffer->inputLen + buffer->outputLen; - executor->kernelParams = (CUdeviceptr**)ALLOCATE_PTR_ARRAY(context, CUdeviceptr, paramLen); - for (int i = 0; i < paramLen; i++) { - CUdeviceptr* deviceptr = new CUdeviceptr(); - // memory allocate - union Data* data = i < buffer->inputLen? buffer->inputData[i] : buffer->outputData[i-buffer->inputLen]; - checkCudaErrors(cuMemAlloc(deviceptr, GET_SIZE(data))); - checkCudaErrors(cuMemcpyHtoD(*deviceptr, data, GET_SIZE(data))); - // Synchronous data transfer(host to device) - executor->kernelParams[i] = deviceptr; - } - // TODO: Implements pipeline - // goto next(...); - goto meta(context, C_execCUDAExecutor); -} - -int computeblockDim(int count, int maxThreadPerBlock) { - return count < maxThreadPerBlock ? count : maxThreadPerBlock; -} - -__code execCUDAExecutor(struct CUDAExecutor* executor, struct Context* task, __code next(...)) { - // Asynchronous launch kernel - task->num_exec = 1; - if (task->iterate) { - struct MultiDimIterator* iterator = &task->iterator->iterator->MultiDimIterator; - int blockDimX = computeblockDim(iterator->x, executor->maxThreadPerBlock); - int blockDimY = computeblockDim(iterator->y, executor->maxThreadPerBlock); - int blockDimZ = computeblockDim(iterator->z, executor->maxThreadPerBlock); - checkCudaErrors(cuLaunchKernel(task->function, - iterator->x/blockDimX, iterator->y/blockDimY, iterator->z/blockDimZ, - blockDimX, blockDimY, blockDimZ, - 0, NULL, (void**)executor->kernelParams, NULL)); - } else { - checkCudaErrors(cuLaunchKernel(task->function, - 1, 1, 1, - 1, 1, 1, - 0, NULL, (void**)executor->kernelParams, NULL)); - } - // TODO: Implements pipeline - // goto next(...); - goto meta(context, C_writeCUDAExecutor); -} - -__code writeCUDAExecutor(struct CUDAExecutor* executor, struct Context* task, __code next(...)) { - //結果を取ってくるコマンドを入力する - //コマンドの終了待ちを行う - struct CUDABuffer* buffer = executor->buffer; - int paramLen = buffer->inputLen + buffer->outputLen; - for (int i = 0; i < paramLen; i++) { - CUdeviceptr deviceptr = *(executor->kernelParams[i]); - union Data* data = i < buffer->inputLen? buffer->inputData[i] : buffer->outputData[i-buffer->inputLen]; - checkCudaErrors(cuMemcpyDtoH(data, deviceptr, GET_SIZE(data))); - cuMemFree(deviceptr); - } - // wait for stream - checkCudaErrors(cuCtxSynchronize()); - goto next(...); -}
--- a/src/parallel_execution/CUDAWorker.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +0,0 @@ -#include "../context.h" -#interface "TaskManager.h" -#interface "Worker.h" -#interface "Iterator.h" -#interface "Queue.h" - -extern void cudaInit(struct CUDAWorker *cudaWorker,int phase, int deviceNum); -extern void cudaShutdown(CUDAWorker *cudaWorker); - -static void startCUDAWorker(Worker* worker); - -Worker* createCUDAWorker(struct Context* context, int id, Queue* queue, int deviceNum) { - struct Worker* worker = new Worker(); - struct CUDAWorker* cudaWorker = new CUDAWorker(); - worker->worker = (union Data*)cudaWorker; - worker->tasks = queue; - cudaWorker->id = id; - cudaWorker->loopCounter = 0; - cudaWorker->deviceNum = deviceNum; - worker->taskReceive = C_taskReceiveCUDAWorker; - worker->shutdown = C_shutdownCUDAWorker; - pthread_create(&worker->thread, NULL, (void*)&startCUDAWorker, worker); - return worker; -} - -static void startCUDAWorker(Worker* worker) { - struct CUDAWorker* cudaWorker = &worker->worker->CUDAWorker; - cudaInit(cudaWorker, 0, cudaWorker->deviceNum); - cudaWorker->context = NEW(struct Context); - initContext(cudaWorker->context); - cudaWorker->executor = createCUDAExecutor(cudaWorker->context, cudaWorker->device); - Gearef(cudaWorker->context, Worker)->worker = (union Data*)worker; - Gearef(cudaWorker->context, Worker)->tasks = worker->tasks; - goto meta(cudaWorker->context, worker->taskReceive); -} - -__code taskReceiveCUDAWorker(struct Worker* worker, struct Queue* tasks) { - goto tasks->take(getTaskCUDAWorker); -} - -__code getTaskCUDAWorker(struct CUDAWorker* cudaWorker, struct Context* task, struct Worker* worker) { - if (!task) { - goto worker->shutdown(); // end thread - } - task->worker = worker; - enum Code taskCg = task->next; - task->next = C_odgCommitCUDAWorker; // commit outputDG after task exec - goto meta(task, taskCg); // switch task context -} - -__code getTaskCUDAWorker_stub(struct Context* context) { - CUDAWorker* cudaWorker = (CUDAWorker*)GearImpl(context, Worker, worker); - Worker* worker = &Gearef(context,Worker)->worker->Worker; - struct Context* task = &Gearef(context, Queue)->data->Context; - goto getTaskCUDAWorker(context, cudaWorker, task, worker); -} - -__code odgCommitCUDAWorker(struct CUDAWorker* worker, struct Context* task) { - if (task->iterate) { - struct Iterator* iterator = task->iterator; - goto iterator->barrier(task, odgCommitCUDAWorker1, odgCommitCUDAWorker6); - } else { - goto odgCommitCUDAWorker1(); - } -} - -__code odgCommitCUDAWorker_stub(struct Context* context) { - // switch worker context - struct Context* workerContext = context->worker->worker->CUDAWorker.context; - Gearef(workerContext, Worker)->worker = (union Data*)context->worker; - Gearef(workerContext, Worker)->task = context; - CUDAWorker* cudaWorker = (CUDAWorker*)GearImpl(workerContext, Worker, worker); - goto odgCommitCUDAWorker(workerContext, - cudaWorker, - context); -} - -__code odgCommitCUDAWorker1(struct CUDAWorker* worker, struct Context* task) { - int i = worker->loopCounter; - if (task->odg+i < task->maxOdg) { - goto odgCommitCUDAWorker2(); - } - worker->loopCounter = 0; - struct TaskManager* taskManager = task->taskManager; - goto taskManager->decrementTaskCount(odgCommitCUDAWorker6); -} - -__code odgCommitCUDAWorker2(struct CUDAWorker* worker, struct Context* task) { - int i = worker->loopCounter; - struct Queue* queue = GET_WAIT_LIST(task->data[task->odg+i]); - goto queue->isEmpty(odgCommitCUDAWorker3, odgCommitCUDAWorker5); -} - -__code odgCommitCUDAWorker3(struct CUDAWorker* worker, struct Context* task) { - int i = worker->loopCounter; - struct Queue* queue = GET_WAIT_LIST(task->data[task->odg+i]); - goto queue->take(odgCommitCUDAWorker4); -} - -__code odgCommitCUDAWorker4(struct CUDAWorker* worker, struct Context* task, struct Context* waitTask) { - if (__sync_fetch_and_sub(&waitTask->idgCount, 1) == 1) { // atomic decrement idg counter(__sync_fetch_and_sub function return initial value of waitTask->idgCount point) - struct TaskManager* taskManager = waitTask->taskManager; - goto taskManager->spawn(waitTask, odgCommitCUDAWorker2); - } - goto odgCommitCUDAWorker2(); -} - -__code odgCommitCUDAWorker4_stub(struct Context* context) { - CUDAWorker* cudaWorker = (CUDAWorker*)GearImpl(context, Worker, worker); - struct Context* task = Gearef(context, Worker)->task; - struct Context* waitTask = &Gearef(context, Queue)->data->Context; - goto odgCommitCUDAWorker4(context, - cudaWorker, - task, - waitTask); -} - -__code odgCommitCUDAWorker5(struct CUDAWorker* worker, struct Context* task) { - worker->loopCounter++; - goto odgCommitCUDAWorker1(); -} - -__code odgCommitCUDAWorker6(struct CUDAWorker* worker, struct Context* task) { - struct Worker* taskWorker = task->worker; - goto taskWorker->taskReceive(taskWorker->tasks); -} - -__code shutdownCUDAWorker(struct CUDAWorker* worker) { - cudaShutdown(worker); - goto meta(context, C_exit_code); -}
--- a/src/parallel_execution/CodeGear.h Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -typedef struct CodeGear<Impl>{ - union Data* codeGear; - enum Code code; - __code code(struct Integer* input1, struct Integer* input2, __code next(struct Integer* output, ...)); - __code setInfo(struct Context* codeGear, union Data** dataGears, __code next(...)); - union Data* dataGears[10]; - __code next(...); -} CodeGear;
--- a/src/parallel_execution/Executor.h Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -typedef struct Executor<Type, Impl>{ - Type* Executor; - struct Context* task; - __code read(Impl* executor, struct Context* task, __code next(...)); - __code exec(Impl* executor, struct Context* task, __code next(...)); - __code write(Impl* executor, struct Context* task, __code next(...)); -}
--- a/src/parallel_execution/Iterator.h Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -typedef struct Iterator<Impl>{ - union Data* iterator; - struct Context* task; - int numGPU; - __code exec(Impl* iterator, struct Context* task, int numGPU, __code next(...)); - __code barrier(Impl* iterator, struct Context* task, __code next(...), __code whenWait(...)); - __code whenWait(...); - __code next(...); -} Iterator;
--- a/src/parallel_execution/Lock.h Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -typedef struct Lock<Impl>{ - union Data* lock; - __code doLock(Impl* lock, __code next(...)); - __code doUnlock(Impl* lock, __code next(...)); - __code next(...); -} Lock;
--- a/src/parallel_execution/LockImpl.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -#include "../context.h" -#interface "Queue.h" -#interface "Atomic.h" -#interface "Lock.h" -#interface "Worker.h" -#interface "TaskManager.h" - -Lock* createLockImpl(struct Context* context) { - struct Lock* lock = new Lock(); - struct LockImpl* lockImpl = new LockImpl(); - lockImpl->lock = NULL; - lockImpl->waitThreadQueue = createSynchronizedQueue(context); - lockImpl->atomic = createAtomicReference(context); - lock->lock = (union Data*)lockImpl; - lock->doLock = C_doLockLockImpl; - lock->doUnlock = C_doUnlockLockImpl; - return lock; -} - -__code doLockLockImpl(struct LockImpl* lock, __code next(...)) { - struct Atomic* atomic = lock->atomic; - goto atomic->checkAndSet(&lock->lock, NULL, 1, doLockLockImpl1, doLockLockImpl2); -} - -__code doLockLockImpl1(struct LockImpl* lock, __code next(...)) { - lock->lockContext = context; - goto next(...); -} - -__code doLockLockImpl2(struct LockImpl* lock, __code next(...)) { - struct Queue* queue = lock->waitThreadQueue; - context->next= C_doLockLockImpl; - printf("Put task\n"); - goto queue->put(context, doLockLockImpl3); -} - -__code doLockLockImpl3(struct LockImpl* lock, struct Worker* worker, __code next(...)) { - goto worker->taskReceive(); // goto shceduler -} - -__code doLockLockImpl3_stub(struct Context* context) { - // switch worker context - struct Context* workerContext = context->worker->worker->CPUWorker.context; - LockImpl* lockImpl = (LockImpl*)GearImpl(context, Lock, lock); - goto doLockLockImpl3(workerContext, - lockImpl, - context->worker, - Gearef(context, Lock)->next); -} - -__code doUnlockLockImpl(struct LockImpl* lock, __code next(...)) { - if (lock->lockContext == context) { - struct Atomic* atomic = lock->atomic; - goto atomic->checkAndSet(&lock->lock, 1, NULL, doUnlockLockImpl1, doUnlockLockImpl); - } - goto next(...); -} - -__code doUnlockLockImpl1(struct LockImpl* lock, __code next(...)) { - struct Queue* queue = lock->waitThreadQueue; - goto queue->isEmpty(doUnlockLockImpl2, doUnlockLockImpl4); -} - -__code doUnlockLockImpl2(struct LockImpl* lock, __code next(...)) { - struct Queue* queue = lock->waitThreadQueue; - printf("%p: Take task\n", lock); - goto queue->take(doUnlockLockImpl3); -} - -__code doUnlockLockImpl3(struct LockImpl* lock, struct Context* waitTask, __code next(...)) { - struct TaskManager* taskManager = waitTask->taskManager; - goto taskManager->spawn(waitTask, next(...)); //notify -} - -__code doUnlockLockImpl3_stub(struct Context* context) { - LockImpl* lockImpl = (LockImpl*)GearImpl(context, Lock, lock); - struct Context* waitTask = &Gearef(context, Queue)->data->Context; - goto doUnlockLockImpl3(context, - lockImpl, - waitTask, - Gearef(context, Lock)->next); -} - -__code doUnlockLockImpl4(struct LockImpl* lock, __code next(...)) { - goto next(...); -}
--- a/src/parallel_execution/MultiDimIterator.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -#include "../context.h" -#interface "Iterator.h" -#interface "TaskManager.h" -#include <stdio.h> - -Iterator* createMultiDimIterator(struct Context* context, int x, int y, int z) { - struct Iterator* iterator = new Iterator(); - struct MultiDimIterator* multiDimIterator = new MultiDimIterator(); - iterator->iterator = (union Data*)multiDimIterator; - iterator->exec = C_execMultiDimIterator; - iterator->barrier = C_barrierMultiDimIterator; - multiDimIterator->x = x; - multiDimIterator->y = y; - multiDimIterator->z = z; - multiDimIterator->count = x * y * z; - multiDimIterator->counterX = 0; - multiDimIterator->counterY = 0; - multiDimIterator->counterZ = 0; - return iterator; -} - -/** - * create iterateTask with index, that copy from task argument - * @return created iterateTask - * @param task task of the copy source - * @x index - */ -struct Context* createMultiDimIterateTask(struct Context* task, int x, int y, int z) { - struct Context* task1 = NEW(struct Context); - initContext(task1); - task1->taskManager = task->taskManager; - task1->next = task->next; - task1->iterate = 1; - task1->iterator = task->iterator; - task1->idgCount = task->idgCount; - task1->idg = task->idg; - task1->maxIdg = task->maxIdg; - for(int i = task1->idg; i < task1->maxIdg; i++) { - task1->data[i] = task->data[i]; - } - - // create index data gear and register input data to iterate task - struct MultiDim* multiDim = &ALLOCATE_DATA_GEAR(task1, MultiDim)->MultiDim; - multiDim->x = x; - multiDim->y = y; - multiDim->z = z; - task1->data[task1->maxIdg++] = (union Data*)multiDim; - task1->odg = task->odg + 1; - task1->maxOdg = task->maxOdg + 1; - for (int i = task1->odg; i < task1->maxOdg; i++) { - task1->data[i] = task->data[i-1]; - } - - return task1; -} - -__code execMultiDimIterator(struct MultiDimIterator* iterator, struct Context* task, int numGPU, __code next(...)) { - // No GPU device - if (numGPU == 0) { - goto meta(context, C_execMultiDimIterator1); - } - task->iterate = 1; - task->gpu = 1; - struct TaskManager* taskManager = task->taskManager; - goto taskManager->spawn(task, next(...)); -} - -__code execMultiDimIterator1(struct MultiDimIterator* iterator, struct Context* task, __code next(...)) { - int x = iterator->counterX; - int y = iterator->counterY; - int z = iterator->counterZ; - struct Context* iterateTask = createMultiDimIterateTask(task, x, y, z); - struct TaskManager* taskManager = task->taskManager; - goto taskManager->spawn(iterateTask, execMultiDimIterator2); -} - -__code execMultiDimIterator2(struct MultiDimIterator* iterator, struct Context* task, __code next(...)) { - if (++iterator->counterX >= iterator->x) { - iterator->counterX = 0; - if (++iterator->counterY >= iterator->y) { - iterator->counterY = 0; - if (++iterator->counterZ >= iterator->z) { - iterator->counterZ = 0; - goto next(...); - } - } - } - goto meta(context, C_execMultiDimIterator1); -} - -__code barrierMultiDimIterator(struct MultiDimIterator* iterator, struct Context* task, __code next(...), __code whenWait(...)) { - if (task->gpu || __sync_fetch_and_sub(&iterator->count, 1) == 1) { - goto next(...); - } - goto whenWait(...); -}
--- a/src/parallel_execution/Queue.h Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -typedef struct Queue<Impl>{ - union Data* queue; - union Data* data; - __code whenEmpty(...); - __code clear(Impl* queue, __code next(...)); - __code put(Impl* queue, union Data* data, __code next(...)); - __code take(Impl* queue, __code next(union Data*, ...)); - __code isEmpty(Impl* queue, __code next(...), __code whenEmpty(...)); - __code next(...); -} Queue;
--- a/src/parallel_execution/RedBlackTree.agda Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,145 +0,0 @@ -module RedBlackTree where - -open import stack -open import Level - -record TreeMethods {n m : Level } {a : Set n } {t : Set m } (treeImpl : Set n ) : Set (m Level.⊔ n) where - field - putImpl : treeImpl -> a -> (treeImpl -> t) -> t - getImpl : treeImpl -> (treeImpl -> Maybe a -> t) -> t -open TreeMethods - -record Tree {n m : Level } {a : Set n } {t : Set m } (treeImpl : Set n ) : Set (m Level.⊔ n) where - field - tree : treeImpl - treeMethods : TreeMethods {n} {m} {a} {t} treeImpl - putTree : a -> (Tree treeImpl -> t) -> t - putTree d next = putImpl (treeMethods ) tree d (\t1 -> next (record {tree = t1 ; treeMethods = treeMethods} )) - getTree : (Tree treeImpl -> Maybe a -> t) -> t - getTree next = getImpl (treeMethods ) tree (\t1 d -> next (record {tree = t1 ; treeMethods = treeMethods} ) d ) - -open Tree - -data Color {n : Level } : Set n where - Red : Color - Black : Color - -data CompareResult {n : Level } : Set n where - LT : CompareResult - GT : CompareResult - EQ : CompareResult - -record Node {n : Level } (a k : Set n) : Set n where - inductive - field - key : k - value : a - right : Maybe (Node a k) - left : Maybe (Node a k) - color : Color {n} -open Node - -record RedBlackTree {n m : Level } {t : Set m} (a k si : Set n) : Set (m Level.⊔ n) where - field - root : Maybe (Node a k) - nodeStack : Stack {n} {m} (Node a k) {t} si - compare : k -> k -> CompareResult {n} - -open RedBlackTree - -open Stack - --- --- put new node at parent node, and rebuild tree to the top --- -{-# TERMINATING #-} -- https://agda.readthedocs.io/en/v2.5.3/language/termination-checking.html -replaceNode : {n m : Level } {t : Set m } {a k si : Set n} -> RedBlackTree {n} {m} {t} a k si -> Stack (Node a k) si -> Node a k -> Node a k -> (RedBlackTree {n} {m} {t} a k si -> t) -> t -replaceNode {n} {m} {t} {a} {k} {si} tree s parent n0 next = popStack s ( - \s grandParent -> replaceNode1 s grandParent ( compare tree (key parent) (key n0) ) ) - where - replaceNode1 : Stack (Node a k) si -> Maybe ( Node a k ) -> CompareResult -> t - replaceNode1 s Nothing LT = next ( record tree { root = Just ( record parent { left = Just n0 ; color = Black } ) } ) - replaceNode1 s Nothing GT = next ( record tree { root = Just ( record parent { right = Just n0 ; color = Black } ) } ) - replaceNode1 s Nothing EQ = next ( record tree { root = Just ( record parent { right = Just n0 ; color = Black } ) } ) - replaceNode1 s (Just grandParent) result with result - ... | LT = replaceNode tree s grandParent ( record parent { left = Just n0 } ) next - ... | GT = replaceNode tree s grandParent ( record parent { right = Just n0 } ) next - ... | EQ = next tree - -rotateRight : {n m : Level } {t : Set m } {a k si : Set n} -> RedBlackTree {n} {m} {t} a k si -> Stack (Node a k) {t} si -> Node a k -> Node a k -> Node a k -> (RedBlackTree {n} {m} {t} a k si -> t) -> t -rotateRight {n} {m} {t} {a} {k} {si} tree s n0 parent grandParent next = {!!} - -rotateLeft : {n m : Level } {t : Set m } {a k si : Set n} -> RedBlackTree {n} {m} {t} a k si -> Stack (Node a k) {t} si -> Node a k -> Node a k -> Node a k -> (RedBlackTree {n} {m} {t} a k si -> t) -> t -rotateLeft {n} {m} {t} {a} {k} {si} tree s n0 parent grandParent next = {!!} - -insertCase5 : {n m : Level } {t : Set m } {a k si : Set n} -> RedBlackTree {n} {m} {t} a k si -> Stack (Node a k) {t} si -> Node a k -> Node a k -> Node a k -> (RedBlackTree {n} {m} {t} a k si -> t) -> t -insertCase5 {n} {m} {t} {a} {k} {si} tree s n0 parent grandParent next = {!!} - -insertCase4 : {n m : Level } {t : Set m } {a k si : Set n} -> RedBlackTree {n} {m} {t} a k si -> Stack (Node a k) {t} si -> Node a k -> Node a k -> Node a k -> (RedBlackTree {n} {m} {t} a k si -> t) -> t -insertCase4 {n} {m} {t} {a} {k} {si} tree s n0 parent grandParent next = {!!} - -{-# TERMINATING #-} -insertNode : {n m : Level } {t : Set m } {a k si : Set n} -> RedBlackTree {n} {m} {t} a k si -> Stack (Node a k) {t} si -> Node a k -> (RedBlackTree {n} {m} {t} a k si -> t) -> t -insertNode {n} {m} {t} {a} {k} {si} tree s n0 next = get2Stack s (\ s d1 d2 -> insertCase1 s n0 d1 d2 ) - where - insertCase1 : Stack (Node a k) si -> Node a k -> Maybe (Node a k) -> Maybe (Node a k) -> t -- placed here to allow mutual recursion - -- http://agda.readthedocs.io/en/v2.5.2/language/mutual-recursion.html - insertCase3 : Stack (Node a k) si -> Node a k -> Node a k -> Node a k -> t - insertCase3 s n0 parent grandParent with left grandParent | right grandParent - ... | Nothing | Nothing = insertCase4 tree s n0 parent grandParent next - ... | Nothing | Just uncle = insertCase4 tree s n0 parent grandParent next - ... | Just uncle | _ with compare tree ( key uncle ) ( key parent ) - ... | EQ = insertCase4 tree s n0 parent grandParent next - ... | _ with color uncle - ... | Red = pop2Stack s ( \s p0 p1 -> insertCase1 s ( - record grandParent { color = Red ; left = Just ( record parent { color = Black ; left = Just n0 } ) ; right = Just ( record uncle { color = Black } ) }) p0 p1 ) - ... | Black = insertCase4 tree s n0 parent grandParent next - insertCase2 : Stack (Node a k) si -> Node a k -> Node a k -> Node a k -> t - insertCase2 s n0 parent grandParent with color parent - ... | Black = replaceNode tree s grandParent n0 next - ... | Red = insertCase3 s n0 parent grandParent - insertCase1 s n0 Nothing Nothing = next tree - insertCase1 s n0 Nothing (Just grandParent) = replaceNode tree s grandParent n0 next - insertCase1 s n0 (Just grandParent) Nothing = replaceNode tree s grandParent n0 next - insertCase1 s n0 (Just parent) (Just grandParent) = insertCase2 s n0 parent grandParent - where - -findNode : {n m : Level } {a k si : Set n} {t : Set m} -> RedBlackTree {n} {m} {t} a k si -> Stack (Node a k) si -> (Node a k) -> (Node a k) -> (RedBlackTree {n} {m} {t} a k si -> Stack (Node a k) si -> Node a k -> t) -> t -findNode {n} {m} {a} {k} {si} {t} tree s n0 n1 next = pushStack s n1 (\ s -> findNode1 s n1) - where - findNode2 : Stack (Node a k) si -> (Maybe (Node a k)) -> t - findNode2 s Nothing = next tree s n0 - findNode2 s (Just n) = findNode tree s n0 n next - findNode1 : Stack (Node a k) si -> (Node a k) -> t - findNode1 s n1 with (compare tree (key n0) (key n1)) - ... | EQ = next tree s n0 - ... | GT = findNode2 s (right n1) - ... | LT = findNode2 s (left n1) - - -leafNode : {n : Level } {a k : Set n} -> k -> a -> Node a k -leafNode k1 value = record { - key = k1 ; - value = value ; - right = Nothing ; - left = Nothing ; - color = Black - } - -putRedBlackTree : {n m : Level } {a k si : Set n} {t : Set m} -> RedBlackTree {n} {m} {t} a k si -> k -> a -> (RedBlackTree {n} {m} {t} a k si -> t) -> t -putRedBlackTree {n} {m} {a} {k} {si} {t} tree k1 value next with (root tree) -... | Nothing = next (record tree {root = Just (leafNode k1 value) }) -... | Just n2 = findNode tree (nodeStack tree) (leafNode k1 value) n2 (\ tree1 s n1 -> insertNode tree1 s n1 next) - -getRedBlackTree : {n m : Level } {a k si : Set n} {t : Set m} -> RedBlackTree {n} {m} {t} a k si -> k -> (RedBlackTree {n} {m} {t} a k si -> (Maybe (Node a k)) -> t) -> t -getRedBlackTree {_} {_} {a} {k} {_} {t} tree k1 cs = checkNode (root tree) - where - checkNode : Maybe (Node a k) -> t - checkNode Nothing = cs tree Nothing - checkNode (Just n) = search n - where - search : Node a k -> t - search n with compare tree k1 (key n) - search n | LT = checkNode (left n) - search n | GT = checkNode (right n) - search n | EQ = cs tree (Just n)
--- a/src/parallel_execution/RedBlackTree.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,597 +0,0 @@ -#include <stdio.h> - -#include "../context.h" -#interface "Tree.h" -#interface "Stack.h" -#include "compare.c" - -extern enum Relational compare(struct Node* node1, struct Node* node2); - -Tree* createRedBlackTree(struct Context* context) { - struct Tree* tree = new Tree(); - struct RedBlackTree* redBlackTree = new RedBlackTree(); - tree->tree = (union Data*)redBlackTree; - redBlackTree->root = NULL; - redBlackTree->nodeStack = createSingleLinkedStack(context); - tree->put = C_putRedBlackTree; - tree->get = C_getRedBlackTree; - tree->remove = C_removeRedBlackTree; - // tree->clear = C_clearRedBlackTree; - return tree; -} - -void printTree1(union Data* data) { - struct Node* node = &data->Node; - if (node == NULL) { - printf("NULL"); - } else { - printf("key = %d (", node->key); - printTree1((union Data*)(node->right)); - printf("), ("); - printTree1((union Data*)(node->left)); - printf(")"); - } -} - -void printTree(union Data* data) { - printTree1(data); - printf("\n"); -} - -__code putRedBlackTree(struct RedBlackTree* tree, struct Node* node) { - struct Node* newNode = &ALLOCATE(context, Node)->Node; - struct Node* root = tree->root; - printTree((union Data*)(tree->root)); - tree->newNode = newNode; - tree->root = newNode; // this should done at stackClear - tree->parent = NULL; - if (root) { - tree->current = root; - tree->result = compare(tree->current, node); - tree->findNodeNext = C_insertNode; - goto findNode(tree); - } - goto insertNode(tree, node); -} - -__code findNode(struct RedBlackTree* tree) { - struct Stack* nodeStack = tree->nodeStack; - struct Node* oldNode = tree->current; - struct Node* newNode = tree->newNode; - tree->previous = newNode; - *newNode = *oldNode; - goto nodeStack->push((union Data*)newNode, findNode1); -} - -__code findNode1(struct RedBlackTree* tree, struct Node* node, __code next(...)) { - struct Node* oldNode = tree->current; - struct Node* newNode = tree->previous; - struct Node* newnewNode = &ALLOCATE(context, Node)->Node; - int result = tree->result; - if (result == EQ) { - newNode->value = node->value; - // go to stack clear - goto next(...); - } else if (result == GT) { - tree->current = oldNode->right; - newNode->right = newnewNode; - } else { - tree->current = oldNode->left; - newNode->left = newnewNode; - } - tree->newNode = newnewNode; - if (tree->current) { - tree->result = compare(tree->current, node); - goto findNode(tree); - } - goto meta(context, tree->findNodeNext); - // gato tree->findNodeNext(tree, node); - -} - -__code insertNode(struct RedBlackTree* tree, struct Node* node) { - struct Stack* nodeStack = tree->nodeStack; - struct Node* newNode = tree->newNode; - *newNode = *node; - newNode->color = Red; - tree->current = newNode; - goto nodeStack->get2(insertCase1); -} - -__code insertCase1(struct RedBlackTree* tree, struct Node *parent, struct Node *grandparent) { - if (parent != NULL) { - tree->parent = parent; - tree->grandparent = grandparent; - goto insertCase2(tree); - } - tree->root->color = Black; - goto stackClear(); -} - -__code insertCase1_stub(struct Context* context) { - goto insertCase1(context, - &Gearef(context, Tree)->tree->Tree.tree->RedBlackTree, - &context->data[D_Stack]->Stack.data->Node, - &context->data[D_Stack]->Stack.data1->Node); -} - -__code insertCase2(struct RedBlackTree* tree) { - if (tree->parent->color == Black) { - goto stackClear(); - } - goto insertCase3(tree); -} - -__code insertCase3(struct RedBlackTree* tree) { - struct Stack* nodeStack = tree->nodeStack; - struct Node* uncle; - - if (tree->grandparent->left == tree->parent) - uncle = tree->grandparent->right; - else - uncle = tree->grandparent->left; - - if (uncle && (uncle->color == Red)) { - // do insertcase1 on grandparent, stack must be pop by two - tree->parent->color = Black; - uncle->color = Black; - tree->grandparent->color = Red; - tree->current = tree->grandparent; - goto nodeStack->pop2(insertCase1); - } - goto insertCase4(); -} - -__code insertCase4(struct RedBlackTree* tree, struct RotateTree* rotateTree) { - struct Stack* nodeStack = tree->nodeStack; - - if ((tree->current == tree->parent->right) && (tree->parent == tree->grandparent->left)) { - tree->current = tree->current->left; - tree->parent = tree->grandparent; - - rotateTree->traverse = tree; - rotateTree->next = C_insertCase5; - - goto nodeStack->pop(rotateLeft); - } else if ((tree->current == tree->parent->left) && (tree->parent == tree->grandparent->right)) { - tree->parent = tree->grandparent; - tree->current = tree->current->right; - - rotateTree->traverse = tree; - rotateTree->next = C_insertCase5; - - goto nodeStack->pop(rotateRight); - } - - goto insertCase5(); -} - -__code insertCase5(struct RedBlackTree* tree) { - struct Stack* nodeStack = tree->nodeStack; - goto nodeStack->pop2(insertCase51); -} - -__code insertCase51(struct RedBlackTree* tree, struct RotateTree* rotateTree, struct Node* parent, struct Node* grandparent) { - struct Node* current = tree->current; - tree->parent = parent; - tree->grandparent = grandparent; - - parent->color = Black; - grandparent->color = Red; - - tree->current = grandparent; - - rotateTree->traverse = tree; - rotateTree->next = C_stackClear; - - if ((current == parent->left) && (parent == grandparent->left)) - goto rotateRight(); - else - goto rotateLeft(); -} - -__code insertCase51_stub(struct Context* context) { - struct Node* parent = &context->data[D_Stack]->Stack.data->Node; - struct Node* grandparent = &context->data[D_Stack]->Stack.data1->Node; - goto insertCase51(context, - &Gearef(context, Tree)->tree->Tree.tree->RedBlackTree, - Gearef(context, RotateTree), - parent, - grandparent); -} - -__code rotateLeft(struct RedBlackTree* tree) { - struct Stack* nodeStack = tree->nodeStack; - goto nodeStack->get(rotateLeft1); -} - -__code rotateLeft_stub(struct Context* context) { - struct RedBlackTree* traverse = context->data[D_RotateTree]->RotateTree.traverse; - goto rotateLeft(context, traverse); -} - -__code rotateLeft1(struct Node* node, struct RedBlackTree* tree, struct Node* parent, struct RotateTree* rotateTree) { - struct Node* tmp = node->right; - - if (parent) { - if (node == parent->left) - parent->left = tmp; - else - parent->right = tmp; - } else { - tree->root = tmp; - } - - node->right = tmp->left; - tmp->left = node; - tree->current = tmp; - - goto meta(context, rotateTree->next); -} - -__code rotateLeft1_stub(struct Context* context) { - struct RedBlackTree* traverse = context->data[D_RotateTree]->RotateTree.traverse; - struct Node* parent = &context->data[D_Stack]->Stack.data->Node; - goto rotateLeft1(context, - traverse->current, - traverse, - parent, - Gearef(context, RotateTree)); -} - -__code rotateRight(struct RedBlackTree* tree) { - struct Stack* nodeStack = tree->nodeStack; - goto nodeStack->get(rotateRight1); -} - -__code rotateRight_stub(struct Context* context) { - struct RedBlackTree* traverse = context->data[D_RotateTree]->RotateTree.traverse; - goto rotateLeft(context, traverse); -} - -__code rotateRight1(struct Node* node, struct RedBlackTree* traverse,struct Node *parent,struct RotateTree *rotateTree) { - struct Node* tmp = node->left; - - if (parent) { - if (node == parent->left) - parent->left = tmp; - else - parent->right = tmp; - } else { - traverse->root = tmp; - } - - node->left = tmp->right; - tmp->right = node; - traverse->current = tmp; - - goto meta(context, rotateTree->next); -} - -__code rotateRight1_stub(struct Context* context) { - struct RedBlackTree* traverse = context->data[D_RotateTree]->RotateTree.traverse; - struct Node* parent = &context->data[D_Stack]->Stack.data->Node; - goto rotateRight1(context, - traverse->current, - traverse, - parent, - Gearef(context, RotateTree)); -} - -__code stackClear(struct RedBlackTree* tree, struct Stack* nodeStack, __code next(...)) { - tree->current = 0; - nodeStack->stack = (union Data*)tree->nodeStack; - nodeStack->next = next; - goto meta(context, tree->nodeStack->clear); -} - -__code getRedBlackTree(struct RedBlackTree* tree, __code next(...)) { - if (tree->root) { - tree->current = tree->root; - - goto search(); - } - - goto next(...); -} - -__code search(struct RedBlackTree* tree, struct Node* node, __code next(...)) { - // compare(context, traverse, traverse->current->key, node->key); - tree->result = compare(tree->current, node); - if (tree->result == EQ) { - *node = *tree->current; - - goto meta(context, next); - } else if (tree->result == GT) { - tree->current = tree->current->right; - } else { - tree->current = tree->current->left; - } - - if (tree->current) - goto meta(context, C_search); - - goto next(...); -} - - -__code removeRedBlackTree(struct RedBlackTree* tree, struct Node* node, __code next(...)) { - struct Node* newNode = &ALLOCATE(context, Node)->Node; - struct Node* root = tree->root; - printTree((union Data*)(tree->root)); - tree->newNode = newNode; - tree->root = newNode; // this should done at stackClear - tree->parent = NULL; - if (root) { - tree->current = root; - tree->result = compare(tree->current, node); - tree->findNodeNext = C_replaceNodeForDelete2; - goto findNode(tree); - } - goto next(...); -} - - - -__code delete2(struct Node* current) { - if (current->color == Black) { - struct Node* child = current->right == NULL ? current->left : current->right; - current->color = child == NULL ? Black : child->color; - - goto deleteCase1(current); - } - - goto delete3(tree, current); -} - - - -__code delete3(struct RedBlackTree* tree, struct Node* current, __code next(...)) { - struct Node* tmp = current->right == NULL ? current->left : current->right; - struct Stack* nodeStack = tree->nodeStack; - - if (tree->parent) { - if (current == tree->parent->left) - tree->parent->left = tmp; - else - tree->parent->right = tmp; - } else { - tree->root = tmp; - } - - - if (tree->parent == NULL && tmp) - tmp->color = Black; - - current == tree->parent->left ? (tree->parent->left = NULL) : (tree->parent->right = NULL); - - Gearef(context, Stack)->stack = (union Data*) nodeStack; - Gearef(context, Stack)->next = next; - goto meta(context, nodeStack->pop); - -// gato nodeStack->pop(next); -} - - - -__code replaceNodeForDelete2(struct RedBlackTree* tree, struct Node* newNode) { - if (tree->current->left && tree->current->right) { - tree->parent = newNode; - tree->current = newNode->left; - newNode->left = context->heap; - - - tree->parent = newNode; - - goto findMax1(tree,oldNode, newNode); - } - - goto delete2(current); -} - - -__code findMax1(struct RedBlackTree* tree, struct Node* oldNode, struct Node* newNode) { - *newNode = *oldNode; - - if (newNode->right) - goto findMax2(tree, oldNode, newNode); - - tree->current = newNode; - - goto delete2(current); -} - - - - -__code findMax2(struct RedBlackTree* tree, struct Node* oldNode, struct Node* newNode) { - *newNode = *oldNode; - - if (newNode->right->right) { - tree->current = newNode->right; - newNode->right = context->heap; - - tree->parent = newNode; - - goto findMax2(tree, oldNode, newNode); - } - - tree->current = newNode; - - goto delete2(tree,current); -} - - -__code deleteCase1(struct RedBlackTree* tree, struct Node* current) { - if (tree->parent) - goto deleteCase2(tree,current); - - goto delete3(tree, current); -} - - - -__code deleteCase2(struct RedBlackTree* tree, struct Node* current, struct RotateTree* rotateTree) { - struct Node* sibling = current == tree->parent->left ? tree->parent->right : tree->parent->left; - struct Stack* nodeStack = tree->nodeStack; - - if ((sibling == NULL ? Black : sibling->color) == Red) { - tree->parent->color = Red; - sibling->color = Black; - - current == tree->parent->left ? (tree->parent->left = context->heap) : (tree->parent->right = context->heap); - - struct Node* node = sibling; - - tree->current = tree->parent; - - rotateTree->traverse = tree; - rotateTree->next = C_deleteCase3; - - if (current == tree->parent->left) { - goto nodeStack->push((union Data*)node,rotateLeft); - } else { - goto nodeStack->push((union Data*)node,rotateRight); - } - - goto deleteCase3(tree,current); - } -} - - - -__code deleteCase3(struct RedBlackTree* tree, struct Node* current) { - struct Node* sibling = current == tree->parent->left ? tree->parent->right : tree->parent->left; - - if (tree->parent->color == Black && - (sibling == NULL ? Black : sibling->color) == Black && - (sibling->left == NULL ? Black : sibling->left->color) == Black && - (sibling->right == NULL ? Black : sibling->right->color) == Black) { - sibling->color = Red; - - tree->current = tree->parent; - goto deleteCase1(current); - } - - goto deleteCase4(current); -} - - - -__code deleteCase4(struct RedBlackTree* tree,struct Node* current) { - struct Node* sibling = current == tree->parent->left ? tree->parent->right : tree->parent->left; - - if (tree->parent->color == Red && - (sibling == NULL ? Black : sibling->color) == Black && - (sibling->left == NULL ? Black : sibling->left->color) == Black && - (sibling->right == NULL ? Black : sibling->right->color) == Black) { - sibling->color = Red; - tree->parent->color = Black; - - goto delete3(tree,current); - } - - goto deleteCase5(tree,current); -} - - - -__code deleteCase5(struct RedBlackTree* tree, struct Node* current, struct RotateTree* rotateTree) { - struct Node* sibling = current == tree->parent->left ? tree->parent->right : tree->parent->left; - struct Stack* nodeStack = tree->nodeStack; - // sibling->parent = tree->parent; - - if (current == tree->parent->left && - (sibling == NULL ? Black : sibling->color) == Black && - (sibling->left == NULL ? Black : sibling->left->color) == Red && - (sibling->right == NULL ? Black : sibling->right->color) == Black) { - sibling->color = Red; - sibling->left->color = Black; - - // sibling == sibling->parent->left ? (sibling->parent->left = context->heap) : (sibling->parent->right = context->heap); - sibling == tree->parent->left ? (tree->parent->left = context->heap) : (tree->parent->right = context->heap); - - struct Node* node = new Node(); - node = sibling->left; - - struct Node* tmp = node; - *tmp = *sibling; - tree->parent = current; - - tmp->left = context->heap; -/* struct Node* node = new Node(); */ -/* node = *sibling->left; */ - tree->parent = tmp; - - tree->current = tmp; - - - rotateTree->traverse = tree; - rotateTree->next = C_deleteCase6; - - goto nodeStack->push((union Data*)node,rotateRight); - } else if (current == tree->parent->right && - (sibling == NULL ? Black : sibling->color) == Black && - (sibling->left == NULL ? Black : sibling->left->color) == Black && - (sibling->right == NULL ? Black : sibling->right->color) == Red) { - sibling->color = Red; - sibling->right->color = Black; - - sibling == tree->parent->left ? (tree->parent->left = context->heap) : (tree->parent->right = context->heap); - - struct Node* node = new Node(); - node = sibling->right; - - struct Node* tmp = node; - *tmp = *sibling; - // tmp->parent = current; - - tmp->right = context->heap; -/* struct Node* node = new Node(); */ -/* node = *sibling->right; */ - //node->parent = tmp; - - tree->current = tmp; - - - rotateTree->traverse = tree; - rotateTree->next = C_deleteCase6; - - goto nodeStack->push((union Data*)node,rotateLeft); - } - - goto deleteCase6(tree,current); -} - - -__code deleteCase6(struct RedBlackTree* tree, struct Node* current, struct RotateTree* rotateTree) { - struct Node* sibling = current == tree->parent->left ? tree->parent->right : tree->parent->left; - struct Stack* nodeStack = tree->nodeStack; - sibling == tree->parent->left ? (tree->parent->left = context->heap) : (tree->parent->right = context->heap); - - struct Node* tmp = sibling; - // *tmp = *sibling; - tree->parent = current; - - tmp->color = tree->parent->color; - tree->parent->color = Black; - - - if (current == tree->parent->left) { - tmp->right->color = Black; - tree->current = tree->parent; - - rotateTree->traverse = tree; - rotateTree->next = C_delete3; - - goto nodeStack->push((union Data*)tmp,rotateLeft); - } else { - tmp->left->color = Black; - tree->current = tree->parent; - - rotateTree->traverse = tree; - rotateTree->next = C_delete3; - - goto nodeStack->push((union Data*)tmp,rotateLeft); - } -}
--- a/src/parallel_execution/RedBlackTreeReWright.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,269 +0,0 @@ -#include <stdio.h> - -#include "../context.h" -#include "../compare.c" -#interface "Tree.h" -#interface "Stack.h" - -extern enum Relational compare(struct Node* node1, struct Node* node2); - - -Tree* createRedBlackTree(struct Context* context) { - struct Tree* tree = new Tree(); - struct RedBlackTree* rbtree = new RedBlackTree(); - - tree->tree = (union Data*)rbtree; - rbtree->root = NULL; - rbtree->nodeStack = (union Data*)createSingleLinkedStack(context); - tree->put = C_putRedBlackTree; - // tree->get = C_getRedBlackTree; - // tree->remove = C_removeRedBlackTree; - // tree->clear = C_clearRedBlackTree; - return tree; -} - -void printNode(struct Node* node) { - if (node == NULL) { - printf("leaf"); - } else { - printf("((%d,%d (",node->color, node->key); - printNode(node->right); - printf(") ("); - printNode(node->left); - printf(")"); - } -} - -void printTree(struct RedBlackTree* tree) { - printf("\n"); - tree->current = tree->root; - printNode(tree->current); - printf(")\n"); -} - -__code putRedBlackTree(struct RedBlackTree* tree, struct Node* node, __code next(...)) { - printf("C_putRedBlackTree\n"); - printf("value->%d,key->%d \n",node->value,node->key); - tree->previous = tree->newNode; - tree->newNode = node; - tree->newNode->color = Red; - tree->current = tree->root; - goto insertRBTree(node, tree); -} - -__code stackClear(struct RedBlackTree* tree, struct Stack* nodeStack, __code next(...)) { - tree->current = 0; - nodeStack->stack = tree->nodeStack; - nodeStack->next = next; - goto meta(context, tree->nodeStack->clear); - } - -__code getRedBlackTree(struct RedBlackTree* tree, __code next(...)) { - if (tree->root) { - tree->current = tree->root; - goto insertRBTree(); - // goto deleteRBTree(); - } - goto next(...); -} - -__code insertRBTree(struct Node* node, struct RedBlackTree* tree, struct Stack* stack, __code next(...)) { - // first case tree->current = root; - printf("C_insertRBTree\n"); - printf("value->%d,key->%d\n",node->value,node->key); - printf("newNode value->%d,newNode key->%d\n",tree->newNode->value,tree->newNode->key); - - if (tree->root == NULL) { - printf("insertRBTree_root eq NULL\n"); - tree->root = tree->newNode; - tree->root->color = Black; - printf("tree->root->key = %d, tree->root->color = %d \n",tree->root->key,tree->root->color); - printTree(tree); - goto next(tree,...); - } else { - goto searchInsertLocation(node, tree, stack); - } -} - -__code insertRBTree_stub(struct Context* context) { - Node* node = Gearef(context, Tree)->node; - RedBlackTree* tree = (RedBlackTree*)GearImpl(context, Tree, tree); - Stack* stack = createSingleLinkedStack(context); - enum Code next = Gearef(context, Tree)->next; - goto insertRBTree(context, node, tree, stack, next); -} - -__code searchInsertLocation(struct Node* node, struct RedBlackTree* tree) { - // first case tree->current = root; PreCase remove root=NULL case.don't exist firstCase tree->current=NULL - printf("C_searchInsertLocation\n"); - printf("nownode->key %d , previous->key %d \n",tree->newNode->key,tree->previous->key); - - tree->result = compare(tree->current, node); - printf("tree->current->key = %d, node->key %d\n",tree->current->key,node->key); - printf("compare (%d,%d)\n",tree->current,node); - - Stack* stack = tree->nodeStack; - - if (tree->current == NULL) { - printf("goto insertLocationBackInsert stack->pop\n"); - goto stack->pop(insertLocationBackInsert); - } - if (tree->result == GT) { - printf("GT searchInsertLocation\n"); - tree->current = tree->current->right; - goto stack->push(tree->newNode,insertLocationBackInsert); - } else if (tree->result == LT) { - printf("LT searchInsertLocation\n"); - tree->current = tree->current->left; - goto stack->push(tree->newNode, searchInsertLocation); - } else if (tree->result == EQ) { - printf("already member this node : __code searchInsertLocation()\n"); - goto meta(context, C_exit_code); - } else { - printf("$insert value tree : __code searchInsertLocation() \n"); - goto meta(context, C_exit_code); - } -} - -__code searchInsertLocation_stub(struct Context* context) { - Node* node = Gearef(context, Tree)->node; - RedBlackTree* tree = (RedBlackTree*)GearImpl(context, Tree, tree); - Stack* stack = (struct Stack*)Gearef(context, Stack)->stack; - goto searchInsertLocation(context, node, tree); -} - -__code insertLocationBackInsert(struct RedBlackTree* tree, struct Node* node, struct Stack* stack) { - printf("C_insertLocationBackInsert\n"); - struct Node* hoge = stack->data; - printf("stackpopdata%d\n",stack->data); - tree->current = tree->previous; - // tree->current = nodeStack->data; - // this CS is ones only backTrace, and insert node - tree->result = compare(tree->previous,tree->newNode); - printf("back,compare\n"); - if (tree->result == GT) { - printf("GT\n"); - tree->current->right = tree->newNode; - printTree(tree); - goto insertBalance(tree, stack, node, next); - } else if (tree->result == LT) { - printf("LT\n"); - tree->current->left = tree->newNode; - goto insertBalance(tree, stack, node, next); - } else { - printf("error : __code insertLocationBackTrace() \n"); - goto meta(context, C_exit_code); - } -} - -__code insertLocationBackInsert_stub(struct Context* context) { - RedBlackTree* tree = (RedBlackTree*)GearImpl(context, Tree, tree); - SingleLinkedStack* singleLinkedStack = (SingleLinkedStack*)GearImpl(context, Stack, stack); - Node* node = Gearef(context, Tree)->node; - Stack* stack = (struct Stack*)Gearef(context, Stack)->stack; - goto insertLocationBackInsert(context, tree, node, stack); -} - -__code insertBalance(struct RedBlackTree* tree, struct Node* nodeStack, struct Node* node, __code next(...)) { - printf("C_insertBalance\n"); - struct Node* traceNode = tree->nodeStack->data; - tree->current = traceNode; - struct Stack* stack = tree->nodeStack; - - // exit insertion code - if (tree->current == tree->root) { - tree->current->color = Black; - printTree(tree); - //printTree - goto next(tree,...); - } - - - //current color eq Red - if (tree->current->color == Red) - goto stack->pop(insertBalance); - - // current color eq Black - if (tree->current->left->left || tree->current->left->right) { - goto insertBalanceLeft(tree,nodeStack); - } else if (tree->current->right->left || tree->current->right->right) { - goto insertBalanceRight(tree,nodeStack); - } else { - goto stack->pop(insertBalance); - } -} - -__code insertBalanceLeft(struct RedBlackTree* tree, struct Node* nodeStack, struct Node* node) { - printf("C_insertBalanceLeft\n"); - struct Stack* stack = tree->nodeStack; - - if (tree->current->color == Black && tree->current->left->color == Red && tree->current->left->left->color == Red) { - struct Node* tmpCurrent = tree->current; - struct Node* tmpLeft = tree->current->left; - struct Node* tmpLeftLeft = tree->current->left->left; - - tree->current = tmpLeft; - tree->current->right = tmpCurrent; - tree->current->left = tmpLeftLeft; - tree->current->right->left = tmpLeft->right; - tree->current->color = Red; - tree->current->left->color = Black; - tree->current->right->color = Black; - goto stack->pop(insertBalance); - - } else if(tree->current->color == Black && tree->current->left->color == Red && tree->current->left->right->color == Red) { - struct Node* tmpCurrent = tree->current; - struct Node* tmpLeft = tree->current->left; - struct Node* tmpLeftRight = tree->current->left->right; - - tree->current = tmpLeft; - tree->current->right = tmpCurrent; - tree->current->left = tmpLeftRight; - tree->current->right->left = tmpLeft->left; - tree->current->color = Red; - tree->current->left->color = Black; - tree->current->right->color = Black; - goto stack->pop(insertBalance); - - } -} - -__code insertBalanceRight(struct RedBlackTree* tree, struct Node* nodeStack, struct Node* node) { - printf("C_insertBalanceLeft\n"); - struct Stack* stack = tree->nodeStack; - - if (tree->current->color == Black && tree->current->right->color == Red && tree->current->right->right->color == Red) { - struct Node* tmpCurrent = tree->current; - struct Node* tmpRight = tree->current->right; - struct Node* tmpRightRight = tree->current->right->right; - - tree->current = tmpRight; - tree->current->left = tmpCurrent; - tree->current->right = tmpRightRight; - tree->current->left->right = tmpRight->left; - tree->current->color = Red; - tree->current->left->color = Black; - tree->current->right->color = Black; - goto stack->pop(insertBalance); - - } else if (tree->current->color == Black && tree->current->right->color == Red && tree->current->right->left->color == Red) { - - struct Node* tmpCurrent = tree->current; - struct Node* tmpRight = tree->current->right; - struct Node* tmpRightLeft = tree->current->right->left; - - tree->current = tmpRight; - tree->current->right = tmpCurrent; - tree->current->left = tmpRightLeft; - tree->current->left->right = tmpRight->right; - tree->current->color = Red; - tree->current->left->color = Black; - tree->current->right->color = Black; - goto stack->pop(insertBalance); - - } else { - printf("unkwon error : __code insertBalanceRight() \n"); - goto meta(context, C_exit_code); - } -} -// insertCode end
--- a/src/parallel_execution/Semaphore.h Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -typedef struct Semaphore<Impl>{ - union Data* semaphore; - __code p(Impl* semaphore, __code next(...)); - __code v(Impl* semaphore, __code next(...)); - __code next(...); -} Semaphore;
--- a/src/parallel_execution/SemaphoreImpl.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -#include "../context.h" -#interface "semaphore.h" - -Semaphore* createSemaphoreImpl(struct Context* context, int n) { - struct Semaphore* semaphore = new Semaphore(); - struct SemaphoreImpl* semaphoreImpl = new SemaphoreImpl(); - semaphore->semaphore = (union Data*)semaphoreImpl; - semaphoreImpl->value = n; - pthread_mutex_init(&semaphoreImpl->mutex, NULL); - pthread_cond_init(&semaphoreImpl->cond, NULL); - semaphore->p = C_pOperationSemaphoreImpl; - semaphore->v = C_vOperationSemaphoreImpl; - return semaphore; -} - -__code pOperationSemaphoreImpl(struct SemaphoreImpl* semaphore, __code next(...)) { - pthread_mutex_lock(&semaphore->mutex); - goto meta(context, C_pOperationSemaphoreImpl1); -} - -__code pOperationSemaphoreImpl1(struct SemaphoreImpl* semaphore, __code next(...)) { - if(semaphore->value == 0) { - pthread_cond_wait(&semaphore->cond, &semaphore->mutex); - goto meta(context, C_pOperationSemaphoreImpl1); - } - semaphore->value--; - pthread_mutex_unlock(&semaphore->mutex); - goto next(...); -} - -__code vOperationSemaphoreImpl(struct SemaphoreImpl* semaphore, __code next(...)) { - pthread_mutex_lock(&semaphore->mutex); - semaphore->value++; - pthread_cond_signal(&semaphore->cond); - pthread_mutex_unlock(&semaphore->mutex); - goto next(...); -}
--- a/src/parallel_execution/SingleLinkedQueue.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -#include "../context.h" -#include <stdio.h> -#interface "Queue.h" - -Queue* createSingleLinkedQueue(struct Context* context) { - struct Queue* queue = new Queue(); - struct SingleLinkedQueue* singleLinkedQueue = new SingleLinkedQueue(); - queue->queue = (union Data*)singleLinkedQueue; - singleLinkedQueue->top = new Element(); - singleLinkedQueue->last = singleLinkedQueue->top; - queue->take = C_takeSingleLinkedQueue; - queue->put = C_putSingleLinkedQueue; - queue->isEmpty = C_isEmptySingleLinkedQueue; - queue->clear = C_clearSingleLinkedQueue; - return queue; -} - -void printQueue1(union Data* data) { - struct Node* node = &data->Element.data->Node; - if (node == NULL) { - printf("NULL"); - } else { - printf("key = %d ,", node->key); - printQueue1((union Data*)data->Element.next); - } -} - -void printQueue(union Data* data) { - printQueue1(data); - printf("\n"); -} - -__code clearSingleLinkedQueue(struct SingleLinkedQueue* queue, __code next(...)) { - queue->top = NULL; - goto next(...); -} - -__code putSingleLinkedQueue(struct SingleLinkedQueue* queue, union Data* data, __code next(...)) { - Element* element = new Element(); - element->data = data; - element->next = NULL; - queue->last->next = element; - queue->last = element; - goto next(...); -} - -__code takeSingleLinkedQueue(struct SingleLinkedQueue* queue, __code next(union Data* data, ...)) { - struct Element* top = queue->top; - struct Element* nextElement = top->next; - if (queue->top == queue->last) { - data = NULL; - } else { - queue->top = nextElement; - data = nextElement->data; - } - goto next(data, ...); -} - -__code isEmptySingleLinkedQueue(struct SingleLinkedQueue* queue, __code next(...), __code whenEmpty(...)) { - if (queue->top == queue->last) - goto whenEmpty(...); - else - goto next(...); -} -
--- a/src/parallel_execution/SingleLinkedStack.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,109 +0,0 @@ -#include "../context.h" -#interface "Stack.h" -#include <stdio.h> - -// typedef struct SingleLinkedStack { -// struct Element* top; -// } SingleLinkedStack; - -Stack* createSingleLinkedStack(struct Context* context) { - struct Stack* stack = new Stack(); - struct SingleLinkedStack* singleLinkedStack = new SingleLinkedStack(); - stack->stack = (union Data*)singleLinkedStack; - singleLinkedStack->top = NULL; - stack->push = C_pushSingleLinkedStack; - stack->pop = C_popSingleLinkedStack; - stack->pop2 = C_pop2SingleLinkedStack; - stack->get = C_getSingleLinkedStack; - stack->get2 = C_get2SingleLinkedStack; - stack->isEmpty = C_isEmptySingleLinkedStack; - stack->clear = C_clearSingleLinkedStack; - return stack; -} - -void printStack1(union Data* data) { - struct Node* node = &data->Element.data->Node; - if (node == NULL) { - printf("NULL"); - } else { - printf("key = %d ,", node->key); - printStack1((union Data*)data->Element.next); - } -} - -void printStack(union Data* data) { - printStack1(data); - printf("\n"); -} - -__code clearSingleLinkedStack(struct SingleLinkedStack* stack,__code next(...)) { - stack->top = NULL; - goto next(...); -} - -__code pushSingleLinkedStack(struct SingleLinkedStack* stack, union Data* data, __code next(...)) { - Element* element = new Element(); - element->next = stack->top; - element->data = data; - stack->top = element; - goto next(...); -} - -__code popSingleLinkedStack(struct SingleLinkedStack* stack, __code next(union Data* data, ...)) { - if (stack->top) { - data = stack->top->data; - stack->top = stack->top->next; - } else { - data = NULL; - } - goto next(data, ...); -} - -__code pop2SingleLinkedStack(struct SingleLinkedStack* stack, __code next(union Data* data, union Data* data1, ...)) { - if (stack->top) { - data = stack->top->data; - stack->top = stack->top->next; - } else { - data = NULL; - } - if (stack->top) { - data1 = stack->top->data; - stack->top = stack->top->next; - } else { - data1 = NULL; - } - goto next(data, data1, ...); -} - - -__code getSingleLinkedStack(struct SingleLinkedStack* stack, __code next(union Data* data, ...)) { - if (stack->top) - data = stack->top->data; - else - data = NULL; - goto next(data, ...); -} - -__code get2SingleLinkedStack(struct SingleLinkedStack* stack, __code next(union Data* data, union Data* data1, ...)) { - if (stack->top) { - data = stack->top->data; - if (stack->top->next) { - data1 = stack->top->next->data; - } else { - data1 = NULL; - } - } else { - data = NULL; - data1 = NULL; - } - goto next(data, data1, ...); -} - -__code isEmptySingleLinkedStack(struct SingleLinkedStack* stack, __code next(...), __code whenEmpty(...)) { - if (stack->top) - goto next(...); - else - goto whenEmpty(...); -} - -
--- a/src/parallel_execution/SpinLock.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -#include "../context.h" -#interface "Atomic.h" -#interface "Lock.h" - -Lock* createSpinLock(struct Context* context) { - struct Lock* lock = new Lock(); - struct SpinLock* spinLock = new SpinLock(); - spinLock->lock = NULL; - spinLock->atomic = createAtomicReference(context); - lock->lock = (union Data*)spinLock; - lock->doLock = C_doLockSpinLock; - lock->doUnlock = C_doUnlockSpinLock; - return lock; -} - -__code doLockSpinLock(struct SpinLock* lock, __code next(...)) { - struct Atomic* atomic = lock->atomic; - goto atomic->checkAndSet(&lock->lock, NULL, 1, doLockSpinLock1, doLockSpinLock); -} - -__code doLockSpinLock1(struct SpinLock* lock, __code next(...)) { - lock->lockContext = context; - goto next(...); -} - -__code doUnlockSpinLock(struct SpinLock* lock, __code next(...)) { - if (lock->lockContext == context) { - struct Atomic* atomic = lock->atomic; - goto atomic->checkAndSet(&lock->lock, 1, NULL, next(...), doUnlockSpinLock); - } - goto next(...); -}
--- a/src/parallel_execution/Stack.h Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -typedef struct Stack<Type, Impl>{ - union Data* stack; - union Data* data; - union Data* data1; - /* Type* stack; */ - /* Type* data; */ - /* Type* data1; */ - __code whenEmpty(...); - __code clear(Impl* stack,__code next(...)); - __code push(Impl* stack,Type* data, __code next(...)); - __code pop(Impl* stack, __code next(Type* data, ...)); - __code pop2(Impl* stack, __code next(Type* data, Type* data1, ...)); - __code isEmpty(Impl* stack, __code next(...), __code whenEmpty(...)); - __code get(Impl* stack, __code next(Type* data, ...)); - __code get2(Impl* stack, __code next(Type* data, Type* data1, ...)); - __code next(...); -} Stack;
--- a/src/parallel_execution/SynchronizedQueue.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -#include "../context.h" -#interface "Queue.h" -#interface "Atomic.h" - -#include <stdio.h> - -/* - * Non-blocking queue of Paper: Simple, Fast, and Practical Non-Blocking and Blocking Concurrent Queue Algorithms(https://www.research.ibm.com/people/m/michael/podc-1996.pdf). - */ - -Queue* createSynchronizedQueue(struct Context* context) { - struct Queue* queue = new Queue(); - struct SynchronizedQueue* synchronizedQueue = new SynchronizedQueue(); - synchronizedQueue->top = new Element(); - synchronizedQueue->top->next = NULL; - synchronizedQueue->last = synchronizedQueue->top; - synchronizedQueue->atomic = createAtomicReference(context); - queue->queue = (union Data*)synchronizedQueue; - queue->take = C_takeSynchronizedQueue; - queue->put = C_putSynchronizedQueue; - queue->isEmpty = C_isEmptySynchronizedQueue; - queue->clear = C_clearSynchronizedQueue; - return queue; -} - -__code clearSynchronizedQueue(struct SynchronizedQueue* queue, __code next(...)) { - struct Element* top = queue->top; - struct Atomic* atomic = queue->atomic; - goto atomic->checkAndSet(&queue->top, top, NULL, next(...), clearSynchronizedQueue); -} - -__code putSynchronizedQueue(struct SynchronizedQueue* queue, union Data* data, __code next(...)) { - Element* element = new Element(); - element->data = data; - element->next = NULL; - Element* last = queue->last; - Element* nextElement = last->next; - if (last != queue->last) { - goto putSynchronizedQueue(); - } - if (nextElement == NULL) { - struct Atomic* atomic = queue->atomic; - goto atomic->checkAndSet(&last->next, nextElement, element, next(...), putSynchronizedQueue); - } else { - struct Atomic* atomic = queue->atomic; - goto atomic->checkAndSet(&queue->last, last, nextElement, putSynchronizedQueue, putSynchronizedQueue); - } -} - -__code takeSynchronizedQueue(struct SynchronizedQueue* queue, __code next(union Data* data, ...)) { - struct Element* top = queue->top; - struct Element* last = queue->last; - struct Element* nextElement = top->next; - if (top != queue->top) { - goto takeSynchronizedQueue(); - } - if (top == last) { - if (nextElement != NULL) { - struct Atomic* atomic = queue->atomic; - goto atomic->checkAndSet(&queue->last, last, nextElement, takeSynchronizedQueue, takeSynchronizedQueue); - } - } else { - struct Atomic* atomic = queue->atomic; - goto atomic->checkAndSet(&queue->top, top, nextElement, takeSynchronizedQueue1, takeSynchronizedQueue); - } - goto takeSynchronizedQueue(); -} - -__code takeSynchronizedQueue1(struct SynchronizedQueue* queue, __code next(union Data* data, ...), struct Element* nextElement) { - data = nextElement->data; - goto next(data, ...); -} - -__code takeSynchronizedQueue1_stub(struct Context* context) { - SynchronizedQueue* queue = (SynchronizedQueue*)GearImpl(context, Queue, queue); - enum Code next = Gearef(context, Queue)->next; - Data** O_data = &Gearef(context, Queue)->data; - goto takeSynchronizedQueue1(context, - queue, - next, - O_data, - (struct Element*)Gearef(context, Atomic)->newData); -} - -__code isEmptySynchronizedQueue(struct SynchronizedQueue* queue, __code next(...), __code whenEmpty(...)) { - struct Element* top = queue->top; - struct Element* last = queue->last; - struct Element* nextElement = top->next; - if (top != queue->top) { - goto isEmptySynchronizedQueue(); - } - if (top == last && nextElement == NULL) { - goto whenEmpty(...); - } - goto next(...); -}
--- a/src/parallel_execution/TaskIterator.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -#include "../context.h" -#interface "Iterator.h" -#include <stdio.h> - -createTaskIterator(struct Context, struct List list) { - struct Iterator* iterator = new Iterator(); - struct TaskIterator* taskIterator = new TaskIterator(); - iterator->itearot = (union Data*)taskIterator; - iterator->exec = C_execTaskIterator; - iterator->barrier = C_barrierTaskIterator; - taskIterator->taskList = list; -} - -__code execTaskIterator(struct taskIterator* iterator, struct TaskManager* taskManager, struct Context* task, __code next(...)) { - if (iterator->list->next == null) { - goto next(...); - } - iterator->list = list->next; - struct Context* task = (struct Context*)iterator->list->data; - struct TaskManager taskManager = task->taskManager; - taskManager->spawn(task, C_execTaskIterator); -} - -__code barrierTaskIterator(struct MultiDimIterator* iterator, struct Context* task, __code next(...), __code whenWait(...)) { - if (__sync_fetch_and_sub(&iterator->count, 1) == 1) { - goto next(...); - } - goto whenWait(...); -}
--- a/src/parallel_execution/TaskManager.h Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -typedef struct TaskManager<Impl>{ - union Data* taskManager; - struct Context* task; - struct Element* taskList; - __code spawn(Impl* taskManager, struct Context* task, __code next(...)); - __code spawnTasks(Impl* taskManagerImpl, struct Element* taskList, __code next1(...)); - __code setWaitTask(Impl* taskManagerImpl, struct Context* task, __code next(...)); - __code shutdown(Impl* taskManagerImpl, __code next(...)); - __code incrementTaskCount(Impl* taskManagerImpl, __code next(...)); - __code decrementTaskCount(Impl* taskManagerImpl, __code next(...)); - __code next(...); - __code next1(...); -} TaskManager;
--- a/src/parallel_execution/TaskManagerImpl.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,195 +0,0 @@ -#include "../context.h" -#interface "TaskManager.h" -#interface "Iterator.h" -#interface "Queue.h" -#interface "Worker.h" - -#include <stdio.h> -#include <unistd.h> - -void createWorkers(struct Context* context, TaskManagerImpl* taskManager); - -TaskManager* createTaskManagerImpl(struct Context* context, int numCPU, int numGPU, int numIO) { - struct TaskManager* taskManager = new TaskManager(); - taskManager->spawnTasks = C_spawnTasksTaskManagerImpl; - taskManager->spawn = C_spawnTaskManagerImpl; - taskManager->shutdown = C_shutdownTaskManagerImpl; - taskManager->incrementTaskCount = C_incrementTaskCountTaskManagerImpl; - taskManager->decrementTaskCount = C_decrementTaskCountTaskManagerImpl; - taskManager->setWaitTask = C_setWaitTaskTaskManagerImpl; - struct TaskManagerImpl* taskManagerImpl = new TaskManagerImpl(); - // 0...numIO-1 IOProcessor - // numIO...numIO+numGPU-1 GPUProcessor - // numIO+numGPU...numIO+numGPU+numCPU-1 CPUProcessor - taskManagerImpl->io = 0; - taskManagerImpl->gpu = numIO; - taskManagerImpl->cpu = numIO+numGPU; - taskManagerImpl->maxCPU = numIO+numGPU+numCPU; - taskManagerImpl->numWorker = taskManagerImpl->maxCPU; - taskManagerImpl->sendGPUWorkerIndex = taskManagerImpl->gpu; - taskManagerImpl->sendCPUWorkerIndex = taskManagerImpl->cpu; - taskManagerImpl->taskCount = 0; - taskManagerImpl->loopCounter = 0; - createWorkers(context, taskManagerImpl); - taskManager->taskManager = (union Data*)taskManagerImpl; - return taskManager; -} - -void createWorkers(struct Context* context, TaskManagerImpl* taskManager) { - int i = 0; - taskManager->workers = (Worker**)ALLOCATE_PTR_ARRAY(context, Worker, taskManager->maxCPU); - for (;i<taskManager->gpu;i++) { - Queue* queue = createSynchronizedQueue(context); - taskManager->workers[i] = (Worker*)createCPUWorker(context, i, queue); - } - for (;i<taskManager->cpu;i++) { - Queue* queue = createSynchronizedQueue(context); -#ifdef USE_CUDAWorker - taskManager->workers[i] = (Worker*)createCUDAWorker(context, i, queue,0); -#else - taskManager->workers[i] = (Worker*)createCPUWorker(context, i, queue); -#endif - } - for (;i<taskManager->maxCPU;i++) { - Queue* queue = createSynchronizedQueue(context); - taskManager->workers[i] = (Worker*)createCPUWorker(context, i, queue); - } -} - -__code spawnTasksTaskManagerImpl(struct TaskManagerImpl* taskManager, struct Element* taskList, __code next1(...)) { - taskManager->taskList = taskList; - goto spawnTasksTaskManagerImpl1(); -} - -__code spawnTasksTaskManagerImpl1(struct TaskManagerImpl* taskManagerImpl, struct TaskManager* taskManager) { - if (taskManagerImpl->taskList == NULL) { - goto spawnTasksTaskManagerImpl2(); - } - struct Context* task = (struct Context*)taskManagerImpl->taskList->data; - taskManagerImpl->taskList = taskManagerImpl->taskList->next; - goto taskManager->setWaitTask(task, spawnTasksTaskManagerImpl1); -} - -__code spawnTasksTaskManagerImpl1_stub(struct Context* context) { - TaskManagerImpl* taskManagerImpl = (TaskManagerImpl*)GearImpl(context, TaskManager, taskManager); - TaskManager* taskManager = &Gearef(context, TaskManager)->taskManager->TaskManager; - goto spawnTasksTaskManagerImpl1(context, taskManagerImpl, taskManager); -} - -__code spawnTasksTaskManagerImpl2(struct TaskManagerImpl* taskManager, struct Element* taskList, __code next1(...)) { - taskManager->taskList = taskList; - goto spawnTasksTaskManagerImpl3(); -} - -__code spawnTasksTaskManagerImpl3(struct TaskManagerImpl* taskManagerImpl, __code next1(...), struct TaskManager* taskManager) { - if (taskManagerImpl->taskList == NULL) { - goto next1(...); - } - struct Context* task = (struct Context*)taskManagerImpl->taskList->data; - taskManagerImpl->taskList = taskManagerImpl->taskList->next; - goto taskManager->spawn(task, spawnTasksTaskManagerImpl3); -} - -__code spawnTasksTaskManagerImpl3_stub(struct Context* context) { - TaskManagerImpl* taskManagerImpl = (TaskManagerImpl*)GearImpl(context, TaskManager, taskManager); - enum Code next1 = Gearef(context, TaskManager)->next1; - TaskManager* taskManager = &Gearef(context, TaskManager)->taskManager->TaskManager; - goto spawnTasksTaskManagerImpl3(context, taskManagerImpl, next1, taskManager); -} - -__code setWaitTaskTaskManagerImpl(struct TaskManagerImpl* taskManager, struct Context* task, __code next(...)) { - int i = taskManager->loopCounter; - if(task->idg+i < task->maxIdg) { - struct Queue* queue = GET_WAIT_LIST(task->data[task->idg + i]); - taskManager->loopCounter++; - goto queue->put(task, setWaitTaskTaskManagerImpl); - } - taskManager->loopCounter = 0; - goto incrementTaskCountTaskManagerImpl(); -} - -__code incrementTaskCountTaskManagerImpl(struct TaskManagerImpl* taskManager, __code next(...)) { - __sync_fetch_and_add(&taskManager->taskCount, 1); - goto next(...); -} - -__code decrementTaskCountTaskManagerImpl(struct TaskManagerImpl* taskManager, __code next(...)) { - __sync_fetch_and_sub(&taskManager->taskCount, 1); - goto next(...); -} - -__code spawnTaskManagerImpl(struct TaskManagerImpl* taskManagerImpl, struct Context* task, __code next(...), struct TaskManager* taskManager) { - task->taskManager = taskManager; - if (task->idgCount == 0) { - // iterator task is normal task until spawned - if(task->iterator != NULL && task->iterate == 0) { - pthread_mutex_unlock(&taskManagerImpl->mutex); - struct Iterator* iterator = task->iterator; - goto iterator->exec(task, taskManagerImpl->cpu - taskManagerImpl->gpu, next(...)); - } - goto taskSend(); - } - pthread_mutex_unlock(&taskManagerImpl->mutex); - goto next(...); -} - -__code spawnTaskManagerImpl_stub(struct Context* context) { - TaskManagerImpl* taskManagerImpl = (TaskManagerImpl*)GearImpl(context, TaskManager, taskManager); - struct Context* task = Gearef(context, TaskManager)->task; - TaskManager* taskManager = &Gearef(context, TaskManager)->taskManager->TaskManager; - goto spawnTaskManagerImpl(context, - taskManagerImpl, - task, - Gearef(context, TaskManager)->next, - taskManager); -} - - -__code taskSend(struct TaskManagerImpl* taskManager, struct Context* task, __code next(...)) { - // set workerId - if (task->gpu) { - task->workerId = taskManager->sendGPUWorkerIndex; - if(++taskManager->sendGPUWorkerIndex >= taskManager->cpu) { - taskManager->sendGPUWorkerIndex = taskManager->gpu; - } - } else { - task->workerId = taskManager->sendCPUWorkerIndex; - if(++taskManager->sendCPUWorkerIndex >= taskManager->maxCPU) { - taskManager->sendCPUWorkerIndex = taskManager->cpu; - } - } - pthread_mutex_unlock(&taskManager->mutex); - struct Queue* queue = taskManager->workers[task->workerId]->tasks; - goto queue->put(task, next(...)); -} - -__code shutdownTaskManagerImpl(struct TaskManagerImpl* taskManager, __code next(...)) { - if (taskManager->taskCount != 0) { - usleep(1000); - goto shutdownTaskManagerImpl(); - } - int i = taskManager->loopCounter; - if (i < taskManager->numWorker) { - struct Queue* tasks = taskManager->workers[i]->tasks; - goto tasks->put(NULL, shutdownTaskManagerImpl1); - } - - taskManager->loopCounter = 0; - goto shutdownTaskManagerImpl2(); -} - -__code shutdownTaskManagerImpl1(struct TaskManagerImpl* taskManager, __code next(...)) { - taskManager->loopCounter++; - goto shutdownTaskManagerImpl(); -} - -__code shutdownTaskManagerImpl2(struct TaskManagerImpl* taskManager, __code next(...)) { - int i = taskManager->loopCounter; - if (i < taskManager->numWorker) { - pthread_join(taskManager->workers[i]->thread, NULL); - taskManager->loopCounter++; - goto shutdownTaskManagerImpl2(); - } - taskManager->loopCounter = 0; - goto next(...); -}
--- a/src/parallel_execution/Timer.h Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -typedef struct Timer<Impl>{ - union Data* timer; - __code start(Impl* timer, __code next(...)); - __code end(Impl* timer, __code next(...)); - __code next(...); -} Queue; -
--- a/src/parallel_execution/TimerImpl.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -#include <stdio.h> -#include <sys/time.h> - -#include "../context.h" -#interface "Timer.h" - -Timer* createTimerImpl(struct Context* context) { - struct Timer* timer = new Timer(); - struct TimerImpl* timerImpl = new TimerImpl(); - timer->timer = (union Data*)timerImpl; - timer->start = C_startTimer; - timer->end = C_endTimer; - return timer; -} - -__code startTimer(struct TimerImpl* timer, __code next(...)) { - struct timeval tv; - gettimeofday(&tv, NULL); - - timer->time = tv.tv_sec + (double)tv.tv_usec*1e-6; - - goto next(...); -} - -__code endTimer(struct TimerImpl* timer, __code next(...)) { - struct timeval tv; - gettimeofday(&tv, NULL); - printf("%0.6f\n", (tv.tv_sec+(double)tv.tv_usec*1e-6) - timer->time); - goto next(...); -}
--- a/src/parallel_execution/Todo Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +0,0 @@ -Tue Aug 1 19:32:55 JST 2017 - - DataGear の待ち合わせ - DataGear の Commit - - これらは、stubとgoto meta の部分で行う - - どれに対して行うかを実行時あるいはコンパイル時に指定する必要がある - - 一つの解決策は、 typedefのときにannotution してあげる - もう一つの解決策は, Data Gear の allocation 時に指定する - Code Gearのプロトタイプのなかで指定する事も考えられる - - par goto時に渡す continuation で同期をとっても良い, このときにはこのcontinuation を作成するinterfaceを作る必要がある - - 実行時に指定してしまうと、毎回フラグのチェックが必要になる。 - これを abstract model checking を事前に行うことで, static なコードに置き換える事はできる - - 例題としては, chat、dining philosophers, map reduce - -Fri Apr 14 18:44:09 JST 2017 - struct B { - A a; - ..... - } - struct A { - __code init(..., __code next(A a, ...)); - } - par goto A->init(a); - // meta level - task->code = C_init_A; - task->data[idg] = ...; - task->data[idg + 1] = ...; - task->data[odg] = ...; - task->next = C_writeToa; - goto meta(context, context->TaskManager->spawn) - - // lambda version? - par goto A->init(\A -> a = A) - - // meta level - par goto A->init(next = \A -> a = A) - -Wed Mar 1 18:25:36 JST 2017 - - parallel_executtion/test/ を .cbc に書き直す - rb_tree の stub をできるだけ取り外す - synchornizedQueue の meta部分を分離する - synchronizedQueue のバグをとる - GPU のバグとり - cbc++...? - -Sat Jan 28 16:10:28 JST 2017 - - stackからpopした後、呼び出される continuation は出力を受けとる。 - 出力を受けとる stub を生成する必要がある。 - なので、CodeGear が、そのような interface で定義されたものかどうかを調べる必要がある。 - Stackのnext(やisEmpty)に代入された時点でわかる。なので、あまり自明な見つける方法がない。 - 引数の異なるnextは異なる名前を持つべきか? 持たなくてもできるが... - - goto next(data, ...); 引数で渡された continuation に移動 - goto nodeStack->push(newNode, replaceNode1); Interface の呼び出し。(ここで replaceNode1 が stack の戻り値を受けることがわかる。 - goto replaceNode(traverse, traverse->current, newNode); 普通のgoto - goto rotateTree->next(...); DataGearに格納された continuation - - などをチェックする必要がある。これらの型チェックは CbC level では行われない。(CbCはmeta levelだから) - - 戻り値の部分は interface に記述させるという手もあるな。 - - -Sun Jan 22 20:11:28 JST 2017 - - TaskManagerから必要なCPUWorkerを生成する - WorkerはcreateWorker時に新しくthreadを作る - - TaskManager->createTaskで新しいContextを生成する - この時点でWorkerを番号で指定する - このContextにGearefで値を設定していく - 待ち合わせ用のDSを設定する - taskManager->spawnでWorkerにcontextを送る - -Fri Jan 13 17:47:40 JST 2017 - - Task は contextを直接使うことにする - DS には, まっているcontextをListを作る - context に実行中断中のCS の番号をいれるフィールドを用意する - 待っているDS のcount - createTaskの手順 - 新しくcontextを作る - allocate 用のheap も用意 - もとのcontextを全部copyする or 必要なものだけcopyする - 待ち合わせのDS群を指定する - 終わったあとの行き先を指定する(default は task_exit) - exception の行き先も必要な指定する - 待っているDSが全部揃っていたら active Queueに入れる - task の実行 - taskの実行後、 goto meta する直前で code gear commit を呼んで, Reader list を消化する - 複数から参照されるDSは一旦localに書き出して, その後atomic に書き出す - 複数から参照されるDSは何かしら宣言が必要 - つまり DS には 一つ一つ owner がいる - -Mon Nov 28 17:39:39 JST 2016 - - Task,TaskManager,Workerのインターフェースの実装を作成する - Taskを一旦Treeに入れずに直接Queueに入れる - - Task - CodeGen - IDataSeg - IDataSeg - ... - idsCount - nextTask(can be C_exit) - ODataSeg? - - TaskManager - createWorker - spawn (any,cpu,GPU) - taskSend - activeQueue - shutdown - deadlockDetectid - - SynchronizedQueue * Workerの数だけ - - Worker - execute - taskRecive - shutdown
--- a/src/parallel_execution/Tree.h Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -typedef struct Tree<Type, Impl>{ - /* future Code */ - /* Type* tree; */ - /* Type* node; */ - union Data* tree; - struct Node* node; - __code put(Impl* tree,Type* node, __code next(...)); - // __code get(Impl* tree, __code next(...)); - __code remove(Impl* tree,Type* node, __code next(...)); - // __code clearRedBlackTree(); - __code next(...); -} Tree;
--- a/src/parallel_execution/Worker.h Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -typedef struct Worker<Impl>{ - union Data* worker; - struct Queue* tasks; - struct Context* task; - __code taskReceive(Impl* worker, struct Queue* tasks); - __code shutdown(Impl* worker); - __code next(...); -} Worker;
--- a/src/parallel_execution/compare.c Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -#include "context.h" - -enum Relational compare(struct Node* node1, struct Node* node2) { - int key1 = node1->key; - int key2 = node2->key; - if (key1 == key2) { - return EQ; - } else if (key1 < key2) { - return GT; - } else { - return LT; - } -}
--- a/src/parallel_execution/context.h Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,447 +0,0 @@ -/* Context definition for llrb example */ -#ifndef CONTEXT_H -#define CONTEXT_H -#include <stdlib.h> -#include <pthread.h> -#ifdef USE_CUDAWorker -#include <cuda.h> -#include <driver_types.h> -#include <cuda_runtime.h> -#include "helper_cuda.h" -#endif - -#define ALLOCATE_SIZE 20000000 -#define NEW(type) (type*)(calloc(1, sizeof(type))) -#define NEWN(n, type) (type*)(calloc(n, sizeof(type))) - -#define ALLOC_DATA(context, dseg) ({\ - Meta* meta = (Meta*)context->heap;\ - meta->type = D_##dseg;\ - meta->size = sizeof(dseg);\ - meta->len = 1;\ - context->heap += sizeof(Meta);\ - context->data[D_##dseg] = context->heap; context->heap += sizeof(dseg); (dseg *)context->data[D_##dseg]; }) - -#define ALLOC_DATA_TYPE(context, dseg, t) ({\ - Meta* meta = (Meta*)context->heap;\ - meta->type = D_##t;\ - meta->size = sizeof(t);\ - meta->len = 1;\ - context->heap += sizeof(Meta);\ - context->data[D_##dseg] = context->heap; context->heap += sizeof(t); (t *)context->data[D_##dseg]; }) - -#define ALLOCATE(context, t) ({ \ - Meta* meta = (Meta*)context->heap;\ - context->heap += sizeof(Meta);\ - union Data* data = context->heap; \ - context->heap += sizeof(t); \ - meta->type = D_##t; \ - meta->size = sizeof(t); \ - meta->len = 1;\ - data; }) - -#define ALLOCATE_ARRAY(context, t, length) ({ \ - Meta* meta = (Meta*)context->heap;\ - context->heap += sizeof(Meta);\ - union Data* data = context->heap; \ - context->heap += sizeof(t)*length; \ - meta->type = D_##t; \ - meta->size = sizeof(t)*length; \ - meta->len = length; \ - data; }) - -#define ALLOCATE_PTR_ARRAY(context, dseg, length) ({\ - Meta* meta = (Meta*)context->heap;\ - context->heap += sizeof(Meta);\ - union Data* data = context->heap; \ - context->heap += sizeof(dseg *)*length; \ - meta->type = D_##dseg; \ - meta->size = sizeof(dseg *)*length; \ - meta->len = length; \ - data; }) - -#define ALLOCATE_DATA_GEAR(context, t) ({ \ - union Data* data = ALLOCATE(context, t); \ - Meta* meta = GET_META(data); \ - meta->wait = createSynchronizedQueue(context); \ - data; }) - -#define ALLOC(context, t) (&ALLOCATE(context, t)->t) - -#define GET_META(dseg) ((Meta*)(((void*)dseg) - sizeof(Meta))) -#define GET_TYPE(dseg) (GET_META(dseg)->type) -#define GET_SIZE(dseg) (GET_META(dseg)->size) -#define GET_LEN(dseg) (GET_META(dseg)->len) -#define GET_WAIT_LIST(dseg) (GET_META(dseg)->wait) - -#define Gearef(context, t) (&(context)->data[D_##t]->t) - -// (SingleLinkedStack *)context->data[D_Stack]->Stack.stack->Stack.stack - -#define GearImpl(context, intf, name) (Gearef(context, intf)->name->intf.name) - -#include "c/enumCode.h" - -enum Relational { - EQ, - GT, - LT, -}; - -#include "c/enumData.h" - -struct Context { - enum Code next; - struct Worker* worker; - struct TaskManager* taskManager; - int codeNum; - __code (**code) (struct Context*); - void* heapStart; - void* heap; - long heapLimit; - int dataNum; - int idgCount; //number of waiting dataGear - int idg; - int maxIdg; - int odg; - int maxOdg; - int workerId; - int gpu; // GPU task - struct Context* task; - struct Element* taskList; -#ifdef USE_CUDAWorker - int num_exec; - CUmodule module; - CUfunction function; -#endif - union Data **data; - - /* multi dimension parameter */ - int iterate; - struct Iterator* iterator; -}; - -typedef int Int; -#ifndef USE_CUDAWorker -typedef unsigned long long CUdeviceptr; -#endif -union Data { - struct Meta { - enum DataType type; - long size; - long len; - struct Queue* wait; // tasks waiting this dataGear - } Meta; - struct Context Context; - struct Timer { - union Data* timer; - enum Code start; - enum Code end; - enum Code next; - } Timer; - struct TimerImpl { - double time; - } TimerImpl; - struct LoopCounter { - int i; - } LoopCounter; - struct TaskManager { - union Data* taskManager; - enum Code spawn; // start NEW context on the worker - enum Code spawnTasks; // start NEW tasks on the worker - enum Code shutdown; - enum Code incrementTaskCount; - enum Code decrementTaskCount; - enum Code next; - enum Code next1; - enum Code setWaitTask; - struct Context* task; - struct Element* taskList; - union Data* data; - } TaskManager; - struct TaskManagerImpl { - enum Code next; - int numWorker; - int sendCPUWorkerIndex; - int sendGPUWorkerIndex; - int taskCount; - pthread_mutex_t mutex; - struct Queue* activeQueue; - struct Worker** workers; - struct Element* taskList; - int loopCounter; - int cpu; - int gpu; - int io; - int maxCPU; - } TaskManagerImpl; - struct Worker { - union Data* worker; - enum Code taskReceive; - enum Code shutdown; - enum Code next; - struct Queue* tasks; - pthread_t thread; - struct TaskManager* taskManager; - struct Context* task; - } Worker; - struct CPUWorker { - pthread_mutex_t mutex; - pthread_cond_t cond; - struct Context* context; - int id; - int loopCounter; - } CPUWorker; -#ifdef USE_CUDAWorker - struct CUDAWorker { - CUdevice device; - CUcontext cuCtx; - struct Context* context; - int id; - int loopCounter; - int deviceNum; - struct Queue* tasks; - int runFlag; - enum Code next; - int numStream; - struct Executor* executor; - CUstream *stream; - } CUDAWorker; -#else - struct CUDAWorker { - } CUDAWorker; -#endif - struct Main { - enum Code code; - enum Code next; - struct Queue* args; - } Main; - // Queue Interface - struct Queue { - union Data* queue; - union Data* data; - enum Code whenEmpty; - enum Code clear; - enum Code put; - enum Code take; - enum Code isEmpty; - enum Code next; - } Queue; - struct SingleLinkedQueue { - struct Element* top; - struct Element* last; - } SingleLinkedQueue; - struct SynchronizedQueue { - struct Element* top; - struct Element* last; - struct Atomic* atomic; - } SynchronizedQueue; - // Stack Interface - struct Stack { - union Data* stack; - union Data* data; - union Data* data1; - enum Code whenEmpty; - enum Code clear; - enum Code push; - enum Code pop; - enum Code pop2; - enum Code isEmpty; - enum Code get; - enum Code get2; - enum Code next; - } Stack; - // Stack implementations - struct SingleLinkedStack { - struct Element* top; - } SingleLinkedStack; - struct ArrayStack { - int size; - int limit; - struct Element* array; - } ArrayStack; - // Stack implementation end - struct Element { - union Data* data; - struct Element* next; - } Element; - struct Array { - int prefix; - Int* array; - } Array; - struct Tree { - union Data* tree; - struct Node* node; - enum Code put; - enum Code get; - enum Code remove; - enum Code clear; - enum Code next; - } Tree; - struct RedBlackTree { - struct Node* root; - struct Node* current; // reading node of original tree - struct Node* previous; // parent of reading node of original tree - struct Node* newNode; // writing node of new tree - struct Node* parent; - struct Node* grandparent; - struct Stack* nodeStack; - enum Code findNodeNext; - int result; - } RedBlackTree; - struct RotateTree { - enum Code next; - struct RedBlackTree* traverse; - struct Tree* tree; - } RotateTree; - struct Node { - int key; // comparable data segment - union Data* value; - struct Node* left; - struct Node* right; - // need to balancing - enum Color { - Red, - Black, - // Red eq 0,Black eq 1. enum name convert intager. - } color; - } Node; - struct Atomic { - union Data* atomic; - union Data** ptr; - union Data* oldData; - union Data* newData; - enum Code checkAndSet; - enum Code next; - enum Code fail; - } Atomic; - struct AtomicReference { - } AtomicReference; - struct Semaphore { - union Data* semaphore; - enum Code p; - enum Code v; - enum Code next; - } Semaphore; - struct SemaphoreImpl { - int value; - struct Lock* lock; - struct Queue* waitThreadQueue; - } SemaphoreImpl; - struct Allocate { - enum Code next; - long size; - } Allocate; - struct Integer { - int value; - } Integer; - struct SortArray { - struct Integer *array; //Array arrayじゃできない? - int loopCounter; - int block; - int first; - int prefix; - } SortArray; - struct Iterator { - union Data* iterator; - struct Context* task; - int numGPU; - enum Code exec; - enum Code barrier; - enum Code whenWait; - enum Code next; - } Iterator; - struct MultiDimIterator { - int x; - int y; - int z; - int count; - int counterX; - int counterY; - int counterZ; - } MultiDimIterator; - struct MultiDim { - int x; - int y; - int z; - } MultiDim; - struct Executor { - union Data* executor; - struct Context* task; - enum Code read; - enum Code exec; - enum Code write; - enum Code next; - } Executor; -#ifdef USE_CUDAWorker - struct CUDAExecutor { - CUdeviceptr** kernelParams; - struct CUDABuffer* buffer; - int maxThreadPerBlock; - } CUDAExecutor; - struct CUDABuffer { - int inputLen; - int outputLen; - union Data** inputData; - union Data** outputData; - } CUDABuffer; - CUdeviceptr CUdeviceptr; -#else - struct CUDAExecutor { - } CUDAExecutor; - struct CUDABuffer { - } CUDABuffer; - CUdeviceptr CUdeviceptr; -#endif - Int Int; - struct Memory { - union Data* adr; - int length; - union Data* body; - int hash; - } Memory; - struct Buffer { - union Data* buffer; - union Data* data; - enum Code put; - enum Code take; - enum Code next; - } Buffer; - struct BoundedBuffer { - struct Element* top; - struct Element* last; - struct Semaphore* fullCount; - struct Semaphore* emptyCount; - struct Semaphore* lock; - } BoundedBuffer; - struct Lock { - union Data* lock; - enum Code doLock; - enum Code doUnlock; - enum Code next; - } Lock; - struct LockImpl { - Int* lock; - struct Queue* waitThreadQueue; - struct Atomic* atomic; - struct Context* lockContext; - } LockImpl; - struct SpinLock { - volatile Int* lock; - struct Atomic* atomic; - struct Context* lockContext; - } SpinLock; -}; // union Data end this is necessary for context generator -typedef union Data Data; - -#include "c/typedefData.h" - -#include "c/extern.h" - -extern __code start_code(struct Context* context); -extern __code exit_code(struct Context* context); -extern __code meta(struct Context* context, enum Code next); -extern __code par_meta(struct Context* context, enum Code spawns, enum Code next); -extern void initContext(struct Context* context); - -#endif
--- a/src/parallel_execution/cuda.c Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -#include <stdio.h> -#include <sys/time.h> -#include <string.h> -#include <stdlib.h> - -// includes, project -#include <driver_types.h> -#include <cuda_runtime.h> -#include <cuda.h> -#include "helper_cuda.h" -#include "pthread.h" - -#include "context.h" - -/* -struct Context { - int next; - struct Worker* worker; - struct TaskManager* taskManager; - int codeNum; - void (**code) (struct Context*); - void* heapStart; - void* heap; - long heapLimit; - int dataNum; - int idgCount; //number of waiting dataGear - int idg; - int maxIdg; - int odg; - int maxOdg; - int workerId; - struct Context* task; - struct Queue* tasks; - int num_exec; - CUmodule module; - CUfunction function; - union Data **data; - - // multi dimension parameter - int iterate; - struct Iterator* iterator; -}; - -struct CUDAWorker { - CUdevice device; - CUcontext cuCtx; - pthread_t thread; - struct Context* context; - int id; - struct Queue* tasks; - int runFlag; - int next; - int numStream; - CUstream *stream; -} CUDAWorker; - -struct LoopCounter { - int i; -} LoopCounter; - -struct Array { - int size; - int index; - int prefix; - int* array; -} Array; -*/ - -void cudaInit(struct CUDAWorker *cudaWorker,int phase, int deviceNum) { - // initialize and load kernel - cudaWorker->numStream = 1; // number of stream - // cudaWorker->stream = NEWN(cudaWorker->numStream, CUstream ); - if (phase==0) - checkCudaErrors(cuInit(0)); - if (phase==0) - checkCudaErrors(cuDeviceGet(&cudaWorker->device, deviceNum)); - if (phase==0) - checkCudaErrors(cuCtxCreate(&cudaWorker->cuCtx, CU_CTX_SCHED_SPIN, cudaWorker->device)); - // if (cudaWorker->num_stream) { - // for (int i=0;i<cudaWorker->num_stream;i++) - // checkCudaErrors(cuStreamCreate(&cudaWorker->stream[i],0)); - // } - printf("cuda Init: Done\n"); -} - -void cudaLoadFunction(struct Context* context, char* filename, char* function) { - checkCudaErrors(cuModuleLoad(&context->module, filename)); - checkCudaErrors(cuModuleGetFunction(&context->function, context->module, function)); -} - -void cudaShutdown(struct CUDAWorker *worker) { - // for (int i=0;i<worker->num_stream;i++) - // checkCudaErrors(cuStreamDestroy(worker->stream[i])); - checkCudaErrors(cuCtxDestroy(worker->cuCtx)); -}
--- a/src/parallel_execution/examples/bitonicSort/CUDAbitonicSwap.cu Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -extern "C" { - struct Integer { - int value; - }; - struct SortArray { - struct Integer *array; - int loopCounter; - int block; - int first; - int prefix; - }; - __global__ void bitonicSwap(struct Integer* array, struct SortArray* sortArray) { - int block = sortArray->block; - int first = sortArray->first; - int prefix = sortArray->prefix; - int i = 0; -C_bitonicSwap: - if (i < prefix) { - int index = i + (blockIdx.x * blockDim.x + threadIdx.x) * prefix; - int position = index/block; - int index1 = index+block*position; - int index2 = (first == 1)? ((block<<1)*(position+1))-(index1%block)-1 : index1+block; - if (array[index2].value < array[index1].value) { - struct Integer tmp = array[index1]; - array[index1] = array[index2]; - array[index2] = tmp; - } - i++; - goto C_bitonicSwap; - } - } -}
--- a/src/parallel_execution/examples/bitonicSort/SortArray.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -typedef struct SortArray<Impl>{ - SortArray *sortArray; - Integer **array; - int loop_counter; - int loop_counter2; - int loop_counter3; - int sort_finish; - __code print(struct SortArray* sortArray, __code next(...)); - __code make_array(struct SortArray* sortArray, __code next(...)); - __code bitonic_sort(struct SortArray* sortArray, __code next(...)); - __code kernel(struct SortArray* sortArray, __code next(...)); - __code kernel2(struct SortArray* sortArray, __code next(...)); - __code swap(struct SortArray* sortArray, __code next(...)); -} SortArray;
--- a/src/parallel_execution/examples/bitonicSort/bitonicSort.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +0,0 @@ -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> -#include <math.h> - -#include "../../../context.h" -#interface "TaskManager.h" - -int cpu_num = 1; -int length = 1024; -int split = 8; -int gpu_num = 0; -int CPU_ANY = -1; -int CPU_CUDA = -1; - -void *start_taskManager(struct Context *context) { - goto initDataGears(context, Gearef(context, LoopCounter), Gearef(context, TaskManager)); - return 0; -} - -__code initDataGears(struct LoopCounter* loopCounter, struct TaskManager* taskManager) { - // loopCounter->tree = createRedBlackTree(context); - loopCounter->i = 0; - taskManager->taskManager = (union Data*)createTaskManagerImpl(context, cpu_num, gpu_num, 0); - goto code1(); -} - -__code initDataGears_stub(struct Context* context) { - struct TaskManager* taskManager = Gearef(context, TaskManager); - taskManager->taskManager = 0; - struct LoopCounter* loopCounter = Gearef(context, LoopCounter); - goto initDataGears(context, loopCounter, taskManager); -} - -__code code1(struct LoopCounter* loopCounter) { - printf("cpus:\t\t%d\n", cpu_num); - printf("gpus:\t\t%d\n", gpu_num); - printf("length:\t\t%d\n", length); - printf("length/task:\t%d\n", length/split); - /* puts("queue"); */ - /* print_queue(context->data[ActiveQueue]->queue.first); */ - /* puts("tree"); */ - /* print_tree(context->data[Tree]->tree.root); */ - /* puts("result"); */ - - goto createTask1(); -} - -__code createTask1(struct LoopCounter* loopCounter, struct TaskManager* taskManager) { - struct SortArray* outputSortArray = new SortArray(); - struct SortArray* inputSortArray = outputSortArray; - struct Timer* timer = createTimerImpl(context); - - par goto makeArray(outputSortArray, timer, __exit); - - for (int i=2; i <= length; i=2*i) { - int first = 1; - for (int j=i>>1; j > 0; j=j>>1) { - outputSortArray = new SortArray(); - inputSortArray->prefix = length/2/split; - inputSortArray->block = j; - inputSortArray->first = first; - par goto bitonicSwap(inputSortArray, outputSortArray, iterate(split), __exit); - first = 0; - inputSortArray = outputSortArray; - } - } - - par goto printArray(inputSortArray, timer, __exit); - - goto code2(); -} - -__code code2(struct TaskManager* taskManager) { - goto taskManager->shutdown(exit_code); -} - -__code code2_stub(struct Context* context) { - goto code2(context, &Gearef(context, TaskManager)->taskManager->TaskManager); -} - -void init(int argc, char** argv) { - for (int i = 1; argv[i]; ++i) { - if (strcmp(argv[i], "-cpu") == 0) - cpu_num = (int)atoi(argv[i+1]); - else if (strcmp(argv[i], "-l") == 0) - length = (int)atoi(argv[i+1]); - else if (strcmp(argv[i], "-s") == 0) - split = (int)atoi(argv[i+1]); - else if (strcmp(argv[i], "-cuda") == 0) { - gpu_num = 1; - CPU_CUDA = 0; - } - } -} - -int main(int argc, char** argv) { - init(argc, argv); - goto initDataGears(); -}
--- a/src/parallel_execution/examples/bitonicSort/bitonicSwap.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -#include "../../../context.h" -#include <stdio.h> - -#ifdef USE_CUDAWorker -extern void cudaLoadFunction(struct Context* context, char* filename, char* function); -#endif - -__code bitonicSwap(struct SortArray* inputArray, struct MultiDim* multiDim, __code next(struct SortArray* output, ...), struct LoopCounter* loopCounter) { - struct SortArray* output = *O_output; - int block = inputArray->block; - int first = inputArray->first; - if (loopCounter->i < inputArray->prefix) { - int index = loopCounter->i + multiDim->x * inputArray->prefix; - int position = index/block; - int index1 = index+block*position; - int index2 = (first == 1)? ((block<<1)*(position+1))-(index1%block)-1 : index1+block; - struct Integer* array = inputArray->array; - if (array[index2].value < array[index1].value) { - struct Integer tmp = array[index1]; - array[index1] = array[index2]; - array[index2] = tmp; - } - loopCounter->i++; - goto meta(context, C_bitonicSwap); - } - loopCounter->i = 0; - output->array = inputArray->array; - *O_output = output; - goto meta(context, next); -} - -__code bitonicSwap_stub(struct Context* context) { -#ifdef USE_CUDAWorker - if (context->gpu) { - SortArray* inputSortArray = &context->data[context->idg]->SortArray; - SortArray* outputSortArray = &context->data[context->odg]->SortArray; - CUDABuffer* buffer = &ALLOCATE(context, CUDABuffer)->CUDABuffer; - buffer->inputData = (union Data**)ALLOCATE_PTR_ARRAY(context, SortArray, 2); - buffer->inputData[0] = (union Data*)inputSortArray->array; - buffer->inputData[1] = (union Data*)inputSortArray; - buffer->outputData = NULL; - buffer->inputLen = 2; - buffer->outputLen = 0; - //continuationにそってGPUworkerに戻る - outputSortArray->array = inputSortArray->array; - Executor* executor = context->worker->worker->CUDAWorker.executor; - executor->executor->CUDAExecutor.buffer = buffer; - cudaLoadFunction(context, "c/examples/bitonicSort/CUDAbitonicSwap.ptx", "bitonicSwap"); - Gearef(context, Executor)->executor = (union Data*)executor; - Gearef(context, Executor)->task = context; - Gearef(context, Executor)->next = context->next; - goto meta(context, executor->read); - } -#endif - SortArray** O_output = (struct SortArray **)&context->data[context->odg]; - goto bitonicSwap(context, - &context->data[context->idg]->SortArray, - &context->data[context->idg+1]->MultiDim, - context->next, - O_output, - Gearef(context, LoopCounter)); -}
--- a/src/parallel_execution/examples/bitonicSort/makeArray.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -#include "../../../context.h" -#include <stdio.h> -#interface "Timer.h" - -extern int length; -__code makeArray(__code next(struct SortArray* output, struct Timer* output1, ...)){ - struct SortArray* output = *O_output; - struct Timer* output1 = *O_output1; - if (output->loopCounter == 0){ - output->array = (Integer*)ALLOCATE_ARRAY(context, Integer, length); - srand((unsigned) time(NULL)); - } - if (output->loopCounter == GET_LEN(output->array)){ - printf("created Array\n"); - output->loopCounter = 0; - *O_output = output; - *O_output1 = output1; - goto output1->start(next(...)); - } - output->array[output->loopCounter].value = rand() % 1000; - //printf("%d\n", output->array[output->loopCounter]->value); - output->loopCounter++; - *O_output = output; - *O_output1 = output1; - goto meta(context, C_makeArray); -} - -__code makeArray_stub(struct Context* context) { - SortArray** O_output = (struct SortArray**)&context->data[context->odg]; - Timer** O_output1 = (struct Timer**)&context->data[context->odg+1]; - goto makeArray(context, - context->next, - O_output, - O_output1); -}
--- a/src/parallel_execution/examples/bitonicSort/printArray.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -#include "../../../context.h" -#interface "Timer.h" -#include <stdio.h> - -__code printArray(struct SortArray* inputArray, struct Timer* inputTimer, __code next(...)){ - goto inputTimer->end(printArray1); -} - -__code printArray_stub(struct Context* context) { - goto printArray(context, - &context->data[context->idg]->SortArray, - &context->data[context->idg+1]->Timer, - context->next); -} - -__code printArray1(struct SortArray* inputArray, __code next(...)){ - //printf("%d\n", inputArray->array[inputArray->loopCounter].value); - inputArray->loopCounter++; - if (inputArray->loopCounter == GET_LEN(inputArray->array)){ - printf("sort completed\n"); - inputArray->loopCounter = 0; - goto meta(context, next); - } - if (inputArray->array[inputArray->loopCounter-1].value > inputArray->array[inputArray->loopCounter].value) { - printf("wrong result\n"); - goto meta(context, next); - } - goto meta(context, C_printArray1); -} - -__code printArray1_stub(struct Context* context) { - goto printArray1(context, - &context->data[context->idg]->SortArray, - context->next); -}
--- a/src/parallel_execution/examples/bitonicSort/sort.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -#include<stdio.h> -#include <stdlib.h> -#include "../../../context.h" -#define LOGN 5 -#define MAX 1 << LOGN - -int main(int argc, char const* argv[]) { - struct Context* main_context = NEW(struct Context); - initContext(main_context); - main_context->next = C_sort_start; - goto start_code(main_context); -} - -__code sort_start(struct SortArray* sortArray){ - sortArray->sortArray = new SortArray(); - sortArray->sortArray->array = (Integer**)ALLOCATE_PTR_ARRAY(context, Integer, MAX);//ALLOC_ARRAYはDSの配列なのでintではできない - sortArray->sortArray->loop_counter = 0; - sortArray->sortArray->loop_counter2 = 0; - sortArray->sortArray->loop_counter3 = 0; - srand((unsigned) time(NULL)); - goto meta(context, C_make_array); -} - -__code make_array(struct SortArray* sortArray){//乱数生成 - if (sortArray->sortArray->loop_counter == MAX){//ループの終了→配列表示へ - sortArray->sortArray->loop_counter = 0; - goto meta(context, C_print); - } - struct Integer* integer = new Integer(); - integer->value = rand() % 1000; - sortArray->sortArray->array[sortArray->sortArray->loop_counter] = integer; - sortArray->sortArray->loop_counter++; - goto meta(context, C_make_array); -} - -__code print(struct SortArray* sortArray){//配列表示 - if (sortArray->sortArray->loop_counter == MAX){//ループの終了→ソートへ - printf("\n"); - if(sortArray->sortArray->sort_finish == 1){//ソート終わってたら終了 - goto meta(context, C_exit_code); - } - sortArray->sortArray->loop_counter = 0; - sortArray->sortArray->loop_counter2 = 0; - goto meta(context, C_bitonic_sort); - } - - printf("%d, ", sortArray->sortArray->array[sortArray->sortArray->loop_counter]->value); - sortArray->sortArray->loop_counter++; - goto meta(context, C_print); -} - -__code bitonic_sort(struct SortArray* sortArray){//ソートの繰り返し - if (sortArray->sortArray->loop_counter >= LOGN){//ループの終了→配列表示へ - sortArray->sortArray->loop_counter = 0; - sortArray->sortArray->sort_finish = 1; - goto meta(context, C_print); - } - goto meta(context, C_kernel); -} - -__code kernel(struct SortArray* sortArray){//繰り返し2 - if (sortArray->sortArray->loop_counter2 > sortArray->sortArray->loop_counter){//ループの終了→上のループへ - sortArray->sortArray->loop_counter++; - sortArray->sortArray->loop_counter2 = 0; - goto meta(context, C_bitonic_sort); - } - - goto meta(context, C_kernel2); -} - -__code kernel2(struct SortArray* sortArray){//ソートの中身 - int i = sortArray->sortArray->loop_counter3; - - if (i >= GET_LEN(sortArray->sortArray->array)){//ループの終了→上のループへ - sortArray->sortArray->loop_counter2++; - sortArray->sortArray->loop_counter3 = 0; - goto meta(context, C_kernel); - } - - goto meta(context, C_swap); -} - -__code swap(struct SortArray* sortArray){//配列の要素を入れ替える - int i = sortArray->sortArray->loop_counter3; - int d = 1 << (sortArray->sortArray->loop_counter - sortArray->sortArray->loop_counter2); - int up = ((i >> sortArray->sortArray->loop_counter) & 2) == 0; - - if ((i & d) == 0 && (sortArray->sortArray->array[i]->value > sortArray->sortArray->array[i | d]->value) == up) { - struct Integer *tmp = sortArray->sortArray->array[i]; - sortArray->sortArray->array[i] = sortArray->sortArray->array[i | d]; - sortArray->sortArray->array[i | d] = tmp; - } - sortArray->sortArray->loop_counter3++; - goto meta(context, C_kernel2);//上位のループへ -}
--- a/src/parallel_execution/examples/boundedBuffer/BoundedBuffer.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -#include "../../../context.h" -#interface "Buffer.h" -#interface "Semaphore.h" - -Buffer* createBoundedBuffer(struct Context* context, int size) { - struct Buffer* buffer = new Buffer(); - struct BoundedBuffer* boundedBuffer = new BoundedBuffer(); - boundedBuffer->top = new Element(); - boundedBuffer->top->next = NULL; - boundedBuffer->last = boundedBuffer->top; - boundedBuffer->fullCount = createSemaphoreImpl(context, 0); - boundedBuffer->emptyCount = createSemaphoreImpl(context, size); - boundedBuffer->lock = createSemaphoreImpl(context, 1); // binary semaphore - buffer->buffer = (union Data*)boundedBuffer; - buffer->take = C_takeBoundedBuffer; - buffer->put = C_putBoundedBuffer; - return buffer; -} - -__code putBoundedBuffer(struct BoundedBuffer* buffer, union Data* data, __code next(...)) { - struct Semaphore* semaphore = buffer->emptyCount; - goto semaphore->p(putBoundedBuffer1); -} - -__code putBoundedBuffer1(struct BoundedBuffer* buffer, union Data* data, __code next(...)) { - struct Semaphore* semaphore = buffer->lock; - goto semaphore->p(putBoundedBuffer2); -} - -__code putBoundedBuffer2(struct BoundedBuffer* buffer, union Data* data, __code next(...)) { - struct Element* element = new Element(); - element->data = data; - element->next = NULL; - struct Element* last = buffer->last; - last->next = element; - buffer->last = element; - struct Semaphore* semaphore = buffer->lock; - goto semaphore->v(putBoundedBuffer3); -} - -__code putBoundedBuffer3(struct BoundedBuffer* buffer, union Data* data, __code next(...)) { - struct Semaphore* semaphore = buffer->fullCount; - goto semaphore->v(putBoundedBuffer4); -} - -__code putBoundedBuffer4(struct BoundedBuffer* buffer, union Data* data, __code next(...)) { - goto next(...); -} -__code takeBoundedBuffer(struct BoundedBuffer* buffer, __code next(union Data* data, ...)) { - struct Semaphore* semaphore = buffer->fullCount; - goto semaphore->p(takeBoundedBuffer1); -} - -__code takeBoundedBuffer1(struct BoundedBuffer* buffer, __code next(union Data* data, ...)) { - struct Semaphore* semaphore = buffer->lock; - goto semaphore->p(takeBoundedBuffer2); -} - -__code takeBoundedBuffer2(struct BoundedBuffer* buffer, __code next(union Data* data, ...)) { - struct Element* top = buffer->top; - struct Element* nextElement = top->next; - data = nextElement->data; - *O_data =data; - buffer->top = nextElement; - struct Semaphore* semaphore = buffer->lock; - goto semaphore->v(takeBoundedBuffer3); -} - -__code takeBoundedBuffer3(struct BoundedBuffer* buffer, __code next(union Data* data, ...)) { - struct Semaphore* semaphore = buffer->emptyCount; - goto semaphore->v(takeBoundedBuffer4); -} - -__code takeBoundedBuffer4(struct BoundedBuffer* buffer, __code next(union Data* data, ...)) { - goto next(data, ...); -}
--- a/src/parallel_execution/examples/boundedBuffer/SemaphoreImpl.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -#include "../../../context.h" -#interface "Semaphore.h" -#interface "Queue.h" -#interface "TaskManager.h" -#interface "Lock.h" - -Semaphore* createSemaphoreImpl(struct Context* context, int n) { - struct Semaphore* semaphore = new Semaphore(); - struct SemaphoreImpl* semaphoreImpl = new SemaphoreImpl(); - semaphore->semaphore = (union Data*)semaphoreImpl; - semaphoreImpl->value = n; - semaphoreImpl->waitThreadQueue = createSingleLinkedQueue(context); - semaphoreImpl->lock = createSpinLock(context); - semaphore->p = C_pOperationSemaphoreImpl; - semaphore->v = C_vOperationSemaphoreImpl; - return semaphore; -} - -__code pOperationSemaphoreImpl(struct SemaphoreImpl* semaphore, __code next(...)) { - struct Lock* lock = semaphore->lock; - goto lock->doLock(pOperationSemaphoreImpl1); -} - -__code pOperationSemaphoreImpl1(struct SemaphoreImpl* semaphore, __code next(...)) { - if(semaphore->value == 0) { - context->next= C_pOperationSemaphoreImpl; - struct Queue* queue = semaphore->waitThreadQueue; - goto queue->put(context, pOperationSemaphoreImpl2); // put this context(thread, process) - } - semaphore->value--; - struct Lock* lock = semaphore->lock; - goto lock->doUnlock(next(...)); -} - -__code pOperationSemaphoreImpl2(struct SemaphoreImpl* semaphore, __code next(...)) { - struct Lock* lock = semaphore->lock; - goto lock->doUnlock(pOperationSemaphoreImpl3); -} - -__code pOperationSemaphoreImpl3(struct SemaphoreImpl* semaphore, struct Worker* worker, __code next(...)) { - goto worker->taskReceive(); // goto shceduler -} - -__code pOperationSemaphoreImpl3_stub(struct Context* context) { - // switch worker context - struct Context* workerContext = context->worker->worker->CPUWorker.context; - SemaphoreImpl* semaphoreImpl = (SemaphoreImpl*)GearImpl(context, Semaphore, semaphore); - goto pOperationSemaphoreImpl3(workerContext, - semaphoreImpl, - context->worker, - Gearef(context, Semaphore)->next); -} - -__code vOperationSemaphoreImpl(struct SemaphoreImpl* semaphore, __code next(...)) { - struct Lock* lock = semaphore->lock; - goto lock->doLock(vOperationSemaphoreImpl1); -} - -__code vOperationSemaphoreImpl1(struct SemaphoreImpl* semaphore, __code next(...)) { - semaphore->value++; - struct Queue* queue = semaphore->waitThreadQueue; - goto queue->isEmpty(vOperationSemaphoreImpl2, vOperationSemaphoreImpl4); -} - -__code vOperationSemaphoreImpl2(struct SemaphoreImpl* semaphore, __code next(...)) { - struct Queue* queue = semaphore->waitThreadQueue; - goto queue->take(vOperationSemaphoreImpl3); -} - -__code vOperationSemaphoreImpl3(struct SemaphoreImpl* semaphore, struct Context* waitTask, __code next(...)) { - struct TaskManager* taskManager = waitTask->taskManager; - goto taskManager->spawn(waitTask, vOperationSemaphoreImpl4); //notify -} - -__code vOperationSemaphoreImpl3_stub(struct Context* context) { - SemaphoreImpl* semaphoreImpl = (SemaphoreImpl*)GearImpl(context, Semaphore, semaphore); - struct Context* waitTask = &Gearef(context, Queue)->data->Context; - goto vOperationSemaphoreImpl3(context, - semaphoreImpl, - waitTask, - Gearef(context, Semaphore)->next); -} - -__code vOperationSemaphoreImpl4(struct SemaphoreImpl* semaphore, __code next(...)) { - struct Lock* lock = semaphore->lock; - goto lock->doUnlock(next(...)); -}
--- a/src/parallel_execution/examples/boundedBuffer/consumer.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -#include "../../../context.h" -#include <stdio.h> -#interface "Buffer.h" - -__code consumer(struct Buffer* buffer, Int length, __code next(...), struct LoopCounter* loopCounter) { - int i = loopCounter->i; - if (i < length) { - loopCounter->i++; - goto buffer->take(consumer1); - } - goto next(...); -} - -__code consumer_stub(struct Context* context) { - goto consumer(context, - &context->data[context->idg]->Buffer, - context->data[context->idg+1]->Int, - context->next, - Gearef(context, LoopCounter)); -} - -__code consumer1(struct Buffer* buffer, Int length, __code next(...), struct Node* node) { - printf("getData %d\n", node->value->Int); - goto consumer(); -} - -__code consumer1_stub(struct Context* context) { - goto consumer1(context, - &context->data[context->idg]->Buffer, - context->data[context->idg+1]->Int, - context->next, - &Gearef(context, Buffer)->data->Node); -}
--- a/src/parallel_execution/examples/boundedBuffer/initBuffer.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -#include "../../../context.h" - -__code initBuffer(__code next(struct Buffer* output, Int* output1, ...)) { - struct Buffer* output = *O_output; - Int* output1 = *O_output1; - goto next(output, output1, ...); -} - -__code initBuffer_stub(struct Context* context) { - struct Buffer** O_output = (struct Buffer**)&context->data[context->odg]; - Int** O_output1 = (Int**)&context->data[context->odg+1]; - goto initBuffer(context, - context->next, - O_output, - O_output1); -}
--- a/src/parallel_execution/examples/boundedBuffer/main.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> -#include <assert.h> - -#include "../../../context.h" -#interface "TaskManager.h" - -int cpu_num = 1; -int length = 100; -int buffer_size = 10; -int gpu_num = 0; -int CPU_ANY = -1; -int CPU_CUDA = -1; - -void *start_taskManager(struct Context *context) { - goto initDataGears(context, Gearef(context, LoopCounter), Gearef(context, TaskManager)); - return 0; -} - -__code initDataGears(struct LoopCounter* loopCounter, struct TaskManager* taskManager) { - // loopCounter->tree = createRedBlackTree(context); - loopCounter->i = 0; - taskManager->taskManager = (union Data*)createTaskManagerImpl(context, cpu_num, gpu_num, 0); - goto code1(); -} - -__code initDataGears_stub(struct Context* context) { - struct TaskManager* taskManager = Gearef(context, TaskManager); - taskManager->taskManager = 0; - struct LoopCounter* loopCounter = Gearef(context, LoopCounter); - goto initDataGears(context, loopCounter, taskManager); -} - -__code code1(struct Timer* timer) { - printf("cpus:\t\t%d\n", cpu_num); - printf("gpus:\t\t%d\n", gpu_num); - printf("length:\t\t%d\n", length); - goto createTask1(); -} - -__code code2(struct TaskManager* taskManager) { - goto taskManager->shutdown(exit_code); -} - -__code code2_stub(struct Context* context) { - goto code2(context, &Gearef(context, TaskManager)->taskManager->TaskManager); -} - -__code createTask1(struct TaskManager* taskManager) { - struct Buffer* buffer = createBoundedBuffer(context, buffer_size); - Int* len = new Int(); - *len = length; - par goto producer(buffer, len, __exit); - par goto producer(buffer, len, __exit); - par goto consumer(buffer, len, __exit); - par goto consumer(buffer, len, __exit); - par goto initBuffer(buffer, len, __exit); - goto code2(); -} - -void init(int argc, char** argv) { - for (int i = 1; argv[i]; ++i) { - if (strcmp(argv[i], "-cpu") == 0) - cpu_num = (int)atoi(argv[i+1]); - else if (strcmp(argv[i], "-l") == 0) - length = (int)atoi(argv[i+1]); - else if (strcmp(argv[i], "-bufferSize") == 0) - buffer_size = (int)atoi(argv[i+1]); - else if (strcmp(argv[i], "-cuda") == 0) { - gpu_num = 1; - CPU_CUDA = 0; - } - } -} - -int main(int argc, char** argv) { - init(argc, argv); - goto initDataGears(); -}
--- a/src/parallel_execution/examples/boundedBuffer/producer.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -#include "../../../context.h" -#interface "Buffer.h" - -__code producer(struct Buffer* buffer, Int length, __code next(...), struct LoopCounter* loopCounter) { - int i = loopCounter->i; - if (i < length) { - Node* node = new Node(); - node->value = (union Data*)new Int(); - node->value->Int = i; - loopCounter->i++; - goto buffer->put(node, producer); - } - goto next(...); -} - -__code producer_stub(struct Context* context) { - goto producer(context, - &context->data[context->idg]->Buffer, - context->data[context->idg+1]->Int, - context->next, - Gearef(context, LoopCounter)); -}
--- a/src/parallel_execution/examples/calc/add.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -#include "../../../context.h" -#include <stdio.h> -__code add(struct Integer* input1, struct Integer* input2, __code next(struct Integer* output, ...)) { - struct Integer* output = *O_output; - output->value = input1->value + input2->value; - printf("%d + %d = %d\n", input1->value, input2->value, output->value); - *O_output = output; - goto meta(context, next); -} - -__code add_stub(struct Context* context) { - Integer** O_output = (struct Integer **)&context->data[context->odg]; - goto add(context, - &context->data[context->idg]->Integer, - &context->data[context->idg + 1]->Integer, - context->next, - O_output); -}
--- a/src/parallel_execution/examples/calc/calc.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> -#include <assert.h> - -#include "../../../context.h" -#interface "TaskManager.h" - -int cpu_num = 1; -int length = 100; -int gpu_num = 0; -int CPU_ANY = -1; -int CPU_CUDA = -1; - -void *start_taskManager(struct Context *context) { - goto initDataGears(context, Gearef(context, LoopCounter), Gearef(context, TaskManager)); - return 0; -} - -__code initDataGears(struct LoopCounter* loopCounter, struct TaskManager* taskManager) { - // loopCounter->tree = createRedBlackTree(context); - loopCounter->i = 0; - taskManager->taskManager = (union Data*)createTaskManagerImpl(context, cpu_num, gpu_num, 0); - goto meta(context, C_code1); -} - -__code initDataGears_stub(struct Context* context) { - struct TaskManager* taskManager = Gearef(context, TaskManager); - taskManager->taskManager = 0; - struct LoopCounter* loopCounter = Gearef(context, LoopCounter); - goto initDataGears(context, loopCounter, taskManager); -} - -__code code1(struct Timer* timer) { - printf("cpus:\t\t%d\n", cpu_num); - printf("gpus:\t\t%d\n", gpu_num); - printf("length:\t\t%d\n", length); - /* puts("queue"); */ - /* print_queue(context->data[ActiveQueue]->queue.first); */ - /* puts("tree"); */ - /* print_tree(context->data[Tree]->tree.root); */ - /* puts("result"); */ - - //time->next = C_code2; - goto meta(context, C_createTask1); - //goto meta(context, C_start_time); -} - -__code code1_stub(struct Context* context) { - goto code1(context, Gearef(context, Timer)); -} - - -__code createTask1(struct LoopCounter* loopCounter, struct TaskManager* taskManager) { - int i = loopCounter->i; - - if (i < length) { - loopCounter->i++; - goto meta(context, C_createTask2); - } - - loopCounter->i = 0; - taskManager->next = C_exit_code; - goto meta(context, taskManager->taskManager->TaskManager.shutdown); -} - -__code createTask2(struct LoopCounter* loopCounter, struct TaskManager* taskManager) { - Integer* integer1 = new Integer(); - Integer* integer2 = new Integer(); - Integer* integer3 = new Integer(); - par goto mult(integer1, integer2, integer3, __exit); - - Integer* integer4 = new Integer(); - Integer* integer5 = new Integer(); - par goto add(integer4, integer5, integer1, __exit); - - par goto initIntegerDataGears(integer2, integer4, integer5, __exit); - - goto createTask1(); -} - -void init(int argc, char** argv) { - for (int i = 1; argv[i]; ++i) { - if (strcmp(argv[i], "-cpu") == 0) - cpu_num = (int)atoi(argv[i+1]); - else if (strcmp(argv[i], "-l") == 0) - length = (int)atoi(argv[i+1]); - else if (strcmp(argv[i], "-cuda") == 0) { - gpu_num = 1; - CPU_CUDA = 0; - } - } -} - -int main(int argc, char** argv) { - init(argc, argv); - goto initDataGears(); -}
--- a/src/parallel_execution/examples/calc/initIntegerDataGears.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -#include "../../../context.h" -#include <stdio.h> -__code initIntegerDataGears(__code next(struct Integer* output1, struct Integer* output2, struct Integer* output3, ...)) { - struct Integer* output1 = *O_output1; - struct Integer* output2 = *O_output2; - struct Integer* output3 = *O_output3; - output1->value = 1; - output2->value = 2; - output3->value = 3; - *O_output1 = output1; - *O_output2 = output2; - *O_output3 = output3; - goto meta(context, next); -} - -__code initIntegerDataGears_stub(struct Context* context) { - Integer** O_output1 = (struct Integer **)&context->data[context->odg]; - Integer** O_output2 = (struct Integer **)&context->data[context->odg+1]; - Integer** O_output3 = (struct Integer **)&context->data[context->odg+2]; - goto initIntegerDataGears(context, - context->next, - O_output1, - O_output2, - O_output3); -}
--- a/src/parallel_execution/examples/calc/mult.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -#include "../../../context.h" -#include <stdio.h> -__code mult(struct Integer* input1, struct Integer* input2, __code next(struct Integer* output, ...)) { - struct Integer* output = *O_output; - output->value = input1->value * input2->value; - printf("%d * %d = %d\n", input1->value, input2->value, output->value); - *O_output = output; - goto meta(context, next); -} - -__code mult_stub(struct Context* context) { - Integer** O_output = (struct Integer **)&context->data[context->odg]; - goto mult(context, - &context->data[context->idg]->Integer, - &context->data[context->idg + 1]->Integer, - context->next, - O_output); -}
--- a/src/parallel_execution/examples/twice/CUDAtwice.cu Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -extern "C" { - struct Array { - int prefix; - int* array; - } Array; - - __global__ void twice(int* array, struct Array* inputArray) { - int i = 0; - int prefix = inputArray->prefix; -C_twice: - if (i < prefix) { - array[i+(blockIdx.x*blockDim.x+threadIdx.x)*prefix] = array[i+(blockIdx.x*blockDim.x+threadIdx.x)*prefix]*2; - i++; - goto C_twice; - } - } -}
--- a/src/parallel_execution/examples/twice/createArray.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -#include <stdio.h> -#include "../../../context.h" -#interface "Timer.h" - -extern int length; -extern int split; - -__code createArray(__code next(struct Array* output, struct Timer* output1, ...), struct LoopCounter* loopCounter) { - struct Array* output = *O_output; - struct Timer* output1 = *O_output1; - int i = loopCounter->i; - if (i == 0){ - output->array = (Int*)ALLOCATE_ARRAY(context, Int, length); - output->prefix = length/split; - } - if (i == GET_LEN(output->array)){ - printf("created Array\n"); - loopCounter->i = 0; - *O_output = output; - *O_output1 = output1; - goto output1->start(next(...)); - } - output->array[i] = i; - loopCounter->i++; - *O_output = output; - *O_output1 = output1; - goto meta(context, C_createArray); -} - -__code createArray_stub(struct Context* context) { - Array** O_output = (struct Array **)&context->data[context->odg]; - Timer** O_output1 = (struct Timer**)&context->data[context->odg+1]; - goto createArray(context, - context->next, - O_output, - O_output1, - Gearef(context, LoopCounter)); -}
--- a/src/parallel_execution/examples/twice/main.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> - -#include "../../../context.h" -#interface "TaskManager.h" - -int cpu_num = 1; -int length = 102400; -int split = 8; -int* array_ptr; -int gpu_num = 0; -int CPU_ANY = -1; -int CPU_CUDA = -1; - -void *start_taskManager(struct Context *context) { - goto initDataGears(context, Gearef(context, LoopCounter), Gearef(context, TaskManager)); - return 0; -} - -__code initDataGears(struct LoopCounter* loopCounter, struct TaskManager* taskManager) { - // loopCounter->tree = createRedBlackTree(context); - loopCounter->i = 0; - taskManager->taskManager = (union Data*)createTaskManagerImpl(context, cpu_num, gpu_num, 0); - goto code1(); -} - -__code initDataGears_stub(struct Context* context) { - struct TaskManager* taskManager = Gearef(context, TaskManager); - taskManager->taskManager = 0; - struct LoopCounter* loopCounter = Gearef(context, LoopCounter); - goto initDataGears(context, loopCounter, taskManager); -} - -__code code1(struct LoopCounter* loopCounter) { - printf("cpus:\t\t%d\n", cpu_num); - printf("gpus:\t\t%d\n", gpu_num); - printf("length:\t\t%d\n", length); - printf("length/task:\t%d\n", length/split); - /* puts("queue"); */ - /* print_queue(context->data[ActiveQueue]->queue.first); */ - /* puts("tree"); */ - /* print_tree(context->data[Tree]->tree.root); */ - /* puts("result"); */ - goto createTask1(); -} - - -__code createTask1(struct LoopCounter* loopCounter, struct TaskManager* taskManager) { - Array* array1 = new Array(); - Array* array2 = new Array(); - Timer* timer = createTimerImpl(context); - - par goto createArray(array1, timer, __exit); - par goto twice(array1, array2, iterate(split), __exit); - par goto printArray(array2, timer, __exit); - goto code2(); -} - -__code code2(struct TaskManager* taskManager) { - goto taskManager->shutdown(exit_code); -} - -__code code2_stub(struct Context* context) { - goto code2(context, &Gearef(context, TaskManager)->taskManager->TaskManager); -} - -void init(int argc, char** argv) { - for (int i = 1; argv[i]; ++i) { - if (strcmp(argv[i], "-cpu") == 0) - cpu_num = (int)atoi(argv[i+1]); - else if (strcmp(argv[i], "-l") == 0) - length = (int)atoi(argv[i+1]); - else if (strcmp(argv[i], "-s") == 0) - split = (int)atoi(argv[i+1]); - else if (strcmp(argv[i], "-cuda") == 0) { - gpu_num = 1; - CPU_CUDA = 0; - } - } -} - -int main(int argc, char** argv) { - init(argc, argv); - goto initDataGears(); -}
--- a/src/parallel_execution/examples/twice/printArray.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#include "../../../context.h" -#interface "Timer.h" -#include <stdio.h> - -__code printArray(struct Array* array, struct Timer* inputTimer, __code next(...)){ - goto inputTimer->end(printArray1); -} - -__code printArray_stub(struct Context* context) { - goto printArray(context, - &context->data[context->idg]->Array, - &context->data[context->idg+1]->Timer, - context->next); -} - -__code printArray1(struct Array* array, __code next(...), struct LoopCounter* loopCounter){ - int i = loopCounter->i; - //printf("%d\n", array->array[i]); - if(i < GET_LEN(array->array)) { - if (array->array[i] == i*2) { - loopCounter->i++; - goto meta(context, C_printArray1); - } else { - printf("wrong result\n"); - } - } - loopCounter->i = 0; - goto meta(context, next); -} - -__code printArray1_stub(struct Context* context) { - goto printArray1(context, - &context->data[context->idg]->Array, - context->next, - Gearef(context, LoopCounter)); -}
--- a/src/parallel_execution/examples/twice/twice.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -#include <stdio.h> - -#include "../../../context.h" - -#ifdef USE_CUDAWorker -extern void cudaLoadFunction(struct Context* context, char* filename, char* function); -#endif - -__code twice(struct Array* array, struct MultiDim* multiDim, __code next(struct Array* output, ...), struct LoopCounter* loopCounter) { - struct Array* output = *O_output; - int i = loopCounter->i; - int index = multiDim->x; - if (i < array->prefix) { - array->array[i+index*array->prefix] = array->array[i+index*array->prefix]*2; - loopCounter->i++; - - goto meta(context, C_twice); - } - - loopCounter->i = 0; - output->array = array->array; - goto meta(context, context->next); -} - -__code twice_stub(struct Context* context) { -#ifdef USE_CUDAWorker - if (context->gpu) { - Array* inputArray = &context->data[context->idg]->Array; - Array* outputArray = &context->data[context->odg]->Array; - CUDABuffer* buffer = &ALLOCATE(context, CUDABuffer)->CUDABuffer; - buffer->inputData = (union Data**)ALLOCATE_PTR_ARRAY(context, Array, 2); - buffer->inputData[0] = (union Data*)inputArray->array; - buffer->inputData[1] = (union Data*)inputArray; - buffer->outputData = NULL; - buffer->inputLen = 2; - buffer->outputLen = 0; - Executor* executor = context->worker->worker->CUDAWorker.executor; - executor->executor->CUDAExecutor.buffer = buffer; - cudaLoadFunction(context, "c/examples/twice/CUDAtwice.ptx", "twice"); - outputArray->array = inputArray->array; - Gearef(context, Executor)->executor = (union Data*)executor; - Gearef(context, Executor)->task = context; - Gearef(context, Executor)->next = context->next; - goto meta(context, executor->read); - } -#endif - Array** O_output = (struct Array **)&context->data[context->odg]; - goto twice(context, - &context->data[context->idg]->Array, - &context->data[context->idg+1]->MultiDim, - context->next, - O_output, - Gearef(context, LoopCounter)); -}
--- a/src/parallel_execution/generate_context.pl Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,225 +0,0 @@ -#!/usr/bin/perl - -use Getopt::Std; -use strict; - -# -# generrate Gears OS context heaader and initializer from CbC sources -# -# CodeGear -# -# get stub information from # *.c -# __code taskManager_stub(struct Context* context) { -# -# generate CodeGear indexn in context.h -# C_taskManager, -# -# generate CodeGear stub reference in context.h -# extern __code taskManager_stub(struct Context*); -# -# generate CodeGear stub reference in $name-context.h for each module -# context->code[C_taskManager] = taskManager_stub; -# -# DataGear -# -# get DataGear information from context.h -# struct Worker { -# int id; -# struct Context* contexts; -# enum Code execute; -# enum Code taskSend; -# enum Code taskRecive; -# enum Code shutdown; -# struct Queue* tasks; -# } Worker; -# -# generate typedefs and DataGear index in context.h -# typedef struct Worker Worker; -# D_Worker, -# -# generate DataGear allocator in context.h -# ALLOC_DATA(context, Worker); -# - -my $ddir = "c"; - -our($opt_o,$opt_d,$opt_h); -getopts('o:d:h'); - -my $name = $opt_o?$opt_o:"gears"; - -if ($opt_d) { - $ddir = $opt_d; -} - -if ( ! -d $ddir) { - mkdir $ddir; -} - -if ($opt_h) { - print "$0 [-d distdir] [-h]\n"; - exit; -} - -my %codeGear; -my %dataGear; -my %constructor; - -# gather module Information for code table initialization -for (@ARGV) { - next if (/context.c/); - &getStubInfo($_); -} - -my (%mCodeGear) = (%codeGear); - -# anyway we gather all Gears Information -while (<*.c test/*.c>) { - next if (/context.c/); - &getStubInfo($_); -} - -&generateContext(); - -sub getStubInfo { - my ($filename) = @_; - open my $fd,"<",$filename or die("can't open $filename $!"); - while (<$fd>) { - if (/^__code (\w+)_stub\(struct *Context *\* *context\)/) { - $codeGear{$1} = $filename; - } elsif (/^(\w+)(\*)+ *create(\w+)\(([^]]*)\)/) { - my $interface = $1; - my $implementation = $3; - my $constructorArgs = $4; - $constructor{$implementation} = [$interface, $constructorArgs]; - } - } - - open my $cx,"<","context.h" or die("can't open context.h $!"); - my $inUnionData = 0; - while (<$cx>) { - if (! $inUnionData) { - if ( /^union Data/) { - $inUnionData = 1; - } - next; - } - last if (/union Data end/); - if (/struct (\w+) \{/) { - $dataGear{$1} = 'struct'; - } elsif (/^\s{4}(\w+) (\w+);/) { # primitive type - $dataGear{$1} = 'primitive'; - } - $dataGear{"Context"} = "struct"; - } -} - -sub generateContext { - $codeGear{"start_code"} = "$ddir/$name-context.c"; - $codeGear{"exit_code"} = "$ddir/$name-context.c"; - $mCodeGear{"start_code"} = "$ddir/$name-context.c"; - $mCodeGear{"exit_code"} = "$ddir/$name-context.c"; - open my $fd,">","$ddir/extern.h" or die("can't open $ddir/extern.h $!"); - for my $code ( sort keys %codeGear ) { - print $fd "extern __code ${code}_stub(struct Context*);\n"; - } - for my $impl ( sort keys %constructor ) { - my ($interface, $constructorArgs) = @{$constructor{$impl}}; - print $fd "extern ${interface}* create${impl}($constructorArgs);\n"; - } - print $fd "\n"; - - open my $fd,">","$ddir/enumCode.h" or die("can't open $ddir/enumCode.h $!"); - print $fd "enum Code {\n"; - for my $code ( sort keys %codeGear ) { - print $fd " C_${code},\n"; - } - print $fd "};\n"; - - my $code_init = ''; - for my $code ( sort keys %mCodeGear ) { - $code_init .= " context->code[C_${code}] = ${code}_stub;\n"; - } - - my $data_num = keys(%dataGear); - $data_num++; -my $context_c = << "EOFEOF"; -#include <stdlib.h> - -#include "../context.h" - -void initContext(struct Context* context) { - context->heapLimit = sizeof(union Data)*ALLOCATE_SIZE; - context->code = (__code(**) (struct Context*)) NEWN(ALLOCATE_SIZE, void*); - context->data = NEWN(ALLOCATE_SIZE, union Data*); - context->heapStart = NEWN(context->heapLimit, char); - context->heap = context->heapStart; - // context->codeNum = Exit; - -$code_init - -#include "dataGearInit.c" - context->dataNum = $data_num; -} -EOFEOF - - open my $fd,">","$ddir/$name-context.c" or die("can't open $ddir/$name-context.c $!"); - print $fd $context_c; - -my $meta_call = <<"EOFEOF"; -__code meta(struct Context* context, enum Code next) { - // printf("meta %d\\n",next); - if (context->task == NULL) { - goto (context->code[next])(context); - } - context->task = NULL; - context->taskList = NULL; - goto (context->code[Gearef(context, TaskManager)->taskManager->TaskManager.spawnTasks])(context); -} - -__code start_code(struct Context* context) { - goto meta(context, context->next); -} - -__code start_code_stub(struct Context* context) { - goto start_code(context); -} - -__code exit_code(struct Context* context) { - free(context->code); - free(context->data); - free(context->heapStart); - goto exit(0); -} - -__code exit_code_stub(struct Context* context) { - goto exit_code(context); -} - -// end context_c -EOFEOF - -print $fd $meta_call; - -open my $fd,">","$ddir/enumData.h" or die("can't open $ddir/enumData.h $!"); -print $fd "enum DataType {\n"; -print $fd " D_Code,\n"; -for my $data ( sort keys %dataGear ) { - print $fd " D_${data},\n"; -} -print $fd "};\n\n"; - -open my $fd,">","$ddir/typedefData.h" or die("can't open $ddir/typedefData.h $!"); -for my $data ( sort keys %dataGear ) { - if ($dataGear{$data} eq 'struct') { - print $fd "typedef struct ${data} ${data};\n"; - } -} - -open my $fd,">","$ddir/dataGearInit.c" or die("can't open $ddir/dataGearInit.c $!"); -for my $data ( sort keys %dataGear ) { - print $fd " ALLOC_DATA(context, ${data});\n"; -} -} - -# end
--- a/src/parallel_execution/generate_stub.pl Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,581 +0,0 @@ -#!/usr/bin/perl - -use strict; -use Getopt::Std; -use File::Path qw(make_path); - -# interface.h -# typedef struct Worker { -# int id; -# struct Context* contexts; -# enum Code execute; -# enum Code taskSend; -# enum Code taskRecive; -# enum Code shutdown; -# struct Queue* tasks; -# } Worker; - -our($opt_o,$opt_d,$opt_h); -getopts('o:d:h'); - -my $dir = "."; -if ($opt_d) { - $dir = $opt_d; - if (! -d $dir) { - make_path $dir; - } -} - -for my $fn (@ARGV) { - next if ($fn !~ /\.cbc$/); - &getDataGear($fn); - &generateDataGear($fn); -} - -my %var; -my %code; -my %dataGearVar; -my %outputVar; # output var initializer -my %outputArgs; # continuation's output variables -my %dataGear; -my %dataGearName; -my %generic; -my %dataGearVarType; -my %codeGear; -my $implementation; -my $interface; - -# interface definision -# -# typedef struct Stack<Type, Impl>{ -# Type* stack; -# Type* data; -# Type* data1; -# __code whenEmpty(...); -# __code clear(Impl* stack,__code next(...)); -# __code push(Impl* stack,Type* data, __code next(...)); -# __code pop(Impl* stack, __code next(Type*, ...)); -# __code pop2(Impl* stack, Type** data, Type** data1, __code next(Type**, Type**, ...)); -# __code isEmpty(Impl* stack, __code next(...), __code whenEmpty(...)); -# __code get(Impl* stack, Type** data, __code next(...)); -# __code get2(Impl* stack,..., __code next(...)); -# __code next(...); -# } Stack; -# -# calling example -# -# goto nodeStack->push((union Data*)node, stackTest3); -# -# generated meta level code -# -# Gearef(context, Stack)->stack = (union Data*)nodeStack; -# Gearef(context, Stack)->data = (union Data*)node; -# Gearef(context, Stack)->next = C_stackTest3; -# goto meta(context, nodeStack->push); - -sub getDataGear { - my ($filename) = @_; - my ($codeGearName, $name, $inTypedef); - open my $fd,"<",$filename or die("can't open $filename $!"); - while (<$fd>) { - if (! $inTypedef) { - if (/^typedef struct (\w+)\s*<(.*)>/) { - $inTypedef = 1; - $name = $1; - $dataGear{$name} = $_; - $var{$name} = {}; - $code{$name} = {}; - $generic{$name} = \split(/,/,$2); - } elsif (/^typedef struct (\w+)/) { - $inTypedef = 1; - $name = $1; - $dataGear{$name} = $_; - $var{$name} = {}; - $code{$name} = {}; - $generic{$name} = []; - } elsif (/^(\w+)(\*)+ create(\w+)\(/) { - if (defined $interface) { - die "duplicate interface $interface\n"; - } - $interface = $1; - $implementation = $3; - if ( -f "$interface.cbc") { - &getDataGear("$interface.cbc"); - } - } elsif(/^(.*)par goto (\w+)\((.*)\)/) { - my $codeGearName = $2; - if ($filename =~ /^(.*)\/(.*)/) { - $codeGearName = "$1/$codeGearName"; - } - if ( -f "$codeGearName.cbc") { - &getCodeGear("$codeGearName.cbc"); - } - } elsif(/^#interface "(.*)"/) { - # use interface - my $interfaceHeader = $1; - next if ($interfaceHeader =~ /context.h/); - if (-f $interfaceHeader) { - &getDataGear("$interfaceHeader"); - &getCodeGear("$interfaceHeader"); - } - } - next; - } - # gather type name and type - $dataGear{$name} .= $_; - if (/^\s*(.*)\s+(\w+);$/ ) { - my $ttype = $1; - my $tname = $2; - if ($ttype =~ /^(union|struct)?\s*(\w+)/) { - $ttype = $2; - } - $var{$name}->{$tname} = $ttype; - } - if (/^}/) { - $inTypedef = 0; - } - } - -} - -sub getCodeGear { - my ($filename) = @_; - open my $fd,"<",$filename or die("can't open $filename $!"); - my ($name,$impln); - while (<$fd>) { - if (/^(\w+)(\*)+ create(\w+)\(/) { - $name = $1; - $impln = $3; - } elsif(/^typedef struct (.*)<.*>\s*{/) { - $name = $1; - } - if (defined $name) { - if (/^\s*\_\_code (\w+)\((.*)\);/) { - my $args = $2; - my $method = $1; - $code{$name}->{$method} = []; - while($args) { - # replace comma - $args =~ s/(^\s*,\s*)//; - # continuation case - if ($args =~ s/^(\s)*\_\_code\s+(\w+)\(([^)]*)\)//) { - my $next = $2; - my @args = split(/,/,$3); - push(@{$code{$name}->{$method}},"\_\_code $next"); - } elsif ($args =~ s/^(struct|union)?\s*(\w+)(\**)\s+(\w+)//) { - my $structType = $1; - my $typeName = $2; - my $ptrType = $3; - my $varName = $4; - my $typeField = lcfirst($typeName); - push(@{$code{$name}->{$method}},"$typeName$ptrType $varName"); - } elsif ($args =~ s/(.*,)//) { - } else { - last; - } - } - } - } elsif (/^\_\_code (\w+)\((.*)\)(.*)/) { - my $codeGearName = $1; - my $args = $2; - my $inputCount = 0; - my $outputCount = 0; - my $inputIncFlag = 1; - while($args) { - if ($args =~ s/(^\s*,\s*)//) { - } - if ($args =~ s/^(\s)*\_\_code\s+(\w+)\((.*?)\)//) { - $inputIncFlag = 0; - $outputCount = split(/,/,$3); - $outputCount--; - } elsif ($args =~ s/^(struct|union)?\s*(\w+)(\*)?+\s(\w+)//) { - if($inputIncFlag) { - $inputCount++; - } - } elsif ($args =~ s/(.*,)//) { - } else { - last; - } - } - $codeGear{$codeGearName}->{"input"} = $inputCount; - $codeGear{$codeGearName}->{"output"} = $outputCount; - } - } -} - -sub generateStub { - my($fd,$prevCodeGearName,$dataGearName) = @_; - print $fd "__code ", $prevCodeGearName ,"_stub(struct Context* context) {\n"; - print $fd $dataGearName; - print $fd "\n} \n\n"; - return 1; -} - -sub generateStubArgs { - my($codeGearName, $varName, $typeName, $ptrType, $typeField, $interface,$output) = @_; - my $varname1 = $output?"O_$varName":$varName; - for my $n ( @{$dataGearVar{$codeGearName}} ) { - # we already have it - return 0 if ( $n eq $varname1); - } - push @{$dataGearVar{$codeGearName}}, $varname1; - push @{$dataGearVarType{$codeGearName}}, $typeName; - if ($typeName eq $implementation) { - # get implementation - $dataGearName{$codeGearName} .= "\t$typeName* $varName = ($typeName*)GearImpl(context, $interface, $varName);\n"; - } else { - for my $ivar (keys %{$var{$interface}}) { - # input data gear field - if ($varName eq $ivar) { - if ($typeName eq $var{$interface}->{$ivar}) { - if ($output) { - $dataGearName{$codeGearName} .= "\t$typeName$ptrType* O_$varName = &Gearef(context, $interface)->$varName;\n"; - $outputVar{$codeGearName} .= "\t$typeName$ptrType $varName = *O_$varName;\n"; - return 1; - } - - $dataGearName{$codeGearName} .= "\t$typeName$ptrType $varName = Gearef(context, $interface)->$varName;\n"; - return 1; - } - } - } - for my $cName (keys %{$code{$interface}}) { - if ($varName eq $cName) { - # continuation field - $dataGearName{$codeGearName} .= "\tenum Code $varName = Gearef(context, $interface)->$varName;\n"; - return 1; - } - } - # global or local variable case - if ($typeName eq "Code") { - $dataGearName{$codeGearName} .= "\tenum $typeName$ptrType $varName = Gearef(context, $interface)->$varName;\n"; - return 1; - } - $dataGearName{$codeGearName} .= "\t$typeName$ptrType $varName = Gearef(context, $typeName);\n"; - return 1; - } -} - -sub generateDataGear { - my ($filename) = @_; - open my $in,"<",$filename or die("can't open $filename $!"); - - my $fn; - if ($opt_o) { - $fn = $opt_o; - } else { - my $fn1 = $filename; - $fn1 =~ s/\.cbc/.c/; - my $i = 1; - $fn = "$dir/$fn1"; - while ( -f $fn) { - $fn = "$dir/$fn1.$i"; - $i++; - } - } - if ( $fn =~ m=(.*)/[^/]+$= ) { - if (! -d $1) { - make_path $1; - } - } - open my $fd,">",$fn or die("can't write $fn $!"); - - my $prevCodeGearName; - my $inTypedef = 0; - my $inStub = 0; - my $inParGoto = 0; - my $inMain = 0 ; - my %stub; - my $codeGearName; - my %localVarType; - - while (<$in>) { - if (! $inTypedef && ! $inStub && ! $inMain) { - if (/^typedef struct (\w+) \{/) { - $inTypedef = 1; - } elsif (/^int main\((.*)\) \{/) { - $inMain = 1; - } elsif(/^#interface "(.*)"/) { - my $interfaceHeader = $1; - # #interface not write - next unless ($interfaceHeader =~ /context.h/); - } elsif (/^\_\_code (\w+)\((.*)\)(.*)/) { - %localVarType = {}; - $codeGearName = $1; - my $args = $2; - my $tail = $3; - if ($codeGearName =~ /_stub$/) { - # don't touch already existing stub - $inStub = 1; - $stub{$codeGearName} = 1; - print $fd $_; - next; - } - if (defined $prevCodeGearName) { - # stub is generated just before next CodeGear - if (defined $stub{$prevCodeGearName."_stub"}) { - undef $prevCodeGearName; - } else { - &generateStub($fd,$prevCodeGearName,$dataGearName{$prevCodeGearName}); - $stub{$prevCodeGearName."_stub"} = 1; - } - } - # analyzing CodeGear argument - # these arguments are extract from current context's arugment DataGear Interface - # and passed to the CodeGear - # struct Implementaion needs special handling - # __code next(...) ---> enum Code next - $prevCodeGearName = $codeGearName; - $dataGearVar{$codeGearName} = []; - $outputVar{$codeGearName} = ""; - $outputArgs{$codeGearName} = {}; - my $newArgs = "struct Context *context,"; - if ($args=~/^struct Context\s*\*\s*context/) { - $newArgs = ""; - } - while($args) { - if ($args =~ s/(^\s*,\s*)//) { - $newArgs .= $1; - } - # continuation case - if ($args =~ s/^(\s)*\_\_code\s+(\w+)\(([^)]*)\)//) { - my $next = $2; - my @args = split(/,/,$3); - if (&generateStubArgs($codeGearName, $next, "Code", "", $next, $interface,0) ) { - $newArgs .= "enum Code $next"; - } - # analyze continuation arguments - # output arguments are defined in the Interface take the pointer of these - # output arguments are put into the Interface DataGear just before the goto - for my $arg (@args) { - $arg =~ s/^\s*//; - last if ($arg =~ /\.\.\./); - $arg =~ s/^(struct|union)?\s*(\w+)(\**)\s(\w+)//; - my $structType = $1; - my $typeName = $2; - my $ptrType = $3; - my $varName = $4; - my $typeField = lcfirst($typeName); - push(@{$outputArgs{$codeGearName}->{$next}}, $varName); - if (&generateStubArgs($codeGearName, $varName, $typeName, $ptrType, $typeField, $interface,1)) { - $newArgs .= ",$structType $typeName **O_$varName"; - } - } - } elsif ($args =~ s/^(struct|union)?\s*(\w+)(\**)\s(\w+)//) { - my $structType = $1; - my $typeName = $2; - my $ptrType = $3; - my $varName = $4; - my $typeField = lcfirst($typeName); - $newArgs .= $&; # assuming no duplicate - &generateStubArgs($codeGearName, $varName, $typeName, $ptrType, $typeField, $interface,0); - } elsif ($args =~ s/(.*,)//) { - $newArgs .= $1; - } else { - $newArgs .= $args; - last; - } - } - # generate goto statement from stub to the CodeGear in the buffer - $dataGearName{$codeGearName} .= "\tgoto $codeGearName(context"; - for my $arg ( @{$dataGearVar{$codeGearName}}) { - $dataGearName{$codeGearName} .= ", $arg"; - } - $dataGearName{$codeGearName} .= ");"; - # generate CodeGear header with new arguments - print $fd "__code $codeGearName($newArgs)$tail\n"; - if ($outputVar{$codeGearName} ne "") { - # output data var can be use before write - # it should be initialze by gearef - print $fd $outputVar{$codeGearName}; - } - next; - } elsif (/^(.*)goto (\w+)\-\>(\w+)\((.*)\);/) { - # handling goto statement - # convert it to the meta call form with two arugments, that is context and enum Code - my $prev = $1; - my $next = $2; - my $method = $3; - my @args = split(/,/,$4); - my @types = @{$dataGearVarType{$codeGearName}}; - my $ntype; - my $ftype; - for my $v (@{$dataGearVar{$codeGearName}}) { - my $t = shift @types; - if ($v eq $next) { - $ntype = $t; - $ftype = lcfirst($ntype); - } - } - if (!defined $ntype) { - $ntype = $localVarType{$next}; - $ftype = lcfirst($ntype); - } - print $fd "\tGearef(context, $ntype)->$ftype = (union Data*) $next;\n"; - # Put interface argument - my $prot = $code{$ntype}->{$method}; - my $i = 1; - for my $arg (@args) { - my $pType; - my $pName; - my $p = @$prot[$i]; - next if ($p eq $arg); - $p =~ s/^(.*)\s(\w+)//; - $pType = $1; - $pName = $2; - $arg =~ s/^(\s)*(\w+)/$2/; - if ($pType =~ s/\_\_code$//) { - if ($arg =~ /(\w+)\(.*\)/) { - print $fd "\tGearef(context, $ntype)->$pName = $1;\n"; - } else { - print $fd "\tGearef(context, $ntype)->$pName = C_$arg;\n"; - } - } elsif ($pType =~ /Data\**$/){ - print $fd "\tGearef(context, $ntype)->$pName = (union $pType) $arg;\n"; - } else { - print $fd "\tGearef(context, $ntype)->$pName = $arg;\n"; - } - $i++; - } - print $fd "${prev}goto meta(context, $next->$method);\n"; - next; - } elsif(/^(.*)par goto (\w+)\((.*)\);/) { - # handling par goto statement - # convert it to the parallel - my $prev = $1; - my $codeGearName = $2; - my $args = $3; - my $inputCount = $codeGear{$codeGearName}->{'input'}; - my $outputCount = $codeGear{$codeGearName}->{'output'}; - my @iterateCounts; - # parse examples 'par goto(.., iterate(10), exit);' - if ($args =~ /iterate\((.*)?\),/) { - @iterateCounts = split(/,/,$1);; - $inputCount--; - } - # replace iterate keyword - $args =~ s/iterate\((.*)?\),//; - my @dataGears = split(/,\s*/, $args); - my $nextCodeGear = pop(@dataGears); - if (! $inParGoto) { - $inParGoto = 1; - print $fd "${prev}struct Element* element;\n"; - } - my $initTask = << "EOFEOF"; - ${prev}context->task = NEW(struct Context); - ${prev}initContext(context->task); - ${prev}context->task->next = C_$codeGearName; - ${prev}context->task->idgCount = $inputCount; - ${prev}context->task->idg = context->task->dataNum; - ${prev}context->task->maxIdg = context->task->idg + $inputCount; - ${prev}context->task->odg = context->task->maxIdg; - ${prev}context->task->maxOdg = context->task->odg + $outputCount; -EOFEOF - print $fd $initTask; - if (@iterateCounts) { - print $fd "${prev}context->task->iterate = 0;\n"; - my $len = @iterateCounts; - if ($len == 1) { - print $fd "${prev}context->task->iterator = createMultiDimIterator(context, $iterateCounts[0], 1, 1);\n"; - } elsif ($len == 2) { - print $fd "${prev}context->task->iterator = createMultiDimIterator(context, $iterateCounts[0], $iterateCounts[1], 1);\n"; - } elsif ($len == 3) { - print $fd "${prev}context->task->iterator = createMultiDimIterator(context, $iterateCounts[0], $iterateCounts[1], $iterateCounts[2]);\n"; - } - } - for my $dataGear (@dataGears) { - print $fd "${prev}GET_META($dataGear)->wait = createSynchronizedQueue(context);\n"; - } - for my $i (0..$inputCount-1) { - print $fd "${prev}context->task->data[context->task->idg+$i] = (union Data*)@dataGears[$i];\n"; - } - for my $i (0..$outputCount-1) { - print $fd "${prev}context->task->data[context->task->odg+$i] = (union Data*)@dataGears[$inputCount+$i];\n"; - } - my $putTask = << "EOFEOF"; - ${prev}element = &ALLOCATE(context, Element)->Element; - ${prev}element->data = (union Data*)context->task; - ${prev}element->next = context->taskList; - ${prev}context->taskList = element; -EOFEOF - print $fd $putTask; - next; - } elsif (/^(.*)goto (\w+)\((.*)\);/) { - # handling goto statement - # convert it to the meta call form with two arugments, that is context and enum Code - my $prev = $1; - my $next = $2; - my @args = split(/, /,$3); - my $v = 0; - for my $n ( @{$dataGearVar{$codeGearName}} ) { - # continuation arguments - $v = 1 if ( $n eq $next); - } - if ($v || defined $code{$interface}->{$next}) { - # write continuation's arguments into the interface arguments - # we may need a commit for a shared DataGear - for my $arg ( @{$outputArgs{$codeGearName}->{$next}} ) { - my $v = shift(@args); - print $fd "\t*O_$arg = $v;\n"; - } - if ($inParGoto) { - print $fd "${prev}Gearef(context, TaskManager)->taskList = context->taskList;\n"; - print $fd "${prev}Gearef(context, TaskManager)->next1 = C_$next;\n"; - print $fd "${prev}goto meta(context, C_$next);\n"; - } else { - print $fd "${prev}goto meta(context, $next);\n"; - } - next; - } - if ($inParGoto) { - print $fd "${prev}Gearef(context, TaskManager)->taskList = context->taskList;\n"; - print $fd "${prev}Gearef(context, TaskManager)->next1 = C_$next;\n"; - print $fd "${prev}goto meta(context, C_$next);\n"; - next; - } elsif ($next eq "meta") { - print $fd $_; - next; - } else { - print $fd "${prev}goto meta(context, C_$next);\n"; - next; - } - } elsif(/^.*(struct|union)?\s(\w+)\*\s(\w+)\s?[=;]/) { - my $type = $2; - my $varName = $3; - $localVarType{$varName} = $type; - s/new\s+(\w+)\(\)/\&ALLOCATE(context, \1)->\1/g; # replacing new - } elsif(/^}/) { - $inParGoto = 0; - } else { - s/new\s+(\w+)\(\)/\&ALLOCATE(context, \1)->\1/g; # replacing new - } - # gather type name and type - } elsif ($inMain) { - if (/^(.*)goto start_code\(main_context\);/) { - print $fd $_; - next; - } elsif (/^(.*)goto (\w+)\((.*)\);/) { - my $prev = $1; - my $next = $2; - print $fd "${prev}struct Context* main_context = NEW(struct Context);\n"; - print $fd "${prev}initContext(main_context);\n"; - print $fd "${prev}main_context->next = C_$next;\n"; - print $fd "${prev}goto start_code(main_context);\n"; - next; - } - } - if (/^}/) { - $inStub = 0; - $inTypedef = 0; - $inMain = 0; - } - print $fd $_; - } - if (defined $prevCodeGearName) { - if (!defined $stub{$prevCodeGearName."_stub"}) { - $stub{$prevCodeGearName."_stub"} = &generateStub($fd,$prevCodeGearName,$dataGearName{$codeGearName}); - } - } -} - -# end
--- a/src/parallel_execution/helper_cuda.h Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1088 +0,0 @@ -/** - * Copyright 1993-2013 NVIDIA Corporation. All rights reserved. - * - * Please refer to the NVIDIA end user license agreement (EULA) associated - * with this source code for terms and conditions that govern your use of - * this software. Any use, reproduction, disclosure, or distribution of - * this software and related documentation outside the terms of the EULA - * is strictly prohibited. - * - */ - -//////////////////////////////////////////////////////////////////////////////// -// These are CUDA Helper functions for initialization and error checking - -#ifndef HELPER_CUDA_H -#define HELPER_CUDA_H - -#pragma once - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> - -#include "helper_string.h" - -#ifndef EXIT_WAIVED -#define EXIT_WAIVED 2 -#endif - -// Note, it is required that your SDK sample to include the proper header files, please -// refer the CUDA examples for examples of the needed CUDA headers, which may change depending -// on which CUDA functions are used. - -// CUDA Runtime error messages -#ifndef __DRIVER_TYPES_H__ -static const char *_cudaGetErrorEnum(cudaError_t error) -{ - switch (error) - { - case cudaSuccess: - return "cudaSuccess"; - - case cudaErrorMissingConfiguration: - return "cudaErrorMissingConfiguration"; - - case cudaErrorMemoryAllocation: - return "cudaErrorMemoryAllocation"; - - case cudaErrorInitializationError: - return "cudaErrorInitializationError"; - - case cudaErrorLaunchFailure: - return "cudaErrorLaunchFailure"; - - case cudaErrorPriorLaunchFailure: - return "cudaErrorPriorLaunchFailure"; - - case cudaErrorLaunchTimeout: - return "cudaErrorLaunchTimeout"; - - case cudaErrorLaunchOutOfResources: - return "cudaErrorLaunchOutOfResources"; - - case cudaErrorInvalidDeviceFunction: - return "cudaErrorInvalidDeviceFunction"; - - case cudaErrorInvalidConfiguration: - return "cudaErrorInvalidConfiguration"; - - case cudaErrorInvalidDevice: - return "cudaErrorInvalidDevice"; - - case cudaErrorInvalidValue: - return "cudaErrorInvalidValue"; - - case cudaErrorInvalidPitchValue: - return "cudaErrorInvalidPitchValue"; - - case cudaErrorInvalidSymbol: - return "cudaErrorInvalidSymbol"; - - case cudaErrorMapBufferObjectFailed: - return "cudaErrorMapBufferObjectFailed"; - - case cudaErrorUnmapBufferObjectFailed: - return "cudaErrorUnmapBufferObjectFailed"; - - case cudaErrorInvalidHostPointer: - return "cudaErrorInvalidHostPointer"; - - case cudaErrorInvalidDevicePointer: - return "cudaErrorInvalidDevicePointer"; - - case cudaErrorInvalidTexture: - return "cudaErrorInvalidTexture"; - - case cudaErrorInvalidTextureBinding: - return "cudaErrorInvalidTextureBinding"; - - case cudaErrorInvalidChannelDescriptor: - return "cudaErrorInvalidChannelDescriptor"; - - case cudaErrorInvalidMemcpyDirection: - return "cudaErrorInvalidMemcpyDirection"; - - case cudaErrorAddressOfConstant: - return "cudaErrorAddressOfConstant"; - - case cudaErrorTextureFetchFailed: - return "cudaErrorTextureFetchFailed"; - - case cudaErrorTextureNotBound: - return "cudaErrorTextureNotBound"; - - case cudaErrorSynchronizationError: - return "cudaErrorSynchronizationError"; - - case cudaErrorInvalidFilterSetting: - return "cudaErrorInvalidFilterSetting"; - - case cudaErrorInvalidNormSetting: - return "cudaErrorInvalidNormSetting"; - - case cudaErrorMixedDeviceExecution: - return "cudaErrorMixedDeviceExecution"; - - case cudaErrorCudartUnloading: - return "cudaErrorCudartUnloading"; - - case cudaErrorUnknown: - return "cudaErrorUnknown"; - - case cudaErrorNotYetImplemented: - return "cudaErrorNotYetImplemented"; - - case cudaErrorMemoryValueTooLarge: - return "cudaErrorMemoryValueTooLarge"; - - case cudaErrorInvalidResourceHandle: - return "cudaErrorInvalidResourceHandle"; - - case cudaErrorNotReady: - return "cudaErrorNotReady"; - - case cudaErrorInsufficientDriver: - return "cudaErrorInsufficientDriver"; - - case cudaErrorSetOnActiveProcess: - return "cudaErrorSetOnActiveProcess"; - - case cudaErrorInvalidSurface: - return "cudaErrorInvalidSurface"; - - case cudaErrorNoDevice: - return "cudaErrorNoDevice"; - - case cudaErrorECCUncorrectable: - return "cudaErrorECCUncorrectable"; - - case cudaErrorSharedObjectSymbolNotFound: - return "cudaErrorSharedObjectSymbolNotFound"; - - case cudaErrorSharedObjectInitFailed: - return "cudaErrorSharedObjectInitFailed"; - - case cudaErrorUnsupportedLimit: - return "cudaErrorUnsupportedLimit"; - - case cudaErrorDuplicateVariableName: - return "cudaErrorDuplicateVariableName"; - - case cudaErrorDuplicateTextureName: - return "cudaErrorDuplicateTextureName"; - - case cudaErrorDuplicateSurfaceName: - return "cudaErrorDuplicateSurfaceName"; - - case cudaErrorDevicesUnavailable: - return "cudaErrorDevicesUnavailable"; - - case cudaErrorInvalidKernelImage: - return "cudaErrorInvalidKernelImage"; - - case cudaErrorNoKernelImageForDevice: - return "cudaErrorNoKernelImageForDevice"; - - case cudaErrorIncompatibleDriverContext: - return "cudaErrorIncompatibleDriverContext"; - - case cudaErrorPeerAccessAlreadyEnabled: - return "cudaErrorPeerAccessAlreadyEnabled"; - - case cudaErrorPeerAccessNotEnabled: - return "cudaErrorPeerAccessNotEnabled"; - - case cudaErrorDeviceAlreadyInUse: - return "cudaErrorDeviceAlreadyInUse"; - - case cudaErrorProfilerDisabled: - return "cudaErrorProfilerDisabled"; - - case cudaErrorProfilerNotInitialized: - return "cudaErrorProfilerNotInitialized"; - - case cudaErrorProfilerAlreadyStarted: - return "cudaErrorProfilerAlreadyStarted"; - - case cudaErrorProfilerAlreadyStopped: - return "cudaErrorProfilerAlreadyStopped"; - - /* Since CUDA 4.0*/ - case cudaErrorAssert: - return "cudaErrorAssert"; - - case cudaErrorTooManyPeers: - return "cudaErrorTooManyPeers"; - - case cudaErrorHostMemoryAlreadyRegistered: - return "cudaErrorHostMemoryAlreadyRegistered"; - - case cudaErrorHostMemoryNotRegistered: - return "cudaErrorHostMemoryNotRegistered"; - - /* Since CUDA 5.0 */ - case cudaErrorOperatingSystem: - return "cudaErrorOperatingSystem"; - - case cudaErrorPeerAccessUnsupported: - return "cudaErrorPeerAccessUnsupported"; - - case cudaErrorLaunchMaxDepthExceeded: - return "cudaErrorLaunchMaxDepthExceeded"; - - case cudaErrorLaunchFileScopedTex: - return "cudaErrorLaunchFileScopedTex"; - - case cudaErrorLaunchFileScopedSurf: - return "cudaErrorLaunchFileScopedSurf"; - - case cudaErrorSyncDepthExceeded: - return "cudaErrorSyncDepthExceeded"; - - case cudaErrorLaunchPendingCountExceeded: - return "cudaErrorLaunchPendingCountExceeded"; - - case cudaErrorNotPermitted: - return "cudaErrorNotPermitted"; - - case cudaErrorNotSupported: - return "cudaErrorNotSupported"; - - /* Since CUDA 6.0 */ - case cudaErrorHardwareStackError: - return "cudaErrorHardwareStackError"; - - case cudaErrorIllegalInstruction: - return "cudaErrorIllegalInstruction"; - - case cudaErrorMisalignedAddress: - return "cudaErrorMisalignedAddress"; - - case cudaErrorInvalidAddressSpace: - return "cudaErrorInvalidAddressSpace"; - - case cudaErrorInvalidPc: - return "cudaErrorInvalidPc"; - - case cudaErrorIllegalAddress: - return "cudaErrorIllegalAddress"; - - /* Since CUDA 6.5*/ - case cudaErrorInvalidPtx: - return "cudaErrorInvalidPtx"; - - case cudaErrorInvalidGraphicsContext: - return "cudaErrorInvalidGraphicsContext"; - - case cudaErrorStartupFailure: - return "cudaErrorStartupFailure"; - - case cudaErrorApiFailureBase: - return "cudaErrorApiFailureBase"; - - /* Since CUDA 8.0*/ - case cudaErrorNvlinkUncorrectable : - return "cudaErrorNvlinkUncorrectable"; - } - - return "<unknown>"; -} -#else -// CUDA Driver API errors -static const char *_cudaGetErrorEnum(CUresult error) -{ - switch (error) - { - case CUDA_SUCCESS: - return "CUDA_SUCCESS"; - - case CUDA_ERROR_INVALID_VALUE: - return "CUDA_ERROR_INVALID_VALUE"; - - case CUDA_ERROR_OUT_OF_MEMORY: - return "CUDA_ERROR_OUT_OF_MEMORY"; - - case CUDA_ERROR_NOT_INITIALIZED: - return "CUDA_ERROR_NOT_INITIALIZED"; - - case CUDA_ERROR_DEINITIALIZED: - return "CUDA_ERROR_DEINITIALIZED"; - - case CUDA_ERROR_PROFILER_DISABLED: - return "CUDA_ERROR_PROFILER_DISABLED"; - - case CUDA_ERROR_PROFILER_NOT_INITIALIZED: - return "CUDA_ERROR_PROFILER_NOT_INITIALIZED"; - - case CUDA_ERROR_PROFILER_ALREADY_STARTED: - return "CUDA_ERROR_PROFILER_ALREADY_STARTED"; - - case CUDA_ERROR_PROFILER_ALREADY_STOPPED: - return "CUDA_ERROR_PROFILER_ALREADY_STOPPED"; - - case CUDA_ERROR_NO_DEVICE: - return "CUDA_ERROR_NO_DEVICE"; - - case CUDA_ERROR_INVALID_DEVICE: - return "CUDA_ERROR_INVALID_DEVICE"; - - case CUDA_ERROR_INVALID_IMAGE: - return "CUDA_ERROR_INVALID_IMAGE"; - - case CUDA_ERROR_INVALID_CONTEXT: - return "CUDA_ERROR_INVALID_CONTEXT"; - - case CUDA_ERROR_CONTEXT_ALREADY_CURRENT: - return "CUDA_ERROR_CONTEXT_ALREADY_CURRENT"; - - case CUDA_ERROR_MAP_FAILED: - return "CUDA_ERROR_MAP_FAILED"; - - case CUDA_ERROR_UNMAP_FAILED: - return "CUDA_ERROR_UNMAP_FAILED"; - - case CUDA_ERROR_ARRAY_IS_MAPPED: - return "CUDA_ERROR_ARRAY_IS_MAPPED"; - - case CUDA_ERROR_ALREADY_MAPPED: - return "CUDA_ERROR_ALREADY_MAPPED"; - - case CUDA_ERROR_NO_BINARY_FOR_GPU: - return "CUDA_ERROR_NO_BINARY_FOR_GPU"; - - case CUDA_ERROR_ALREADY_ACQUIRED: - return "CUDA_ERROR_ALREADY_ACQUIRED"; - - case CUDA_ERROR_NOT_MAPPED: - return "CUDA_ERROR_NOT_MAPPED"; - - case CUDA_ERROR_NOT_MAPPED_AS_ARRAY: - return "CUDA_ERROR_NOT_MAPPED_AS_ARRAY"; - - case CUDA_ERROR_NOT_MAPPED_AS_POINTER: - return "CUDA_ERROR_NOT_MAPPED_AS_POINTER"; - - case CUDA_ERROR_ECC_UNCORRECTABLE: - return "CUDA_ERROR_ECC_UNCORRECTABLE"; - - case CUDA_ERROR_UNSUPPORTED_LIMIT: - return "CUDA_ERROR_UNSUPPORTED_LIMIT"; - - case CUDA_ERROR_CONTEXT_ALREADY_IN_USE: - return "CUDA_ERROR_CONTEXT_ALREADY_IN_USE"; - - case CUDA_ERROR_PEER_ACCESS_UNSUPPORTED: - return "CUDA_ERROR_PEER_ACCESS_UNSUPPORTED"; - - case CUDA_ERROR_INVALID_PTX: - return "CUDA_ERROR_INVALID_PTX"; - - case CUDA_ERROR_INVALID_GRAPHICS_CONTEXT: - return "CUDA_ERROR_INVALID_GRAPHICS_CONTEXT"; - - case CUDA_ERROR_NVLINK_UNCORRECTABLE: - return "CUDA_ERROR_NVLINK_UNCORRECTABLE"; - - case CUDA_ERROR_INVALID_SOURCE: - return "CUDA_ERROR_INVALID_SOURCE"; - - case CUDA_ERROR_FILE_NOT_FOUND: - return "CUDA_ERROR_FILE_NOT_FOUND"; - - case CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND: - return "CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND"; - - case CUDA_ERROR_SHARED_OBJECT_INIT_FAILED: - return "CUDA_ERROR_SHARED_OBJECT_INIT_FAILED"; - - case CUDA_ERROR_OPERATING_SYSTEM: - return "CUDA_ERROR_OPERATING_SYSTEM"; - - case CUDA_ERROR_INVALID_HANDLE: - return "CUDA_ERROR_INVALID_HANDLE"; - - case CUDA_ERROR_NOT_FOUND: - return "CUDA_ERROR_NOT_FOUND"; - - case CUDA_ERROR_NOT_READY: - return "CUDA_ERROR_NOT_READY"; - - case CUDA_ERROR_ILLEGAL_ADDRESS: - return "CUDA_ERROR_ILLEGAL_ADDRESS"; - - case CUDA_ERROR_LAUNCH_FAILED: - return "CUDA_ERROR_LAUNCH_FAILED"; - - case CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES: - return "CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES"; - - case CUDA_ERROR_LAUNCH_TIMEOUT: - return "CUDA_ERROR_LAUNCH_TIMEOUT"; - - case CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING: - return "CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING"; - - case CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED: - return "CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED"; - - case CUDA_ERROR_PEER_ACCESS_NOT_ENABLED: - return "CUDA_ERROR_PEER_ACCESS_NOT_ENABLED"; - - case CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE: - return "CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE"; - - case CUDA_ERROR_CONTEXT_IS_DESTROYED: - return "CUDA_ERROR_CONTEXT_IS_DESTROYED"; - - case CUDA_ERROR_ASSERT: - return "CUDA_ERROR_ASSERT"; - - case CUDA_ERROR_TOO_MANY_PEERS: - return "CUDA_ERROR_TOO_MANY_PEERS"; - - case CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED: - return "CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED"; - - case CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED: - return "CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED"; - - case CUDA_ERROR_HARDWARE_STACK_ERROR: - return "CUDA_ERROR_HARDWARE_STACK_ERROR"; - - case CUDA_ERROR_ILLEGAL_INSTRUCTION: - return "CUDA_ERROR_ILLEGAL_INSTRUCTION"; - - case CUDA_ERROR_MISALIGNED_ADDRESS: - return "CUDA_ERROR_MISALIGNED_ADDRESS"; - - case CUDA_ERROR_INVALID_ADDRESS_SPACE: - return "CUDA_ERROR_INVALID_ADDRESS_SPACE"; - - case CUDA_ERROR_INVALID_PC: - return "CUDA_ERROR_INVALID_PC"; - - case CUDA_ERROR_NOT_PERMITTED: - return "CUDA_ERROR_NOT_PERMITTED"; - - case CUDA_ERROR_NOT_SUPPORTED: - return "CUDA_ERROR_NOT_SUPPORTED"; - - case CUDA_ERROR_UNKNOWN: - return "CUDA_ERROR_UNKNOWN"; - } - - return "<unknown>"; -} -#endif - -#ifdef CUBLAS_API_H_ -// cuBLAS API errors -static const char *_cudaGetErrorEnum(cublasStatus_t error) -{ - switch (error) - { - case CUBLAS_STATUS_SUCCESS: - return "CUBLAS_STATUS_SUCCESS"; - - case CUBLAS_STATUS_NOT_INITIALIZED: - return "CUBLAS_STATUS_NOT_INITIALIZED"; - - case CUBLAS_STATUS_ALLOC_FAILED: - return "CUBLAS_STATUS_ALLOC_FAILED"; - - case CUBLAS_STATUS_INVALID_VALUE: - return "CUBLAS_STATUS_INVALID_VALUE"; - - case CUBLAS_STATUS_ARCH_MISMATCH: - return "CUBLAS_STATUS_ARCH_MISMATCH"; - - case CUBLAS_STATUS_MAPPING_ERROR: - return "CUBLAS_STATUS_MAPPING_ERROR"; - - case CUBLAS_STATUS_EXECUTION_FAILED: - return "CUBLAS_STATUS_EXECUTION_FAILED"; - - case CUBLAS_STATUS_INTERNAL_ERROR: - return "CUBLAS_STATUS_INTERNAL_ERROR"; - - case CUBLAS_STATUS_NOT_SUPPORTED: - return "CUBLAS_STATUS_NOT_SUPPORTED"; - - case CUBLAS_STATUS_LICENSE_ERROR: - return "CUBLAS_STATUS_LICENSE_ERROR"; - } - - return "<unknown>"; -} -#endif - -#ifdef _CUFFT_H_ -// cuFFT API errors -static const char *_cudaGetErrorEnum(cufftResult error) -{ - switch (error) - { - case CUFFT_SUCCESS: - return "CUFFT_SUCCESS"; - - case CUFFT_INVALID_PLAN: - return "CUFFT_INVALID_PLAN"; - - case CUFFT_ALLOC_FAILED: - return "CUFFT_ALLOC_FAILED"; - - case CUFFT_INVALID_TYPE: - return "CUFFT_INVALID_TYPE"; - - case CUFFT_INVALID_VALUE: - return "CUFFT_INVALID_VALUE"; - - case CUFFT_INTERNAL_ERROR: - return "CUFFT_INTERNAL_ERROR"; - - case CUFFT_EXEC_FAILED: - return "CUFFT_EXEC_FAILED"; - - case CUFFT_SETUP_FAILED: - return "CUFFT_SETUP_FAILED"; - - case CUFFT_INVALID_SIZE: - return "CUFFT_INVALID_SIZE"; - - case CUFFT_UNALIGNED_DATA: - return "CUFFT_UNALIGNED_DATA"; - - case CUFFT_INCOMPLETE_PARAMETER_LIST: - return "CUFFT_INCOMPLETE_PARAMETER_LIST"; - - case CUFFT_INVALID_DEVICE: - return "CUFFT_INVALID_DEVICE"; - - case CUFFT_PARSE_ERROR: - return "CUFFT_PARSE_ERROR"; - - case CUFFT_NO_WORKSPACE: - return "CUFFT_NO_WORKSPACE"; - - case CUFFT_NOT_IMPLEMENTED: - return "CUFFT_NOT_IMPLEMENTED"; - - case CUFFT_LICENSE_ERROR: - return "CUFFT_LICENSE_ERROR"; - - case CUFFT_NOT_SUPPORTED: - return "CUFFT_NOT_SUPPORTED"; - } - - return "<unknown>"; -} -#endif - - -#ifdef CUSPARSEAPI -// cuSPARSE API errors -static const char *_cudaGetErrorEnum(cusparseStatus_t error) -{ - switch (error) - { - case CUSPARSE_STATUS_SUCCESS: - return "CUSPARSE_STATUS_SUCCESS"; - - case CUSPARSE_STATUS_NOT_INITIALIZED: - return "CUSPARSE_STATUS_NOT_INITIALIZED"; - - case CUSPARSE_STATUS_ALLOC_FAILED: - return "CUSPARSE_STATUS_ALLOC_FAILED"; - - case CUSPARSE_STATUS_INVALID_VALUE: - return "CUSPARSE_STATUS_INVALID_VALUE"; - - case CUSPARSE_STATUS_ARCH_MISMATCH: - return "CUSPARSE_STATUS_ARCH_MISMATCH"; - - case CUSPARSE_STATUS_MAPPING_ERROR: - return "CUSPARSE_STATUS_MAPPING_ERROR"; - - case CUSPARSE_STATUS_EXECUTION_FAILED: - return "CUSPARSE_STATUS_EXECUTION_FAILED"; - - case CUSPARSE_STATUS_INTERNAL_ERROR: - return "CUSPARSE_STATUS_INTERNAL_ERROR"; - - case CUSPARSE_STATUS_MATRIX_TYPE_NOT_SUPPORTED: - return "CUSPARSE_STATUS_MATRIX_TYPE_NOT_SUPPORTED"; - } - - return "<unknown>"; -} -#endif - -#ifdef CUSOLVER_COMMON_H_ -//cuSOLVER API errors -static const char *_cudaGetErrorEnum(cusolverStatus_t error) -{ - switch(error) - { - case CUSOLVER_STATUS_SUCCESS: - return "CUSOLVER_STATUS_SUCCESS"; - case CUSOLVER_STATUS_NOT_INITIALIZED: - return "CUSOLVER_STATUS_NOT_INITIALIZED"; - case CUSOLVER_STATUS_ALLOC_FAILED: - return "CUSOLVER_STATUS_ALLOC_FAILED"; - case CUSOLVER_STATUS_INVALID_VALUE: - return "CUSOLVER_STATUS_INVALID_VALUE"; - case CUSOLVER_STATUS_ARCH_MISMATCH: - return "CUSOLVER_STATUS_ARCH_MISMATCH"; - case CUSOLVER_STATUS_MAPPING_ERROR: - return "CUSOLVER_STATUS_MAPPING_ERROR"; - case CUSOLVER_STATUS_EXECUTION_FAILED: - return "CUSOLVER_STATUS_EXECUTION_FAILED"; - case CUSOLVER_STATUS_INTERNAL_ERROR: - return "CUSOLVER_STATUS_INTERNAL_ERROR"; - case CUSOLVER_STATUS_MATRIX_TYPE_NOT_SUPPORTED: - return "CUSOLVER_STATUS_MATRIX_TYPE_NOT_SUPPORTED"; - case CUSOLVER_STATUS_NOT_SUPPORTED : - return "CUSOLVER_STATUS_NOT_SUPPORTED "; - case CUSOLVER_STATUS_ZERO_PIVOT: - return "CUSOLVER_STATUS_ZERO_PIVOT"; - case CUSOLVER_STATUS_INVALID_LICENSE: - return "CUSOLVER_STATUS_INVALID_LICENSE"; - } - - return "<unknown>"; - -} -#endif - -#ifdef CURAND_H_ -// cuRAND API errors -static const char *_cudaGetErrorEnum(curandStatus_t error) -{ - switch (error) - { - case CURAND_STATUS_SUCCESS: - return "CURAND_STATUS_SUCCESS"; - - case CURAND_STATUS_VERSION_MISMATCH: - return "CURAND_STATUS_VERSION_MISMATCH"; - - case CURAND_STATUS_NOT_INITIALIZED: - return "CURAND_STATUS_NOT_INITIALIZED"; - - case CURAND_STATUS_ALLOCATION_FAILED: - return "CURAND_STATUS_ALLOCATION_FAILED"; - - case CURAND_STATUS_TYPE_ERROR: - return "CURAND_STATUS_TYPE_ERROR"; - - case CURAND_STATUS_OUT_OF_RANGE: - return "CURAND_STATUS_OUT_OF_RANGE"; - - case CURAND_STATUS_LENGTH_NOT_MULTIPLE: - return "CURAND_STATUS_LENGTH_NOT_MULTIPLE"; - - case CURAND_STATUS_DOUBLE_PRECISION_REQUIRED: - return "CURAND_STATUS_DOUBLE_PRECISION_REQUIRED"; - - case CURAND_STATUS_LAUNCH_FAILURE: - return "CURAND_STATUS_LAUNCH_FAILURE"; - - case CURAND_STATUS_PREEXISTING_FAILURE: - return "CURAND_STATUS_PREEXISTING_FAILURE"; - - case CURAND_STATUS_INITIALIZATION_FAILED: - return "CURAND_STATUS_INITIALIZATION_FAILED"; - - case CURAND_STATUS_ARCH_MISMATCH: - return "CURAND_STATUS_ARCH_MISMATCH"; - - case CURAND_STATUS_INTERNAL_ERROR: - return "CURAND_STATUS_INTERNAL_ERROR"; - } - - return "<unknown>"; -} -#endif - -#ifdef NV_NPPIDEFS_H -// NPP API errors -static const char *_cudaGetErrorEnum(NppStatus error) -{ - switch (error) - { - case NPP_NOT_SUPPORTED_MODE_ERROR: - return "NPP_NOT_SUPPORTED_MODE_ERROR"; - - case NPP_ROUND_MODE_NOT_SUPPORTED_ERROR: - return "NPP_ROUND_MODE_NOT_SUPPORTED_ERROR"; - - case NPP_RESIZE_NO_OPERATION_ERROR: - return "NPP_RESIZE_NO_OPERATION_ERROR"; - - case NPP_NOT_SUFFICIENT_COMPUTE_CAPABILITY: - return "NPP_NOT_SUFFICIENT_COMPUTE_CAPABILITY"; - -#if ((NPP_VERSION_MAJOR << 12) + (NPP_VERSION_MINOR << 4)) <= 0x5000 - - case NPP_BAD_ARG_ERROR: - return "NPP_BAD_ARGUMENT_ERROR"; - - case NPP_COEFF_ERROR: - return "NPP_COEFFICIENT_ERROR"; - - case NPP_RECT_ERROR: - return "NPP_RECTANGLE_ERROR"; - - case NPP_QUAD_ERROR: - return "NPP_QUADRANGLE_ERROR"; - - case NPP_MEM_ALLOC_ERR: - return "NPP_MEMORY_ALLOCATION_ERROR"; - - case NPP_HISTO_NUMBER_OF_LEVELS_ERROR: - return "NPP_HISTOGRAM_NUMBER_OF_LEVELS_ERROR"; - - case NPP_INVALID_INPUT: - return "NPP_INVALID_INPUT"; - - case NPP_POINTER_ERROR: - return "NPP_POINTER_ERROR"; - - case NPP_WARNING: - return "NPP_WARNING"; - - case NPP_ODD_ROI_WARNING: - return "NPP_ODD_ROI_WARNING"; -#else - - // These are for CUDA 5.5 or higher - case NPP_BAD_ARGUMENT_ERROR: - return "NPP_BAD_ARGUMENT_ERROR"; - - case NPP_COEFFICIENT_ERROR: - return "NPP_COEFFICIENT_ERROR"; - - case NPP_RECTANGLE_ERROR: - return "NPP_RECTANGLE_ERROR"; - - case NPP_QUADRANGLE_ERROR: - return "NPP_QUADRANGLE_ERROR"; - - case NPP_MEMORY_ALLOCATION_ERR: - return "NPP_MEMORY_ALLOCATION_ERROR"; - - case NPP_HISTOGRAM_NUMBER_OF_LEVELS_ERROR: - return "NPP_HISTOGRAM_NUMBER_OF_LEVELS_ERROR"; - - case NPP_INVALID_HOST_POINTER_ERROR: - return "NPP_INVALID_HOST_POINTER_ERROR"; - - case NPP_INVALID_DEVICE_POINTER_ERROR: - return "NPP_INVALID_DEVICE_POINTER_ERROR"; -#endif - - case NPP_LUT_NUMBER_OF_LEVELS_ERROR: - return "NPP_LUT_NUMBER_OF_LEVELS_ERROR"; - - case NPP_TEXTURE_BIND_ERROR: - return "NPP_TEXTURE_BIND_ERROR"; - - case NPP_WRONG_INTERSECTION_ROI_ERROR: - return "NPP_WRONG_INTERSECTION_ROI_ERROR"; - - case NPP_NOT_EVEN_STEP_ERROR: - return "NPP_NOT_EVEN_STEP_ERROR"; - - case NPP_INTERPOLATION_ERROR: - return "NPP_INTERPOLATION_ERROR"; - - case NPP_RESIZE_FACTOR_ERROR: - return "NPP_RESIZE_FACTOR_ERROR"; - - case NPP_HAAR_CLASSIFIER_PIXEL_MATCH_ERROR: - return "NPP_HAAR_CLASSIFIER_PIXEL_MATCH_ERROR"; - - -#if ((NPP_VERSION_MAJOR << 12) + (NPP_VERSION_MINOR << 4)) <= 0x5000 - - case NPP_MEMFREE_ERR: - return "NPP_MEMFREE_ERR"; - - case NPP_MEMSET_ERR: - return "NPP_MEMSET_ERR"; - - case NPP_MEMCPY_ERR: - return "NPP_MEMCPY_ERROR"; - - case NPP_MIRROR_FLIP_ERR: - return "NPP_MIRROR_FLIP_ERR"; -#else - - case NPP_MEMFREE_ERROR: - return "NPP_MEMFREE_ERROR"; - - case NPP_MEMSET_ERROR: - return "NPP_MEMSET_ERROR"; - - case NPP_MEMCPY_ERROR: - return "NPP_MEMCPY_ERROR"; - - case NPP_MIRROR_FLIP_ERROR: - return "NPP_MIRROR_FLIP_ERROR"; -#endif - - case NPP_ALIGNMENT_ERROR: - return "NPP_ALIGNMENT_ERROR"; - - case NPP_STEP_ERROR: - return "NPP_STEP_ERROR"; - - case NPP_SIZE_ERROR: - return "NPP_SIZE_ERROR"; - - case NPP_NULL_POINTER_ERROR: - return "NPP_NULL_POINTER_ERROR"; - - case NPP_CUDA_KERNEL_EXECUTION_ERROR: - return "NPP_CUDA_KERNEL_EXECUTION_ERROR"; - - case NPP_NOT_IMPLEMENTED_ERROR: - return "NPP_NOT_IMPLEMENTED_ERROR"; - - case NPP_ERROR: - return "NPP_ERROR"; - - case NPP_SUCCESS: - return "NPP_SUCCESS"; - - case NPP_WRONG_INTERSECTION_QUAD_WARNING: - return "NPP_WRONG_INTERSECTION_QUAD_WARNING"; - - case NPP_MISALIGNED_DST_ROI_WARNING: - return "NPP_MISALIGNED_DST_ROI_WARNING"; - - case NPP_AFFINE_QUAD_INCORRECT_WARNING: - return "NPP_AFFINE_QUAD_INCORRECT_WARNING"; - - case NPP_DOUBLE_SIZE_WARNING: - return "NPP_DOUBLE_SIZE_WARNING"; - - case NPP_WRONG_INTERSECTION_ROI_WARNING: - return "NPP_WRONG_INTERSECTION_ROI_WARNING"; - -#if ((NPP_VERSION_MAJOR << 12) + (NPP_VERSION_MINOR << 4)) >= 0x6000 - /* These are 6.0 or higher */ - case NPP_LUT_PALETTE_BITSIZE_ERROR: - return "NPP_LUT_PALETTE_BITSIZE_ERROR"; - - case NPP_ZC_MODE_NOT_SUPPORTED_ERROR: - return "NPP_ZC_MODE_NOT_SUPPORTED_ERROR"; - - case NPP_QUALITY_INDEX_ERROR: - return "NPP_QUALITY_INDEX_ERROR"; - - case NPP_CHANNEL_ORDER_ERROR: - return "NPP_CHANNEL_ORDER_ERROR"; - - case NPP_ZERO_MASK_VALUE_ERROR: - return "NPP_ZERO_MASK_VALUE_ERROR"; - - case NPP_NUMBER_OF_CHANNELS_ERROR: - return "NPP_NUMBER_OF_CHANNELS_ERROR"; - - case NPP_COI_ERROR: - return "NPP_COI_ERROR"; - - case NPP_DIVISOR_ERROR: - return "NPP_DIVISOR_ERROR"; - - case NPP_CHANNEL_ERROR: - return "NPP_CHANNEL_ERROR"; - - case NPP_STRIDE_ERROR: - return "NPP_STRIDE_ERROR"; - - case NPP_ANCHOR_ERROR: - return "NPP_ANCHOR_ERROR"; - - case NPP_MASK_SIZE_ERROR: - return "NPP_MASK_SIZE_ERROR"; - - case NPP_MOMENT_00_ZERO_ERROR: - return "NPP_MOMENT_00_ZERO_ERROR"; - - case NPP_THRESHOLD_NEGATIVE_LEVEL_ERROR: - return "NPP_THRESHOLD_NEGATIVE_LEVEL_ERROR"; - - case NPP_THRESHOLD_ERROR: - return "NPP_THRESHOLD_ERROR"; - - case NPP_CONTEXT_MATCH_ERROR: - return "NPP_CONTEXT_MATCH_ERROR"; - - case NPP_FFT_FLAG_ERROR: - return "NPP_FFT_FLAG_ERROR"; - - case NPP_FFT_ORDER_ERROR: - return "NPP_FFT_ORDER_ERROR"; - - case NPP_SCALE_RANGE_ERROR: - return "NPP_SCALE_RANGE_ERROR"; - - case NPP_DATA_TYPE_ERROR: - return "NPP_DATA_TYPE_ERROR"; - - case NPP_OUT_OFF_RANGE_ERROR: - return "NPP_OUT_OFF_RANGE_ERROR"; - - case NPP_DIVIDE_BY_ZERO_ERROR: - return "NPP_DIVIDE_BY_ZERO_ERROR"; - - case NPP_RANGE_ERROR: - return "NPP_RANGE_ERROR"; - - case NPP_NO_MEMORY_ERROR: - return "NPP_NO_MEMORY_ERROR"; - - case NPP_ERROR_RESERVED: - return "NPP_ERROR_RESERVED"; - - case NPP_NO_OPERATION_WARNING: - return "NPP_NO_OPERATION_WARNING"; - - case NPP_DIVIDE_BY_ZERO_WARNING: - return "NPP_DIVIDE_BY_ZERO_WARNING"; -#endif - -#if ((NPP_VERSION_MAJOR << 12) + (NPP_VERSION_MINOR << 4)) >= 0x7000 - /* These are 7.0 or higher */ - case NPP_OVERFLOW_ERROR: - return "NPP_OVERFLOW_ERROR"; - - case NPP_CORRUPTED_DATA_ERROR: - return "NPP_CORRUPTED_DATA_ERROR"; -#endif - } - - return "<unknown>"; -} -#endif - -#ifdef __DRIVER_TYPES_H__ -#ifndef DEVICE_RESET -#define DEVICE_RESET cudaDeviceReset(); -#endif -#else -#ifndef DEVICE_RESET -#define DEVICE_RESET -#endif -#endif - -#ifdef __DRIVER_TYPES_H__ -static inline void check(CUresult result, char const *const func, const char *const file, int const line) -{ - if (result) - { - fprintf(stderr, "CUDA error at %s:%d code=%d(%s) \"%s\" \n", - file, line, (unsigned int)(result), _cudaGetErrorEnum(result), func); - DEVICE_RESET - // Make sure we call CUDA Device Reset before exiting - exit(EXIT_FAILURE); - } -} -#else -static inline void check(cudaError_t result, char const *const func, const char *const file, int const line) -{ - if (result) - { - fprintf(stderr, "CUDA error at %s:%d code=%d(%s) \"%s\" \n", - file, line, (unsigned int)(result), _cudaGetErrorEnum(result), func); - DEVICE_RESET - // Make sure we call CUDA Device Reset before exiting - exit(EXIT_FAILURE); - } -} -#endif - -#ifdef __DRIVER_TYPES_H__ -// This will output the proper CUDA error strings in the event that a CUDA host call returns an error -#define checkCudaErrors(val) check ( (val), #val, __FILE__, __LINE__ ) - -// This will output the proper error string when calling cudaGetLastError -#define getLastCudaError(msg) __getLastCudaError (msg, __FILE__, __LINE__) - -inline void __getLastCudaError(const char *errorMessage, const char *file, const int line) -{ - cudaError_t err = cudaGetLastError(); - - if (cudaSuccess != err) - { - fprintf(stderr, "%s(%i) : getLastCudaError() CUDA error : %s : (%d) %s.\n", - file, line, errorMessage, (int)err, cudaGetErrorString(err)); - DEVICE_RESET - exit(EXIT_FAILURE); - } -} -#endif - -#ifndef MAX -#define MAX(a,b) (a > b ? a : b) -#endif - -// Float To Int conversion -inline int ftoi(float value) -{ - return (value >= 0 ? (int)(value + 0.5) : (int)(value - 0.5)); -} - -// Beginning of GPU Architecture definitions -inline int _ConvertSMVer2Cores(int major, int minor) -{ - // Defines for GPU Architecture types (using the SM version to determine the # of cores per SM - typedef struct sSMtoCores - { - int SM; // 0xMm (hexidecimal notation), M = SM Major version, and m = SM minor version - int Cores; - } sSMtoCores; - - sSMtoCores nGpuArchCoresPerSM[] = - { - { 0x20, 32 }, // Fermi Generation (SM 2.0) GF100 class - { 0x21, 48 }, // Fermi Generation (SM 2.1) GF10x class - { 0x30, 192}, // Kepler Generation (SM 3.0) GK10x class - { 0x32, 192}, // Kepler Generation (SM 3.2) GK10x class - { 0x35, 192}, // Kepler Generation (SM 3.5) GK11x class - { 0x37, 192}, // Kepler Generation (SM 3.7) GK21x class - { 0x50, 128}, // Maxwell Generation (SM 5.0) GM10x class - { 0x52, 128}, // Maxwell Generation (SM 5.2) GM20x class - { 0x53, 128}, // Maxwell Generation (SM 5.3) GM20x class - { 0x60, 64 }, // Pascal Generation (SM 6.0) GP100 class - { 0x61, 128}, // Pascal Generation (SM 6.1) GP10x class - { 0x62, 128}, // Pascal Generation (SM 6.2) GP10x class - { -1, -1 } - }; - - int index = 0; - - while (nGpuArchCoresPerSM[index].SM != -1) - { - if (nGpuArchCoresPerSM[index].SM == ((major << 4) + minor)) - { - return nGpuArchCoresPerSM[index].Cores; - } - - index++; - } - - // If we don't find the values, we default use the previous one to run properly - printf("MapSMtoCores for SM %d.%d is undefined. Default to use %d Cores/SM\n", major, minor, nGpuArchCoresPerSM[index-1].Cores); - return nGpuArchCoresPerSM[index-1].Cores; -} -// end of GPU Architecture definitions - - -// end of CUDA Helper Functions - - -#endif
--- a/src/parallel_execution/helper_string.h Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,264 +0,0 @@ -/** - * Copyright 1993-2013 NVIDIA Corporation. All rights reserved. - * - * Please refer to the NVIDIA end user license agreement (EULA) associated - * with this source code for terms and conditions that govern your use of - * this software. Any use, reproduction, disclosure, or distribution of - * this software and related documentation outside the terms of the EULA - * is strictly prohibited. - * - */ - -// These are helper functions for the SDK samples (string parsing, timers, etc) -#ifndef STRING_HELPER_H -#define STRING_HELPER_H - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) -#ifndef _CRT_SECURE_NO_DEPRECATE -#define _CRT_SECURE_NO_DEPRECATE -#endif -#ifndef STRCASECMP -#define STRCASECMP _stricmp -#endif -#ifndef STRNCASECMP -#define STRNCASECMP _strnicmp -#endif -#ifndef STRCPY -#define STRCPY(sFilePath, nLength, sPath) strcpy_s(sFilePath, nLength, sPath) -#endif - -#ifndef FOPEN -#define FOPEN(fHandle,filename,mode) fopen_s(&fHandle, filename, mode) -#endif -#ifndef FOPEN_FAIL -#define FOPEN_FAIL(result) (result != 0) -#endif -#ifndef SSCANF -#define SSCANF sscanf_s -#endif -#ifndef SPRINTF -#define SPRINTF sprintf_s -#endif -#else // Linux Includes -#include <string.h> -#include <strings.h> - -#ifndef STRCASECMP -#define STRCASECMP strcasecmp -#endif -#ifndef STRNCASECMP -#define STRNCASECMP strncasecmp -#endif -#ifndef STRCPY -#define STRCPY(sFilePath, nLength, sPath) strcpy(sFilePath, sPath) -#endif - -#ifndef FOPEN -#define FOPEN(fHandle,filename,mode) (fHandle = fopen(filename, mode)) -#endif -#ifndef FOPEN_FAIL -#define FOPEN_FAIL(result) (result == NULL) -#endif -#ifndef SSCANF -#define SSCANF sscanf -#endif -#ifndef SPRINTF -#define SPRINTF sprintf -#endif -#endif - -#ifndef EXIT_WAIVED -#define EXIT_WAIVED 2 -#endif - -#ifndef bool -typedef int bool; -#define false 0 -#define true 1 -#endif - -// CUDA Utility Helper Functions -inline int stringRemoveDelimiter(char delimiter, const char *string) -{ - int string_start = 0; - - while (string[string_start] == delimiter) - { - string_start++; - } - - if (string_start >= (int)strlen(string)-1) - { - return 0; - } - - return string_start; -} - -inline int getFileExtension(char *filename, char **extension) -{ - int string_length = (int)strlen(filename); - - while (filename[string_length--] != '.') - { - if (string_length == 0) - break; - } - - if (string_length > 0) string_length += 2; - - if (string_length == 0) - *extension = NULL; - else - *extension = &filename[string_length]; - - return string_length; -} - - -inline bool checkCmdLineFlag(const int argc, const char **argv, const char *string_ref) -{ - bool bFound = false; - - if (argc >= 1) - { - for (int i=1; i < argc; i++) - { - int string_start = stringRemoveDelimiter('-', argv[i]); - const char *string_argv = &argv[i][string_start]; - - const char *equal_pos = strchr(string_argv, '='); - int argv_length = (int)(equal_pos == 0 ? strlen(string_argv) : equal_pos - string_argv); - - int length = (int)strlen(string_ref); - - if (length == argv_length && !STRNCASECMP(string_argv, string_ref, length)) - { - bFound = true; - continue; - } - } - } - - return bFound; -} - - -inline int getCmdLineArgumentInt(const int argc, const char **argv, const char *string_ref) -{ - bool bFound = false; - int value = -1; - - if (argc >= 1) - { - for (int i=1; i < argc; i++) - { - int string_start = stringRemoveDelimiter('-', argv[i]); - const char *string_argv = &argv[i][string_start]; - int length = (int)strlen(string_ref); - - if (!STRNCASECMP(string_argv, string_ref, length)) - { - if (length+1 <= (int)strlen(string_argv)) - { - int auto_inc = (string_argv[length] == '=') ? 1 : 0; - value = atoi(&string_argv[length + auto_inc]); - } - else - { - value = 0; - } - - bFound = true; - continue; - } - } - } - - if (bFound) - { - return value; - } - else - { - return 0; - } -} - -inline float getCmdLineArgumentFloat(const int argc, const char **argv, const char *string_ref) -{ - bool bFound = false; - float value = -1; - - if (argc >= 1) - { - for (int i=1; i < argc; i++) - { - int string_start = stringRemoveDelimiter('-', argv[i]); - const char *string_argv = &argv[i][string_start]; - int length = (int)strlen(string_ref); - - if (!STRNCASECMP(string_argv, string_ref, length)) - { - if (length+1 <= (int)strlen(string_argv)) - { - int auto_inc = (string_argv[length] == '=') ? 1 : 0; - value = (float)atof(&string_argv[length + auto_inc]); - } - else - { - value = 0.f; - } - - bFound = true; - continue; - } - } - } - - if (bFound) - { - return value; - } - else - { - return 0; - } -} - -inline bool getCmdLineArgumentString(const int argc, const char **argv, - const char *string_ref, char **string_retval) -{ - bool bFound = false; - - if (argc >= 1) - { - for (int i=1; i < argc; i++) - { - int string_start = stringRemoveDelimiter('-', argv[i]); - char *string_argv = (char *)&argv[i][string_start]; - int length = (int)strlen(string_ref); - - if (!STRNCASECMP(string_argv, string_ref, length)) - { - *string_retval = &string_argv[length+1]; - bFound = true; - continue; - } - } - } - - if (!bFound) - { - *string_retval = NULL; - } - - return bFound; -} - - -#endif
--- a/src/parallel_execution/main.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +0,0 @@ -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> - -#include "../context.h" - -int cpu_num = 1; -int length = 102400; -int split = 8; -int* array_ptr; -int gpu_num = 0; -int CPU_ANY = -1; -int CPU_CUDA = -1; - -void *start_taskManager(struct Context *context) { - goto initDataGears(context, Gearef(context, LoopCounter), Gearef(context, TaskManager)); - return 0; -} - -__code initDataGears(struct LoopCounter* loopCounter, struct TaskManager* taskManager) { - // loopCounter->tree = createRedBlackTree(context); - loopCounter->i = 0; - taskManager->taskManager = (union Data*)createTaskManagerImpl(context, cpu_num, gpu_num, 0); - goto meta(context, C_code1); -} - -__code initDataGears_stub(struct Context* context) { - struct TaskManager* taskManager = Gearef(context, TaskManager); - taskManager->taskManager = 0; - struct LoopCounter* loopCounter = Gearef(context, LoopCounter); - goto initDataGears(context, loopCounter, taskManager); -} - -__code code1(struct Time* time) { - printf("cpus:\t\t%d\n", cpu_num); - printf("gpus:\t\t%d\n", gpu_num); - printf("length:\t\t%d\n", length); - printf("length/task:\t%d\n", length/split); - /* puts("queue"); */ - /* print_queue(context->data[ActiveQueue]->queue.first); */ - /* puts("tree"); */ - /* print_tree(context->data[Tree]->tree.root); */ - /* puts("result"); */ - time->time = (union Data*)createTimeImpl(context); - time->next = C_createTask1; - goto meta(context, time->time->Time.start); -} - -__code code2(struct Time* time, struct TaskManager* taskManager) { - time->next = C_code3; - taskManager->next = time->time->Time.end; - goto meta(context, taskManager->taskManager->TaskManager.shutdown); -} - -__code code3(struct LoopCounter* loopCounter) { - int i = loopCounter->i; - - if (i < length) { - //printf("%d\n", array_ptr[i]); - if (array_ptr[i] == (i*2)) { - loopCounter->i++; - goto meta(context, C_code3); - } else - puts("wrong result"); - - } - - goto meta(context, C_exit_code); -} - -__code createTask1(struct LoopCounter* loopCounter, struct TaskManager* taskManager) { - Array* array = new Array(); - - par goto createArray(array, __exit); - - par goto twice(array, iterate(split), __exit); - goto code2(); -} - -void init(int argc, char** argv) { - for (int i = 1; argv[i]; ++i) { - if (strcmp(argv[i], "-cpu") == 0) - cpu_num = (int)atoi(argv[i+1]); - else if (strcmp(argv[i], "-l") == 0) - length = (int)atoi(argv[i+1]); - else if (strcmp(argv[i], "-s") == 0) - split = (int)atoi(argv[i+1]); - else if (strcmp(argv[i], "-cuda") == 0) { - gpu_num = 1; - CPU_CUDA = 0; - } - } -} - - -int main(int argc, char** argv) { - init(argc, argv); - - array_ptr = NEWN(length, int); - - for(int i=0; i<length; i++) - array_ptr[i]=i; - - struct Context* main_context = NEW(struct Context); - initContext(main_context); - main_context->next = C_initDataGears; - - goto start_code(main_context); -}
--- a/src/parallel_execution/stack.agda Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,255 +0,0 @@ -open import Level renaming (suc to succ ; zero to Zero ) -module stack where - -open import Relation.Binary.PropositionalEquality -open import Relation.Binary.Core -open import Data.Nat - -ex : 1 + 2 ≡ 3 -ex = refl - -data Bool {n : Level } : Set n where - True : Bool - False : Bool - -record _∧_ {n : Level } (a : Set n) (b : Set n): Set n where - field - pi1 : a - pi2 : b - -data Maybe {n : Level } (a : Set n) : Set n where - Nothing : Maybe a - Just : a -> Maybe a - -record StackMethods {n m : Level } (a : Set n ) {t : Set m }(stackImpl : Set n ) : Set (m Level.⊔ n) where - field - push : stackImpl -> a -> (stackImpl -> t) -> t - pop : stackImpl -> (stackImpl -> Maybe a -> t) -> t - pop2 : stackImpl -> (stackImpl -> Maybe a -> Maybe a -> t) -> t - get : stackImpl -> (stackImpl -> Maybe a -> t) -> t - get2 : stackImpl -> (stackImpl -> Maybe a -> Maybe a -> t) -> t -open StackMethods - -record Stack {n m : Level } (a : Set n ) {t : Set m } (si : Set n ) : Set (m Level.⊔ n) where - field - stack : si - stackMethods : StackMethods {n} {m} a {t} si - pushStack : a -> (Stack a si -> t) -> t - pushStack d next = push (stackMethods ) (stack ) d (\s1 -> next (record {stack = s1 ; stackMethods = stackMethods } )) - popStack : (Stack a si -> Maybe a -> t) -> t - popStack next = pop (stackMethods ) (stack ) (\s1 d1 -> next (record {stack = s1 ; stackMethods = stackMethods }) d1 ) - pop2Stack : (Stack a si -> Maybe a -> Maybe a -> t) -> t - pop2Stack next = pop2 (stackMethods ) (stack ) (\s1 d1 d2 -> next (record {stack = s1 ; stackMethods = stackMethods }) d1 d2) - getStack : (Stack a si -> Maybe a -> t) -> t - getStack next = get (stackMethods ) (stack ) (\s1 d1 -> next (record {stack = s1 ; stackMethods = stackMethods }) d1 ) - get2Stack : (Stack a si -> Maybe a -> Maybe a -> t) -> t - get2Stack next = get2 (stackMethods ) (stack ) (\s1 d1 d2 -> next (record {stack = s1 ; stackMethods = stackMethods }) d1 d2) - -open Stack - -data Element {n : Level } (a : Set n) : Set n where - cons : a -> Maybe (Element a) -> Element a - -datum : {n : Level } {a : Set n} -> Element a -> a -datum (cons a _) = a - -next : {n : Level } {a : Set n} -> Element a -> Maybe (Element a) -next (cons _ n) = n - - -{- --- cannot define recrusive record definition. so use linked list with maybe. -record Element {l : Level} (a : Set n l) : Set n (suc l) where - field - datum : a -- `data` is reserved by Agda. - next : Maybe (Element a) --} - - - -record SingleLinkedStack {n : Level } (a : Set n) : Set n where - field - top : Maybe (Element a) -open SingleLinkedStack - -pushSingleLinkedStack : {n m : Level } {t : Set m } {Data : Set n} -> SingleLinkedStack Data -> Data -> (Code : SingleLinkedStack Data -> t) -> t -pushSingleLinkedStack stack datum next = next stack1 - where - element = cons datum (top stack) - stack1 = record {top = Just element} - - -popSingleLinkedStack : {n m : Level } {t : Set m } {a : Set n} -> SingleLinkedStack a -> (Code : SingleLinkedStack a -> (Maybe a) -> t) -> t -popSingleLinkedStack stack cs with (top stack) -... | Nothing = cs stack Nothing -... | Just d = cs stack1 (Just data1) - where - data1 = datum d - stack1 = record { top = (next d) } - -pop2SingleLinkedStack : {n m : Level } {t : Set m } {a : Set n} -> SingleLinkedStack a -> (Code : SingleLinkedStack a -> (Maybe a) -> (Maybe a) -> t) -> t -pop2SingleLinkedStack {n} {m} {t} {a} stack cs with (top stack) -... | Nothing = cs stack Nothing Nothing -... | Just d = pop2SingleLinkedStack' {n} {m} stack cs - where - pop2SingleLinkedStack' : {n m : Level } {t : Set m } -> SingleLinkedStack a -> (Code : SingleLinkedStack a -> (Maybe a) -> (Maybe a) -> t) -> t - pop2SingleLinkedStack' stack cs with (next d) - ... | Nothing = cs stack Nothing Nothing - ... | Just d1 = cs (record {top = (next d1)}) (Just (datum d)) (Just (datum d1)) - - -getSingleLinkedStack : {n m : Level } {t : Set m } {a : Set n} -> SingleLinkedStack a -> (Code : SingleLinkedStack a -> (Maybe a) -> t) -> t -getSingleLinkedStack stack cs with (top stack) -... | Nothing = cs stack Nothing -... | Just d = cs stack (Just data1) - where - data1 = datum d - -get2SingleLinkedStack : {n m : Level } {t : Set m } {a : Set n} -> SingleLinkedStack a -> (Code : SingleLinkedStack a -> (Maybe a) -> (Maybe a) -> t) -> t -get2SingleLinkedStack {n} {m} {t} {a} stack cs with (top stack) -... | Nothing = cs stack Nothing Nothing -... | Just d = get2SingleLinkedStack' {n} {m} stack cs - where - get2SingleLinkedStack' : {n m : Level} {t : Set m } -> SingleLinkedStack a -> (Code : SingleLinkedStack a -> (Maybe a) -> (Maybe a) -> t) -> t - get2SingleLinkedStack' stack cs with (next d) - ... | Nothing = cs stack Nothing Nothing - ... | Just d1 = cs stack (Just (datum d)) (Just (datum d1)) - - - -emptySingleLinkedStack : {n : Level } {a : Set n} -> SingleLinkedStack a -emptySingleLinkedStack = record {top = Nothing} - ------ --- Basic stack implementations are specifications of a Stack --- -singleLinkedStackSpec : {n m : Level } {t : Set m } {a : Set n} -> StackMethods {n} {m} a {t} (SingleLinkedStack a) -singleLinkedStackSpec = record { - push = pushSingleLinkedStack - ; pop = popSingleLinkedStack - ; pop2 = pop2SingleLinkedStack - ; get = getSingleLinkedStack - ; get2 = get2SingleLinkedStack - } - -createSingleLinkedStack : {n m : Level } {t : Set m } {a : Set n} -> Stack {n} {m} a {t} (SingleLinkedStack a) -createSingleLinkedStack = record { - stack = emptySingleLinkedStack ; - stackMethods = singleLinkedStackSpec - } - ----- --- --- proof of properties ( concrete cases ) --- - -test01 : {n : Level } {a : Set n} -> SingleLinkedStack a -> Maybe a -> Bool {n} -test01 stack _ with (top stack) -... | (Just _) = True -... | Nothing = False - - -test02 : {n : Level } {a : Set n} -> SingleLinkedStack a -> Bool -test02 stack = popSingleLinkedStack stack test01 - -test03 : {n : Level } {a : Set n} -> a -> Bool -test03 v = pushSingleLinkedStack emptySingleLinkedStack v test02 - --- after a push and a pop, the stack is empty -lemma : {n : Level} {A : Set n} {a : A} -> test03 a ≡ False -lemma = refl - -testStack01 : {n m : Level } {a : Set n} -> a -> Bool {m} -testStack01 v = pushStack createSingleLinkedStack v ( - \s -> popStack s (\s1 d1 -> True)) - --- after push 1 and 2, pop2 get 1 and 2 - -testStack02 : {m : Level } -> ( Stack ℕ (SingleLinkedStack ℕ) -> Bool {m} ) -> Bool {m} -testStack02 cs = pushStack createSingleLinkedStack 1 ( - \s -> pushStack s 2 cs) - - -testStack031 : (d1 d2 : ℕ ) -> Bool {Zero} -testStack031 2 1 = True -testStack031 _ _ = False - -testStack032 : (d1 d2 : Maybe ℕ) -> Bool {Zero} -testStack032 (Just d1) (Just d2) = testStack031 d1 d2 -testStack032 _ _ = False - -testStack03 : {m : Level } -> Stack ℕ (SingleLinkedStack ℕ) -> ((Maybe ℕ) -> (Maybe ℕ) -> Bool {m} ) -> Bool {m} -testStack03 s cs = pop2Stack s ( - \s d1 d2 -> cs d1 d2 ) - -testStack04 : Bool -testStack04 = testStack02 (\s -> testStack03 s testStack032) - -testStack05 : testStack04 ≡ True -testStack05 = refl - ------- --- --- proof of properties with indefinite state of stack --- --- this should be proved by properties of the stack inteface, not only by the implementation, --- and the implementation have to provides the properties. --- --- we cannot write "s ≡ s3", since level of the Set does not fit , but use stack s ≡ stack s3 is ok. --- anyway some implementations may result s != s3 --- - -stackInSomeState : {l m : Level } {D : Set l} {t : Set m } (s : SingleLinkedStack D ) -> Stack {l} {m} D {t} ( SingleLinkedStack D ) -stackInSomeState s = record { stack = s ; stackMethods = singleLinkedStackSpec } - -push->push->pop2 : {l : Level } {D : Set l} (x y : D ) (s : SingleLinkedStack D ) -> - pushStack ( stackInSomeState s ) x ( \s1 -> pushStack s1 y ( \s2 -> pop2Stack s2 ( \s3 y1 x1 -> (Just x ≡ x1 ) ∧ (Just y ≡ y1 ) ) )) -push->push->pop2 {l} {D} x y s = record { pi1 = refl ; pi2 = refl } - - -id : {n : Level} {A : Set n} -> A -> A -id a = a - --- push a, n times - -n-push : {n : Level} {A : Set n} {a : A} -> ℕ -> SingleLinkedStack A -> SingleLinkedStack A -n-push zero s = s -n-push {l} {A} {a} (suc n) s = pushSingleLinkedStack (n-push {l} {A} {a} n s) a (\s -> s ) - -n-pop : {n : Level}{A : Set n} {a : A} -> ℕ -> SingleLinkedStack A -> SingleLinkedStack A -n-pop zero s = s -n-pop {_} {A} {a} (suc n) s = popSingleLinkedStack (n-pop {_} {A} {a} n s) (\s _ -> s ) - -open ≡-Reasoning - -push-pop-equiv : {n : Level} {A : Set n} {a : A} (s : SingleLinkedStack A) -> (popSingleLinkedStack (pushSingleLinkedStack s a (\s -> s)) (\s _ -> s) ) ≡ s -push-pop-equiv s = refl - -push-and-n-pop : {n : Level} {A : Set n} {a : A} (n : ℕ) (s : SingleLinkedStack A) -> n-pop {_} {A} {a} (suc n) (pushSingleLinkedStack s a id) ≡ n-pop {_} {A} {a} n s -push-and-n-pop zero s = refl -push-and-n-pop {_} {A} {a} (suc n) s = begin - n-pop {_} {A} {a} (suc (suc n)) (pushSingleLinkedStack s a id) - ≡⟨ refl ⟩ - popSingleLinkedStack (n-pop {_} {A} {a} (suc n) (pushSingleLinkedStack s a id)) (\s _ -> s) - ≡⟨ cong (\s -> popSingleLinkedStack s (\s _ -> s )) (push-and-n-pop n s) ⟩ - popSingleLinkedStack (n-pop {_} {A} {a} n s) (\s _ -> s) - ≡⟨ refl ⟩ - n-pop {_} {A} {a} (suc n) s - ∎ - - -n-push-pop-equiv : {n : Level} {A : Set n} {a : A} (n : ℕ) (s : SingleLinkedStack A) -> (n-pop {_} {A} {a} n (n-push {_} {A} {a} n s)) ≡ s -n-push-pop-equiv zero s = refl -n-push-pop-equiv {_} {A} {a} (suc n) s = begin - n-pop {_} {A} {a} (suc n) (n-push (suc n) s) - ≡⟨ refl ⟩ - n-pop {_} {A} {a} (suc n) (pushSingleLinkedStack (n-push n s) a (\s -> s)) - ≡⟨ push-and-n-pop n (n-push n s) ⟩ - n-pop {_} {A} {a} n (n-push n s) - ≡⟨ n-push-pop-equiv n s ⟩ - s - ∎ - - -n-push-pop-equiv-empty : {n : Level} {A : Set n} {a : A} -> (n : ℕ) -> n-pop {_} {A} {a} n (n-push {_} {A} {a} n emptySingleLinkedStack) ≡ emptySingleLinkedStack -n-push-pop-equiv-empty n = n-push-pop-equiv n emptySingleLinkedStack
--- a/src/parallel_execution/test/cbc_stack_test.c Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -#include "../context.h" -#include <assert.h> - -__code stack_test1(struct Context* context, struct Task* task, struct Stack* stack) { - task->code = C_stack_test1; - stack->next = C_stack_test2; - stack->data = (union Data*)task; - goto meta(context, stack->stack->Stack.push); -} - -__code stack_test1_stub(struct Context* context) { - Task* task = &ALLOCATE(context, Task)->Task; - struct Stack* stack = &(createSingleLinkedStack(context)->Stack); - assert(stack->stack->SingleLinkedStack.top == NULL); - context->data[D_Stack]->Stack.stack = (union Data*)stack; - goto stack_test1(context, - task, - &context->data[D_Stack]->Stack); -} - -__code stack_test2(struct Context* context, struct Task* task, struct Stack* stack) { - task->code = C_stack_test2; - stack->next = C_stack_test3; - stack->data = (union Data*)task; - goto meta(context, stack->stack->Stack.push); -} - -__code stack_test2_stub(struct Context* context) { - assert(context->data[D_Stack]->Stack.stack->Stack.stack->SingleLinkedStack.top->data->Task.code == C_stack_test1); - Task* task = &ALLOCATE(context, Task)->Task; - goto stack_test2(context, - task, - &context->data[D_Stack]->Stack); -} - -__code stack_test3(struct Context* context, struct Stack* stack) { - stack->next = C_stack_test4; - goto meta(context, stack->stack->Stack.pop); -} - -__code stack_test3_stub(struct Context* context) { - assert(context->data[D_Stack]->Stack.stack->Stack.stack->SingleLinkedStack.top->data->Task.code == C_stack_test2); - goto stack_test3(context, - &context->data[D_Stack]->Stack); -} - -__code stack_test4(struct Context* context) { - goto meta(context, C_exit_code); -} - -__code stack_test4_stub(struct Context* context) { - assert(context->data[D_Stack]->Stack.data->Task.code == C_stack_test2); - assert(context->data[D_Stack]->Stack.stack->Stack.stack->SingleLinkedStack.top->data->Task.code == C_stack_test1); - goto stack_test4(context); -} - -int main(int argc, char const* argv[]) { - struct Context* main_context = NEW(struct Context); - initContext(main_context); - main_context->next = C_stack_test1; - goto start_code(main_context); -}
--- a/src/parallel_execution/test/multiDimIterator_test.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> -#interface "Iterator.h" - -#include "../../context.h" - -int cpu_num = 1; -int length = 1; -int gpu_num = 0; -int CPU_ANY = -1; -int CPU_CUDA = -1; - -__code initDataGears(struct LoopCounter* loopCounter, struct TaskManager* taskManager) { - // loopCounter->tree = createRedBlackTree(context); - loopCounter->i = 0; - taskManager->taskManager = (union Data*)createTaskManagerImpl(context, cpu_num, gpu_num, 0); - goto meta(context, C_code1); -} - -__code initDataGears_stub(struct Context* context) { - struct TaskManager* taskManager = Gearef(context, TaskManager); - taskManager->taskManager = 0; - struct LoopCounter* loopCounter = Gearef(context, LoopCounter); - goto initDataGears(context, loopCounter, taskManager); -} - -__code code1(struct LoopCounter* loopCounter) { - printf("cpus:\t\t%d\n", cpu_num); - printf("gpus:\t\t%d\n", gpu_num); - printf("length:\t\t%d\n", length); - /* puts("queue"); */ - /* print_queue(context->data[ActiveQueue]->queue.first); */ - /* puts("tree"); */ - /* print_tree(context->data[Tree]->tree.root); */ - /* puts("result"); */ - - goto createTask1(); -} - -__code createTask1(struct LoopCounter* loopCounter, struct TaskManager* taskManager) { - int i = loopCounter->i; - - if (i < length) { - loopCounter->i++; - goto meta(context, C_createTask2); - } - - loopCounter->i = 0; - taskManager->next = C_exit_code; - goto meta(context, taskManager->taskManager->TaskManager.shutdown); -} - -__code createTask2(struct TaskManager* taskManager) { - par goto printIterator(iterate(2), exit); - par goto printIterator(iterate(2, 2), exit); - par goto printIterator(iterate(2, 2, 2), exit); - goto createTask1(); -} - -void init(int argc, char** argv) { - for (int i = 1; argv[i]; ++i) { - if (strcmp(argv[i], "-cpu") == 0) - cpu_num = (int)atoi(argv[i+1]); - else if (strcmp(argv[i], "-l") == 0) - length = (int)atoi(argv[i+1]); - else if (strcmp(argv[i], "-cuda") == 0) { - gpu_num = 1; - CPU_CUDA = 0; - } - } -} - -int main(int argc, char** argv) { - init(argc, argv); - struct Context* main_context = NEW(struct Context); - initContext(main_context); - main_context->next = C_initDataGears; - goto start_code(main_context); -}
--- a/src/parallel_execution/test/printIterator.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -#include "../../context.h" -#include <stdio.h> -__code printIterator(struct MultiDim* multiDim, __code next(...)) { - printf("x: %d, y: %d, z: %d\n", multiDim->x, multiDim->y, multiDim->z); - goto meta(context, next); -} - -__code printIterator_stub(struct Context* context) { - goto printIterator(context, - &context->data[context->idg]->MultiDim, - context->next); -}
--- a/src/parallel_execution/test/queue_test.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -#include "../../context.h" -#interface "Queue.h" -#include <assert.h> - -__code queueTest1(struct Queue* queue) { - Node* node = new Node(); - node->color = Red; - goto queue->put(node, queueTest2); -} - -__code queueTest1_stub(struct Context* context) { - Queue* queue = createSingleLinkedQueue(context); - goto queueTest1(context, queue); -} - -__code queueTest2(struct Queue* queue) { - Node* node = new Node(); - node->color = Black; - goto queue->put(node, queueTest3); -} - -__code queueTest2_stub(struct Context* context) { - SingleLinkedQueue* singleLinkedQueue = (SingleLinkedQueue*)GearImpl(context, Queue, queue); - assert(singleLinkedQueue->top->next->data->Node.color == Red); - assert(singleLinkedQueue->last->data->Node.color == Red); - Queue* queue = (struct Queue*)Gearef(context, Queue)->queue; - goto queueTest2(context, queue); -} - -__code queueTest3(struct Queue* queue) { - goto queue->take(assert3); -} - -__code queueTest3_stub(struct Context* context) { - SingleLinkedQueue* singleLinkedQueue = (SingleLinkedQueue*)GearImpl(context, Queue, queue); - assert(singleLinkedQueue->top->next->data->Node.color == Red); - assert(singleLinkedQueue->last->data->Node.color == Black); - Queue* queue = (struct Queue*)Gearef(context, Queue)->queue; - goto queueTest3(context, queue); -} - -__code assert3(struct Queue* queue) { - SingleLinkedQueue* singleLinkedQueue = &queue->queue->Queue.queue->SingleLinkedQueue; - assert(singleLinkedQueue->top->next->data->Node.color == Black); - assert(singleLinkedQueue->last->data->Node.color == Black); - goto exit_code(context); -} - -int main(int argc, char const* argv[]) { - goto queueTest1(); -}
--- a/src/parallel_execution/test/rbTree_test.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -#include <stdio.h> -#include "../../context.h" -#interface "Tree.h" - -/* #include <assert.h> */ - -__code rbTreeTest1(struct Tree* tree) { - printf("Test1\n"); - Node* node = new Node(); - node->value = (union Data*)new Int(); - node->value->Int = 3; - node->key = 3; - printf("value->%d,key->%d\n",node->value->Int,node->key); - goto tree->put(node, rbTreeTest2); -} - -__code rbTreeTest1_stub(struct Context* context) { - printf("test1_stub\n"); - Tree* tree = createRedBlackTree(context); - goto rbTreeTest1(context,tree); -} - - -__code rbTreeTest2(struct Tree* tree) { - printf("Test2\n"); - Node* node = new Node(); - node->value = (union Data*)new Int(); - node->value->Int = 4; - node->key = 4; - goto tree->put(node, rbTreeTest3); -} - -__code rbTreeTest2_stub(struct Context* context) { - printf("test2_stub\n"); - Tree* tree = (struct Tree*)Gearef(context, Tree)->tree; - goto rbTreeTest2(context,tree); -} - - -__code rbTreeTest3(struct Tree* tree) { - printf("test3\n"); - Node* node = new Node(); - node->value = (union Data*)new Int(); - node->value->Int = 2; - node->key = 2; - goto tree->put(node, rbTreeTest4); -} - -__code rbTreeTest3_stub(struct Context* context) { - Tree* tree = (struct Tree*)Gearef(context, Tree)->tree; - goto rbTreeTest3(context,tree); -} - -__code rbTreeTest4(struct Tree* tree) { - printf("test4\n"); - Node* node = new Node(); - node->value = (union Data*)new Int(); - node->value->Int = 8; - node->key = 8; - goto tree->put(node, rbTreeTest5); -} - -__code rbTreeTest4_stub(struct Context* context) { - Tree* tree = (struct Tree*)Gearef(context, Tree)->tree; - goto rbTreeTest4(context,tree); -} - -__code rbTreeTest5(struct Tree* tree) { - printf("test5\n"); - Node* node = new Node(); - node->value = (union Data*)new Int(); - node->value->Int = 8; - node->key = 8; - goto tree->remove(node,exit_code); -} - -__code rbTreeTest5_stub(struct Context* context) { - Tree* tree = (struct Tree*)Gearef(context, Tree)->tree; - goto rbTreeTest5(context,tree); -} - - - -int main(int argc, char const* argv[]) { - printf("test_main\n"); - goto rbTreeTest1(); -}
--- a/src/parallel_execution/test/stack_test.cbc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -#include "../../context.h" -#interface "Stack.h" -#include <assert.h> - -__code stackTest1(struct Stack* stack) { - Node* node = new Node(); - node->color = Red; - goto stack->push(node, stackTest2); -} - -__code stackTest1_stub(struct Context* context) { - Stack* stack = createSingleLinkedStack(context); - goto stackTest1(context, stack); -} - -__code stackTest2(struct Stack* stack) { - Node* node = new Node(); - node->color = Black; - goto stack->push(node, stackTest3); -} - -__code stackTest2_stub(struct Context* context) { - SingleLinkedStack* singleLinkedStack = (SingleLinkedStack*)GearImpl(context, Stack, stack); - assert(singleLinkedStack->top->data->Node.color == Red); - Stack* stack = (struct Stack*)Gearef(context, Stack)->stack; - goto stackTest2(context, stack); -} - -__code stackTest3(struct Stack* stack) { - goto stack->pop(assert3); -} - -__code stackTest3_stub(struct Context* context) { - /* - assert on stack implementation - */ - SingleLinkedStack* singleLinkedStack = (SingleLinkedStack*)GearImpl(context, Stack, stack); - assert(singleLinkedStack->top->data->Node.color == Black); - Stack* stack = (struct Stack*)Gearef(context, Stack)->stack; - goto stackTest3(context, stack); -} - -__code assert3(struct Node* node, struct Stack* stack) { - /* - assert in normal level - */ - assert(node->color == Red); - goto exit_code(0); -} - -int main(int argc, char const* argv[]) { - goto stackTest1(); -}
--- a/src/parallel_execution/verifier/llrbContextWithVerifier.c Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -#include <stdio.h> -#include "llrbContextWithVerifier.h" - -unsigned int min_height(struct Node* node, unsigned int height) { - if ((node->left == NULL) && (node->right == NULL)) return height; - if (node->left == NULL) return min_height(node->right, height+1); - if (node->right == NULL) return min_height(node->left, height+1); - - unsigned int left_min = min_height(node->left, height+1); - unsigned int right_min = min_height(node->right, height+1); - - if (left_min < right_min) { - return left_min; - } else { - return right_min; - } -} - -unsigned int max_height(struct Node* node, unsigned int height) { - if ((node->left == NULL) && (node->right == NULL)) return height; - if (node->left == NULL) return max_height(node->right, height+1); - if (node->right == NULL) return max_height(node->left, height+1); - - unsigned int left_max = max_height(node->left, height+1); - unsigned int right_max = max_height(node->right, height+1); - - if (left_max > right_max) { - return left_max; - } else { - return right_max; - } -} - -void verify_tree_height(struct Node* root) { - if (root == NULL) return; - - unsigned int min_h = min_height(root, 1); - unsigned int max_h = max_height(root, 1); - - if (max_h >= 2*min_h) { - printf("llrb-condition violated.\n"); - printf("\tmin-height %u", min_h); - printf("\tmax-height %u", max_h); - exit(EXIT_FAILURE); - } -}
--- a/src/parallel_execution/verifier/llrbContextWithVerifier.h Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -#include "llrbContext.h" - -unsigned int min_height(struct Node* node, unsigned int height); -unsigned int max_height(struct Node* node, unsigned int height); -void verify_tree_height(struct Node* root);
--- a/src/parallel_execution/verifier/verify_put_cs.c Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* Verification of LLRB-Tree height in put operations. - * LLRB-Tree allows (max-height) <= 2*(min-height). - */ - -#include <stdlib.h> -#include <stdio.h> -#include <time.h> -#include "llrbContextWithVerifier.h" - -__code meta(struct Context* context, enum Code next) { - if (next == Put) { - verify_tree_height(context->data[Tree]->tree.root); - } - goto (context->code[next])(context); -} - -__code start_code(struct Context* context, enum Code next) { - unsigned int seed = (unsigned int)time(NULL); - - printf("--- srand(%u)\n", seed); - goto meta(context, next); -} - -__code exit_code(struct Context* context) { - free(context->code); - free(context->data); - free(context->heapStart); - goto exit(0); -}
--- a/src/test/CMakeLists.txt Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -cmake_minimum_required(VERSION 2.8) - -add_definitions("-Wall -g -O0") - -set(NVCCFLAG "-std=c++11" "-g" "-O0" ) - -include_directories("/usr/local/cuda/include") - -set(CMAKE_C_COMPILER $ENV{CBC_COMPILER}) - -set(CUDA_LINK_FLAGS "-framework CUDA -lc++ -Wl,-search_paths_first -Wl,-headerpad_max_install_names /Developer/NVIDIA/CUDA-8.0/lib/libcudart_static.a -Wl,-rpath,/usr/local/cuda/lib") -# for linux use -lcuda - -SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CUDA_LINK_FLAGS}" ) - -cmake_minimum_required(VERSION 2.8) -find_package(CUDA REQUIRED) - -add_custom_command(OUTPUT main.o - DEPENDS main.cu - COMMAND nvcc ${NVCCFLAG} -c main.cu -) - -add_executable(cudaExmple main.o test.c) - -add_custom_command(OUTPUT multiply.ptx - DEPENDS multiply.cu - COMMAND nvcc ${NVCCFLAG} -c multiply.cu -ptx -) - -add_executable(twiceExample twice.cc multiply.ptx ) - -add_custom_command(OUTPUT vectorAdd_kernel.ptx - DEPENDS vectorAdd_kernel.cu - COMMAND nvcc ${NVCCFLAG} -c vectorAdd_kernel.cu -ptx -) - -add_executable(vectorExample vectorAddDrv.cc vectorAdd_kernel.ptx) - -# to compile these, comment out CMAKE_C_COMPILER -# cuda_add_executable(Cudasample_gpu Cudasample_gpu.cu) -# cuda_add_executable(Cudasample_cpu Cudasample_cpu.cu) - -# target_link_libraries(twiceExample ${CUDA_LIBRARIES} ${MPI_LIBRARIES} ${OPENGL_LIBRARIES}) -
--- a/src/test/Cudasample_cpu.cu Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -#include <stdio.h> - -int main(void) -{ - int b; - - for (b = 99; b >= 0; b--) { - switch (b) { - case 0: - printf("No more bottles of beer on the wall, no more bottles of beer.\n"); - printf("Go to the store and buy some more, 99 bottles of beer on the wall.\n"); - break; - case 1: - printf("1 bottle of beer on the wall, 1 bottle of beer.\n"); - printf("Take one down and pass it around, no more bottles of beer on the wall\n"); - break; - default: - printf("%d bottles of beer on the wall, %d bottles of beer.\n", b, b); - printf("Take one down and pass it around, %d %s of beer on the wall.\n" - ,b - 1 - ,((b - 1) > 1)? "bottles" : "bottle"); - break; - } - } - return 0; -} \ No newline at end of file
--- a/src/test/Cudasample_gpu.cu Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -#include <stdio.h> - -#define SIZE_TEXT (sizeof(text)-1) -#define SIZE_END (sizeof(end)-1) - -__device__ char text[] = -"__ bottles of beer on the wall, __ bottles of beer!\n" -"Take one down, and pass it around, ## bottles of beer on the wall!\n\n"; - -__device__ char end[] = -"01 bottle of beer on the wall, 01 bottle of beer.\n" -"Take one down and pass it around, no more bottles of beer on the wall.\n" -"\n" -"No more bottles of beer on the wall, no more bottles of beer.\n" -"Go to the store and buy some more, 99 bottles of beer on the wall."; - - -__global__ -void bottle99(char *addr){ - int x = threadIdx.x; - addr += x * SIZE_TEXT; - int bottle = 99 - x; - if (bottle == 1) { - for (int i=0; i<SIZE_END; i++) { - addr[i] = end[i]; - } - addr[SIZE_END] = '\0'; - } else { - char c1 = (bottle/10) + '0'; - char c2 = (bottle%10) + '0'; - - char d1 = ((bottle-1)/10) + '0'; - char d2 = ((bottle-1)%10) + '0'; - - for (int i=0; i<SIZE_TEXT; i++) { - int c = text[i]; - if (c == '_') { - addr[i] = c1; - addr[i+1] = c2; - i++; - } else if (c == '#') { - - addr[i] = d1; - addr[i+1] = d2; - i++; - } else { - - addr[i] = text[i]; - } - } - } -} - -int main() -{ - char *buffer; - char *d_buffer; - - int size = SIZE_TEXT * 98 + SIZE_END + 1; - - buffer = new char[size]; - cudaMalloc((void**)&d_buffer, size); - - bottle99<<<1, 99>>>(d_buffer); - - cudaMemcpy(buffer, d_buffer, size, cudaMemcpyDeviceToHost); - cudaFree(d_buffer); - - puts(buffer); - free(buffer); - } - \ No newline at end of file
--- a/src/test/OpenCL_gpu.c Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> - -#ifdef __APPLE__ -#include <OpenCL/opencl.h> -#else -#include <CL/cl.h> -#endif - -#define MEM_SIZE (128) -#define MAX_SOURCE_SIZE (0x100000) - -int main() -{ - cl_device_id device_id = NULL; - cl_context context = NULL; - cl_command_queue command_queue = NULL; - cl_mem memobj = NULL; - cl_program program = NULL; - cl_kernel kernel = NULL; - cl_platform_id platform_id = NULL; - cl_uint ret_num_devices; - cl_uint ret_num_platforms; - cl_int ret; - - char string[MEM_SIZE]; - - FILE *fp; - char fileName[] = "./hello.cl"; - char *source_str; - size_t source_size; - -/* Load the source code containing the kernel*/ - fp = fopen(fileName, "r"); - if (!fp) { - fprintf(stderr, "Failed to load kernel.\n"); - exit(1); - } - source_str = (char*)malloc(MAX_SOURCE_SIZE); - source_size = fread(source_str, 1, MAX_SOURCE_SIZE, fp); - fclose(fp); - -/* Get Platform and Device Info */ - ret = clGetPlatformIDs(1, &platform_id, &ret_num_platforms); - ret = clGetDeviceIDs(platform_id, CL_DEVICE_TYPE_DEFAULT, 1, &device_id, &ret_num_devices); - -/* Create OpenCL context */ - context = clCreateContext(NULL, 1, &device_id, NULL, NULL, &ret); - -/* Create Command Queue */ - command_queue = clCreateCommandQueue(context, device_id, 0, &ret); - -/* Create Memory Buffer */ - memobj = clCreateBuffer(context, CL_MEM_READ_WRITE,MEM_SIZE * sizeof(char), NULL, &ret); - -/* Create Kernel Program from the source */ - program = clCreateProgramWithSource(context, 1, (const char **)&source_str, - (const size_t *)&source_size, &ret); - -/* Build Kernel Program */ - ret = clBuildProgram(program, 1, &device_id, NULL, NULL, NULL); - -/* Create OpenCL Kernel */ - kernel = clCreateKernel(program, "hello", &ret); - -/* Set OpenCL Kernel Parameters */ - ret = clSetKernelArg(kernel, 0, sizeof(cl_mem), (void *)&memobj); - -/* Execute OpenCL Kernel */ - ret = clEnqueueTask(command_queue, kernel, 0, NULL,NULL); - -/* Copy results from the memory buffer */ - ret = clEnqueueReadBuffer(command_queue, memobj, CL_TRUE, 0, - MEM_SIZE * sizeof(char),string, 0, NULL, NULL); - -/* Display Result */ - puts(string); - -/* Finalization */ - ret = clFlush(command_queue); - ret = clFinish(command_queue); - ret = clReleaseKernel(kernel); - ret = clReleaseProgram(program); - ret = clReleaseMemObject(memobj); - ret = clReleaseCommandQueue(command_queue); - ret = clReleaseContext(context); - - free(source_str); - - return 0; -}
--- a/src/test/helper_cuda.h Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1283 +0,0 @@ -/** - * Copyright 1993-2013 NVIDIA Corporation. All rights reserved. - * - * Please refer to the NVIDIA end user license agreement (EULA) associated - * with this source code for terms and conditions that govern your use of - * this software. Any use, reproduction, disclosure, or distribution of - * this software and related documentation outside the terms of the EULA - * is strictly prohibited. - * - */ - -//////////////////////////////////////////////////////////////////////////////// -// These are CUDA Helper functions for initialization and error checking - -#ifndef HELPER_CUDA_H -#define HELPER_CUDA_H - -#pragma once - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> - -#include "helper_string.h" - -#ifndef EXIT_WAIVED -#define EXIT_WAIVED 2 -#endif - -// Note, it is required that your SDK sample to include the proper header files, please -// refer the CUDA examples for examples of the needed CUDA headers, which may change depending -// on which CUDA functions are used. - -// CUDA Runtime error messages -#ifdef __DRIVER_TYPES_H__ -static const char *_cudaGetErrorEnum(cudaError_t error) -{ - switch (error) - { - case cudaSuccess: - return "cudaSuccess"; - - case cudaErrorMissingConfiguration: - return "cudaErrorMissingConfiguration"; - - case cudaErrorMemoryAllocation: - return "cudaErrorMemoryAllocation"; - - case cudaErrorInitializationError: - return "cudaErrorInitializationError"; - - case cudaErrorLaunchFailure: - return "cudaErrorLaunchFailure"; - - case cudaErrorPriorLaunchFailure: - return "cudaErrorPriorLaunchFailure"; - - case cudaErrorLaunchTimeout: - return "cudaErrorLaunchTimeout"; - - case cudaErrorLaunchOutOfResources: - return "cudaErrorLaunchOutOfResources"; - - case cudaErrorInvalidDeviceFunction: - return "cudaErrorInvalidDeviceFunction"; - - case cudaErrorInvalidConfiguration: - return "cudaErrorInvalidConfiguration"; - - case cudaErrorInvalidDevice: - return "cudaErrorInvalidDevice"; - - case cudaErrorInvalidValue: - return "cudaErrorInvalidValue"; - - case cudaErrorInvalidPitchValue: - return "cudaErrorInvalidPitchValue"; - - case cudaErrorInvalidSymbol: - return "cudaErrorInvalidSymbol"; - - case cudaErrorMapBufferObjectFailed: - return "cudaErrorMapBufferObjectFailed"; - - case cudaErrorUnmapBufferObjectFailed: - return "cudaErrorUnmapBufferObjectFailed"; - - case cudaErrorInvalidHostPointer: - return "cudaErrorInvalidHostPointer"; - - case cudaErrorInvalidDevicePointer: - return "cudaErrorInvalidDevicePointer"; - - case cudaErrorInvalidTexture: - return "cudaErrorInvalidTexture"; - - case cudaErrorInvalidTextureBinding: - return "cudaErrorInvalidTextureBinding"; - - case cudaErrorInvalidChannelDescriptor: - return "cudaErrorInvalidChannelDescriptor"; - - case cudaErrorInvalidMemcpyDirection: - return "cudaErrorInvalidMemcpyDirection"; - - case cudaErrorAddressOfConstant: - return "cudaErrorAddressOfConstant"; - - case cudaErrorTextureFetchFailed: - return "cudaErrorTextureFetchFailed"; - - case cudaErrorTextureNotBound: - return "cudaErrorTextureNotBound"; - - case cudaErrorSynchronizationError: - return "cudaErrorSynchronizationError"; - - case cudaErrorInvalidFilterSetting: - return "cudaErrorInvalidFilterSetting"; - - case cudaErrorInvalidNormSetting: - return "cudaErrorInvalidNormSetting"; - - case cudaErrorMixedDeviceExecution: - return "cudaErrorMixedDeviceExecution"; - - case cudaErrorCudartUnloading: - return "cudaErrorCudartUnloading"; - - case cudaErrorUnknown: - return "cudaErrorUnknown"; - - case cudaErrorNotYetImplemented: - return "cudaErrorNotYetImplemented"; - - case cudaErrorMemoryValueTooLarge: - return "cudaErrorMemoryValueTooLarge"; - - case cudaErrorInvalidResourceHandle: - return "cudaErrorInvalidResourceHandle"; - - case cudaErrorNotReady: - return "cudaErrorNotReady"; - - case cudaErrorInsufficientDriver: - return "cudaErrorInsufficientDriver"; - - case cudaErrorSetOnActiveProcess: - return "cudaErrorSetOnActiveProcess"; - - case cudaErrorInvalidSurface: - return "cudaErrorInvalidSurface"; - - case cudaErrorNoDevice: - return "cudaErrorNoDevice"; - - case cudaErrorECCUncorrectable: - return "cudaErrorECCUncorrectable"; - - case cudaErrorSharedObjectSymbolNotFound: - return "cudaErrorSharedObjectSymbolNotFound"; - - case cudaErrorSharedObjectInitFailed: - return "cudaErrorSharedObjectInitFailed"; - - case cudaErrorUnsupportedLimit: - return "cudaErrorUnsupportedLimit"; - - case cudaErrorDuplicateVariableName: - return "cudaErrorDuplicateVariableName"; - - case cudaErrorDuplicateTextureName: - return "cudaErrorDuplicateTextureName"; - - case cudaErrorDuplicateSurfaceName: - return "cudaErrorDuplicateSurfaceName"; - - case cudaErrorDevicesUnavailable: - return "cudaErrorDevicesUnavailable"; - - case cudaErrorInvalidKernelImage: - return "cudaErrorInvalidKernelImage"; - - case cudaErrorNoKernelImageForDevice: - return "cudaErrorNoKernelImageForDevice"; - - case cudaErrorIncompatibleDriverContext: - return "cudaErrorIncompatibleDriverContext"; - - case cudaErrorPeerAccessAlreadyEnabled: - return "cudaErrorPeerAccessAlreadyEnabled"; - - case cudaErrorPeerAccessNotEnabled: - return "cudaErrorPeerAccessNotEnabled"; - - case cudaErrorDeviceAlreadyInUse: - return "cudaErrorDeviceAlreadyInUse"; - - case cudaErrorProfilerDisabled: - return "cudaErrorProfilerDisabled"; - - case cudaErrorProfilerNotInitialized: - return "cudaErrorProfilerNotInitialized"; - - case cudaErrorProfilerAlreadyStarted: - return "cudaErrorProfilerAlreadyStarted"; - - case cudaErrorProfilerAlreadyStopped: - return "cudaErrorProfilerAlreadyStopped"; - - /* Since CUDA 4.0*/ - case cudaErrorAssert: - return "cudaErrorAssert"; - - case cudaErrorTooManyPeers: - return "cudaErrorTooManyPeers"; - - case cudaErrorHostMemoryAlreadyRegistered: - return "cudaErrorHostMemoryAlreadyRegistered"; - - case cudaErrorHostMemoryNotRegistered: - return "cudaErrorHostMemoryNotRegistered"; - - /* Since CUDA 5.0 */ - case cudaErrorOperatingSystem: - return "cudaErrorOperatingSystem"; - - case cudaErrorPeerAccessUnsupported: - return "cudaErrorPeerAccessUnsupported"; - - case cudaErrorLaunchMaxDepthExceeded: - return "cudaErrorLaunchMaxDepthExceeded"; - - case cudaErrorLaunchFileScopedTex: - return "cudaErrorLaunchFileScopedTex"; - - case cudaErrorLaunchFileScopedSurf: - return "cudaErrorLaunchFileScopedSurf"; - - case cudaErrorSyncDepthExceeded: - return "cudaErrorSyncDepthExceeded"; - - case cudaErrorLaunchPendingCountExceeded: - return "cudaErrorLaunchPendingCountExceeded"; - - case cudaErrorNotPermitted: - return "cudaErrorNotPermitted"; - - case cudaErrorNotSupported: - return "cudaErrorNotSupported"; - - /* Since CUDA 6.0 */ - case cudaErrorHardwareStackError: - return "cudaErrorHardwareStackError"; - - case cudaErrorIllegalInstruction: - return "cudaErrorIllegalInstruction"; - - case cudaErrorMisalignedAddress: - return "cudaErrorMisalignedAddress"; - - case cudaErrorInvalidAddressSpace: - return "cudaErrorInvalidAddressSpace"; - - case cudaErrorInvalidPc: - return "cudaErrorInvalidPc"; - - case cudaErrorIllegalAddress: - return "cudaErrorIllegalAddress"; - - /* Since CUDA 6.5*/ - case cudaErrorInvalidPtx: - return "cudaErrorInvalidPtx"; - - case cudaErrorInvalidGraphicsContext: - return "cudaErrorInvalidGraphicsContext"; - - case cudaErrorStartupFailure: - return "cudaErrorStartupFailure"; - - case cudaErrorApiFailureBase: - return "cudaErrorApiFailureBase"; - - /* Since CUDA 8.0*/ - case cudaErrorNvlinkUncorrectable : - return "cudaErrorNvlinkUncorrectable"; - } - - return "<unknown>"; -} -#endif - -#ifdef __cuda_cuda_h__ -// CUDA Driver API errors -const char *_cudaGetErrorEnum(CUresult error) -{ - switch (error) - { - case CUDA_SUCCESS: - return "CUDA_SUCCESS"; - - case CUDA_ERROR_INVALID_VALUE: - return "CUDA_ERROR_INVALID_VALUE"; - - case CUDA_ERROR_OUT_OF_MEMORY: - return "CUDA_ERROR_OUT_OF_MEMORY"; - - case CUDA_ERROR_NOT_INITIALIZED: - return "CUDA_ERROR_NOT_INITIALIZED"; - - case CUDA_ERROR_DEINITIALIZED: - return "CUDA_ERROR_DEINITIALIZED"; - - case CUDA_ERROR_PROFILER_DISABLED: - return "CUDA_ERROR_PROFILER_DISABLED"; - - case CUDA_ERROR_PROFILER_NOT_INITIALIZED: - return "CUDA_ERROR_PROFILER_NOT_INITIALIZED"; - - case CUDA_ERROR_PROFILER_ALREADY_STARTED: - return "CUDA_ERROR_PROFILER_ALREADY_STARTED"; - - case CUDA_ERROR_PROFILER_ALREADY_STOPPED: - return "CUDA_ERROR_PROFILER_ALREADY_STOPPED"; - - case CUDA_ERROR_NO_DEVICE: - return "CUDA_ERROR_NO_DEVICE"; - - case CUDA_ERROR_INVALID_DEVICE: - return "CUDA_ERROR_INVALID_DEVICE"; - - case CUDA_ERROR_INVALID_IMAGE: - return "CUDA_ERROR_INVALID_IMAGE"; - - case CUDA_ERROR_INVALID_CONTEXT: - return "CUDA_ERROR_INVALID_CONTEXT"; - - case CUDA_ERROR_CONTEXT_ALREADY_CURRENT: - return "CUDA_ERROR_CONTEXT_ALREADY_CURRENT"; - - case CUDA_ERROR_MAP_FAILED: - return "CUDA_ERROR_MAP_FAILED"; - - case CUDA_ERROR_UNMAP_FAILED: - return "CUDA_ERROR_UNMAP_FAILED"; - - case CUDA_ERROR_ARRAY_IS_MAPPED: - return "CUDA_ERROR_ARRAY_IS_MAPPED"; - - case CUDA_ERROR_ALREADY_MAPPED: - return "CUDA_ERROR_ALREADY_MAPPED"; - - case CUDA_ERROR_NO_BINARY_FOR_GPU: - return "CUDA_ERROR_NO_BINARY_FOR_GPU"; - - case CUDA_ERROR_ALREADY_ACQUIRED: - return "CUDA_ERROR_ALREADY_ACQUIRED"; - - case CUDA_ERROR_NOT_MAPPED: - return "CUDA_ERROR_NOT_MAPPED"; - - case CUDA_ERROR_NOT_MAPPED_AS_ARRAY: - return "CUDA_ERROR_NOT_MAPPED_AS_ARRAY"; - - case CUDA_ERROR_NOT_MAPPED_AS_POINTER: - return "CUDA_ERROR_NOT_MAPPED_AS_POINTER"; - - case CUDA_ERROR_ECC_UNCORRECTABLE: - return "CUDA_ERROR_ECC_UNCORRECTABLE"; - - case CUDA_ERROR_UNSUPPORTED_LIMIT: - return "CUDA_ERROR_UNSUPPORTED_LIMIT"; - - case CUDA_ERROR_CONTEXT_ALREADY_IN_USE: - return "CUDA_ERROR_CONTEXT_ALREADY_IN_USE"; - - case CUDA_ERROR_PEER_ACCESS_UNSUPPORTED: - return "CUDA_ERROR_PEER_ACCESS_UNSUPPORTED"; - - case CUDA_ERROR_INVALID_PTX: - return "CUDA_ERROR_INVALID_PTX"; - - case CUDA_ERROR_INVALID_GRAPHICS_CONTEXT: - return "CUDA_ERROR_INVALID_GRAPHICS_CONTEXT"; - - case CUDA_ERROR_NVLINK_UNCORRECTABLE: - return "CUDA_ERROR_NVLINK_UNCORRECTABLE"; - - case CUDA_ERROR_INVALID_SOURCE: - return "CUDA_ERROR_INVALID_SOURCE"; - - case CUDA_ERROR_FILE_NOT_FOUND: - return "CUDA_ERROR_FILE_NOT_FOUND"; - - case CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND: - return "CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND"; - - case CUDA_ERROR_SHARED_OBJECT_INIT_FAILED: - return "CUDA_ERROR_SHARED_OBJECT_INIT_FAILED"; - - case CUDA_ERROR_OPERATING_SYSTEM: - return "CUDA_ERROR_OPERATING_SYSTEM"; - - case CUDA_ERROR_INVALID_HANDLE: - return "CUDA_ERROR_INVALID_HANDLE"; - - case CUDA_ERROR_NOT_FOUND: - return "CUDA_ERROR_NOT_FOUND"; - - case CUDA_ERROR_NOT_READY: - return "CUDA_ERROR_NOT_READY"; - - case CUDA_ERROR_ILLEGAL_ADDRESS: - return "CUDA_ERROR_ILLEGAL_ADDRESS"; - - case CUDA_ERROR_LAUNCH_FAILED: - return "CUDA_ERROR_LAUNCH_FAILED"; - - case CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES: - return "CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES"; - - case CUDA_ERROR_LAUNCH_TIMEOUT: - return "CUDA_ERROR_LAUNCH_TIMEOUT"; - - case CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING: - return "CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING"; - - case CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED: - return "CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED"; - - case CUDA_ERROR_PEER_ACCESS_NOT_ENABLED: - return "CUDA_ERROR_PEER_ACCESS_NOT_ENABLED"; - - case CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE: - return "CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE"; - - case CUDA_ERROR_CONTEXT_IS_DESTROYED: - return "CUDA_ERROR_CONTEXT_IS_DESTROYED"; - - case CUDA_ERROR_ASSERT: - return "CUDA_ERROR_ASSERT"; - - case CUDA_ERROR_TOO_MANY_PEERS: - return "CUDA_ERROR_TOO_MANY_PEERS"; - - case CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED: - return "CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED"; - - case CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED: - return "CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED"; - - case CUDA_ERROR_HARDWARE_STACK_ERROR: - return "CUDA_ERROR_HARDWARE_STACK_ERROR"; - - case CUDA_ERROR_ILLEGAL_INSTRUCTION: - return "CUDA_ERROR_ILLEGAL_INSTRUCTION"; - - case CUDA_ERROR_MISALIGNED_ADDRESS: - return "CUDA_ERROR_MISALIGNED_ADDRESS"; - - case CUDA_ERROR_INVALID_ADDRESS_SPACE: - return "CUDA_ERROR_INVALID_ADDRESS_SPACE"; - - case CUDA_ERROR_INVALID_PC: - return "CUDA_ERROR_INVALID_PC"; - - case CUDA_ERROR_NOT_PERMITTED: - return "CUDA_ERROR_NOT_PERMITTED"; - - case CUDA_ERROR_NOT_SUPPORTED: - return "CUDA_ERROR_NOT_SUPPORTED"; - - case CUDA_ERROR_UNKNOWN: - return "CUDA_ERROR_UNKNOWN"; - } - - return "<unknown>"; -} -#endif - -#ifdef CUBLAS_API_H_ -// cuBLAS API errors -static const char *_cudaGetErrorEnum(cublasStatus_t error) -{ - switch (error) - { - case CUBLAS_STATUS_SUCCESS: - return "CUBLAS_STATUS_SUCCESS"; - - case CUBLAS_STATUS_NOT_INITIALIZED: - return "CUBLAS_STATUS_NOT_INITIALIZED"; - - case CUBLAS_STATUS_ALLOC_FAILED: - return "CUBLAS_STATUS_ALLOC_FAILED"; - - case CUBLAS_STATUS_INVALID_VALUE: - return "CUBLAS_STATUS_INVALID_VALUE"; - - case CUBLAS_STATUS_ARCH_MISMATCH: - return "CUBLAS_STATUS_ARCH_MISMATCH"; - - case CUBLAS_STATUS_MAPPING_ERROR: - return "CUBLAS_STATUS_MAPPING_ERROR"; - - case CUBLAS_STATUS_EXECUTION_FAILED: - return "CUBLAS_STATUS_EXECUTION_FAILED"; - - case CUBLAS_STATUS_INTERNAL_ERROR: - return "CUBLAS_STATUS_INTERNAL_ERROR"; - - case CUBLAS_STATUS_NOT_SUPPORTED: - return "CUBLAS_STATUS_NOT_SUPPORTED"; - - case CUBLAS_STATUS_LICENSE_ERROR: - return "CUBLAS_STATUS_LICENSE_ERROR"; - } - - return "<unknown>"; -} -#endif - -#ifdef _CUFFT_H_ -// cuFFT API errors -static const char *_cudaGetErrorEnum(cufftResult error) -{ - switch (error) - { - case CUFFT_SUCCESS: - return "CUFFT_SUCCESS"; - - case CUFFT_INVALID_PLAN: - return "CUFFT_INVALID_PLAN"; - - case CUFFT_ALLOC_FAILED: - return "CUFFT_ALLOC_FAILED"; - - case CUFFT_INVALID_TYPE: - return "CUFFT_INVALID_TYPE"; - - case CUFFT_INVALID_VALUE: - return "CUFFT_INVALID_VALUE"; - - case CUFFT_INTERNAL_ERROR: - return "CUFFT_INTERNAL_ERROR"; - - case CUFFT_EXEC_FAILED: - return "CUFFT_EXEC_FAILED"; - - case CUFFT_SETUP_FAILED: - return "CUFFT_SETUP_FAILED"; - - case CUFFT_INVALID_SIZE: - return "CUFFT_INVALID_SIZE"; - - case CUFFT_UNALIGNED_DATA: - return "CUFFT_UNALIGNED_DATA"; - - case CUFFT_INCOMPLETE_PARAMETER_LIST: - return "CUFFT_INCOMPLETE_PARAMETER_LIST"; - - case CUFFT_INVALID_DEVICE: - return "CUFFT_INVALID_DEVICE"; - - case CUFFT_PARSE_ERROR: - return "CUFFT_PARSE_ERROR"; - - case CUFFT_NO_WORKSPACE: - return "CUFFT_NO_WORKSPACE"; - - case CUFFT_NOT_IMPLEMENTED: - return "CUFFT_NOT_IMPLEMENTED"; - - case CUFFT_LICENSE_ERROR: - return "CUFFT_LICENSE_ERROR"; - - case CUFFT_NOT_SUPPORTED: - return "CUFFT_NOT_SUPPORTED"; - } - - return "<unknown>"; -} -#endif - - -#ifdef CUSPARSEAPI -// cuSPARSE API errors -static const char *_cudaGetErrorEnum(cusparseStatus_t error) -{ - switch (error) - { - case CUSPARSE_STATUS_SUCCESS: - return "CUSPARSE_STATUS_SUCCESS"; - - case CUSPARSE_STATUS_NOT_INITIALIZED: - return "CUSPARSE_STATUS_NOT_INITIALIZED"; - - case CUSPARSE_STATUS_ALLOC_FAILED: - return "CUSPARSE_STATUS_ALLOC_FAILED"; - - case CUSPARSE_STATUS_INVALID_VALUE: - return "CUSPARSE_STATUS_INVALID_VALUE"; - - case CUSPARSE_STATUS_ARCH_MISMATCH: - return "CUSPARSE_STATUS_ARCH_MISMATCH"; - - case CUSPARSE_STATUS_MAPPING_ERROR: - return "CUSPARSE_STATUS_MAPPING_ERROR"; - - case CUSPARSE_STATUS_EXECUTION_FAILED: - return "CUSPARSE_STATUS_EXECUTION_FAILED"; - - case CUSPARSE_STATUS_INTERNAL_ERROR: - return "CUSPARSE_STATUS_INTERNAL_ERROR"; - - case CUSPARSE_STATUS_MATRIX_TYPE_NOT_SUPPORTED: - return "CUSPARSE_STATUS_MATRIX_TYPE_NOT_SUPPORTED"; - } - - return "<unknown>"; -} -#endif - -#ifdef CUSOLVER_COMMON_H_ -//cuSOLVER API errors -static const char *_cudaGetErrorEnum(cusolverStatus_t error) -{ - switch(error) - { - case CUSOLVER_STATUS_SUCCESS: - return "CUSOLVER_STATUS_SUCCESS"; - case CUSOLVER_STATUS_NOT_INITIALIZED: - return "CUSOLVER_STATUS_NOT_INITIALIZED"; - case CUSOLVER_STATUS_ALLOC_FAILED: - return "CUSOLVER_STATUS_ALLOC_FAILED"; - case CUSOLVER_STATUS_INVALID_VALUE: - return "CUSOLVER_STATUS_INVALID_VALUE"; - case CUSOLVER_STATUS_ARCH_MISMATCH: - return "CUSOLVER_STATUS_ARCH_MISMATCH"; - case CUSOLVER_STATUS_MAPPING_ERROR: - return "CUSOLVER_STATUS_MAPPING_ERROR"; - case CUSOLVER_STATUS_EXECUTION_FAILED: - return "CUSOLVER_STATUS_EXECUTION_FAILED"; - case CUSOLVER_STATUS_INTERNAL_ERROR: - return "CUSOLVER_STATUS_INTERNAL_ERROR"; - case CUSOLVER_STATUS_MATRIX_TYPE_NOT_SUPPORTED: - return "CUSOLVER_STATUS_MATRIX_TYPE_NOT_SUPPORTED"; - case CUSOLVER_STATUS_NOT_SUPPORTED : - return "CUSOLVER_STATUS_NOT_SUPPORTED "; - case CUSOLVER_STATUS_ZERO_PIVOT: - return "CUSOLVER_STATUS_ZERO_PIVOT"; - case CUSOLVER_STATUS_INVALID_LICENSE: - return "CUSOLVER_STATUS_INVALID_LICENSE"; - } - - return "<unknown>"; - -} -#endif - -#ifdef CURAND_H_ -// cuRAND API errors -static const char *_cudaGetErrorEnum(curandStatus_t error) -{ - switch (error) - { - case CURAND_STATUS_SUCCESS: - return "CURAND_STATUS_SUCCESS"; - - case CURAND_STATUS_VERSION_MISMATCH: - return "CURAND_STATUS_VERSION_MISMATCH"; - - case CURAND_STATUS_NOT_INITIALIZED: - return "CURAND_STATUS_NOT_INITIALIZED"; - - case CURAND_STATUS_ALLOCATION_FAILED: - return "CURAND_STATUS_ALLOCATION_FAILED"; - - case CURAND_STATUS_TYPE_ERROR: - return "CURAND_STATUS_TYPE_ERROR"; - - case CURAND_STATUS_OUT_OF_RANGE: - return "CURAND_STATUS_OUT_OF_RANGE"; - - case CURAND_STATUS_LENGTH_NOT_MULTIPLE: - return "CURAND_STATUS_LENGTH_NOT_MULTIPLE"; - - case CURAND_STATUS_DOUBLE_PRECISION_REQUIRED: - return "CURAND_STATUS_DOUBLE_PRECISION_REQUIRED"; - - case CURAND_STATUS_LAUNCH_FAILURE: - return "CURAND_STATUS_LAUNCH_FAILURE"; - - case CURAND_STATUS_PREEXISTING_FAILURE: - return "CURAND_STATUS_PREEXISTING_FAILURE"; - - case CURAND_STATUS_INITIALIZATION_FAILED: - return "CURAND_STATUS_INITIALIZATION_FAILED"; - - case CURAND_STATUS_ARCH_MISMATCH: - return "CURAND_STATUS_ARCH_MISMATCH"; - - case CURAND_STATUS_INTERNAL_ERROR: - return "CURAND_STATUS_INTERNAL_ERROR"; - } - - return "<unknown>"; -} -#endif - -#ifdef NV_NPPIDEFS_H -// NPP API errors -static const char *_cudaGetErrorEnum(NppStatus error) -{ - switch (error) - { - case NPP_NOT_SUPPORTED_MODE_ERROR: - return "NPP_NOT_SUPPORTED_MODE_ERROR"; - - case NPP_ROUND_MODE_NOT_SUPPORTED_ERROR: - return "NPP_ROUND_MODE_NOT_SUPPORTED_ERROR"; - - case NPP_RESIZE_NO_OPERATION_ERROR: - return "NPP_RESIZE_NO_OPERATION_ERROR"; - - case NPP_NOT_SUFFICIENT_COMPUTE_CAPABILITY: - return "NPP_NOT_SUFFICIENT_COMPUTE_CAPABILITY"; - -#if ((NPP_VERSION_MAJOR << 12) + (NPP_VERSION_MINOR << 4)) <= 0x5000 - - case NPP_BAD_ARG_ERROR: - return "NPP_BAD_ARGUMENT_ERROR"; - - case NPP_COEFF_ERROR: - return "NPP_COEFFICIENT_ERROR"; - - case NPP_RECT_ERROR: - return "NPP_RECTANGLE_ERROR"; - - case NPP_QUAD_ERROR: - return "NPP_QUADRANGLE_ERROR"; - - case NPP_MEM_ALLOC_ERR: - return "NPP_MEMORY_ALLOCATION_ERROR"; - - case NPP_HISTO_NUMBER_OF_LEVELS_ERROR: - return "NPP_HISTOGRAM_NUMBER_OF_LEVELS_ERROR"; - - case NPP_INVALID_INPUT: - return "NPP_INVALID_INPUT"; - - case NPP_POINTER_ERROR: - return "NPP_POINTER_ERROR"; - - case NPP_WARNING: - return "NPP_WARNING"; - - case NPP_ODD_ROI_WARNING: - return "NPP_ODD_ROI_WARNING"; -#else - - // These are for CUDA 5.5 or higher - case NPP_BAD_ARGUMENT_ERROR: - return "NPP_BAD_ARGUMENT_ERROR"; - - case NPP_COEFFICIENT_ERROR: - return "NPP_COEFFICIENT_ERROR"; - - case NPP_RECTANGLE_ERROR: - return "NPP_RECTANGLE_ERROR"; - - case NPP_QUADRANGLE_ERROR: - return "NPP_QUADRANGLE_ERROR"; - - case NPP_MEMORY_ALLOCATION_ERR: - return "NPP_MEMORY_ALLOCATION_ERROR"; - - case NPP_HISTOGRAM_NUMBER_OF_LEVELS_ERROR: - return "NPP_HISTOGRAM_NUMBER_OF_LEVELS_ERROR"; - - case NPP_INVALID_HOST_POINTER_ERROR: - return "NPP_INVALID_HOST_POINTER_ERROR"; - - case NPP_INVALID_DEVICE_POINTER_ERROR: - return "NPP_INVALID_DEVICE_POINTER_ERROR"; -#endif - - case NPP_LUT_NUMBER_OF_LEVELS_ERROR: - return "NPP_LUT_NUMBER_OF_LEVELS_ERROR"; - - case NPP_TEXTURE_BIND_ERROR: - return "NPP_TEXTURE_BIND_ERROR"; - - case NPP_WRONG_INTERSECTION_ROI_ERROR: - return "NPP_WRONG_INTERSECTION_ROI_ERROR"; - - case NPP_NOT_EVEN_STEP_ERROR: - return "NPP_NOT_EVEN_STEP_ERROR"; - - case NPP_INTERPOLATION_ERROR: - return "NPP_INTERPOLATION_ERROR"; - - case NPP_RESIZE_FACTOR_ERROR: - return "NPP_RESIZE_FACTOR_ERROR"; - - case NPP_HAAR_CLASSIFIER_PIXEL_MATCH_ERROR: - return "NPP_HAAR_CLASSIFIER_PIXEL_MATCH_ERROR"; - - -#if ((NPP_VERSION_MAJOR << 12) + (NPP_VERSION_MINOR << 4)) <= 0x5000 - - case NPP_MEMFREE_ERR: - return "NPP_MEMFREE_ERR"; - - case NPP_MEMSET_ERR: - return "NPP_MEMSET_ERR"; - - case NPP_MEMCPY_ERR: - return "NPP_MEMCPY_ERROR"; - - case NPP_MIRROR_FLIP_ERR: - return "NPP_MIRROR_FLIP_ERR"; -#else - - case NPP_MEMFREE_ERROR: - return "NPP_MEMFREE_ERROR"; - - case NPP_MEMSET_ERROR: - return "NPP_MEMSET_ERROR"; - - case NPP_MEMCPY_ERROR: - return "NPP_MEMCPY_ERROR"; - - case NPP_MIRROR_FLIP_ERROR: - return "NPP_MIRROR_FLIP_ERROR"; -#endif - - case NPP_ALIGNMENT_ERROR: - return "NPP_ALIGNMENT_ERROR"; - - case NPP_STEP_ERROR: - return "NPP_STEP_ERROR"; - - case NPP_SIZE_ERROR: - return "NPP_SIZE_ERROR"; - - case NPP_NULL_POINTER_ERROR: - return "NPP_NULL_POINTER_ERROR"; - - case NPP_CUDA_KERNEL_EXECUTION_ERROR: - return "NPP_CUDA_KERNEL_EXECUTION_ERROR"; - - case NPP_NOT_IMPLEMENTED_ERROR: - return "NPP_NOT_IMPLEMENTED_ERROR"; - - case NPP_ERROR: - return "NPP_ERROR"; - - case NPP_SUCCESS: - return "NPP_SUCCESS"; - - case NPP_WRONG_INTERSECTION_QUAD_WARNING: - return "NPP_WRONG_INTERSECTION_QUAD_WARNING"; - - case NPP_MISALIGNED_DST_ROI_WARNING: - return "NPP_MISALIGNED_DST_ROI_WARNING"; - - case NPP_AFFINE_QUAD_INCORRECT_WARNING: - return "NPP_AFFINE_QUAD_INCORRECT_WARNING"; - - case NPP_DOUBLE_SIZE_WARNING: - return "NPP_DOUBLE_SIZE_WARNING"; - - case NPP_WRONG_INTERSECTION_ROI_WARNING: - return "NPP_WRONG_INTERSECTION_ROI_WARNING"; - -#if ((NPP_VERSION_MAJOR << 12) + (NPP_VERSION_MINOR << 4)) >= 0x6000 - /* These are 6.0 or higher */ - case NPP_LUT_PALETTE_BITSIZE_ERROR: - return "NPP_LUT_PALETTE_BITSIZE_ERROR"; - - case NPP_ZC_MODE_NOT_SUPPORTED_ERROR: - return "NPP_ZC_MODE_NOT_SUPPORTED_ERROR"; - - case NPP_QUALITY_INDEX_ERROR: - return "NPP_QUALITY_INDEX_ERROR"; - - case NPP_CHANNEL_ORDER_ERROR: - return "NPP_CHANNEL_ORDER_ERROR"; - - case NPP_ZERO_MASK_VALUE_ERROR: - return "NPP_ZERO_MASK_VALUE_ERROR"; - - case NPP_NUMBER_OF_CHANNELS_ERROR: - return "NPP_NUMBER_OF_CHANNELS_ERROR"; - - case NPP_COI_ERROR: - return "NPP_COI_ERROR"; - - case NPP_DIVISOR_ERROR: - return "NPP_DIVISOR_ERROR"; - - case NPP_CHANNEL_ERROR: - return "NPP_CHANNEL_ERROR"; - - case NPP_STRIDE_ERROR: - return "NPP_STRIDE_ERROR"; - - case NPP_ANCHOR_ERROR: - return "NPP_ANCHOR_ERROR"; - - case NPP_MASK_SIZE_ERROR: - return "NPP_MASK_SIZE_ERROR"; - - case NPP_MOMENT_00_ZERO_ERROR: - return "NPP_MOMENT_00_ZERO_ERROR"; - - case NPP_THRESHOLD_NEGATIVE_LEVEL_ERROR: - return "NPP_THRESHOLD_NEGATIVE_LEVEL_ERROR"; - - case NPP_THRESHOLD_ERROR: - return "NPP_THRESHOLD_ERROR"; - - case NPP_CONTEXT_MATCH_ERROR: - return "NPP_CONTEXT_MATCH_ERROR"; - - case NPP_FFT_FLAG_ERROR: - return "NPP_FFT_FLAG_ERROR"; - - case NPP_FFT_ORDER_ERROR: - return "NPP_FFT_ORDER_ERROR"; - - case NPP_SCALE_RANGE_ERROR: - return "NPP_SCALE_RANGE_ERROR"; - - case NPP_DATA_TYPE_ERROR: - return "NPP_DATA_TYPE_ERROR"; - - case NPP_OUT_OFF_RANGE_ERROR: - return "NPP_OUT_OFF_RANGE_ERROR"; - - case NPP_DIVIDE_BY_ZERO_ERROR: - return "NPP_DIVIDE_BY_ZERO_ERROR"; - - case NPP_RANGE_ERROR: - return "NPP_RANGE_ERROR"; - - case NPP_NO_MEMORY_ERROR: - return "NPP_NO_MEMORY_ERROR"; - - case NPP_ERROR_RESERVED: - return "NPP_ERROR_RESERVED"; - - case NPP_NO_OPERATION_WARNING: - return "NPP_NO_OPERATION_WARNING"; - - case NPP_DIVIDE_BY_ZERO_WARNING: - return "NPP_DIVIDE_BY_ZERO_WARNING"; -#endif - -#if ((NPP_VERSION_MAJOR << 12) + (NPP_VERSION_MINOR << 4)) >= 0x7000 - /* These are 7.0 or higher */ - case NPP_OVERFLOW_ERROR: - return "NPP_OVERFLOW_ERROR"; - - case NPP_CORRUPTED_DATA_ERROR: - return "NPP_CORRUPTED_DATA_ERROR"; -#endif - } - - return "<unknown>"; -} -#endif - -#ifdef __DRIVER_TYPES_H__ -#ifndef DEVICE_RESET -#define DEVICE_RESET cudaDeviceReset(); -#endif -#else -#ifndef DEVICE_RESET -#define DEVICE_RESET -#endif -#endif - -template< typename T > -void check(T result, char const *const func, const char *const file, int const line) -{ - if (result) - { - fprintf(stderr, "CUDA error at %s:%d code=%d(%s) \"%s\" \n", - file, line, static_cast<unsigned int>(result), _cudaGetErrorEnum(result), func); - DEVICE_RESET - // Make sure we call CUDA Device Reset before exiting - exit(EXIT_FAILURE); - } -} - -#ifdef __DRIVER_TYPES_H__ -// This will output the proper CUDA error strings in the event that a CUDA host call returns an error -#define checkCudaErrors(val) check ( (val), #val, __FILE__, __LINE__ ) - -// This will output the proper error string when calling cudaGetLastError -#define getLastCudaError(msg) __getLastCudaError (msg, __FILE__, __LINE__) - -inline void __getLastCudaError(const char *errorMessage, const char *file, const int line) -{ - cudaError_t err = cudaGetLastError(); - - if (cudaSuccess != err) - { - fprintf(stderr, "%s(%i) : getLastCudaError() CUDA error : %s : (%d) %s.\n", - file, line, errorMessage, (int)err, cudaGetErrorString(err)); - DEVICE_RESET - exit(EXIT_FAILURE); - } -} -#endif - -#ifndef MAX -#define MAX(a,b) (a > b ? a : b) -#endif - -// Float To Int conversion -inline int ftoi(float value) -{ - return (value >= 0 ? (int)(value + 0.5) : (int)(value - 0.5)); -} - -// Beginning of GPU Architecture definitions -inline int _ConvertSMVer2Cores(int major, int minor) -{ - // Defines for GPU Architecture types (using the SM version to determine the # of cores per SM - typedef struct - { - int SM; // 0xMm (hexidecimal notation), M = SM Major version, and m = SM minor version - int Cores; - } sSMtoCores; - - sSMtoCores nGpuArchCoresPerSM[] = - { - { 0x20, 32 }, // Fermi Generation (SM 2.0) GF100 class - { 0x21, 48 }, // Fermi Generation (SM 2.1) GF10x class - { 0x30, 192}, // Kepler Generation (SM 3.0) GK10x class - { 0x32, 192}, // Kepler Generation (SM 3.2) GK10x class - { 0x35, 192}, // Kepler Generation (SM 3.5) GK11x class - { 0x37, 192}, // Kepler Generation (SM 3.7) GK21x class - { 0x50, 128}, // Maxwell Generation (SM 5.0) GM10x class - { 0x52, 128}, // Maxwell Generation (SM 5.2) GM20x class - { 0x53, 128}, // Maxwell Generation (SM 5.3) GM20x class - { 0x60, 64 }, // Pascal Generation (SM 6.0) GP100 class - { 0x61, 128}, // Pascal Generation (SM 6.1) GP10x class - { 0x62, 128}, // Pascal Generation (SM 6.2) GP10x class - { -1, -1 } - }; - - int index = 0; - - while (nGpuArchCoresPerSM[index].SM != -1) - { - if (nGpuArchCoresPerSM[index].SM == ((major << 4) + minor)) - { - return nGpuArchCoresPerSM[index].Cores; - } - - index++; - } - - // If we don't find the values, we default use the previous one to run properly - printf("MapSMtoCores for SM %d.%d is undefined. Default to use %d Cores/SM\n", major, minor, nGpuArchCoresPerSM[index-1].Cores); - return nGpuArchCoresPerSM[index-1].Cores; -} -// end of GPU Architecture definitions - -#ifdef __CUDA_RUNTIME_H__ -// General GPU Device CUDA Initialization -inline int gpuDeviceInit(int devID) -{ - int device_count; - checkCudaErrors(cudaGetDeviceCount(&device_count)); - - if (device_count == 0) - { - fprintf(stderr, "gpuDeviceInit() CUDA error: no devices supporting CUDA.\n"); - exit(EXIT_FAILURE); - } - - if (devID < 0) - { - devID = 0; - } - - if (devID > device_count-1) - { - fprintf(stderr, "\n"); - fprintf(stderr, ">> %d CUDA capable GPU device(s) detected. <<\n", device_count); - fprintf(stderr, ">> gpuDeviceInit (-device=%d) is not a valid GPU device. <<\n", devID); - fprintf(stderr, "\n"); - return -devID; - } - - cudaDeviceProp deviceProp; - checkCudaErrors(cudaGetDeviceProperties(&deviceProp, devID)); - - if (deviceProp.computeMode == cudaComputeModeProhibited) - { - fprintf(stderr, "Error: device is running in <Compute Mode Prohibited>, no threads can use ::cudaSetDevice().\n"); - return -1; - } - - if (deviceProp.major < 1) - { - fprintf(stderr, "gpuDeviceInit(): GPU device does not support CUDA.\n"); - exit(EXIT_FAILURE); - } - - checkCudaErrors(cudaSetDevice(devID)); - printf("gpuDeviceInit() CUDA Device [%d]: \"%s\n", devID, deviceProp.name); - - return devID; -} - -// This function returns the best GPU (with maximum GFLOPS) -inline int gpuGetMaxGflopsDeviceId() -{ - int current_device = 0, sm_per_multiproc = 0; - int max_perf_device = 0; - int device_count = 0, best_SM_arch = 0; - int devices_prohibited = 0; - - unsigned long long max_compute_perf = 0; - cudaDeviceProp deviceProp; - cudaGetDeviceCount(&device_count); - - checkCudaErrors(cudaGetDeviceCount(&device_count)); - - if (device_count == 0) - { - fprintf(stderr, "gpuGetMaxGflopsDeviceId() CUDA error: no devices supporting CUDA.\n"); - exit(EXIT_FAILURE); - } - - // Find the best major SM Architecture GPU device - while (current_device < device_count) - { - cudaGetDeviceProperties(&deviceProp, current_device); - - // If this GPU is not running on Compute Mode prohibited, then we can add it to the list - if (deviceProp.computeMode != cudaComputeModeProhibited) - { - if (deviceProp.major > 0 && deviceProp.major < 9999) - { - best_SM_arch = MAX(best_SM_arch, deviceProp.major); - } - } - else - { - devices_prohibited++; - } - - current_device++; - } - - if (devices_prohibited == device_count) - { - fprintf(stderr, "gpuGetMaxGflopsDeviceId() CUDA error: all devices have compute mode prohibited.\n"); - exit(EXIT_FAILURE); - } - - // Find the best CUDA capable GPU device - current_device = 0; - - while (current_device < device_count) - { - cudaGetDeviceProperties(&deviceProp, current_device); - - // If this GPU is not running on Compute Mode prohibited, then we can add it to the list - if (deviceProp.computeMode != cudaComputeModeProhibited) - { - if (deviceProp.major == 9999 && deviceProp.minor == 9999) - { - sm_per_multiproc = 1; - } - else - { - sm_per_multiproc = _ConvertSMVer2Cores(deviceProp.major, deviceProp.minor); - } - - unsigned long long compute_perf = (unsigned long long) deviceProp.multiProcessorCount * sm_per_multiproc * deviceProp.clockRate; - - if (compute_perf > max_compute_perf) - { - // If we find GPU with SM major > 2, search only these - if (best_SM_arch > 2) - { - // If our device==dest_SM_arch, choose this, or else pass - if (deviceProp.major == best_SM_arch) - { - max_compute_perf = compute_perf; - max_perf_device = current_device; - } - } - else - { - max_compute_perf = compute_perf; - max_perf_device = current_device; - } - } - } - - ++current_device; - } - - return max_perf_device; -} - - -// Initialization code to find the best CUDA Device -inline int findCudaDevice(int argc, const char **argv) -{ - cudaDeviceProp deviceProp; - int devID = 0; - - // If the command-line has a device number specified, use it - if (checkCmdLineFlag(argc, argv, "device")) - { - devID = getCmdLineArgumentInt(argc, argv, "device="); - - if (devID < 0) - { - printf("Invalid command line parameter\n "); - exit(EXIT_FAILURE); - } - else - { - devID = gpuDeviceInit(devID); - - if (devID < 0) - { - printf("exiting...\n"); - exit(EXIT_FAILURE); - } - } - } - else - { - // Otherwise pick the device with highest Gflops/s - devID = gpuGetMaxGflopsDeviceId(); - checkCudaErrors(cudaSetDevice(devID)); - checkCudaErrors(cudaGetDeviceProperties(&deviceProp, devID)); - printf("GPU Device %d: \"%s\" with compute capability %d.%d\n\n", devID, deviceProp.name, deviceProp.major, deviceProp.minor); - } - - return devID; -} - -// General check for CUDA GPU SM Capabilities -inline bool checkCudaCapabilities(int major_version, int minor_version) -{ - cudaDeviceProp deviceProp; - deviceProp.major = 0; - deviceProp.minor = 0; - int dev; - - checkCudaErrors(cudaGetDevice(&dev)); - checkCudaErrors(cudaGetDeviceProperties(&deviceProp, dev)); - - if ((deviceProp.major > major_version) || - (deviceProp.major == major_version && deviceProp.minor >= minor_version)) - { - printf(" Device %d: <%16s >, Compute SM %d.%d detected\n", dev, deviceProp.name, deviceProp.major, deviceProp.minor); - return true; - } - else - { - printf(" No GPU device was found that can support CUDA compute capability %d.%d.\n", major_version, minor_version); - return false; - } -} -#endif - -// end of CUDA Helper Functions - - -#endif
--- a/src/test/helper_string.h Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,527 +0,0 @@ -/** - * Copyright 1993-2013 NVIDIA Corporation. All rights reserved. - * - * Please refer to the NVIDIA end user license agreement (EULA) associated - * with this source code for terms and conditions that govern your use of - * this software. Any use, reproduction, disclosure, or distribution of - * this software and related documentation outside the terms of the EULA - * is strictly prohibited. - * - */ - -// These are helper functions for the SDK samples (string parsing, timers, etc) -#ifndef STRING_HELPER_H -#define STRING_HELPER_H - -#include <stdio.h> -#include <stdlib.h> -#include <fstream> -#include <string> - -#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) -#ifndef _CRT_SECURE_NO_DEPRECATE -#define _CRT_SECURE_NO_DEPRECATE -#endif -#ifndef STRCASECMP -#define STRCASECMP _stricmp -#endif -#ifndef STRNCASECMP -#define STRNCASECMP _strnicmp -#endif -#ifndef STRCPY -#define STRCPY(sFilePath, nLength, sPath) strcpy_s(sFilePath, nLength, sPath) -#endif - -#ifndef FOPEN -#define FOPEN(fHandle,filename,mode) fopen_s(&fHandle, filename, mode) -#endif -#ifndef FOPEN_FAIL -#define FOPEN_FAIL(result) (result != 0) -#endif -#ifndef SSCANF -#define SSCANF sscanf_s -#endif -#ifndef SPRINTF -#define SPRINTF sprintf_s -#endif -#else // Linux Includes -#include <string.h> -#include <strings.h> - -#ifndef STRCASECMP -#define STRCASECMP strcasecmp -#endif -#ifndef STRNCASECMP -#define STRNCASECMP strncasecmp -#endif -#ifndef STRCPY -#define STRCPY(sFilePath, nLength, sPath) strcpy(sFilePath, sPath) -#endif - -#ifndef FOPEN -#define FOPEN(fHandle,filename,mode) (fHandle = fopen(filename, mode)) -#endif -#ifndef FOPEN_FAIL -#define FOPEN_FAIL(result) (result == NULL) -#endif -#ifndef SSCANF -#define SSCANF sscanf -#endif -#ifndef SPRINTF -#define SPRINTF sprintf -#endif -#endif - -#ifndef EXIT_WAIVED -#define EXIT_WAIVED 2 -#endif - -// CUDA Utility Helper Functions -inline int stringRemoveDelimiter(char delimiter, const char *string) -{ - int string_start = 0; - - while (string[string_start] == delimiter) - { - string_start++; - } - - if (string_start >= (int)strlen(string)-1) - { - return 0; - } - - return string_start; -} - -inline int getFileExtension(char *filename, char **extension) -{ - int string_length = (int)strlen(filename); - - while (filename[string_length--] != '.') - { - if (string_length == 0) - break; - } - - if (string_length > 0) string_length += 2; - - if (string_length == 0) - *extension = NULL; - else - *extension = &filename[string_length]; - - return string_length; -} - - -inline bool checkCmdLineFlag(const int argc, const char **argv, const char *string_ref) -{ - bool bFound = false; - - if (argc >= 1) - { - for (int i=1; i < argc; i++) - { - int string_start = stringRemoveDelimiter('-', argv[i]); - const char *string_argv = &argv[i][string_start]; - - const char *equal_pos = strchr(string_argv, '='); - int argv_length = (int)(equal_pos == 0 ? strlen(string_argv) : equal_pos - string_argv); - - int length = (int)strlen(string_ref); - - if (length == argv_length && !STRNCASECMP(string_argv, string_ref, length)) - { - bFound = true; - continue; - } - } - } - - return bFound; -} - -// This function wraps the CUDA Driver API into a template function -template <class T> -inline bool getCmdLineArgumentValue(const int argc, const char **argv, const char *string_ref, T *value) -{ - bool bFound = false; - - if (argc >= 1) - { - for (int i=1; i < argc; i++) - { - int string_start = stringRemoveDelimiter('-', argv[i]); - const char *string_argv = &argv[i][string_start]; - int length = (int)strlen(string_ref); - - if (!STRNCASECMP(string_argv, string_ref, length)) - { - if (length+1 <= (int)strlen(string_argv)) - { - int auto_inc = (string_argv[length] == '=') ? 1 : 0; - *value = (T)atoi(&string_argv[length + auto_inc]); - } - - bFound = true; - i=argc; - } - } - } - - return bFound; -} - -inline int getCmdLineArgumentInt(const int argc, const char **argv, const char *string_ref) -{ - bool bFound = false; - int value = -1; - - if (argc >= 1) - { - for (int i=1; i < argc; i++) - { - int string_start = stringRemoveDelimiter('-', argv[i]); - const char *string_argv = &argv[i][string_start]; - int length = (int)strlen(string_ref); - - if (!STRNCASECMP(string_argv, string_ref, length)) - { - if (length+1 <= (int)strlen(string_argv)) - { - int auto_inc = (string_argv[length] == '=') ? 1 : 0; - value = atoi(&string_argv[length + auto_inc]); - } - else - { - value = 0; - } - - bFound = true; - continue; - } - } - } - - if (bFound) - { - return value; - } - else - { - return 0; - } -} - -inline float getCmdLineArgumentFloat(const int argc, const char **argv, const char *string_ref) -{ - bool bFound = false; - float value = -1; - - if (argc >= 1) - { - for (int i=1; i < argc; i++) - { - int string_start = stringRemoveDelimiter('-', argv[i]); - const char *string_argv = &argv[i][string_start]; - int length = (int)strlen(string_ref); - - if (!STRNCASECMP(string_argv, string_ref, length)) - { - if (length+1 <= (int)strlen(string_argv)) - { - int auto_inc = (string_argv[length] == '=') ? 1 : 0; - value = (float)atof(&string_argv[length + auto_inc]); - } - else - { - value = 0.f; - } - - bFound = true; - continue; - } - } - } - - if (bFound) - { - return value; - } - else - { - return 0; - } -} - -inline bool getCmdLineArgumentString(const int argc, const char **argv, - const char *string_ref, char **string_retval) -{ - bool bFound = false; - - if (argc >= 1) - { - for (int i=1; i < argc; i++) - { - int string_start = stringRemoveDelimiter('-', argv[i]); - char *string_argv = (char *)&argv[i][string_start]; - int length = (int)strlen(string_ref); - - if (!STRNCASECMP(string_argv, string_ref, length)) - { - *string_retval = &string_argv[length+1]; - bFound = true; - continue; - } - } - } - - if (!bFound) - { - *string_retval = NULL; - } - - return bFound; -} - -////////////////////////////////////////////////////////////////////////////// -//! Find the path for a file assuming that -//! files are found in the searchPath. -//! -//! @return the path if succeeded, otherwise 0 -//! @param filename name of the file -//! @param executable_path optional absolute path of the executable -////////////////////////////////////////////////////////////////////////////// -inline char *sdkFindFilePath(const char *filename, const char *executable_path) -{ - // <executable_name> defines a variable that is replaced with the name of the executable - - // Typical relative search paths to locate needed companion files (e.g. sample input data, or JIT source files) - // The origin for the relative search may be the .exe file, a .bat file launching an .exe, a browser .exe launching the .exe or .bat, etc - const char *searchPath[] = - { - "./", // same dir - "./<executable_name>_data_files/", - "./common/", // "/common/" subdir - "./common/data/", // "/common/data/" subdir - "./data/", // "/data/" subdir - "./src/", // "/src/" subdir - "./src/<executable_name>/data/", // "/src/<executable_name>/data/" subdir - "./inc/", // "/inc/" subdir - "./0_Simple/", // "/0_Simple/" subdir - "./1_Utilities/", // "/1_Utilities/" subdir - "./2_Graphics/", // "/2_Graphics/" subdir - "./3_Imaging/", // "/3_Imaging/" subdir - "./4_Finance/", // "/4_Finance/" subdir - "./5_Simulations/", // "/5_Simulations/" subdir - "./6_Advanced/", // "/6_Advanced/" subdir - "./7_CUDALibraries/", // "/7_CUDALibraries/" subdir - "./8_Android/", // "/8_Android/" subdir - "./samples/", // "/samples/" subdir - - "./0_Simple/<executable_name>/data/", // "/0_Simple/<executable_name>/data/" subdir - "./1_Utilities/<executable_name>/data/", // "/1_Utilities/<executable_name>/data/" subdir - "./2_Graphics/<executable_name>/data/", // "/2_Graphics/<executable_name>/data/" subdir - "./3_Imaging/<executable_name>/data/", // "/3_Imaging/<executable_name>/data/" subdir - "./4_Finance/<executable_name>/data/", // "/4_Finance/<executable_name>/data/" subdir - "./5_Simulations/<executable_name>/data/", // "/5_Simulations/<executable_name>/data/" subdir - "./6_Advanced/<executable_name>/data/", // "/6_Advanced/<executable_name>/data/" subdir - "./7_CUDALibraries/<executable_name>/", // "/7_CUDALibraries/<executable_name>/" subdir - "./7_CUDALibraries/<executable_name>/data/", // "/7_CUDALibraries/<executable_name>/data/" subdir - - "../", // up 1 in tree - "../common/", // up 1 in tree, "/common/" subdir - "../common/data/", // up 1 in tree, "/common/data/" subdir - "../data/", // up 1 in tree, "/data/" subdir - "../src/", // up 1 in tree, "/src/" subdir - "../inc/", // up 1 in tree, "/inc/" subdir - - "../0_Simple/<executable_name>/data/", // up 1 in tree, "/0_Simple/<executable_name>/" subdir - "../1_Utilities/<executable_name>/data/", // up 1 in tree, "/1_Utilities/<executable_name>/" subdir - "../2_Graphics/<executable_name>/data/", // up 1 in tree, "/2_Graphics/<executable_name>/" subdir - "../3_Imaging/<executable_name>/data/", // up 1 in tree, "/3_Imaging/<executable_name>/" subdir - "../4_Finance/<executable_name>/data/", // up 1 in tree, "/4_Finance/<executable_name>/" subdir - "../5_Simulations/<executable_name>/data/", // up 1 in tree, "/5_Simulations/<executable_name>/" subdir - "../6_Advanced/<executable_name>/data/", // up 1 in tree, "/6_Advanced/<executable_name>/" subdir - "../7_CUDALibraries/<executable_name>/data/",// up 1 in tree, "/7_CUDALibraries/<executable_name>/" subdir - "../8_Android/<executable_name>/data/", // up 1 in tree, "/8_Android/<executable_name>/" subdir - "../samples/<executable_name>/data/", // up 1 in tree, "/samples/<executable_name>/" subdir - "../../", // up 2 in tree - "../../common/", // up 2 in tree, "/common/" subdir - "../../common/data/", // up 2 in tree, "/common/data/" subdir - "../../data/", // up 2 in tree, "/data/" subdir - "../../src/", // up 2 in tree, "/src/" subdir - "../../inc/", // up 2 in tree, "/inc/" subdir - "../../sandbox/<executable_name>/data/", // up 2 in tree, "/sandbox/<executable_name>/" subdir - "../../0_Simple/<executable_name>/data/", // up 2 in tree, "/0_Simple/<executable_name>/" subdir - "../../1_Utilities/<executable_name>/data/", // up 2 in tree, "/1_Utilities/<executable_name>/" subdir - "../../2_Graphics/<executable_name>/data/", // up 2 in tree, "/2_Graphics/<executable_name>/" subdir - "../../3_Imaging/<executable_name>/data/", // up 2 in tree, "/3_Imaging/<executable_name>/" subdir - "../../4_Finance/<executable_name>/data/", // up 2 in tree, "/4_Finance/<executable_name>/" subdir - "../../5_Simulations/<executable_name>/data/", // up 2 in tree, "/5_Simulations/<executable_name>/" subdir - "../../6_Advanced/<executable_name>/data/", // up 2 in tree, "/6_Advanced/<executable_name>/" subdir - "../../7_CUDALibraries/<executable_name>/data/", // up 2 in tree, "/7_CUDALibraries/<executable_name>/" subdir - "../../8_Android/<executable_name>/data/", // up 2 in tree, "/8_Android/<executable_name>/" subdir - "../../samples/<executable_name>/data/", // up 2 in tree, "/samples/<executable_name>/" subdir - "../../../", // up 3 in tree - "../../../src/<executable_name>/", // up 3 in tree, "/src/<executable_name>/" subdir - "../../../src/<executable_name>/data/", // up 3 in tree, "/src/<executable_name>/data/" subdir - "../../../src/<executable_name>/src/", // up 3 in tree, "/src/<executable_name>/src/" subdir - "../../../src/<executable_name>/inc/", // up 3 in tree, "/src/<executable_name>/inc/" subdir - "../../../sandbox/<executable_name>/", // up 3 in tree, "/sandbox/<executable_name>/" subdir - "../../../sandbox/<executable_name>/data/", // up 3 in tree, "/sandbox/<executable_name>/data/" subdir - "../../../sandbox/<executable_name>/src/", // up 3 in tree, "/sandbox/<executable_name>/src/" subdir - "../../../sandbox/<executable_name>/inc/", // up 3 in tree, "/sandbox/<executable_name>/inc/" subdir - "../../../0_Simple/<executable_name>/data/", // up 3 in tree, "/0_Simple/<executable_name>/" subdir - "../../../1_Utilities/<executable_name>/data/", // up 3 in tree, "/1_Utilities/<executable_name>/" subdir - "../../../2_Graphics/<executable_name>/data/", // up 3 in tree, "/2_Graphics/<executable_name>/" subdir - "../../../3_Imaging/<executable_name>/data/", // up 3 in tree, "/3_Imaging/<executable_name>/" subdir - "../../../4_Finance/<executable_name>/data/", // up 3 in tree, "/4_Finance/<executable_name>/" subdir - "../../../5_Simulations/<executable_name>/data/", // up 3 in tree, "/5_Simulations/<executable_name>/" subdir - "../../../6_Advanced/<executable_name>/data/", // up 3 in tree, "/6_Advanced/<executable_name>/" subdir - "../../../7_CUDALibraries/<executable_name>/data/", // up 3 in tree, "/7_CUDALibraries/<executable_name>/" subdir - "../../../8_Android/<executable_name>/data/", // up 3 in tree, "/8_Android/<executable_name>/" subdir - "../../../0_Simple/<executable_name>/", // up 3 in tree, "/0_Simple/<executable_name>/" subdir - "../../../1_Utilities/<executable_name>/", // up 3 in tree, "/1_Utilities/<executable_name>/" subdir - "../../../2_Graphics/<executable_name>/", // up 3 in tree, "/2_Graphics/<executable_name>/" subdir - "../../../3_Imaging/<executable_name>/", // up 3 in tree, "/3_Imaging/<executable_name>/" subdir - "../../../4_Finance/<executable_name>/", // up 3 in tree, "/4_Finance/<executable_name>/" subdir - "../../../5_Simulations/<executable_name>/", // up 3 in tree, "/5_Simulations/<executable_name>/" subdir - "../../../6_Advanced/<executable_name>/", // up 3 in tree, "/6_Advanced/<executable_name>/" subdir - "../../../7_CUDALibraries/<executable_name>/", // up 3 in tree, "/7_CUDALibraries/<executable_name>/" subdir - "../../../8_Android/<executable_name>/", // up 3 in tree, "/8_Android/<executable_name>/" subdir - "../../../samples/<executable_name>/data/", // up 3 in tree, "/samples/<executable_name>/" subdir - "../../../common/", // up 3 in tree, "../../../common/" subdir - "../../../common/data/", // up 3 in tree, "../../../common/data/" subdir - "../../../data/", // up 3 in tree, "../../../data/" subdir - "../../../../", // up 4 in tree - "../../../../src/<executable_name>/", // up 4 in tree, "/src/<executable_name>/" subdir - "../../../../src/<executable_name>/data/", // up 4 in tree, "/src/<executable_name>/data/" subdir - "../../../../src/<executable_name>/src/", // up 4 in tree, "/src/<executable_name>/src/" subdir - "../../../../src/<executable_name>/inc/", // up 4 in tree, "/src/<executable_name>/inc/" subdir - "../../../../sandbox/<executable_name>/", // up 4 in tree, "/sandbox/<executable_name>/" subdir - "../../../../sandbox/<executable_name>/data/", // up 4 in tree, "/sandbox/<executable_name>/data/" subdir - "../../../../sandbox/<executable_name>/src/", // up 4 in tree, "/sandbox/<executable_name>/src/" subdir - "../../../../sandbox/<executable_name>/inc/", // up 4 in tree, "/sandbox/<executable_name>/inc/" subdir - "../../../../0_Simple/<executable_name>/data/", // up 4 in tree, "/0_Simple/<executable_name>/" subdir - "../../../../1_Utilities/<executable_name>/data/", // up 4 in tree, "/1_Utilities/<executable_name>/" subdir - "../../../../2_Graphics/<executable_name>/data/", // up 4 in tree, "/2_Graphics/<executable_name>/" subdir - "../../../../3_Imaging/<executable_name>/data/", // up 4 in tree, "/3_Imaging/<executable_name>/" subdir - "../../../../4_Finance/<executable_name>/data/", // up 4 in tree, "/4_Finance/<executable_name>/" subdir - "../../../../5_Simulations/<executable_name>/data/",// up 4 in tree, "/5_Simulations/<executable_name>/" subdir - "../../../../6_Advanced/<executable_name>/data/", // up 4 in tree, "/6_Advanced/<executable_name>/" subdir - "../../../../7_CUDALibraries/<executable_name>/data/", // up 4 in tree, "/7_CUDALibraries/<executable_name>/" subdir - "../../../../8_Android/<executable_name>/data/", // up 4 in tree, "/8_Android/<executable_name>/" subdir - "../../../../0_Simple/<executable_name>/", // up 4 in tree, "/0_Simple/<executable_name>/" subdir - "../../../../1_Utilities/<executable_name>/", // up 4 in tree, "/1_Utilities/<executable_name>/" subdir - "../../../../2_Graphics/<executable_name>/", // up 4 in tree, "/2_Graphics/<executable_name>/" subdir - "../../../../3_Imaging/<executable_name>/", // up 4 in tree, "/3_Imaging/<executable_name>/" subdir - "../../../../4_Finance/<executable_name>/", // up 4 in tree, "/4_Finance/<executable_name>/" subdir - "../../../../5_Simulations/<executable_name>/",// up 4 in tree, "/5_Simulations/<executable_name>/" subdir - "../../../../6_Advanced/<executable_name>/", // up 4 in tree, "/6_Advanced/<executable_name>/" subdir - "../../../../7_CUDALibraries/<executable_name>/", // up 4 in tree, "/7_CUDALibraries/<executable_name>/" subdir - "../../../../8_Android/<executable_name>/", // up 4 in tree, "/8_Android/<executable_name>/" subdir - "../../../../samples/<executable_name>/data/", // up 4 in tree, "/samples/<executable_name>/" subdir - "../../../../common/", // up 4 in tree, "../../../common/" subdir - "../../../../common/data/", // up 4 in tree, "../../../common/data/" subdir - "../../../../data/", // up 4 in tree, "../../../data/" subdir - "../../../../../", // up 5 in tree - "../../../../../src/<executable_name>/", // up 5 in tree, "/src/<executable_name>/" subdir - "../../../../../src/<executable_name>/data/", // up 5 in tree, "/src/<executable_name>/data/" subdir - "../../../../../src/<executable_name>/src/", // up 5 in tree, "/src/<executable_name>/src/" subdir - "../../../../../src/<executable_name>/inc/", // up 5 in tree, "/src/<executable_name>/inc/" subdir - "../../../../../sandbox/<executable_name>/", // up 5 in tree, "/sandbox/<executable_name>/" subdir - "../../../../../sandbox/<executable_name>/data/", // up 5 in tree, "/sandbox/<executable_name>/data/" subdir - "../../../../../sandbox/<executable_name>/src/", // up 5 in tree, "/sandbox/<executable_name>/src/" subdir - "../../../../../sandbox/<executable_name>/inc/", // up 5 in tree, "/sandbox/<executable_name>/inc/" subdir - "../../../../../0_Simple/<executable_name>/data/", // up 5 in tree, "/0_Simple/<executable_name>/" subdir - "../../../../../1_Utilities/<executable_name>/data/", // up 5 in tree, "/1_Utilities/<executable_name>/" subdir - "../../../../../2_Graphics/<executable_name>/data/", // up 5 in tree, "/2_Graphics/<executable_name>/" subdir - "../../../../../3_Imaging/<executable_name>/data/", // up 5 in tree, "/3_Imaging/<executable_name>/" subdir - "../../../../../4_Finance/<executable_name>/data/", // up 5 in tree, "/4_Finance/<executable_name>/" subdir - "../../../../../5_Simulations/<executable_name>/data/",// up 5 in tree, "/5_Simulations/<executable_name>/" subdir - "../../../../../6_Advanced/<executable_name>/data/", // up 5 in tree, "/6_Advanced/<executable_name>/" subdir - "../../../../../7_CUDALibraries/<executable_name>/data/", // up 5 in tree, "/7_CUDALibraries/<executable_name>/" subdir - "../../../../../8_Android/<executable_name>/data/", // up 5 in tree, "/8_Android/<executable_name>/" subdir - "../../../../../samples/<executable_name>/data/", // up 5 in tree, "/samples/<executable_name>/" subdir - "../../../../../common/", // up 5 in tree, "../../../common/" subdir - "../../../../../common/data/", // up 5 in tree, "../../../common/data/" subdir - }; - - // Extract the executable name - std::string executable_name; - - if (executable_path != 0) - { - executable_name = std::string(executable_path); - -#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) - // Windows path delimiter - size_t delimiter_pos = executable_name.find_last_of('\\'); - executable_name.erase(0, delimiter_pos + 1); - - if (executable_name.rfind(".exe") != std::string::npos) - { - // we strip .exe, only if the .exe is found - executable_name.resize(executable_name.size() - 4); - } - -#else - // Linux & OSX path delimiter - size_t delimiter_pos = executable_name.find_last_of('/'); - executable_name.erase(0,delimiter_pos+1); -#endif - } - - // Loop over all search paths and return the first hit - for (unsigned int i = 0; i < sizeof(searchPath)/sizeof(char *); ++i) - { - std::string path(searchPath[i]); - size_t executable_name_pos = path.find("<executable_name>"); - - // If there is executable_name variable in the searchPath - // replace it with the value - if (executable_name_pos != std::string::npos) - { - if (executable_path != 0) - { - path.replace(executable_name_pos, strlen("<executable_name>"), executable_name); - } - else - { - // Skip this path entry if no executable argument is given - continue; - } - } - -#ifdef _DEBUG - printf("sdkFindFilePath <%s> in %s\n", filename, path.c_str()); -#endif - - // Test if the file exists - path.append(filename); - FILE *fp; - FOPEN(fp, path.c_str(), "rb"); - - if (fp != NULL) - { - fclose(fp); - // File found - // returning an allocated array here for backwards compatibility reasons - char *file_path = (char *) malloc(path.length() + 1); - STRCPY(file_path, path.length() + 1, path.c_str()); - return file_path; - } - - if (fp) - { - fclose(fp); - } - } - - // File not found - return 0; -} - -#endif
--- a/src/test/main.cu Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,368 +0,0 @@ -/* - * Copyright 1993-2015 NVIDIA Corporation. All rights reserved. - * - * Please refer to the NVIDIA end user license agreement (EULA) associated - * with this source code for terms and conditions that govern your use of - * this software. Any use, reproduction, disclosure, or distribution of - * this software and related documentation outside the terms of the EULA - * is strictly prohibited. - * - */ - -/* - * Quadro and Tesla GPUs with compute capability >= 2.0 can overlap two memcopies - * with kernel execution. This sample illustrates the usage of CUDA streams to - * achieve overlapping of kernel execution with copying data to and from the device. - * - * Additionally, this sample uses CUDA events to measure elapsed time for - * CUDA calls. Events are a part of CUDA API and provide a system independent - * way to measure execution times on CUDA devices with approximately 0.5 - * microsecond precision. - * - * Elapsed times are averaged over nreps repetitions (10 by default). - * -*/ - -const char *sSDKname = "simpleMultiCopy"; - -// includes, system -#include <stdio.h> - -extern "C" { -extern void test1(); -} -// include CUDA -#include <cuda.h> -#include <cuda_runtime.h> - -// includes, project -//#include <helper_cuda.h> -//#include <helper_functions.h> // helper for shared that are common to CUDA Samples - -#include "helper_cuda.h" - -// includes, kernels -// Declare the CUDA kernels here and main() code that is needed to launch -// Compute workload on the system -__global__ void incKernel(int *g_out, int *g_in, int N, int inner_reps) -{ - int idx = blockIdx.x * blockDim.x + threadIdx.x; - - if (idx < N) - { - for (int i=0; i<inner_reps; ++i) - { - g_out[idx] = g_in[idx] + 1; - } - } -} - -#define STREAM_COUNT 4 - -// Uncomment to simulate data source/sink IO times -//#define SIMULATE_IO - -int *h_data_source; -int *h_data_sink; - -int *h_data_in[STREAM_COUNT]; -int *d_data_in[STREAM_COUNT]; - -int *h_data_out[STREAM_COUNT]; -int *d_data_out[STREAM_COUNT]; - - -cudaEvent_t cycleDone[STREAM_COUNT]; -cudaStream_t stream[STREAM_COUNT]; - -cudaEvent_t start, stop; - -int N = 1 << 22; -int nreps = 10; // number of times each experiment is repeated -int inner_reps = 5; - -int memsize; - -dim3 block(512); -dim3 grid; - -int thread_blocks; - -float processWithStreams(int streams_used); -void init(); -bool test(); - -//////////////////////////////////////////////////////////////////////////////// -// Program main -//////////////////////////////////////////////////////////////////////////////// -int main(int argc, char *argv[]) -{ - int cuda_device = 0; - float scale_factor; - cudaDeviceProp deviceProp; - - test1(); - printf("[%s] - Starting...\n", sSDKname); - - // Otherwise pick the device with the highest Gflops/s - cuda_device = 0; - checkCudaErrors(cudaSetDevice(cuda_device)); - checkCudaErrors(cudaGetDeviceProperties(&deviceProp, cuda_device)); - printf("> Using CUDA device [%d]: %s\n", cuda_device, deviceProp.name); - - checkCudaErrors(cudaGetDeviceProperties(&deviceProp, cuda_device)); - printf("[%s] has %d MP(s) x %d (Cores/MP) = %d (Cores)\n", - deviceProp.name, deviceProp.multiProcessorCount, - _ConvertSMVer2Cores(deviceProp.major, deviceProp.minor), - _ConvertSMVer2Cores(deviceProp.major, deviceProp.minor) * deviceProp.multiProcessorCount); - - // Anything that is less than 32 Cores will have scaled down workload - scale_factor = max((32.0f / (_ConvertSMVer2Cores(deviceProp.major, deviceProp.minor) * (float)deviceProp.multiProcessorCount)), 1.0f); - N = (int)((float)N / scale_factor); - - printf("> Device name: %s\n", deviceProp.name); - printf("> CUDA Capability %d.%d hardware with %d multi-processors\n", - deviceProp.major, deviceProp.minor, - deviceProp.multiProcessorCount); - printf("> scale_factor = %.2f\n", 1.0f/scale_factor); - printf("> array_size = %d\n\n", N); - - memsize = N * sizeof(int); - - thread_blocks = N / block.x; - - grid.x = thread_blocks % 65535; - grid.y = (thread_blocks / 65535 + 1); - - - // Allocate resources - - h_data_source = (int *) malloc(memsize); - h_data_sink = (int *) malloc(memsize); - - for (int i =0; i<STREAM_COUNT; ++i) - { - - checkCudaErrors(cudaHostAlloc(&h_data_in[i], memsize, - cudaHostAllocDefault)); - checkCudaErrors(cudaMalloc(&d_data_in[i], memsize)); - - checkCudaErrors(cudaHostAlloc(&h_data_out[i], memsize, - cudaHostAllocDefault)); - checkCudaErrors(cudaMalloc(&d_data_out[i], memsize)); - - checkCudaErrors(cudaStreamCreate(&stream[i])); - checkCudaErrors(cudaEventCreate(&cycleDone[i])); - - cudaEventRecord(cycleDone[i], stream[i]); - } - - cudaEventCreate(&start); - cudaEventCreate(&stop); - - init(); - - // Kernel warmup - incKernel<<<grid, block>>>(d_data_out[0], d_data_in[0], N, inner_reps); - - - // Time copies and kernel - cudaEventRecord(start,0); - checkCudaErrors(cudaMemcpyAsync(d_data_in[0], h_data_in[0], memsize, - cudaMemcpyHostToDevice,0)); - cudaEventRecord(stop,0); - cudaEventSynchronize(stop); - - float memcpy_h2d_time; - cudaEventElapsedTime(&memcpy_h2d_time, start, stop); - - cudaEventRecord(start,0); - checkCudaErrors(cudaMemcpyAsync(h_data_out[0], d_data_out[0], memsize, - cudaMemcpyDeviceToHost, 0)); - cudaEventRecord(stop,0); - cudaEventSynchronize(stop); - - float memcpy_d2h_time; - cudaEventElapsedTime(&memcpy_d2h_time, start, stop); - - cudaEventRecord(start,0); - incKernel<<<grid, block,0,0>>>(d_data_out[0], d_data_in[0], N, inner_reps); - cudaEventRecord(stop,0); - cudaEventSynchronize(stop); - - float kernel_time; - cudaEventElapsedTime(&kernel_time, start, stop); - - printf("\n"); - printf("Relevant properties of this CUDA device\n"); - printf("(%s) Can overlap one CPU<>GPU data transfer with GPU kernel execution (device property \"deviceOverlap\")\n", deviceProp.deviceOverlap ? "X" : " "); - //printf("(%s) Can execute several GPU kernels simultaneously (compute capability >= 2.0)\n", deviceProp.major >= 2 ? "X": " "); - printf("(%s) Can overlap two CPU<>GPU data transfers with GPU kernel execution\n" - " (Compute Capability >= 2.0 AND (Tesla product OR Quadro 4000/5000/6000/K5000)\n", - (deviceProp.major >= 2 && deviceProp.asyncEngineCount > 1) - ? "X" : " "); - - printf("\n"); - printf("Measured timings (throughput):\n"); - printf(" Memcpy host to device\t: %f ms (%f GB/s)\n", - memcpy_h2d_time, (memsize * 1e-6)/ memcpy_h2d_time); - printf(" Memcpy device to host\t: %f ms (%f GB/s)\n", - memcpy_d2h_time, (memsize * 1e-6)/ memcpy_d2h_time); - printf(" Kernel\t\t\t: %f ms (%f GB/s)\n", - kernel_time, (inner_reps *memsize * 2e-6)/ kernel_time); - - printf("\n"); - printf("Theoretical limits for speedup gained from overlapped data transfers:\n"); - printf("No overlap at all (transfer-kernel-transfer): %f ms \n", - memcpy_h2d_time + memcpy_d2h_time + kernel_time); - printf("Compute can overlap with one transfer: %f ms\n", - max((memcpy_h2d_time + memcpy_d2h_time), kernel_time)); - printf("Compute can overlap with both data transfers: %f ms\n", - max(max(memcpy_h2d_time,memcpy_d2h_time), kernel_time)); - - // Process pipelined work - float serial_time = processWithStreams(1); - float overlap_time = processWithStreams(STREAM_COUNT); - - printf("\nAverage measured timings over %d repetitions:\n", nreps); - printf(" Avg. time when execution fully serialized\t: %f ms\n", - serial_time / nreps); - printf(" Avg. time when overlapped using %d streams\t: %f ms\n", - STREAM_COUNT, overlap_time / nreps); - printf(" Avg. speedup gained (serialized - overlapped)\t: %f ms\n", - (serial_time - overlap_time) / nreps); - - printf("\nMeasured throughput:\n"); - printf(" Fully serialized execution\t\t: %f GB/s\n", - (nreps * (memsize * 2e-6))/ serial_time); - printf(" Overlapped using %d streams\t\t: %f GB/s\n", - STREAM_COUNT, (nreps * (memsize * 2e-6))/ overlap_time); - - // Verify the results, we will use the results for final output - bool bResults = test(); - - // Free resources - - free(h_data_source); - free(h_data_sink); - - for (int i =0; i<STREAM_COUNT; ++i) - { - - cudaFreeHost(h_data_in[i]); - cudaFree(d_data_in[i]); - - cudaFreeHost(h_data_out[i]); - cudaFree(d_data_out[i]); - - cudaStreamDestroy(stream[i]); - cudaEventDestroy(cycleDone[i]); - } - - cudaEventDestroy(start); - cudaEventDestroy(stop); - - // Test result - exit(bResults ? EXIT_SUCCESS : EXIT_FAILURE); -} - -float processWithStreams(int streams_used) -{ - - int current_stream = 0; - - float time; - - // Do processing in a loop - // - // Note: All memory commands are processed in the order they are issued, - // independent of the stream they are enqueued in. Hence the pattern by - // which the copy and kernel commands are enqueued in the stream - // has an influence on the achieved overlap. - - cudaEventRecord(start, 0); - - for (int i=0; i<nreps; ++i) - { - int next_stream = (current_stream + 1) % streams_used; - -#ifdef SIMULATE_IO - // Store the result - memcpy(h_data_sink, h_data_out[current_stream],memsize); - - // Read new input - memcpy(h_data_in[next_stream], h_data_source, memsize); -#endif - - // Ensure that processing and copying of the last cycle has finished - cudaEventSynchronize(cycleDone[next_stream]); - - // Process current frame - incKernel<<<grid, block, 0, stream[current_stream]>>>( - d_data_out[current_stream], - d_data_in[current_stream], - N, - inner_reps); - - // Upload next frame - checkCudaErrors(cudaMemcpyAsync( - d_data_in[next_stream], - h_data_in[next_stream], - memsize, - cudaMemcpyHostToDevice, - stream[next_stream])); - - // Download current frame - checkCudaErrors(cudaMemcpyAsync( - h_data_out[current_stream], - d_data_out[current_stream], - memsize, - cudaMemcpyDeviceToHost, - stream[current_stream])); - - checkCudaErrors(cudaEventRecord( - cycleDone[current_stream], - stream[current_stream])); - - current_stream = next_stream; - } - - cudaEventRecord(stop, 0); - - cudaDeviceSynchronize(); - - cudaEventElapsedTime(&time, start, stop); - - return time; - -} - -void init() -{ - for (int i=0; i<N; ++i) - { - h_data_source[i] = 0; - } - - for (int i =0; i<STREAM_COUNT; ++i) - { - memcpy(h_data_in[i], h_data_source, memsize); - } -} - - -bool test() -{ - - bool passed = true; - - for (int j =0; j<STREAM_COUNT; ++j) - { - for (int i =0; i<N; ++i) - { - passed &= (h_data_out[j][i] == 1); - } - } - - return passed; -}
--- a/src/test/multiply.cu Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -extern "C" { - __global__ void multiply(float* A, float* B, float* C) { -// printf("%d %d\n",i[0],i[1]); - int index = blockIdx.x * blockDim.x + threadIdx.x; - C[index] = A[index] * B[0]; - } - -}
--- a/src/test/test.c Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -#include <stdio.h> - -void test1() { - printf("test\n"); -}
--- a/src/test/twice.cc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,182 +0,0 @@ -#include <stdio.h> -#include <sys/time.h> -#include <string.h> -#include <stdlib.h> -extern "C" { -#include <pthread.h> -} - -#include <cuda.h> - -#include <cuda_runtime.h> -#include "helper_cuda.h" - -#define LENGTH (10) -#define THREAD (10) - -double -getTime() { - struct timeval tv; - gettimeofday(&tv, NULL); - return tv.tv_sec + (double)tv.tv_usec*1e-6; -} - -void -check_data(float* A, float B, float* C) { - for (int i=0; i<LENGTH*THREAD; i++) { - if (A[i]*B!=C[i]) { - puts("multiply failure."); - return; - } - } - puts("success."); -} - -void print_result(float* C) { - for (int i=0; i<LENGTH*THREAD; i++) { - printf("%f\n",C[i]); - } -} - -int num_stream = 1; // number of stream -int num_exec = 16; // number of executed kernel - -static void *start_cuda(void *) ; - -int main(int args, char* argv[]) { - - for (int i=1;argv[i];i++) { - if (strcmp(argv[i], "--stream") == 0 || strcmp(argv[i], "-s") == 0) { - num_stream = atoi(argv[++i]); - } - if (strcmp(argv[i], "--numExec") == 0 || strcmp(argv[i], "-e") == 0) { - num_exec = atoi(argv[++i]); - } - } -#if 0 - start_cuda(NULL); -#else - pthread_t thread; - pthread_create(&thread, NULL, start_cuda, NULL); - pthread_join(thread,NULL); -#endif - return 0; -} - -static void *start_cuda(void *args) { - // initialize and load kernel - CUdevice device; - CUcontext context; - CUmodule module; - CUfunction function; - CUstream stream[num_stream]; - - checkCudaErrors(cuInit(0)); - checkCudaErrors(cuDeviceGet(&device, 0)); - checkCudaErrors(cuCtxCreate(&context, CU_CTX_SCHED_SPIN, device)); - checkCudaErrors(cuModuleLoad(&module, "multiply.ptx")); - checkCudaErrors(cuModuleGetFunction(&function, module, "multiply")); - if (num_stream) { - for (int i=0;i<num_stream;i++) - checkCudaErrors(cuStreamCreate(&stream[i],0)); - } - - // memory allocate - CUdeviceptr devA; - CUdeviceptr devB[num_exec]; - CUdeviceptr devOut[num_exec]; - - checkCudaErrors(cuMemAlloc(&devA, LENGTH*THREAD*sizeof(float))); - for (int i=0;i<num_exec;i++) { - checkCudaErrors(cuMemAlloc(&devB[i], sizeof(float))); - checkCudaErrors(cuMemAlloc(&devOut[i], LENGTH*THREAD*sizeof(float))); - } - - // input buffer - float* A = new float[LENGTH*THREAD]; - float* B = new float[num_exec]; - - for (int i=0; i<LENGTH*THREAD; i++) - A[i] = (float)(i+1000); - - // output buffer - float** result = new float* [num_exec]; - - for (int i=0;i<num_exec;i++) - result[i] = new float[LENGTH*THREAD]; - - // Synchronous data transfer(host to device) - checkCudaErrors(cuMemcpyHtoD(devA, A, LENGTH*THREAD*sizeof(float))); - - // Asynchronous data transfer(host to device) - int cur = 0; - - for (int i=0;i<num_exec;i++,cur++) { - if (num_stream <= cur) - cur = 0; - B[i] = (float)(i+1); - if (num_stream) { - checkCudaErrors(cuMemcpyHtoDAsync(devB[i], &B[i], sizeof(float), stream[cur])); - } else { - checkCudaErrors(cuMemcpyHtoD(devB[i], &B[i], sizeof(float))); - } - } - - cur = 0; - - // Asynchronous launch kernel - for (int i=0;i<num_exec;i++,cur++) { - if (num_stream <= cur) - cur=0; - //B[i] = (float)(i+1); - //cuMemcpyHtoDAsync(devB[i], &B[i], sizeof(float), stream[cur]); - void* args[] = {&devA, &devB[i], &devOut[i]}; - checkCudaErrors(cuLaunchKernel(function, - LENGTH, 1, 1, - THREAD, 1, 1, - 0, num_stream ? stream[cur] : NULL , args, NULL)); - //cuMemcpyDtoHAsync(result[i], devOut[i], LENGTH*THREAD*sizeof(float), stream[cur]); - } - - cur = 0; - - - // Asynchronous data transfer(device to host) - for (int i=0;i<num_exec;i++,cur++) { - if (num_stream <= cur) - cur = 0; - if (num_stream) { - checkCudaErrors(cuMemcpyDtoHAsync(result[i], devOut[i], LENGTH*THREAD*sizeof(float), stream[cur])); - } else { - checkCudaErrors(cuMemcpyDtoH(result[i], devOut[i], LENGTH*THREAD*sizeof(float))); - } - } - - // wait for stream - for (int i=0;i<num_stream;i++) - checkCudaErrors(cuStreamSynchronize(stream[i])); - - //printf("%0.6f\n",getTime()-start); - - for (int i=0;i<num_exec;i++) - check_data(A,(float)(i+1),result[i]); - - // memory release - checkCudaErrors(cuMemFree(devA)); - for (int i=0;i<num_exec;i++) { - checkCudaErrors(cuMemFree(devB[i])); - checkCudaErrors(cuMemFree(devOut[i])); - } - for (int i=0;i<num_stream;i++) - checkCudaErrors(cuStreamDestroy(stream[i])); - checkCudaErrors(cuModuleUnload(module)); - checkCudaErrors(cuCtxDestroy(context)); - - delete[] A; - delete[] B; - for (int i=0;i<num_exec;i++) - delete[] result[i]; - delete[] result; - return 0; -} -
--- a/src/test/vectorAddDrv.cc Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,451 +0,0 @@ -/* - * Copyright 1993-2015 NVIDIA Corporation. All rights reserved. - * - * Please refer to the NVIDIA end user license agreement (EULA) associated - * with this source code for terms and conditions that govern your use of - * this software. Any use, reproduction, disclosure, or distribution of - * this software and related documentation outside the terms of the EULA - * is strictly prohibited. - * - */ - -/* Vector addition: C = A + B. - * - * This sample is a very basic sample that implements element by element - * vector addition. It is the same as the sample illustrating Chapter 3 - * of the programming guide with some additions like error checking. - * - */ - -// Includes -#include <stdio.h> -#include <string.h> -#include <iostream> -#include <cstring> -#include <math.h> - -// includes, project -#include <driver_types.h> -#include <cuda_runtime.h> -#include <cuda.h> -#include "helper_cuda.h" - -// includes, CUDA -#include <builtin_types.h> - -#define PTX_FILE "vectorAdd_kernel.ptx" - - -using namespace std; - -// Variables -CUdevice cuDevice; -CUcontext cuContext; -CUmodule cuModule; -CUfunction vecAdd_kernel; -float *h_A; -float *h_B; -float *h_C; -CUdeviceptr d_A; -CUdeviceptr d_B; -CUdeviceptr d_C; -bool noprompt = false; - -// Functions -void Cleanup(bool); -CUresult CleanupNoFailure(); -void RandomInit(float *, int); -bool findModulePath(const char *, string &, char **, string &); -void ParseArguments(int, char **); - -int *pArgc = NULL; -char **pArgv = NULL; - - -// Host code -int main(int argc, char **argv) -{ - pArgc = &argc; - pArgv = argv; - - printf("Vector Addition (Driver API)\n"); - int N = 50000, devID = 0; - size_t size = N * sizeof(float); - - ParseArguments(argc, argv); - - // Initialize - checkCudaErrors(cuInit(0)); - - // This assumes that the user is attempting to specify a explicit device -device=n - if (argc > 1) - { - bool bFound = false; - - for (int param=0; param < argc; param++) - { - int string_start = 0; - - while (argv[param][string_start] == '-') - { - string_start++; - } - - char *string_argv = &argv[param][string_start]; - - if (!strncmp(string_argv, "device", 6)) - { - int len=(int)strlen(string_argv); - - while (string_argv[len] != '=') - { - len--; - } - - devID = atoi(&string_argv[++len]); - bFound = true; - } - - if (bFound) - { - break; - } - } - } - - // Get number of devices supporting CUDA - int deviceCount = 0; - checkCudaErrors(cuDeviceGetCount(&deviceCount)); - if (deviceCount == 0) - { - printf("There is no device supporting CUDA.\n"); - Cleanup(false); - } - - if (devID < 0) - { - devID = 0; - } - - if (devID > deviceCount-1) - { - fprintf(stderr, "(Device=%d) invalid GPU device. %d GPU device(s) detected.\nexiting...\n", devID, deviceCount); - CleanupNoFailure(); - exit(EXIT_SUCCESS); - } - else - { - int major, minor; - char deviceName[100]; - checkCudaErrors(cuDeviceComputeCapability(&major, &minor, devID)); - checkCudaErrors(cuDeviceGetName(deviceName, 256, devID)); - printf("> Using Device %d: \"%s\" with Compute %d.%d capability\n", devID, deviceName, major, minor); - } - - // pick up device with zero ordinal (default, or devID) - checkCudaErrors(cuDeviceGet(&cuDevice, devID)); - // Create context - checkCudaErrors(cuCtxCreate(&cuContext, 0, cuDevice)); - // first search for the module path before we load the results - string module_path, ptx_source; - - if (!findModulePath(PTX_FILE, module_path, argv, ptx_source)) - { - if (!findModulePath("vectorAdd_kernel.cubin", module_path, argv, ptx_source)) - { - printf("> findModulePath could not find <vectorAdd> ptx or cubin\n"); - Cleanup(false); - } - } - else - { - printf("> initCUDA loading module: <%s>\n", module_path.c_str()); - } - - // Create module from binary file (PTX or CUBIN) - if (module_path.rfind("ptx") != string::npos) - { - // in this branch we use compilation with parameters - const unsigned int jitNumOptions = 3; - CUjit_option *jitOptions = new CUjit_option[jitNumOptions]; - void **jitOptVals = new void *[jitNumOptions]; - - // set up size of compilation log buffer - jitOptions[0] = CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES; - int jitLogBufferSize = 1024; - jitOptVals[0] = (void *)(size_t)jitLogBufferSize; - - // set up pointer to the compilation log buffer - jitOptions[1] = CU_JIT_INFO_LOG_BUFFER; - char *jitLogBuffer = new char[jitLogBufferSize]; - jitOptVals[1] = jitLogBuffer; - - // set up pointer to set the Maximum # of registers for a particular kernel - jitOptions[2] = CU_JIT_MAX_REGISTERS; - int jitRegCount = 32; - jitOptVals[2] = (void *)(size_t)jitRegCount; - - checkCudaErrors(cuModuleLoadDataEx(&cuModule, ptx_source.c_str(), jitNumOptions, jitOptions, (void **)jitOptVals)); - - printf("> PTX JIT log:\n%s\n", jitLogBuffer); - } - else - { - checkCudaErrors(cuModuleLoad(&cuModule, module_path.c_str())); - } - - // Get function handle from module - checkCudaErrors(cuModuleGetFunction(&vecAdd_kernel, cuModule, "VecAdd_kernel")); - - // Allocate input vectors h_A and h_B in host memory - h_A = (float *)malloc(size); - if (h_A == 0) { Cleanup(false); } - - h_B = (float *)malloc(size); - if (h_B == 0) { Cleanup(false); } - - h_C = (float *)malloc(size); - if (h_C == 0) { Cleanup(false); } - - // Initialize input vectors - RandomInit(h_A, N); - RandomInit(h_B, N); - - // Allocate vectors in device memory - checkCudaErrors(cuMemAlloc(&d_A, size)); - checkCudaErrors(cuMemAlloc(&d_B, size)); - checkCudaErrors(cuMemAlloc(&d_C, size)); - - // Copy vectors from host memory to device memory - checkCudaErrors(cuMemcpyHtoD(d_A, h_A, size)); - checkCudaErrors(cuMemcpyHtoD(d_B, h_B, size)); - -#if 1 - - if (1) - { - // This is the new CUDA 4.0 API for Kernel Parameter Passing and Kernel Launch (simpler method) - - // Grid/Block configuration - int threadsPerBlock = 256; - int blocksPerGrid = (N + threadsPerBlock - 1) / threadsPerBlock; - - void *args[] = { &d_A, &d_B, &d_C, &N }; - - // Launch the CUDA kernel - checkCudaErrors(cuLaunchKernel(vecAdd_kernel, blocksPerGrid, 1, 1, - threadsPerBlock, 1, 1, - 0, - NULL, args, NULL)); - } - else - { - // This is the new CUDA 4.0 API for Kernel Parameter Passing and Kernel Launch (advanced method) - int offset = 0; - void *argBuffer[16]; - *((CUdeviceptr *)&argBuffer[offset]) = d_A; - offset += sizeof(d_A); - *((CUdeviceptr *)&argBuffer[offset]) = d_B; - offset += sizeof(d_B); - *((CUdeviceptr *)&argBuffer[offset]) = d_C; - offset += sizeof(d_C); - *((int *)&argBuffer[offset]) = N; - offset += sizeof(N); - - // Grid/Block configuration - int threadsPerBlock = 256; - int blocksPerGrid = (N + threadsPerBlock - 1) / threadsPerBlock; - - // Launch the CUDA kernel - checkCudaErrors(cuLaunchKernel(vecAdd_kernel, blocksPerGrid, 1, 1, - threadsPerBlock, 1, 1, - 0, - NULL, NULL, argBuffer)); - } - -#else - { - char argBuffer[256]; - - // pass in launch parameters (not actually de-referencing CUdeviceptr). CUdeviceptr is - // storing the value of the parameters - *((CUdeviceptr *)&argBuffer[offset]) = d_A; - offset += sizeof(d_A); - *((CUdeviceptr *)&argBuffer[offset]) = d_B; - offset += sizeof(d_B); - *((CUdeviceptr *)&argBuffer[offset]) = d_C; - offset += sizeof(d_C); - *((int *)&argBuffer[offset]) = N; - offset += sizeof(N); - - void *kernel_launch_config[5] = - { - CU_LAUNCH_PARAM_BUFFER_POINTER, argBuffer, - CU_LAUNCH_PARAM_BUFFER_SIZE, &offset, - CU_LAUNCH_PARAM_END - }; - - // Grid/Block configuration - int threadsPerBlock = 256; - int blocksPerGrid = (N + threadsPerBlock - 1) / threadsPerBlock; - - // Launch the CUDA kernel - checkCudaErrors(cuLaunchKernel(vecAdd_kernel, blocksPerGrid, 1, 1, - threadsPerBlock, 1, 1, - 0, 0, - NULL, (void **)&kernel_launch_config)); - } -#endif - -#ifdef _DEBUG - checkCudaErrors(cuCtxSynchronize()); -#endif - - // Copy result from device memory to host memory - // h_C contains the result in host memory - checkCudaErrors(cuMemcpyDtoH(h_C, d_C, size)); - - // Verify result - int i; - - for (i = 0; i < N; ++i) - { - float sum = h_A[i] + h_B[i]; - - if (fabs(h_C[i] - sum) > 1e-7f) - { - break; - } - } - - printf("%s\n", (i==N) ? "Result = PASS" : "Result = FAIL"); - - exit((i==N) ? EXIT_SUCCESS : EXIT_FAILURE); -} - -CUresult CleanupNoFailure() -{ - CUresult error; - - // Free device memory - if (d_A) - { - error = cuMemFree(d_A); - } - - if (d_B) - { - error = cuMemFree(d_B); - } - - if (d_C) - { - error = cuMemFree(d_C); - } - - // Free host memory - if (h_A) - { - free(h_A); - } - - if (h_B) - { - free(h_B); - } - - if (h_C) - { - free(h_C); - } - - error = cuCtxDestroy(cuContext); - - return error; -} - -void Cleanup(bool noError) -{ - CUresult error; - error = CleanupNoFailure(); - - if (!noError || error != CUDA_SUCCESS) - { - printf("Function call failed\nFAILED\n"); - exit(EXIT_FAILURE); - } - - if (!noprompt) - { - printf("\nPress ENTER to exit...\n"); - fflush(stdout); - fflush(stderr); - getchar(); - } -} - - -// Allocates an array with random float entries. -void RandomInit(float *data, int n) -{ - for (int i = 0; i < n; ++i) - { - data[i] = rand() / (float)RAND_MAX; - } -} - -bool inline -findModulePath(const char *module_file, string &module_path, char **argv, string &ptx_source) -{ - char *actual_path = sdkFindFilePath(module_file, argv[0]); - - if (actual_path) - { - module_path = actual_path; - } - else - { - printf("> findModulePath file not found: <%s> \n", module_file); - return false; - } - - if (module_path.empty()) - { - printf("> findModulePath could not find file: <%s> \n", module_file); - return false; - } - else - { - printf("> findModulePath found file at <%s>\n", module_path.c_str()); - - if (module_path.rfind(".ptx") != string::npos) - { - FILE *fp = fopen(module_path.c_str(), "rb"); - fseek(fp, 0, SEEK_END); - int file_size = ftell(fp); - char *buf = new char[file_size+1]; - fseek(fp, 0, SEEK_SET); - fread(buf, sizeof(char), file_size, fp); - fclose(fp); - buf[file_size] = '\0'; - ptx_source = buf; - delete[] buf; - } - - return true; - } -} - -// Parse program arguments -void ParseArguments(int argc, char **argv) -{ - for (int i = 0; i < argc; ++i) - { - if (strcmp(argv[i], "--noprompt") == 0 || - strcmp(argv[i], "-noprompt") == 0) - { - noprompt = true; - break; - } - } -}
--- a/src/test/vectorAdd_kernel.cu Fri Jan 05 09:41:27 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* - * Copyright 1993-2015 NVIDIA Corporation. All rights reserved. - * - * Please refer to the NVIDIA end user license agreement (EULA) associated - * with this source code for terms and conditions that govern your use of - * this software. Any use, reproduction, disclosure, or distribution of - * this software and related documentation outside the terms of the EULA - * is strictly prohibited. - * - */ - -/* Vector addition: C = A + B. - * - * This sample is a very basic sample that implements element by element - * vector addition. It is the same as the sample illustrating Chapter 3 - * of the programming guide with some additions like error checking. - * - */ - -// Device code -extern "C" __global__ void VecAdd_kernel(const float *A, const float *B, float *C, int N) -{ - int i = blockDim.x * blockIdx.x + threadIdx.x; - - if (i < N) - C[i] = A[i] + B[i]; -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stack.agda Fri Jan 05 16:39:43 2018 +0900 @@ -0,0 +1,255 @@ +open import Level renaming (suc to succ ; zero to Zero ) +module stack where + +open import Relation.Binary.PropositionalEquality +open import Relation.Binary.Core +open import Data.Nat + +ex : 1 + 2 ≡ 3 +ex = refl + +data Bool {n : Level } : Set n where + True : Bool + False : Bool + +record _∧_ {n : Level } (a : Set n) (b : Set n): Set n where + field + pi1 : a + pi2 : b + +data Maybe {n : Level } (a : Set n) : Set n where + Nothing : Maybe a + Just : a -> Maybe a + +record StackMethods {n m : Level } (a : Set n ) {t : Set m }(stackImpl : Set n ) : Set (m Level.⊔ n) where + field + push : stackImpl -> a -> (stackImpl -> t) -> t + pop : stackImpl -> (stackImpl -> Maybe a -> t) -> t + pop2 : stackImpl -> (stackImpl -> Maybe a -> Maybe a -> t) -> t + get : stackImpl -> (stackImpl -> Maybe a -> t) -> t + get2 : stackImpl -> (stackImpl -> Maybe a -> Maybe a -> t) -> t +open StackMethods + +record Stack {n m : Level } (a : Set n ) {t : Set m } (si : Set n ) : Set (m Level.⊔ n) where + field + stack : si + stackMethods : StackMethods {n} {m} a {t} si + pushStack : a -> (Stack a si -> t) -> t + pushStack d next = push (stackMethods ) (stack ) d (\s1 -> next (record {stack = s1 ; stackMethods = stackMethods } )) + popStack : (Stack a si -> Maybe a -> t) -> t + popStack next = pop (stackMethods ) (stack ) (\s1 d1 -> next (record {stack = s1 ; stackMethods = stackMethods }) d1 ) + pop2Stack : (Stack a si -> Maybe a -> Maybe a -> t) -> t + pop2Stack next = pop2 (stackMethods ) (stack ) (\s1 d1 d2 -> next (record {stack = s1 ; stackMethods = stackMethods }) d1 d2) + getStack : (Stack a si -> Maybe a -> t) -> t + getStack next = get (stackMethods ) (stack ) (\s1 d1 -> next (record {stack = s1 ; stackMethods = stackMethods }) d1 ) + get2Stack : (Stack a si -> Maybe a -> Maybe a -> t) -> t + get2Stack next = get2 (stackMethods ) (stack ) (\s1 d1 d2 -> next (record {stack = s1 ; stackMethods = stackMethods }) d1 d2) + +open Stack + +data Element {n : Level } (a : Set n) : Set n where + cons : a -> Maybe (Element a) -> Element a + +datum : {n : Level } {a : Set n} -> Element a -> a +datum (cons a _) = a + +next : {n : Level } {a : Set n} -> Element a -> Maybe (Element a) +next (cons _ n) = n + + +{- +-- cannot define recrusive record definition. so use linked list with maybe. +record Element {l : Level} (a : Set n l) : Set n (suc l) where + field + datum : a -- `data` is reserved by Agda. + next : Maybe (Element a) +-} + + + +record SingleLinkedStack {n : Level } (a : Set n) : Set n where + field + top : Maybe (Element a) +open SingleLinkedStack + +pushSingleLinkedStack : {n m : Level } {t : Set m } {Data : Set n} -> SingleLinkedStack Data -> Data -> (Code : SingleLinkedStack Data -> t) -> t +pushSingleLinkedStack stack datum next = next stack1 + where + element = cons datum (top stack) + stack1 = record {top = Just element} + + +popSingleLinkedStack : {n m : Level } {t : Set m } {a : Set n} -> SingleLinkedStack a -> (Code : SingleLinkedStack a -> (Maybe a) -> t) -> t +popSingleLinkedStack stack cs with (top stack) +... | Nothing = cs stack Nothing +... | Just d = cs stack1 (Just data1) + where + data1 = datum d + stack1 = record { top = (next d) } + +pop2SingleLinkedStack : {n m : Level } {t : Set m } {a : Set n} -> SingleLinkedStack a -> (Code : SingleLinkedStack a -> (Maybe a) -> (Maybe a) -> t) -> t +pop2SingleLinkedStack {n} {m} {t} {a} stack cs with (top stack) +... | Nothing = cs stack Nothing Nothing +... | Just d = pop2SingleLinkedStack' {n} {m} stack cs + where + pop2SingleLinkedStack' : {n m : Level } {t : Set m } -> SingleLinkedStack a -> (Code : SingleLinkedStack a -> (Maybe a) -> (Maybe a) -> t) -> t + pop2SingleLinkedStack' stack cs with (next d) + ... | Nothing = cs stack Nothing Nothing + ... | Just d1 = cs (record {top = (next d1)}) (Just (datum d)) (Just (datum d1)) + + +getSingleLinkedStack : {n m : Level } {t : Set m } {a : Set n} -> SingleLinkedStack a -> (Code : SingleLinkedStack a -> (Maybe a) -> t) -> t +getSingleLinkedStack stack cs with (top stack) +... | Nothing = cs stack Nothing +... | Just d = cs stack (Just data1) + where + data1 = datum d + +get2SingleLinkedStack : {n m : Level } {t : Set m } {a : Set n} -> SingleLinkedStack a -> (Code : SingleLinkedStack a -> (Maybe a) -> (Maybe a) -> t) -> t +get2SingleLinkedStack {n} {m} {t} {a} stack cs with (top stack) +... | Nothing = cs stack Nothing Nothing +... | Just d = get2SingleLinkedStack' {n} {m} stack cs + where + get2SingleLinkedStack' : {n m : Level} {t : Set m } -> SingleLinkedStack a -> (Code : SingleLinkedStack a -> (Maybe a) -> (Maybe a) -> t) -> t + get2SingleLinkedStack' stack cs with (next d) + ... | Nothing = cs stack Nothing Nothing + ... | Just d1 = cs stack (Just (datum d)) (Just (datum d1)) + + + +emptySingleLinkedStack : {n : Level } {a : Set n} -> SingleLinkedStack a +emptySingleLinkedStack = record {top = Nothing} + +----- +-- Basic stack implementations are specifications of a Stack +-- +singleLinkedStackSpec : {n m : Level } {t : Set m } {a : Set n} -> StackMethods {n} {m} a {t} (SingleLinkedStack a) +singleLinkedStackSpec = record { + push = pushSingleLinkedStack + ; pop = popSingleLinkedStack + ; pop2 = pop2SingleLinkedStack + ; get = getSingleLinkedStack + ; get2 = get2SingleLinkedStack + } + +createSingleLinkedStack : {n m : Level } {t : Set m } {a : Set n} -> Stack {n} {m} a {t} (SingleLinkedStack a) +createSingleLinkedStack = record { + stack = emptySingleLinkedStack ; + stackMethods = singleLinkedStackSpec + } + +---- +-- +-- proof of properties ( concrete cases ) +-- + +test01 : {n : Level } {a : Set n} -> SingleLinkedStack a -> Maybe a -> Bool {n} +test01 stack _ with (top stack) +... | (Just _) = True +... | Nothing = False + + +test02 : {n : Level } {a : Set n} -> SingleLinkedStack a -> Bool +test02 stack = popSingleLinkedStack stack test01 + +test03 : {n : Level } {a : Set n} -> a -> Bool +test03 v = pushSingleLinkedStack emptySingleLinkedStack v test02 + +-- after a push and a pop, the stack is empty +lemma : {n : Level} {A : Set n} {a : A} -> test03 a ≡ False +lemma = refl + +testStack01 : {n m : Level } {a : Set n} -> a -> Bool {m} +testStack01 v = pushStack createSingleLinkedStack v ( + \s -> popStack s (\s1 d1 -> True)) + +-- after push 1 and 2, pop2 get 1 and 2 + +testStack02 : {m : Level } -> ( Stack ℕ (SingleLinkedStack ℕ) -> Bool {m} ) -> Bool {m} +testStack02 cs = pushStack createSingleLinkedStack 1 ( + \s -> pushStack s 2 cs) + + +testStack031 : (d1 d2 : ℕ ) -> Bool {Zero} +testStack031 2 1 = True +testStack031 _ _ = False + +testStack032 : (d1 d2 : Maybe ℕ) -> Bool {Zero} +testStack032 (Just d1) (Just d2) = testStack031 d1 d2 +testStack032 _ _ = False + +testStack03 : {m : Level } -> Stack ℕ (SingleLinkedStack ℕ) -> ((Maybe ℕ) -> (Maybe ℕ) -> Bool {m} ) -> Bool {m} +testStack03 s cs = pop2Stack s ( + \s d1 d2 -> cs d1 d2 ) + +testStack04 : Bool +testStack04 = testStack02 (\s -> testStack03 s testStack032) + +testStack05 : testStack04 ≡ True +testStack05 = refl + +------ +-- +-- proof of properties with indefinite state of stack +-- +-- this should be proved by properties of the stack inteface, not only by the implementation, +-- and the implementation have to provides the properties. +-- +-- we cannot write "s ≡ s3", since level of the Set does not fit , but use stack s ≡ stack s3 is ok. +-- anyway some implementations may result s != s3 +-- + +stackInSomeState : {l m : Level } {D : Set l} {t : Set m } (s : SingleLinkedStack D ) -> Stack {l} {m} D {t} ( SingleLinkedStack D ) +stackInSomeState s = record { stack = s ; stackMethods = singleLinkedStackSpec } + +push->push->pop2 : {l : Level } {D : Set l} (x y : D ) (s : SingleLinkedStack D ) -> + pushStack ( stackInSomeState s ) x ( \s1 -> pushStack s1 y ( \s2 -> pop2Stack s2 ( \s3 y1 x1 -> (Just x ≡ x1 ) ∧ (Just y ≡ y1 ) ) )) +push->push->pop2 {l} {D} x y s = record { pi1 = refl ; pi2 = refl } + + +id : {n : Level} {A : Set n} -> A -> A +id a = a + +-- push a, n times + +n-push : {n : Level} {A : Set n} {a : A} -> ℕ -> SingleLinkedStack A -> SingleLinkedStack A +n-push zero s = s +n-push {l} {A} {a} (suc n) s = pushSingleLinkedStack (n-push {l} {A} {a} n s) a (\s -> s ) + +n-pop : {n : Level}{A : Set n} {a : A} -> ℕ -> SingleLinkedStack A -> SingleLinkedStack A +n-pop zero s = s +n-pop {_} {A} {a} (suc n) s = popSingleLinkedStack (n-pop {_} {A} {a} n s) (\s _ -> s ) + +open ≡-Reasoning + +push-pop-equiv : {n : Level} {A : Set n} {a : A} (s : SingleLinkedStack A) -> (popSingleLinkedStack (pushSingleLinkedStack s a (\s -> s)) (\s _ -> s) ) ≡ s +push-pop-equiv s = refl + +push-and-n-pop : {n : Level} {A : Set n} {a : A} (n : ℕ) (s : SingleLinkedStack A) -> n-pop {_} {A} {a} (suc n) (pushSingleLinkedStack s a id) ≡ n-pop {_} {A} {a} n s +push-and-n-pop zero s = refl +push-and-n-pop {_} {A} {a} (suc n) s = begin + n-pop {_} {A} {a} (suc (suc n)) (pushSingleLinkedStack s a id) + ≡⟨ refl ⟩ + popSingleLinkedStack (n-pop {_} {A} {a} (suc n) (pushSingleLinkedStack s a id)) (\s _ -> s) + ≡⟨ cong (\s -> popSingleLinkedStack s (\s _ -> s )) (push-and-n-pop n s) ⟩ + popSingleLinkedStack (n-pop {_} {A} {a} n s) (\s _ -> s) + ≡⟨ refl ⟩ + n-pop {_} {A} {a} (suc n) s + ∎ + + +n-push-pop-equiv : {n : Level} {A : Set n} {a : A} (n : ℕ) (s : SingleLinkedStack A) -> (n-pop {_} {A} {a} n (n-push {_} {A} {a} n s)) ≡ s +n-push-pop-equiv zero s = refl +n-push-pop-equiv {_} {A} {a} (suc n) s = begin + n-pop {_} {A} {a} (suc n) (n-push (suc n) s) + ≡⟨ refl ⟩ + n-pop {_} {A} {a} (suc n) (pushSingleLinkedStack (n-push n s) a (\s -> s)) + ≡⟨ push-and-n-pop n (n-push n s) ⟩ + n-pop {_} {A} {a} n (n-push n s) + ≡⟨ n-push-pop-equiv n s ⟩ + s + ∎ + + +n-push-pop-equiv-empty : {n : Level} {A : Set n} {a : A} -> (n : ℕ) -> n-pop {_} {A} {a} n (n-push {_} {A} {a} n emptySingleLinkedStack) ≡ emptySingleLinkedStack +n-push-pop-equiv-empty n = n-push-pop-equiv n emptySingleLinkedStack