5.8.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
project(GrayScottGpuNvcppVector)
cmake_minimum_required(VERSION 3.0)

add_subdirectory(cmake)

set(USE_TBB yes CACHE BOOL "Use TBB parallelisation")

if(USE_TBB)
	find_package(TBB COMPONENTS tbb REQUIRED)
endif(USE_TBB)

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("GrayScottGpuNvcppVector" "0.1.0"
		"Set of performance test to use nvc++ with C++17 for GPU"
		"some url")

pull_extra_module("OptionParser" "https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS/OptionParser.git")
pull_extra_module("MicroBenchmark" "https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS/MicroBenchmark.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()

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)

set(GPU_MODE no CACHE BOOL "Use GPU compilation")

#With nvhpc-22-7
if(GPU_MODE)
	message(STATUS "enable GPU mode : GPU_MODE = yes")
	
	if(DEFINED ENV{NVCPP})
		message(STATUS "Use nvc++ compiler at $ENV{NVCPP}")
		set(CMAKE_CXX_COMPILER $ENV{NVCPP})
	else()
		message(FATAL_ERROR "You have to scecify an environnement variable NVCPP which points to your nvc++ compiler")
	endif()
else()
	message(STATUS "GPU mode disabled : GPU_MODE = no")
endif()

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

add_definitions(-DVECTOR_ALIGNEMENT=32)

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
49
50
51
52
53
54
55
56
57
58
project(GrayScottGpuNvcppVector)
cmake_minimum_required(VERSION 3.0)

add_subdirectory(cmake)

set(USE_TBB yes CACHE BOOL "Use TBB parallelisation")

if(USE_TBB)
	find_package(TBB COMPONENTS tbb REQUIRED)
endif(USE_TBB)

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("GrayScottGpuNvcppVector" "0.1.0"
		"Set of performance test to use nvc++ with C++17 for GPU"
		"some url")

pull_extra_module("OptionParser" "https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS/OptionParser.git")
pull_extra_module("MicroBenchmark" "https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS/MicroBenchmark.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()

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)

set(GPU_MODE no CACHE BOOL "Use GPU compilation")

#With nvhpc-22-7
if(GPU_MODE)
	message(STATUS "enable GPU mode : GPU_MODE = yes")
	
	if(DEFINED ENV{NVCPP})
		message(STATUS "Use nvc++ compiler at $ENV{NVCPP}")
		set(CMAKE_CXX_COMPILER $ENV{NVCPP})
	else()
		message(FATAL_ERROR "You have to scecify an environnement variable NVCPP which points to your nvc++ compiler")
	endif()
else()
	message(STATUS "GPU mode disabled : GPU_MODE = no")
endif()

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

add_definitions(-DVECTOR_ALIGNEMENT=32)

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.