annotate src/parallel_execution/CMakeLists.txt @ 308:aeddca686007

CUDAtwice
author ikkun
date Tue, 14 Feb 2017 16:55:22 +0900
parents 700f247f32a1
children 7dd5a7d52a67
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
86
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 cmake_minimum_required(VERSION 2.8)
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
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)
609bf62768b9 add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 286
diff changeset
4
101
8987cf13d5bb Add Allocate macro
innparusu
parents: 98
diff changeset
5 # -DUSE_CUDA
138
04a2f486a30d insert works but is not balanced
kono
parents: 137
diff changeset
6 # add_definitions("-Wall -g -O")
86
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7
131
a4507906938c Fix compile error but not work
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 117
diff changeset
8 set(CMAKE_C_COMPILER $ENV{CBC_COMPILER})
303
1dbaef86593b CUDAtwice.cbc
ikkun
parents: 302
diff changeset
9 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
10
609bf62768b9 add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 286
diff changeset
11 if (${USE_CUDA})
609bf62768b9 add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 286
diff changeset
12 set(NVCCFLAG "-std=c++11" "-g" "-O0" )
609bf62768b9 add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 286
diff changeset
13 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")
609bf62768b9 add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 286
diff changeset
14 find_package(CUDA REQUIRED)
304
9755206813cb helper_string.h for ANSI C
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 303
diff changeset
15 add_definitions("-Wall -g -DUSE_CUDAWorker=1")
305
ec0a5b4fba05 CUDAWorker
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 304
diff changeset
16 SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CUDA_LINK_FLAGS}" )
302
8e7926f3e271 fix CUDAWorker
ikkun
parents: 301
diff changeset
17 else()
8e7926f3e271 fix CUDAWorker
ikkun
parents: 301
diff changeset
18 add_definitions("-Wall -g")
301
609bf62768b9 add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 286
diff changeset
19 endif()
609bf62768b9 add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 286
diff changeset
20
302
8e7926f3e271 fix CUDAWorker
ikkun
parents: 301
diff changeset
21
198
4051c012dec3 cmake macro
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 188
diff changeset
22 macro( GearsCommand )
4051c012dec3 cmake macro
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 188
diff changeset
23 set( _OPTIONS_ARGS )
4051c012dec3 cmake macro
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 188
diff changeset
24 set( _ONE_VALUE_ARGS TARGET )
4051c012dec3 cmake macro
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 188
diff changeset
25 set( _MULTI_VALUE_ARGS SOURCES )
4051c012dec3 cmake macro
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 188
diff changeset
26 cmake_parse_arguments( _Gears "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} )
255
79bbe2c63fb0 cmake generate c from cbc
mir3636
parents: 218
diff changeset
27
256
d2f5d6fc56fa fix cmake file
mir3636
parents: 255
diff changeset
28 set (_Gears_CSOURCES)
d2f5d6fc56fa fix cmake file
mir3636
parents: 255
diff changeset
29 foreach(i ${_Gears_SOURCES})
d2f5d6fc56fa fix cmake file
mir3636
parents: 255
diff changeset
30 if (${i} MATCHES "\\.cbc")
d2f5d6fc56fa fix cmake file
mir3636
parents: 255
diff changeset
31 string(REGEX REPLACE "(.*).cbc" "c/\\1.c" j ${i})
d2f5d6fc56fa fix cmake file
mir3636
parents: 255
diff changeset
32 add_custom_command (
d2f5d6fc56fa fix cmake file
mir3636
parents: 255
diff changeset
33 OUTPUT ${j}
259
195518ab62fc fix type gathering pattern match in generate_stub.pl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 257
diff changeset
34 DEPENDS ${i}
256
d2f5d6fc56fa fix cmake file
mir3636
parents: 255
diff changeset
35 COMMAND "perl" "generate_stub.pl" "-o" ${j} ${i}
d2f5d6fc56fa fix cmake file
mir3636
parents: 255
diff changeset
36 )
301
609bf62768b9 add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 286
diff changeset
37 elseif (${i} MATCHES "\\.cu")
302
8e7926f3e271 fix CUDAWorker
ikkun
parents: 301
diff changeset
38 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
39 add_custom_command (
609bf62768b9 add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 286
diff changeset
40 OUTPUT ${j}
609bf62768b9 add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 286
diff changeset
41 DEPENDS ${i}
609bf62768b9 add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 286
diff changeset
42 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
43 )
270
b6ed4b2a5d9d fix CMakeList
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 265
diff changeset
44 else()
256
d2f5d6fc56fa fix cmake file
mir3636
parents: 255
diff changeset
45 set(j ${i})
270
b6ed4b2a5d9d fix CMakeList
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 265
diff changeset
46 endif()
256
d2f5d6fc56fa fix cmake file
mir3636
parents: 255
diff changeset
47 list(APPEND _Gears_CSOURCES ${j})
d2f5d6fc56fa fix cmake file
mir3636
parents: 255
diff changeset
48 endforeach(i)
d2f5d6fc56fa fix cmake file
mir3636
parents: 255
diff changeset
49
210
ba56dab79dc4 separate code init for each executable
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 208
diff changeset
50 add_custom_command (
ba56dab79dc4 separate code init for each executable
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 208
diff changeset
51 OUTPUT c/${_Gears_TARGET}-context.c
256
d2f5d6fc56fa fix cmake file
mir3636
parents: 255
diff changeset
52 DEPENDS ${_Gears_CSOURCES}
255
79bbe2c63fb0 cmake generate c from cbc
mir3636
parents: 218
diff changeset
53 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
54 )
255
79bbe2c63fb0 cmake generate c from cbc
mir3636
parents: 218
diff changeset
55 add_executable(${_Gears_TARGET} ${_Gears_CSOURCES} c/${_Gears_TARGET}-context.c)
198
4051c012dec3 cmake macro
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 188
diff changeset
56 endmacro()
4051c012dec3 cmake macro
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 188
diff changeset
57
210
ba56dab79dc4 separate code init for each executable
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 208
diff changeset
58
198
4051c012dec3 cmake macro
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 188
diff changeset
59 GearsCommand(
4051c012dec3 cmake macro
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 188
diff changeset
60 TARGET
4051c012dec3 cmake macro
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 188
diff changeset
61 twice
4051c012dec3 cmake macro
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 188
diff changeset
62 SOURCES
286
fd470e090403 Add sempahore
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 280
diff changeset
63 main.cbc RedBlackTree.cbc compare.c SingleLinkedStack.cbc CPUWorker.cbc time.cbc twice.cbc TaskManagerImpl.cbc SingleLinkedQueue.cbc SynchronizedQueue.cbc SemaphoreImpl.cbc
278
23767f714f4a fix generate_stub
mir3636
parents: 270
diff changeset
64 )
23767f714f4a fix generate_stub
mir3636
parents: 270
diff changeset
65
308
aeddca686007 CUDAtwice
ikkun
parents: 307
diff changeset
66 if (${USE_CUDA})
301
609bf62768b9 add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 286
diff changeset
67 GearsCommand(
609bf62768b9 add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 286
diff changeset
68 TARGET
302
8e7926f3e271 fix CUDAWorker
ikkun
parents: 301
diff changeset
69 CUDAtwice
301
609bf62768b9 add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 286
diff changeset
70 SOURCES
306
ae4f6aa427f5 CUDAtwice
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 305
diff changeset
71 main.cbc RedBlackTree.cbc compare.c SingleLinkedStack.cbc CPUWorker.cbc time.cbc twice.cbc TaskManagerImpl.cbc SingleLinkedQueue.cbc SynchronizedQueue.cbc SemaphoreImpl.cbc CUDAWorker.cbc CUDAtwice.cbc CUDAtwice.cu
301
609bf62768b9 add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 286
diff changeset
72 )
609bf62768b9 add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 286
diff changeset
73 endif()
609bf62768b9 add -DUSE_CUDA=1 flag to cmake
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 286
diff changeset
74
278
23767f714f4a fix generate_stub
mir3636
parents: 270
diff changeset
75 GearsCommand(
23767f714f4a fix generate_stub
mir3636
parents: 270
diff changeset
76 TARGET
23767f714f4a fix generate_stub
mir3636
parents: 270
diff changeset
77 queue_test
23767f714f4a fix generate_stub
mir3636
parents: 270
diff changeset
78 SOURCES
23767f714f4a fix generate_stub
mir3636
parents: 270
diff changeset
79 test/queue_test.c SingleLinkedQueue.cbc
86
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 )
e06e1a9e569e create worker
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
81
202
42dbe54332a0 add test
mir3636
parents: 199
diff changeset
82 GearsCommand(
42dbe54332a0 add test
mir3636
parents: 199
diff changeset
83 TARGET
210
ba56dab79dc4 separate code init for each executable
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 208
diff changeset
84 stack_test
202
42dbe54332a0 add test
mir3636
parents: 199
diff changeset
85 SOURCES
278
23767f714f4a fix generate_stub
mir3636
parents: 270
diff changeset
86 test/stack_test.c SingleLinkedStack.cbc
202
42dbe54332a0 add test
mir3636
parents: 199
diff changeset
87 )
42dbe54332a0 add test
mir3636
parents: 199
diff changeset
88