annotate src/test/CMakeLists.txt @ 299:b387b224790c

merge
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 12 Feb 2017 08:36:22 +0900
parents 898fce27f334
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
290
625a19d81ed7 add Cmake
ikkun
parents:
diff changeset
1 cmake_minimum_required(VERSION 2.8)
625a19d81ed7 add Cmake
ikkun
parents:
diff changeset
2
295
8236e4ca6983 use ptx (SEGV)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 294
diff changeset
3 add_definitions("-Wall -g -O0")
8236e4ca6983 use ptx (SEGV)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 294
diff changeset
4
8236e4ca6983 use ptx (SEGV)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 294
diff changeset
5 set(NVCCFLAG "-std=c++11" "-g" "-O0" )
290
625a19d81ed7 add Cmake
ikkun
parents:
diff changeset
6
297
b46398081fe4 add working example
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 296
diff changeset
7 include_directories("/usr/local/cuda/include")
b46398081fe4 add working example
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 296
diff changeset
8
298
898fce27f334 use cbccompiler
ikkun
parents: 297
diff changeset
9 set(CMAKE_C_COMPILER $ENV{CBC_COMPILER})
296
f16802b3b580 add comment on CMakeLists.txt for cuda test
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 295
diff changeset
10
294
f6770c0a24c2 add framework
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 292
diff changeset
11 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")
296
f16802b3b580 add comment on CMakeLists.txt for cuda test
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 295
diff changeset
12 # for linux use -lcuda
f16802b3b580 add comment on CMakeLists.txt for cuda test
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 295
diff changeset
13
292
2bc63a22dd21 add twice
ikkun
parents: 291
diff changeset
14 SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CUDA_LINK_FLAGS}" )
290
625a19d81ed7 add Cmake
ikkun
parents:
diff changeset
15
291
87128b876c63 add test
ikkun
parents: 290
diff changeset
16 cmake_minimum_required(VERSION 2.8)
87128b876c63 add test
ikkun
parents: 290
diff changeset
17 find_package(CUDA REQUIRED)
87128b876c63 add test
ikkun
parents: 290
diff changeset
18
292
2bc63a22dd21 add twice
ikkun
parents: 291
diff changeset
19 add_custom_command(OUTPUT main.o
2bc63a22dd21 add twice
ikkun
parents: 291
diff changeset
20 DEPENDS main.cu
295
8236e4ca6983 use ptx (SEGV)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 294
diff changeset
21 COMMAND nvcc ${NVCCFLAG} -c main.cu
290
625a19d81ed7 add Cmake
ikkun
parents:
diff changeset
22 )
292
2bc63a22dd21 add twice
ikkun
parents: 291
diff changeset
23
2bc63a22dd21 add twice
ikkun
parents: 291
diff changeset
24 add_executable(cudaExmple main.o test.c)
2bc63a22dd21 add twice
ikkun
parents: 291
diff changeset
25
295
8236e4ca6983 use ptx (SEGV)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 294
diff changeset
26 add_custom_command(OUTPUT multiply.ptx
292
2bc63a22dd21 add twice
ikkun
parents: 291
diff changeset
27 DEPENDS multiply.cu
295
8236e4ca6983 use ptx (SEGV)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 294
diff changeset
28 COMMAND nvcc ${NVCCFLAG} -c multiply.cu -ptx
292
2bc63a22dd21 add twice
ikkun
parents: 291
diff changeset
29 )
2bc63a22dd21 add twice
ikkun
parents: 291
diff changeset
30
299
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 298
diff changeset
31 add_executable(twiceExample twice.cc multiply.ptx )
294
f6770c0a24c2 add framework
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 292
diff changeset
32
297
b46398081fe4 add working example
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 296
diff changeset
33 add_custom_command(OUTPUT vectorAdd_kernel.ptx
b46398081fe4 add working example
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 296
diff changeset
34 DEPENDS vectorAdd_kernel.cu
b46398081fe4 add working example
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 296
diff changeset
35 COMMAND nvcc ${NVCCFLAG} -c vectorAdd_kernel.cu -ptx
b46398081fe4 add working example
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 296
diff changeset
36 )
b46398081fe4 add working example
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 296
diff changeset
37
b46398081fe4 add working example
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 296
diff changeset
38 add_executable(vectorExample vectorAddDrv.cc vectorAdd_kernel.ptx)
b46398081fe4 add working example
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 296
diff changeset
39
296
f16802b3b580 add comment on CMakeLists.txt for cuda test
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 295
diff changeset
40 # to compile these, comment out CMAKE_C_COMPILER
f16802b3b580 add comment on CMakeLists.txt for cuda test
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 295
diff changeset
41 # cuda_add_executable(Cudasample_gpu Cudasample_gpu.cu)
f16802b3b580 add comment on CMakeLists.txt for cuda test
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 295
diff changeset
42 # cuda_add_executable(Cudasample_cpu Cudasample_cpu.cu)
f16802b3b580 add comment on CMakeLists.txt for cuda test
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 295
diff changeset
43
294
f6770c0a24c2 add framework
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 292
diff changeset
44 # target_link_libraries(twiceExample ${CUDA_LIBRARIES} ${MPI_LIBRARIES} ${OPENGL_LIBRARIES})
f6770c0a24c2 add framework
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 292
diff changeset
45