M2_SETI/A4/TP_GPU-master/TP0_matrice/CMakeLists-cuda11.2.txt
2022-12-09 09:03:22 +01:00

33 lines
1.3 KiB
Text

#cmake -DCMAKE_CUDA_FLAGS=”-arch=sm_30” ..
cmake_minimum_required(VERSION 2.8)
project(matrice)
set(CUDA_TOOLKIT_ROOT_DIR "/partage/public/ngac/cuda-11.2")
set(ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/)
#set(CUDA_TOOLKIT_ROOT_DIR "/usr/local/cuda")
find_package(CUDA REQUIRED)
list(APPEND HEADER_REP ${ROOT_DIR}/inc/ ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES} "/usr/local/cuda/samples/common/inc/" "${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}/../samples/common/inc")
#file(GLOB CPP_FILES ${ROOT_DIR}/src/CPP/*.cpp)
#file(GLOB CU_FILES ${ROOT_DIR}/src/CPP/*.cu)
set(CPP_FILES ${ROOT_DIR}/src/CPP/matrixMul_C.cpp)
set(CU_FILES ${ROOT_DIR}/src/CPP/matrixMul_cuda.cu ${ROOT_DIR}/src/CPP/matrixMul_CUBLAS.cu ${ROOT_DIR}/src/CPP/matrixMul_main.cu)
file(GLOB_RECURSE HEADER_FILES ${ROOT_DIR}/src/CUDA/*.cuh ${ROOT_DIR}/inc/*.h)
set(CUDA_SEPARABLE_COMPILATION ON)
set(CUDA_NVCC_FLAGS "-lineinfo;-I\"${ROOT_DIR}/inc\" -I\"${ROOT_DIR}/src/CUDA\" -I\"/usr/local/cuda/samples/common/inc/\"")
cuda_add_executable(matrice_CUDA ${CPP_FILES} ${CU_FILES} ${HEADER_FILES})
set_target_properties(matrice_CUDA PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_include_directories(matrice_CUDA PUBLIC ${ROOT_DIR}/inc/ ${CUDA_TOOLKIT_ROOT_DIR}/samples/common/inc)
target_link_libraries(matrice_CUDA ${CUDA_CUBLAS_LIBRARIES})