CMakeLists.txt 8.96 KB
Newer Older
incardon's avatar
incardon committed
1 2
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)

incardon's avatar
incardon committed
3

incardon's avatar
incardon committed
4 5 6
########################### Executables

if(CUDA_FOUND)
7 8 9
	set(CUDA_SOURCES 
		Grid/tests/sgrid_dist_id_gpu_unit_tests.cu
		Vector/cuda/vector_dist_gpu_MP_tests.cu 
10 11 12 13
					 Vector/cuda/vector_dist_cuda_func_test.cu
					 Decomposition/cuda/decomposition_cuda_tests.cu
					 Vector/cuda/vector_dist_gpu_unit_tests.cu
					 ../openfpm_devices/src/memory/CudaMemory.cu
incardon's avatar
incardon committed
14 15
					 Decomposition/cuda/Domain_icells_cart_unit_test.cu
					 Amr/tests/amr_base_gpu_unit_tests.cu)
incardon's avatar
incardon committed
16 17 18 19
else()
	set(CUDA_SOURCES)
endif()

incardon's avatar
incardon committed
20 21 22
add_executable(pdata ${OPENFPM_INIT_FILE} ${CUDA_SOURCES} main.cpp
														  Amr/grid_dist_amr_unit_tests.cpp
														  Amr/tests/amr_base_unit_tests.cpp
23 24 25
														  Debug/debug_test.cpp
														  Grid/tests/grid_dist_id_HDF5_chckpnt_restart_test.cpp
														  Grid/tests/grid_dist_id_unit_test.cpp
incardon's avatar
incardon committed
26
														  Grid/tests/sgrid_dist_id_unit_tests.cpp
27
														  Grid/tests/grid_dist_id_dlb_unit_test.cpp
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
														  Grid/tests/staggered_grid_dist_unit_test.cpp
														  Vector/tests/vector_dist_cell_list_tests.cpp
														  Vector/tests/vector_dist_complex_prp_unit_test.cpp
														  Vector/tests/vector_dist_HDF5_chckpnt_restart_test.cpp 
														  Vector/tests/vector_dist_MP_unit_tests.cpp 
														  Vector/tests/vector_dist_NN_tests.cpp 
														  Vector/tests/vector_dist_unit_test.cpp  
														  pdata_performance.cpp 
														  Decomposition/tests/CartDecomposition_unit_test.cpp 
														  Decomposition/tests/shift_vect_converter_tests.cpp 
														  Vector/performance/vector_dist_performance_util.cpp  
														  lib/pdata.cpp test_multiple_o.cpp  
														  ../openfpm_devices/src/memory/HeapMemory.cpp 
														  ../openfpm_devices/src/memory/PtrMemory.cpp 
														  ../openfpm_vcluster/src/VCluster/VCluster.cpp 
														  ../openfpm_devices/src/Memleak_check.cpp)
incardon's avatar
incardon committed
44

incardon's avatar
incardon committed
45 46
if ( CMAKE_COMPILER_IS_GNUCC )
    target_compile_options(pdata PRIVATE "-Wno-deprecated-declarations")
incardon's avatar
incardon committed
47 48 49
    if (TEST_COVERAGE)
        target_compile_options(pdata PRIVATE $<$<COMPILE_LANGUAGE:CXX>: -fprofile-arcs -ftest-coverage>)
    endif()
incardon's avatar
incardon committed
50 51
endif()

incardon's avatar
incardon committed
52

incardon's avatar
incardon committed
53 54
add_library(ofpm_pdata STATIC lib/pdata.cpp)

incardon's avatar
incardon committed
55 56 57
add_test(NAME pdata_3_proc COMMAND mpirun -np 3 ./pdata)
add_test(NAME pdata_4_proc COMMAND mpirun -np 4 ./pdata)

incardon's avatar
incardon committed
58 59 60
###########################

if (CUDA_FOUND)
incardon's avatar
incardon committed
61
	target_compile_options(pdata PUBLIC $<$<COMPILE_LANGUAGE:CUDA>: ${WARNING_SUPPRESSION_AND_OPTION_NVCC} >)
incardon's avatar
incardon committed
62
	target_include_directories (pdata PUBLIC ${MPI_C_INCLUDE_DIRS})
incardon's avatar
incardon committed
63 64 65
        if (TEST_COVERAGE)
		target_compile_options(pdata PRIVATE $<$<COMPILE_LANGUAGE:CUDA>: -Xcompiler "-fprofile-arcs -ftest-coverage">)
        endif()
