4.1.1 : Le CMakeLists.txt pricipal du projet

Écrivons le CMakeLists.txt principal du projet :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
project(GrayScottGpuCuda)
cmake_minimum_required(VERSION 3.0)

add_subdirectory(cmake)

find_package(HDF5 COMPONENTS C CXX REQUIRED)

include_directories(${HDF5_INCLUDE_DIRS})

message(STATUS "HDF5_CXX_LIBRARIES = ${HDF5_CXX_LIBRARIES}")
set(MUST_JOB no CACHE BOOL "Is job running on MUST computing center")

phoenix_base_project("GRAY_SCOTT_GPU_CUDA" "1.0.0"
		"Commpute Gray Scott Reaction on GPU with Cuda"
		"some url")

pull_extra_module("OptionParser" "https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS/OptionParser.git")
pull_extra_module("TensorAlloc" "https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS/TensorAlloc.git")

if(NOT MUST_JOB)
	pull_extra_module("PhoenixPNG" "https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS/PhoenixPNG.git")
endif()

phoenix_architecture()

if(SELECTED_GPU)
	add_definitions(-DSELECTED_GPU="${SELECTED_GPU}")
endif()


On demande d'avoir Cuda :
1
2
3
4
find_package(CUDA REQUIRED)

message(STATUS "Found headers CUDA : ${CUDA_INCLUDE_DIRS}")
message(STATUS "Found lib CUDA : ${CUDA_LIBRARIES}")


On ajoute les dossiers d'inclusion pour Cuda et nos sources :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
include_directories(${CUDA_INCLUDE_DIRS})

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/AstericsHPC
	${CMAKE_CURRENT_SOURCE_DIR}/DataFormat
	${CMAKE_CURRENT_SOURCE_DIR}/src)

add_definitions(-DVECTOR_ALIGNEMENT=32)

add_subdirectory(AstericsHPC)
add_subdirectory(DataFormat)
add_subdirectory(src)
add_subdirectory(program)

set(PHOENIX_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/Examples;${PHOENIX_INCLUDE_DIRS}" CACHE INTERNAL "list of Phoenix include dirs")


Le fichier CMakeLists.txt complet :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
project(GrayScottGpuCuda)
cmake_minimum_required(VERSION 3.0)

add_subdirectory(cmake)

find_package(HDF5 COMPONENTS C CXX REQUIRED)

include_directories(${HDF5_INCLUDE_DIRS})

message(STATUS "HDF5_CXX_LIBRARIES = ${HDF5_CXX_LIBRARIES}")
set(MUST_JOB no CACHE BOOL "Is job running on MUST computing center")

phoenix_base_project("GRAY_SCOTT_GPU_CUDA" "1.0.0"
		"Commpute Gray Scott Reaction on GPU with Cuda"
		"some url")

pull_extra_module("OptionParser" "https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS/OptionParser.git")
pull_extra_module("TensorAlloc" "https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS/TensorAlloc.git")

if(NOT MUST_JOB)
	pull_extra_module("PhoenixPNG" "https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS/PhoenixPNG.git")
endif()

phoenix_architecture()

if(SELECTED_GPU)
	add_definitions(-DSELECTED_GPU="${SELECTED_GPU}")
endif()

find_package(CUDA REQUIRED)

message(STATUS "Found headers CUDA : ${CUDA_INCLUDE_DIRS}")
message(STATUS "Found lib CUDA : ${CUDA_LIBRARIES}")

include_directories(${CUDA_INCLUDE_DIRS})

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/AstericsHPC
	${CMAKE_CURRENT_SOURCE_DIR}/DataFormat
	${CMAKE_CURRENT_SOURCE_DIR}/src)

add_definitions(-DVECTOR_ALIGNEMENT=32)

add_subdirectory(AstericsHPC)
add_subdirectory(DataFormat)
add_subdirectory(src)
add_subdirectory(program)

set(PHOENIX_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/Examples;${PHOENIX_INCLUDE_DIRS}" CACHE INTERNAL "list of Phoenix include dirs")


Le fichier CMakeLists.txt est disponible ici.