3.4.3.1 : Le CMakeLists 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
project(HadamardProductNvcpp)
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)

phoenix_base_project("HadamardProductNvcpp" "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")

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)

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

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})
		add_definitions(-DPHOENIX_GPU_MODE=1)	# We tell Phoenix that we use GPU
	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()

add_subdirectory(src)


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
project(HadamardProductNvcpp)
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)

phoenix_base_project("HadamardProductNvcpp" "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")

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)

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

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})
		add_definitions(-DPHOENIX_GPU_MODE=1)	# We tell Phoenix that we use GPU
	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()

add_subdirectory(src)


Le fichier CMakeLists.txt est disponible ici.