mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-02 18:20:38 +08:00
Update CUDA testing infra to match master branch.
This commit is contained in:
parent
b0448fc6e0
commit
c7f6f8315f
@ -1,7 +1,7 @@
|
|||||||
project(Eigen3)
|
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 2.8.5)
|
cmake_minimum_required(VERSION 2.8.5)
|
||||||
|
|
||||||
|
project(Eigen3)
|
||||||
|
|
||||||
# guard against in-source builds
|
# guard against in-source builds
|
||||||
|
|
||||||
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
||||||
@ -470,7 +470,7 @@ if (NOT CMAKE_CROSSCOMPILING)
|
|||||||
add_subdirectory(blas EXCLUDE_FROM_ALL)
|
add_subdirectory(blas EXCLUDE_FROM_ALL)
|
||||||
add_subdirectory(lapack EXCLUDE_FROM_ALL)
|
add_subdirectory(lapack EXCLUDE_FROM_ALL)
|
||||||
endif()
|
endif()
|
||||||
endif(CMAKE_CROSSCOMPILING)
|
endif(NOT CMAKE_CROSSCOMPILING)
|
||||||
|
|
||||||
# add SYCL
|
# add SYCL
|
||||||
option(EIGEN_TEST_SYCL "Add Sycl support." OFF)
|
option(EIGEN_TEST_SYCL "Add Sycl support." OFF)
|
||||||
|
@ -23,24 +23,22 @@ macro(ei_add_test_internal testname testname_with_suffix)
|
|||||||
set(is_gpu_test ON)
|
set(is_gpu_test ON)
|
||||||
if(EIGEN_TEST_CUDA_CLANG)
|
if(EIGEN_TEST_CUDA_CLANG)
|
||||||
set_source_files_properties(${filename} PROPERTIES LANGUAGE CXX)
|
set_source_files_properties(${filename} PROPERTIES LANGUAGE CXX)
|
||||||
|
|
||||||
if(CUDA_64_BIT_DEVICE_CODE AND (EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/lib64"))
|
if(CUDA_64_BIT_DEVICE_CODE AND (EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/lib64"))
|
||||||
link_directories("${CUDA_TOOLKIT_ROOT_DIR}/lib64")
|
link_directories("${CUDA_TOOLKIT_ROOT_DIR}/lib64")
|
||||||
else()
|
else()
|
||||||
link_directories("${CUDA_TOOLKIT_ROOT_DIR}/lib")
|
link_directories("${CUDA_TOOLKIT_ROOT_DIR}/lib")
|
||||||
endif()
|
endif()
|
||||||
if (${ARGC} GREATER 2)
|
|
||||||
add_executable(${targetname} ${filename})
|
add_executable(${targetname} ${filename})
|
||||||
else()
|
set(CUDA_CLANG_LINK_LIBRARIES "cudart_static" "cuda" "dl" "pthread")
|
||||||
add_executable(${targetname} ${filename} OPTIONS ${ARGV2})
|
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
set(CUDA_CLANG_LINK_LIBRARIES ${CUDA_CLANG_LINK_LIBRARIES} "rt")
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(${targetname} "cudart_static" "cuda" "dl" "rt" "pthread")
|
target_link_libraries(${targetname} ${CUDA_CLANG_LINK_LIBRARIES})
|
||||||
else()
|
|
||||||
if (${ARGC} GREATER 2)
|
|
||||||
cuda_add_executable(${targetname} ${filename} OPTIONS ${ARGV2})
|
|
||||||
else()
|
else()
|
||||||
cuda_add_executable(${targetname} ${filename})
|
cuda_add_executable(${targetname} ${filename})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
|
||||||
else()
|
else()
|
||||||
add_executable(${targetname} ${filename})
|
add_executable(${targetname} ${filename})
|
||||||
endif()
|
endif()
|
||||||
|
@ -361,9 +361,15 @@ endif()
|
|||||||
|
|
||||||
if (EIGEN_TEST_CUDA)
|
if (EIGEN_TEST_CUDA)
|
||||||
|
|
||||||
find_package(CUDA 5.0)
|
find_package(CUDA 9.0)
|
||||||
if(CUDA_FOUND)
|
if(CUDA_FOUND)
|
||||||
|
# Make sure to compile without the -pedantic, -Wundef, -Wnon-virtual-dtor
|
||||||
|
# and -fno-check-new flags since they trigger thousands of compilation warnings
|
||||||
|
# in the CUDA runtime
|
||||||
|
string(REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
|
string(REPLACE "-Wundef" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
|
string(REPLACE "-Wnon-virtual-dtor" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
|
string(REPLACE "-fno-check-new" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
if( (NOT EIGEN_TEST_CXX11) OR (CMAKE_VERSION VERSION_LESS 3.3))
|
if( (NOT EIGEN_TEST_CXX11) OR (CMAKE_VERSION VERSION_LESS 3.3))
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
string(APPEND EIGEN_CUDA_CXX11_FLAGS " /std:c++11")
|
string(APPEND EIGEN_CUDA_CXX11_FLAGS " /std:c++11")
|
||||||
|
@ -203,7 +203,7 @@ if(EIGEN_TEST_CXX11)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# These tests needs nvcc
|
# These tests needs nvcc
|
||||||
find_package(CUDA 7.0)
|
find_package(CUDA 9.0)
|
||||||
if(CUDA_FOUND AND EIGEN_TEST_CUDA)
|
if(CUDA_FOUND AND EIGEN_TEST_CUDA)
|
||||||
# Make sure to compile without the -pedantic, -Wundef, -Wnon-virtual-dtor
|
# Make sure to compile without the -pedantic, -Wundef, -Wnon-virtual-dtor
|
||||||
# and -fno-check-new flags since they trigger thousands of compilation warnings
|
# and -fno-check-new flags since they trigger thousands of compilation warnings
|
||||||
@ -224,15 +224,12 @@ if(CUDA_FOUND AND EIGEN_TEST_CUDA)
|
|||||||
string(APPEND EIGEN_CUDA_CXX11_FLAGS " -std=c++11")
|
string(APPEND EIGEN_CUDA_CXX11_FLAGS " -std=c++11")
|
||||||
endif(MSVC)
|
endif(MSVC)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
|
||||||
set(CUDA_NVCC_FLAGS "-ccbin ${CMAKE_C_COMPILER}" CACHE STRING "nvcc flags" FORCE)
|
|
||||||
endif()
|
|
||||||
if(EIGEN_TEST_CUDA_CLANG)
|
if(EIGEN_TEST_CUDA_CLANG)
|
||||||
string(APPEND CMAKE_CXX_FLAGS " --cuda-path=${CUDA_TOOLKIT_ROOT_DIR} ${EIGEN_CUDA_CXX11_FLAGS}")
|
string(APPEND CMAKE_CXX_FLAGS " --cuda-path=${CUDA_TOOLKIT_ROOT_DIR}")
|
||||||
foreach(ARCH IN LISTS EIGEN_CUDA_COMPUTE_ARCH)
|
foreach(ARCH IN LISTS EIGEN_CUDA_COMPUTE_ARCH)
|
||||||
string(APPEND CMAKE_CXX_FLAGS " --cuda-gpu-arch=sm_${ARCH}")
|
string(APPEND CMAKE_CXX_FLAGS " --cuda-gpu-arch=sm_${ARCH}")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
string(APPEND CMAKE_CXX_FLAGS " ${EIGEN_CUDA_CXX_FLAGS}")
|
||||||
else()
|
else()
|
||||||
set(CUDA_PROPAGATE_HOST_FLAGS OFF)
|
set(CUDA_PROPAGATE_HOST_FLAGS OFF)
|
||||||
set(NVCC_ARCH_FLAGS)
|
set(NVCC_ARCH_FLAGS)
|
||||||
@ -249,15 +246,10 @@ if(CUDA_FOUND AND EIGEN_TEST_CUDA)
|
|||||||
foreach(ARCH IN LISTS EIGEN_CUDA_COMPUTE_ARCH)
|
foreach(ARCH IN LISTS EIGEN_CUDA_COMPUTE_ARCH)
|
||||||
string(APPEND NVCC_ARCH_FLAGS " -gencode arch=compute_${ARCH},code=sm_${ARCH}")
|
string(APPEND NVCC_ARCH_FLAGS " -gencode arch=compute_${ARCH},code=sm_${ARCH}")
|
||||||
endforeach()
|
endforeach()
|
||||||
set(CUDA_NVCC_FLAGS "--expt-relaxed-constexpr -Xcudafe \"--display_error_number\" ${NVCC_ARCH_FLAGS} ${CUDA_NVCC_FLAGS} ${EIGEN_CUDA_CXX11_FLAGS}")
|
set(CUDA_NVCC_FLAGS "--expt-relaxed-constexpr -Xcudafe \"--display_error_number\" ${NVCC_ARCH_FLAGS} ${CUDA_NVCC_FLAGS} ${EIGEN_CUDA_CXX_FLAGS}")
|
||||||
cuda_include_directories("${CMAKE_CURRENT_BINARY_DIR}" "${CUDA_TOOLKIT_ROOT_DIR}/include")
|
cuda_include_directories("${CMAKE_CURRENT_BINARY_DIR}" "${CUDA_TOOLKIT_ROOT_DIR}/include")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(EIGEN_CUDA_RELAXED_CONSTEXPR "--expt-relaxed-constexpr")
|
|
||||||
if (${CUDA_VERSION} STREQUAL "7.0")
|
|
||||||
set(EIGEN_CUDA_RELAXED_CONSTEXPR "--relaxed-constexpr")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(EIGEN_ADD_TEST_FILENAME_EXTENSION "cu")
|
set(EIGEN_ADD_TEST_FILENAME_EXTENSION "cu")
|
||||||
|
|
||||||
ei_add_test(cxx11_tensor_complex_cuda)
|
ei_add_test(cxx11_tensor_complex_cuda)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user