Mercurial > hg > Gears > GearsAgda
annotate src/parallel_execution/CMakeLists.txt @ 494:d8b2036c6942
BoundedBuffer implments Buffer interface
author | Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 31 Dec 2017 02:40:08 +0900 |
parents | 82f0c49750f1 |
children | a7127917c736 |
rev | line source |
---|---|
410
85b0ddbf458e
Fix CudaWorker
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
408
diff
changeset
|
1 cmake_minimum_required(VERSION 3.8) |
86 | 2 |
301
609bf62768b9
add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
286
diff
changeset
|
3 set(USE_CUDA,0) |
101 | 4 # -DUSE_CUDA |
138 | 5 # add_definitions("-Wall -g -O") |
86 | 6 |
131
a4507906938c
Fix compile error but not work
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
117
diff
changeset
|
7 set(CMAKE_C_COMPILER $ENV{CBC_COMPILER}) |
312
7dd5a7d52a67
USE_CUDAWorker flag only for CUDAtwice
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
308
diff
changeset
|
8 add_definitions("-Wall -g") |
7dd5a7d52a67
USE_CUDAWorker flag only for CUDAtwice
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
308
diff
changeset
|
9 |
410
85b0ddbf458e
Fix CudaWorker
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
408
diff
changeset
|
10 # -DCMAKE_BUILD_TYPE=Debug |
85b0ddbf458e
Fix CudaWorker
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
408
diff
changeset
|
11 set(CMAKE_C_FLAGS_DEBUG "-O0") |
301
609bf62768b9
add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
286
diff
changeset
|
12 |
609bf62768b9
add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
286
diff
changeset
|
13 if (${USE_CUDA}) |
312
7dd5a7d52a67
USE_CUDAWorker flag only for CUDAtwice
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
308
diff
changeset
|
14 include_directories("/usr/local/cuda/include") |
301
609bf62768b9
add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
286
diff
changeset
|
15 set(NVCCFLAG "-std=c++11" "-g" "-O0" ) |
486
da1dafcf1a45
Add cudaflag if Linux
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
16 if (UNIX AND NOT APPLE) # LINUX |
da1dafcf1a45
Add cudaflag if Linux
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
17 set(CUDA_LINK_FLAGS "-L/usr/local/cuda/lib64 -lcuda -lcudart") |
da1dafcf1a45
Add cudaflag if Linux
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
18 elseif (APPLE) |
da1dafcf1a45
Add cudaflag if Linux
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
19 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") |
da1dafcf1a45
Add cudaflag if Linux
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
464
diff
changeset
|
20 endif() |
301
609bf62768b9
add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
286
diff
changeset
|
21 find_package(CUDA REQUIRED) |
305 | 22 SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CUDA_LINK_FLAGS}" ) |
301
609bf62768b9
add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
286
diff
changeset
|
23 endif() |
609bf62768b9
add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
286
diff
changeset
|
24 |
198 | 25 macro( GearsCommand ) |
26 set( _OPTIONS_ARGS ) | |
27 set( _ONE_VALUE_ARGS TARGET ) | |
28 set( _MULTI_VALUE_ARGS SOURCES ) | |
29 cmake_parse_arguments( _Gears "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} ) | |
374
fb50cf8aa615
Add Iterator Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
364
diff
changeset
|
30 |
256 | 31 set (_Gears_CSOURCES) |
32 foreach(i ${_Gears_SOURCES}) | |
33 if (${i} MATCHES "\\.cbc") | |
34 string(REGEX REPLACE "(.*).cbc" "c/\\1.c" j ${i}) | |
35 add_custom_command ( | |
374
fb50cf8aa615
Add Iterator Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
364
diff
changeset
|
36 OUTPUT ${j} |
fb50cf8aa615
Add Iterator Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
364
diff
changeset
|
37 DEPENDS ${i} |
256 | 38 COMMAND "perl" "generate_stub.pl" "-o" ${j} ${i} |
39 ) | |
301
609bf62768b9
add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
286
diff
changeset
|
40 elseif (${i} MATCHES "\\.cu") |
302 | 41 string(REGEX REPLACE "(.*).cu" "c/\\1.ptx" j ${i}) |
301
609bf62768b9
add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
286
diff
changeset
|
42 add_custom_command ( |
374
fb50cf8aa615
Add Iterator Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
364
diff
changeset
|
43 OUTPUT ${j} |
fb50cf8aa615
Add Iterator Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
364
diff
changeset
|
44 DEPENDS ${i} |
301
609bf62768b9
add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
286
diff
changeset
|
45 COMMAND nvcc ${NVCCFLAG} -c -ptx -o ${j} ${i} |
609bf62768b9
add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
286
diff
changeset
|
46 ) |
270 | 47 else() |
256 | 48 set(j ${i}) |
270 | 49 endif() |
256 | 50 list(APPEND _Gears_CSOURCES ${j}) |
374
fb50cf8aa615
Add Iterator Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
364
diff
changeset
|
51 endforeach(i) |
256 | 52 |
210
ba56dab79dc4
separate code init for each executable
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
208
diff
changeset
|
53 add_custom_command ( |
374
fb50cf8aa615
Add Iterator Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
364
diff
changeset
|
54 OUTPUT c/${_Gears_TARGET}-context.c |
256 | 55 DEPENDS ${_Gears_CSOURCES} |
255 | 56 COMMAND "perl" "generate_context.pl" "-o" ${_Gears_TARGET} ${_Gears_CSOURCES} |
210
ba56dab79dc4
separate code init for each executable
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
208
diff
changeset
|
57 ) |
255 | 58 add_executable(${_Gears_TARGET} ${_Gears_CSOURCES} c/${_Gears_TARGET}-context.c) |
379
2744cb933ebc
Fix compile error for bitonicSort but not work
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
377
diff
changeset
|
59 target_link_libraries(${_Gears_TARGET} m pthread) |
198 | 60 endmacro() |
61 | |
210
ba56dab79dc4
separate code init for each executable
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
208
diff
changeset
|
62 |
198 | 63 GearsCommand( |
64 TARGET | |
65 twice | |
374
fb50cf8aa615
Add Iterator Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
364
diff
changeset
|
66 SOURCES |
464
7d67c9cf09ee
Rename from Time interface to Timer interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
452
diff
changeset
|
67 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 |
278 | 68 ) |
69 | |
326
f23f6d0aa4e9
Add examples/calc.cbc and build but not work
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
325
diff
changeset
|
70 GearsCommand( |
f23f6d0aa4e9
Add examples/calc.cbc and build but not work
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
325
diff
changeset
|
71 TARGET |
f23f6d0aa4e9
Add examples/calc.cbc and build but not work
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
325
diff
changeset
|
72 calc |
374
fb50cf8aa615
Add Iterator Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
364
diff
changeset
|
73 SOURCES |
444
0c024ea61601
Using cas interface but occurred warning
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
440
diff
changeset
|
74 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 |
374
fb50cf8aa615
Add Iterator Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
364
diff
changeset
|
75 ) |
fb50cf8aa615
Add Iterator Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
364
diff
changeset
|
76 |
fb50cf8aa615
Add Iterator Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
364
diff
changeset
|
77 GearsCommand( |
fb50cf8aa615
Add Iterator Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
364
diff
changeset
|
78 TARGET |
379
2744cb933ebc
Fix compile error for bitonicSort but not work
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
377
diff
changeset
|
79 bitonicSort |
374
fb50cf8aa615
Add Iterator Interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
364
diff
changeset
|
80 SOURCES |
464
7d67c9cf09ee
Rename from Time interface to Timer interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
452
diff
changeset
|
81 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 |
326
f23f6d0aa4e9
Add examples/calc.cbc and build but not work
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
325
diff
changeset
|
82 ) |
f23f6d0aa4e9
Add examples/calc.cbc and build but not work
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
325
diff
changeset
|
83 |
308 | 84 if (${USE_CUDA}) |
301
609bf62768b9
add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
286
diff
changeset
|
85 GearsCommand( |
609bf62768b9
add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
286
diff
changeset
|
86 TARGET |
302 | 87 CUDAtwice |
301
609bf62768b9
add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
286
diff
changeset
|
88 SOURCES |
464
7d67c9cf09ee
Rename from Time interface to Timer interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
452
diff
changeset
|
89 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 |
301
609bf62768b9
add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
286
diff
changeset
|
90 ) |
450
d3d7a7d6a117
Delete USE_CUDA_MAIN_THREAD
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
445
diff
changeset
|
91 set_target_properties(CUDAtwice PROPERTIES COMPILE_FLAGS "-Wall -g -DUSE_CUDAWorker=1") |
414
49159fbdd1fb
Work CUDAbitonicSort
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
413
diff
changeset
|
92 |
49159fbdd1fb
Work CUDAbitonicSort
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
413
diff
changeset
|
93 GearsCommand( |
49159fbdd1fb
Work CUDAbitonicSort
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
413
diff
changeset
|
94 TARGET |
440
55db2a339958
Add worker shutdown
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
438
diff
changeset
|
95 CUDAbitonicSort |
414
49159fbdd1fb
Work CUDAbitonicSort
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
413
diff
changeset
|
96 SOURCES |
464
7d67c9cf09ee
Rename from Time interface to Timer interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
452
diff
changeset
|
97 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 |
414
49159fbdd1fb
Work CUDAbitonicSort
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
413
diff
changeset
|
98 ) |
49159fbdd1fb
Work CUDAbitonicSort
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
413
diff
changeset
|
99 set_target_properties(CUDAbitonicSort PROPERTIES COMPILE_FLAGS "-Wall -g -DUSE_CUDAWorker=1") |
301
609bf62768b9
add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
286
diff
changeset
|
100 endif() |
609bf62768b9
add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
286
diff
changeset
|
101 |
278 | 102 GearsCommand( |
103 TARGET | |
104 queue_test | |
105 SOURCES | |
322
366baa247572
Use generate_stub for queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
319
diff
changeset
|
106 test/queue_test.cbc SingleLinkedQueue.cbc |
86 | 107 ) |
108 | |
202 | 109 GearsCommand( |
110 TARGET | |
210
ba56dab79dc4
separate code init for each executable
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
208
diff
changeset
|
111 stack_test |
202 | 112 SOURCES |
422 | 113 test/stack_test.cbc SingleLinkedStack.cbc SingleLinkedQueue.cbc |
202 | 114 ) |
115 | |
358 | 116 GearsCommand( |
117 TARGET | |
440
55db2a339958
Add worker shutdown
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
438
diff
changeset
|
118 multiDimIterator_test |
376
b46f38645587
Run oneDimIterator_test
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
375
diff
changeset
|
119 SOURCES |
464
7d67c9cf09ee
Rename from Time interface to Timer interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
452
diff
changeset
|
120 test/multiDimIterator_test.cbc test/printIterator.cbc CPUWorker.cbc TaskManagerImpl.cbc SingleLinkedQueue.cbc SynchronizedQueue.cbc MultiDimIterator.cbc AtomicReference.cbc |
376
b46f38645587
Run oneDimIterator_test
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
375
diff
changeset
|
121 ) |
b46f38645587
Run oneDimIterator_test
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
375
diff
changeset
|
122 |
b46f38645587
Run oneDimIterator_test
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
375
diff
changeset
|
123 GearsCommand( |
b46f38645587
Run oneDimIterator_test
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
375
diff
changeset
|
124 TARGET |
358 | 125 sort |
126 SOURCES | |
381
b81492c74d2b
Create examples directory
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
379
diff
changeset
|
127 examples/bitonicSort/sort.cbc |
358 | 128 ) |
445 | 129 |
130 GearsCommand( | |
131 TARGET | |
132 rbtree | |
133 SOURCES | |
492
9333486471b9
Add boundedBuffer example
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
486
diff
changeset
|
134 SingleLinkedQueue.cbc test/rbTree_test.cbc RedBlackTree.cbc SingleLinkedStack.cbc |
445 | 135 ) |
492
9333486471b9
Add boundedBuffer example
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
486
diff
changeset
|
136 |
9333486471b9
Add boundedBuffer example
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
486
diff
changeset
|
137 GearsCommand( |
9333486471b9
Add boundedBuffer example
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
486
diff
changeset
|
138 TARGET |
9333486471b9
Add boundedBuffer example
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
486
diff
changeset
|
139 boundedBuffer |
9333486471b9
Add boundedBuffer example
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
486
diff
changeset
|
140 SOURCES |
494
d8b2036c6942
BoundedBuffer implments Buffer interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
493
diff
changeset
|
141 examples/boundedBuffer/main.cbc examples/boundedBuffer/initBuffer.cbc examples/boundedBuffer/SemaphoreImpl.cbc examples/boundedBuffer/BoundedBuffer.cbc examples/boundedBuffer/consumer.cbc examples/boundedBuffer/producer.cbc CPUWorker.cbc TaskManagerImpl.cbc SingleLinkedQueue.cbc SynchronizedQueue.cbc MultiDimIterator.cbc AtomicReference.cbc |
492
9333486471b9
Add boundedBuffer example
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
486
diff
changeset
|
142 ) |