incardon's avatar
incardon committed
66 67
endif()

incardon's avatar
incardon committed
68 69 70
if(TEST_PERFORMANCE)
        target_include_directories (pdata PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../openfpm_numerics/src/)
endif()
71 72
target_include_directories (pdata PUBLIC ${PARMETIS_ROOT}/include)
target_include_directories (pdata PUBLIC ${METIS_ROOT}/include)
incardon's avatar
incardon committed
73 74 75 76 77 78 79 80 81 82
target_include_directories (pdata PUBLIC ${CUDA_INCLUDE_DIRS})
target_include_directories (pdata PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories (pdata PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../openfpm_devices/src/)
target_include_directories (pdata PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../openfpm_vcluster/src/)
target_include_directories (pdata PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../openfpm_data/src/)
target_include_directories (pdata PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../openfpm_io/src/)
target_include_directories (pdata PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/config)
target_include_directories (pdata PUBLIC ${PETSC_INCLUDES})
target_include_directories (pdata PUBLIC ${HDF5_ROOT}/include)
target_include_directories (pdata PUBLIC ${LIBHILBERT_INCLUDE_DIRS})
incardon's avatar
incardon committed
83

incardon's avatar
incardon committed
84
target_include_directories (pdata PUBLIC ${Boost_INCLUDE_DIRS})
incardon's avatar
incardon committed
85 86

target_link_libraries(pdata ${Boost_LIBRARIES})
87
target_link_libraries(pdata ${PARMETIS_LIBRARIES})
88
target_link_libraries(pdata -L${METIS_ROOT}/lib metis)
incardon's avatar
incardon committed
89 90
target_link_libraries(pdata -L${HDF5_ROOT}/lib hdf5 hdf5_hl)
target_link_libraries(pdata -L${LIBHILBERT_LIBRARY_DIRS} ${LIBHILBERT_LIBRARIES})
incardon's avatar
incardon committed
91
target_link_libraries(pdata ${PETSC_LIBRARIES})
incardon's avatar
incardon committed
92

incardon's avatar
incardon committed
93 94 95 96 97
if (TEST_PERFORMANCE)
	target_link_libraries(pdata  ${Boost_FILESYSTEM_LIBRARY})
        target_link_libraries(pdata ${Boost_SYSTEM_LIBRARY})
endif()

incardon's avatar
incardon committed
98 99 100 101 102 103
if (TEST_COVERAGE)
    target_link_libraries(pdata -lgcov --coverage)
endif()



incardon's avatar
incardon committed
104
target_include_directories (ofpm_pdata PUBLIC ${CUDA_INCLUDE_DIRS})
incardon's avatar
incardon committed
105 106 107 108
target_include_directories (ofpm_pdata PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories (ofpm_pdata PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../openfpm_data/src/)
target_include_directories (ofpm_pdata PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/config)
target_include_directories (ofpm_pdata PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../openfpm_devices/src/)
109 110
target_include_directories (ofpm_pdata PUBLIC ${Boost_INCLUDE_DIRS})

111
target_compile_definitions(pdata PRIVATE ${MPI_VENDOR})
incardon's avatar
incardon committed
112 113

if(PETSC_FOUND)
incardon's avatar
incardon committed
114
	target_link_libraries(pdata ${PETSC_LIBRARIES})
incardon's avatar
incardon committed
115 116 117 118 119 120 121 122 123
endif()



# Request that particles be built with -std=c++11
# As this is a public compile feature anything that links to particles
# will also build with -std=c++11
target_compile_features(pdata PUBLIC cxx_std_11)
target_link_libraries(pdata ${MPI_C_LIBRARIES})
incardon's avatar
incardon committed
124 125 126 127 128
target_link_libraries(pdata m)
target_link_libraries(pdata c)
if (NOT APPLE)
    target_link_libraries(pdata rt)
endif ()
incardon's avatar
incardon committed
129 130 131 132 133 134 135

install(FILES Decomposition/CartDecomposition.hpp 
	      Decomposition/shift_vect_converter.hpp 
	      Decomposition/CartDecomposition_ext.hpp  
	      Decomposition/common.hpp 
	      Decomposition/Decomposition.hpp  
	      Decomposition/ie_ghost.hpp
incardon's avatar
incardon committed
136
          Decomposition/Domain_NN_calculator_cart.hpp 
incardon's avatar
incardon committed
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
	      Decomposition/nn_processor.hpp Decomposition/ie_loc_ghost.hpp 
	      Decomposition/ORB.hpp
	      Decomposition/dec_optimizer.hpp
	      DESTINATION openfpm_pdata/include/Decomposition/ )

install(FILES Decomposition/Distribution/metis_util.hpp 
	      Decomposition/Distribution/SpaceDistribution.hpp 
	      Decomposition/Distribution/parmetis_dist_util.hpp  
	      Decomposition/Distribution/parmetis_util.hpp 
	      Decomposition/Distribution/MetisDistribution.hpp 
	      Decomposition/Distribution/ParMetisDistribution.hpp 
	      Decomposition/Distribution/DistParMetisDistribution.hpp  
	      DESTINATION openfpm_pdata/include/Decomposition/Distribution )

install(FILES Decomposition/cuda/ie_ghost_gpu.cuh
	      Decomposition/cuda/CartDecomposition_gpu.cuh
	      DESTINATION openfpm_pdata/include/Decomposition/cuda )

install(FILES Grid/grid_dist_id.hpp 
	      Grid/grid_dist_id_comm.hpp
	      Grid/grid_dist_util.hpp  
	      Grid/grid_dist_key.hpp 
	      Grid/staggered_dist_grid.hpp 
	      Grid/staggered_dist_grid_util.hpp 
	      Grid/staggered_dist_grid_copy.hpp
	      DESTINATION openfpm_pdata/include/Grid/ )

install(FILES Grid/Iterators/grid_dist_id_iterator_util.hpp
              Grid/Iterators/grid_dist_id_iterator_dec.hpp
              Grid/Iterators/grid_dist_id_iterator_dec_skin.hpp
              Grid/Iterators/grid_dist_id_iterator_sub.hpp
	      Grid/Iterators/grid_dist_id_iterator.hpp
	      DESTINATION openfpm_pdata/include/Grid/Iterators )


install(FILES Vector/se_class3_vector.hpp  
	      Vector/vector_dist_multiphase_functions.hpp 
	      Vector/vector_dist_comm.hpp Vector/vector_dist.hpp 
	      Vector/vector_dist_ofb.hpp 
	      Vector/vector_dist_key.hpp
	      Vector/vector_dist_kernel.hpp
	      DESTINATION openfpm_pdata/include/Vector )

install(FILES Vector/Iterators/vector_dist_iterator.hpp
	      DESTINATION openfpm_pdata/include/Vector/Iterators/ )

install(FILES Vector/util/vector_dist_funcs.hpp
	      DESTINATION openfpm_pdata/include/Vector/util )

install(FILES Vector/cuda/vector_dist_comm_util_funcs.cuh
	      Vector/cuda/vector_dist_cuda_funcs.cuh
	DESTINATION openfpm_pdata/include/Vector/cuda )

incardon's avatar
incardon committed
190
install(FILES Graph/ids.hpp Graph/dist_map_graph.hpp 
incardon's avatar
incardon committed
191 192 193 194 195 196 197 198 199 200 201 202 203
	      Graph/DistGraphFactory.hpp
              DESTINATION openfpm_pdata/include/Graph )

install(FILES example.mk
	      SubdomainGraphNodes.hpp
              DESTINATION openfpm_pdata/include/ )

install(FILES DLB/DLB.hpp DLB/LB_Model.hpp
	DESTINATION openfpm_pdata/include/DLB )

install(FILES config/config.h
        DESTINATION openfpm_pdata/include/config )

incardon's avatar
incardon committed
204 205 206
install(FILES lib/pdata.hpp
        DESTINATION openfpm_pdata/include/lib )

incardon's avatar
incardon committed
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228
install(FILES Debug/debug.hpp
	DESTINATION openfpm_pdata/include/Debug )

install(TARGETS ofpm_pdata DESTINATION openfpm_pdata/lib)

#if(BUILD_TESTING)

#  add_executable(particle_test test.cu)

#  set_target_properties(particle_test PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
#  target_link_libraries(particle_test PRIVATE particles)

#  add_test(NAME particles_10k COMMAND particle_test 10000 )
#  add_test(NAME particles_256k COMMAND particle_test 256000 )

#  if(APPLE)
    # We need to add the default path to the driver (libcuda.dylib) as an rpath,
    # so that the static cuda runtime can find it at runtime.
    #    set_property(TARGET particle_test PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
    #  endif()
    #endif()