mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-31 01:03:38 +08:00
Update cmake configuration from master
This commit is contained in:
parent
052d91349a
commit
f1922b6dac
1175
CMakeLists.txt
1175
CMakeLists.txt
File diff suppressed because it is too large
Load Diff
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
@PACKAGE_INIT@
|
@PACKAGE_INIT@
|
||||||
|
|
||||||
if (NOT TARGET eigen)
|
if (NOT TARGET Eigen3::Eigen)
|
||||||
include ("${CMAKE_CURRENT_LIST_DIR}/Eigen3Targets.cmake")
|
include ("${CMAKE_CURRENT_LIST_DIR}/Eigen3Targets.cmake")
|
||||||
endif ()
|
endif (NOT TARGET Eigen3::Eigen)
|
||||||
|
|
||||||
# Legacy variables, do *not* use. May be removed in the future.
|
# Legacy variables, do *not* use. May be removed in the future.
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ ei_set_sitename()
|
|||||||
ei_set_build_string()
|
ei_set_build_string()
|
||||||
|
|
||||||
add_custom_target(buildtests)
|
add_custom_target(buildtests)
|
||||||
add_custom_target(check COMMAND "ctest")
|
add_custom_target(check COMMAND "ctest" ${EIGEN_CTEST_ARGS})
|
||||||
add_dependencies(check buildtests)
|
add_dependencies(check buildtests)
|
||||||
|
|
||||||
# Convenience target for only building GPU tests.
|
# Convenience target for only building GPU tests.
|
||||||
|
@ -61,6 +61,9 @@ set(ei_smoke_test_list
|
|||||||
mapped_matrix_1
|
mapped_matrix_1
|
||||||
mapstaticmethods_1
|
mapstaticmethods_1
|
||||||
mapstride_1
|
mapstride_1
|
||||||
|
unaryviewstride_1
|
||||||
|
unaryviewstride_2
|
||||||
|
unaryviewstride_3
|
||||||
matrix_square_root_1
|
matrix_square_root_1
|
||||||
meta
|
meta
|
||||||
minres_2
|
minres_2
|
||||||
@ -100,6 +103,7 @@ set(ei_smoke_test_list
|
|||||||
sizeof
|
sizeof
|
||||||
sizeoverflow
|
sizeoverflow
|
||||||
smallvectors
|
smallvectors
|
||||||
|
sparse_basic_1
|
||||||
sparse_basic_3
|
sparse_basic_3
|
||||||
sparse_block_1
|
sparse_block_1
|
||||||
sparse_extra_4
|
sparse_extra_4
|
||||||
@ -128,4 +132,5 @@ set(ei_smoke_test_list
|
|||||||
unalignedassert
|
unalignedassert
|
||||||
unalignedcount
|
unalignedcount
|
||||||
vectorwiseop_1
|
vectorwiseop_1
|
||||||
visitor_1)
|
visitor_1
|
||||||
|
vectorization_logic_1)
|
||||||
|
@ -28,7 +28,9 @@ macro(ei_add_test_internal testname testname_with_suffix)
|
|||||||
set(is_gpu_test ON)
|
set(is_gpu_test ON)
|
||||||
if(EIGEN_TEST_HIP)
|
if(EIGEN_TEST_HIP)
|
||||||
hip_reset_flags()
|
hip_reset_flags()
|
||||||
hip_add_executable(${targetname} ${filename} HIPCC_OPTIONS "-DEIGEN_USE_HIP ${ARGV2}")
|
hip_add_executable(${targetname} ${filename} HIPCC_OPTIONS -std=c++14)
|
||||||
|
target_compile_definitions(${targetname} PRIVATE -DEIGEN_USE_HIP)
|
||||||
|
set_property(TARGET ${targetname} PROPERTY HIP_ARCHITECTURES gfx900 gfx906 gfx908 gfx90a gfx940 gfx941 gfx942 gfx1030)
|
||||||
elseif(EIGEN_TEST_CUDA_CLANG)
|
elseif(EIGEN_TEST_CUDA_CLANG)
|
||||||
set_source_files_properties(${filename} PROPERTIES LANGUAGE CXX)
|
set_source_files_properties(${filename} PROPERTIES LANGUAGE CXX)
|
||||||
|
|
||||||
@ -38,22 +40,14 @@ macro(ei_add_test_internal testname testname_with_suffix)
|
|||||||
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()
|
|
||||||
add_executable(${targetname} ${filename} OPTIONS ${ARGV2})
|
|
||||||
endif()
|
|
||||||
set(CUDA_CLANG_LINK_LIBRARIES "cudart_static" "cuda" "dl" "pthread")
|
set(CUDA_CLANG_LINK_LIBRARIES "cudart_static" "cuda" "dl" "pthread")
|
||||||
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
set(CUDA_CLANG_LINK_LIBRARIES ${CUDA_CLANG_LINK_LIBRARIES} "rt")
|
set(CUDA_CLANG_LINK_LIBRARIES ${CUDA_CLANG_LINK_LIBRARIES} "rt")
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(${targetname} ${CUDA_CLANG_LINK_LIBRARIES})
|
target_link_libraries(${targetname} ${CUDA_CLANG_LINK_LIBRARIES})
|
||||||
else()
|
else()
|
||||||
if (${ARGC} GREATER 2)
|
cuda_add_executable(${targetname} ${filename})
|
||||||
cuda_add_executable(${targetname} ${filename} OPTIONS ${ARGV2})
|
|
||||||
else()
|
|
||||||
cuda_add_executable(${targetname} ${filename})
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
add_executable(${targetname} ${filename})
|
add_executable(${targetname} ${filename})
|
||||||
@ -66,28 +60,27 @@ macro(ei_add_test_internal testname testname_with_suffix)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(EIGEN_NO_ASSERTION_CHECKING)
|
if(EIGEN_NO_ASSERTION_CHECKING)
|
||||||
ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_NO_ASSERTION_CHECKING=1")
|
target_compile_definitions(${targetname} PRIVATE EIGEN_NO_ASSERTION_CHECKING=1)
|
||||||
else()
|
else()
|
||||||
if(EIGEN_DEBUG_ASSERTS)
|
if(EIGEN_DEBUG_ASSERTS)
|
||||||
ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_DEBUG_ASSERTS=1")
|
target_compile_definitions(${targetname} PRIVATE EIGEN_DEBUG_ASSERTS=1)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_TEST_MAX_SIZE=${EIGEN_TEST_MAX_SIZE}")
|
target_compile_definitions(${targetname} PRIVATE EIGEN_TEST_MAX_SIZE=${EIGEN_TEST_MAX_SIZE})
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
ei_add_target_property(${targetname} COMPILE_FLAGS "/bigobj")
|
target_compile_options(${targetname} PRIVATE "/bigobj")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# let the user pass flags.
|
# let the user pass flags.
|
||||||
if(${ARGC} GREATER 2)
|
if(${ARGC} GREATER 2)
|
||||||
set(compile_options "${ARGV2}")
|
separate_arguments(compile_options NATIVE_COMMAND ${ARGV2})
|
||||||
separate_arguments(compile_options)
|
target_compile_options(${targetname} PRIVATE ${compile_options})
|
||||||
ei_add_target_property(${targetname} COMPILE_FLAGS ${compile_options})
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(EIGEN_TEST_CUSTOM_CXX_FLAGS)
|
if(EIGEN_TEST_CUSTOM_CXX_FLAGS)
|
||||||
ei_add_target_property(${targetname} COMPILE_FLAGS ${EIGEN_TEST_CUSTOM_CXX_FLAGS})
|
target_compile_options(${targetname} PRIVATE ${EIGEN_TEST_CUSTOM_CXX_FLAGS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
|
if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
|
||||||
@ -99,6 +92,7 @@ macro(ei_add_test_internal testname testname_with_suffix)
|
|||||||
if(EIGEN_TEST_CUSTOM_LINKER_FLAGS)
|
if(EIGEN_TEST_CUSTOM_LINKER_FLAGS)
|
||||||
target_link_libraries(${targetname} ${EIGEN_TEST_CUSTOM_LINKER_FLAGS})
|
target_link_libraries(${targetname} ${EIGEN_TEST_CUSTOM_LINKER_FLAGS})
|
||||||
endif()
|
endif()
|
||||||
|
target_link_libraries(${targetname} Eigen3::Eigen)
|
||||||
|
|
||||||
if(${ARGC} GREATER 3)
|
if(${ARGC} GREATER 3)
|
||||||
set(libs_to_link ${ARGV3})
|
set(libs_to_link ${ARGV3})
|
||||||
@ -113,7 +107,7 @@ macro(ei_add_test_internal testname testname_with_suffix)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_test(${testname_with_suffix} "${targetname}")
|
add_test(NAME ${testname_with_suffix} COMMAND "${targetname}")
|
||||||
|
|
||||||
# Specify target and test labels according to EIGEN_CURRENT_SUBPROJECT
|
# Specify target and test labels according to EIGEN_CURRENT_SUBPROJECT
|
||||||
get_property(current_subproject GLOBAL PROPERTY EIGEN_CURRENT_SUBPROJECT)
|
get_property(current_subproject GLOBAL PROPERTY EIGEN_CURRENT_SUBPROJECT)
|
||||||
@ -129,19 +123,7 @@ macro(ei_add_test_internal testname testname_with_suffix)
|
|||||||
|
|
||||||
if(EIGEN_SYCL)
|
if(EIGEN_SYCL)
|
||||||
# Force include of the SYCL file at the end to avoid errors.
|
# Force include of the SYCL file at the end to avoid errors.
|
||||||
set_property(TARGET ${targetname} PROPERTY COMPUTECPP_INCLUDE_AFTER 1)
|
set_property(TARGET ${gittargetname} PROPERTY COMPUTECPP_INCLUDE_AFTER 1)
|
||||||
# Set COMPILE_FLAGS to COMPILE_DEFINITIONS instead to avoid having to duplicate the flags
|
|
||||||
# to the device compiler.
|
|
||||||
get_target_property(target_compile_flags ${targetname} COMPILE_FLAGS)
|
|
||||||
separate_arguments(target_compile_flags)
|
|
||||||
foreach(flag ${target_compile_flags})
|
|
||||||
if(${flag} MATCHES "^-D.*")
|
|
||||||
string(REPLACE "-D" "" definition_flag ${flag})
|
|
||||||
set_property(TARGET ${targetname} APPEND PROPERTY COMPILE_DEFINITIONS ${definition_flag})
|
|
||||||
list(REMOVE_ITEM target_compile_flags ${flag})
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
set_property(TARGET ${targetname} PROPERTY COMPILE_FLAGS ${target_compile_flags})
|
|
||||||
# Link against pthread and add sycl to target
|
# Link against pthread and add sycl to target
|
||||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
@ -218,12 +200,13 @@ macro(ei_add_test testname)
|
|||||||
if( (EIGEN_SPLIT_LARGE_TESTS AND suffixes) OR explicit_suffixes)
|
if( (EIGEN_SPLIT_LARGE_TESTS AND suffixes) OR explicit_suffixes)
|
||||||
add_custom_target(${testname})
|
add_custom_target(${testname})
|
||||||
foreach(suffix ${suffixes})
|
foreach(suffix ${suffixes})
|
||||||
ei_add_test_internal(${testname} ${testname}_${suffix}
|
ei_add_test_internal(${testname} ${testname}_${suffix} "${ARGV1}" "${ARGV2}")
|
||||||
"${ARGV1} -DEIGEN_TEST_PART_${suffix}=1" "${ARGV2}")
|
|
||||||
add_dependencies(${testname} ${testname}_${suffix})
|
add_dependencies(${testname} ${testname}_${suffix})
|
||||||
|
target_compile_definitions(${testname}_${suffix} PRIVATE -DEIGEN_TEST_PART_${suffix}=1)
|
||||||
endforeach()
|
endforeach()
|
||||||
else()
|
else()
|
||||||
ei_add_test_internal(${testname} ${testname} "${ARGV1} -DEIGEN_TEST_PART_ALL=1" "${ARGV2}")
|
ei_add_test_internal(${testname} ${testname} "${ARGV1}" "${ARGV2}")
|
||||||
|
target_compile_definitions(${testname} PRIVATE -DEIGEN_TEST_PART_ALL=1)
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
@ -249,11 +232,16 @@ macro(ei_add_failtest testname)
|
|||||||
|
|
||||||
# Add the tests to ctest.
|
# Add the tests to ctest.
|
||||||
add_test(NAME ${test_target_ok}
|
add_test(NAME ${test_target_ok}
|
||||||
COMMAND ${CMAKE_COMMAND} --build . --target ${test_target_ok} --config $<CONFIGURATION>
|
COMMAND ${CMAKE_COMMAND} --build . --target ${test_target_ok} --config $<CONFIG>
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||||
add_test(NAME ${test_target_ko}
|
add_test(NAME ${test_target_ko}
|
||||||
COMMAND ${CMAKE_COMMAND} --build . --target ${test_target_ko} --config $<CONFIGURATION>
|
COMMAND ${CMAKE_COMMAND} --build . --target ${test_target_ko} --config $<CONFIG>
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||||
|
# Disable emulator if cross-compiling.
|
||||||
|
if (CMAKE_CROSSCOMPILING)
|
||||||
|
set_property(TEST ${test_target_ok} PROPERTY CROSSCOMPILING_EMULATOR "")
|
||||||
|
set_property(TEST ${test_target_ko} PROPERTY CROSSCOMPILING_EMULATOR "")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Expect the second test to fail
|
# Expect the second test to fail
|
||||||
set_tests_properties(${test_target_ko} PROPERTIES WILL_FAIL TRUE)
|
set_tests_properties(${test_target_ko} PROPERTIES WILL_FAIL TRUE)
|
||||||
@ -393,8 +381,10 @@ macro(ei_testing_print_summary)
|
|||||||
if(EIGEN_TEST_SYCL)
|
if(EIGEN_TEST_SYCL)
|
||||||
if(EIGEN_SYCL_TRISYCL)
|
if(EIGEN_SYCL_TRISYCL)
|
||||||
message(STATUS "SYCL: ON (using triSYCL)")
|
message(STATUS "SYCL: ON (using triSYCL)")
|
||||||
else()
|
elseif(EIGEN_SYCL_ComputeCpp)
|
||||||
message(STATUS "SYCL: ON (using computeCPP)")
|
message(STATUS "SYCL: ON (using computeCPP)")
|
||||||
|
elseif(EIGEN_SYCL_DPCPP)
|
||||||
|
message(STATUS "SYCL: ON (using DPCPP)")
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
message(STATUS "SYCL: OFF")
|
message(STATUS "SYCL: OFF")
|
||||||
@ -464,15 +454,7 @@ endmacro()
|
|||||||
|
|
||||||
macro(ei_get_compilerver VAR)
|
macro(ei_get_compilerver VAR)
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
# on windows system, we use a modified CMake script
|
set(${VAR} "${CMAKE_CXX_COMPILER_VERSION}")
|
||||||
include(EigenDetermineVSServicePack)
|
|
||||||
EigenDetermineVSServicePack( my_service_pack )
|
|
||||||
|
|
||||||
if( my_service_pack )
|
|
||||||
set(${VAR} ${my_service_pack})
|
|
||||||
else()
|
|
||||||
set(${VAR} "na")
|
|
||||||
endif()
|
|
||||||
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "PGI")
|
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "PGI")
|
||||||
set(${VAR} "${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}")
|
set(${VAR} "${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}")
|
||||||
else()
|
else()
|
||||||
@ -607,10 +589,7 @@ macro(ei_set_build_string)
|
|||||||
ei_get_compilerver(LOCAL_COMPILER_VERSION)
|
ei_get_compilerver(LOCAL_COMPILER_VERSION)
|
||||||
ei_get_cxxflags(LOCAL_COMPILER_FLAGS)
|
ei_get_cxxflags(LOCAL_COMPILER_FLAGS)
|
||||||
|
|
||||||
include(EigenDetermineOSVersion)
|
set(TMP_BUILD_STRING ${CMAKE_SYSTEM}-${LOCAL_COMPILER_VERSION})
|
||||||
DetermineOSVersion(OS_VERSION)
|
|
||||||
|
|
||||||
set(TMP_BUILD_STRING ${OS_VERSION}-${LOCAL_COMPILER_VERSION})
|
|
||||||
|
|
||||||
if (NOT ${LOCAL_COMPILER_FLAGS} STREQUAL "")
|
if (NOT ${LOCAL_COMPILER_FLAGS} STREQUAL "")
|
||||||
set(TMP_BUILD_STRING ${TMP_BUILD_STRING}-${LOCAL_COMPILER_FLAGS})
|
set(TMP_BUILD_STRING ${TMP_BUILD_STRING}-${LOCAL_COMPILER_FLAGS})
|
||||||
@ -680,8 +659,8 @@ endmacro()
|
|||||||
# Split all tests listed in EIGEN_TESTS_LIST into num_splits many targets
|
# Split all tests listed in EIGEN_TESTS_LIST into num_splits many targets
|
||||||
# named buildtestspartN with N = { 0, ..., num_splits-1}.
|
# named buildtestspartN with N = { 0, ..., num_splits-1}.
|
||||||
#
|
#
|
||||||
# The intention behind the existance of this macro is the size of Eigen's
|
# The intention behind the existence of this macro is the size of Eigen's
|
||||||
# testsuite. Together with the relativly big compile-times building all tests
|
# testsuite. Together with the relatively big compile-times building all tests
|
||||||
# can take a substantial amount of time depending on the available hardware.
|
# can take a substantial amount of time depending on the available hardware.
|
||||||
#
|
#
|
||||||
# The last buildtestspartN target will build possible remaining tests.
|
# The last buildtestspartN target will build possible remaining tests.
|
||||||
|
61
cmake/FindCLANG_FORMAT.cmake
Normal file
61
cmake/FindCLANG_FORMAT.cmake
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# Find clang-format
|
||||||
|
#
|
||||||
|
# CLANG_FORMAT_EXECUTABLE - Path to clang-format executable
|
||||||
|
# CLANG_FORMAT_FOUND - True if the clang-format executable was found.
|
||||||
|
# CLANG_FORMAT_VERSION - The version of clang-format found
|
||||||
|
#
|
||||||
|
# Copyright 2009-2020 The VOTCA Development Team (http://www.votca.org)
|
||||||
|
#
|
||||||
|
# Licensed under the Mozilla Public License Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.mozilla.org/en-US/MPL/2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
find_program(CLANG_FORMAT_EXECUTABLE
|
||||||
|
NAMES
|
||||||
|
clang-format-9
|
||||||
|
clang-format
|
||||||
|
clang-format-11
|
||||||
|
clang-format-10
|
||||||
|
clang-format-8
|
||||||
|
clang-format-7
|
||||||
|
|
||||||
|
DOC "clang-format executable")
|
||||||
|
mark_as_advanced(CLANG_FORMAT_EXECUTABLE)
|
||||||
|
|
||||||
|
# Extract version from command "clang-format -version"
|
||||||
|
if(CLANG_FORMAT_EXECUTABLE)
|
||||||
|
execute_process(COMMAND ${CLANG_FORMAT_EXECUTABLE} -version
|
||||||
|
OUTPUT_VARIABLE clang_format_version
|
||||||
|
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
|
if(clang_format_version MATCHES "^.*clang-format version .*")
|
||||||
|
# clang_format_version sample: "clang-format version 3.9.1-4ubuntu3~16.04.1
|
||||||
|
# (tags/RELEASE_391/rc2)"
|
||||||
|
string(REGEX
|
||||||
|
REPLACE "^.*clang-format version ([.0-9]+).*"
|
||||||
|
"\\1"
|
||||||
|
CLANG_FORMAT_VERSION
|
||||||
|
"${clang_format_version}")
|
||||||
|
# CLANG_FORMAT_VERSION sample: "3.9.1"
|
||||||
|
else()
|
||||||
|
set(CLANG_FORMAT_VERSION 0.0)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
set(CLANG_FORMAT_VERSION 0.0)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
# handle the QUIETLY and REQUIRED arguments and set CLANG_FORMAT_FOUND to TRUE
|
||||||
|
# if all listed variables are TRUE
|
||||||
|
find_package_handle_standard_args(CLANG_FORMAT REQUIRED_VARS CLANG_FORMAT_EXECUTABLE VERSION_VAR CLANG_FORMAT_VERSION)
|
@ -382,7 +382,7 @@ endfunction(__build_ir)
|
|||||||
#######################
|
#######################
|
||||||
#
|
#
|
||||||
# Adds a SYCL compilation custom command associated with an existing
|
# Adds a SYCL compilation custom command associated with an existing
|
||||||
# target and sets a dependancy on that new command.
|
# target and sets a dependency on that new command.
|
||||||
#
|
#
|
||||||
# TARGET : Name of the target to add SYCL to.
|
# TARGET : Name of the target to add SYCL to.
|
||||||
# SOURCES : Source files to be compiled for SYCL.
|
# SOURCES : Source files to be compiled for SYCL.
|
||||||
|
62
cmake/FindDPCPP.cmake
Normal file
62
cmake/FindDPCPP.cmake
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
include_guard()
|
||||||
|
|
||||||
|
include(CheckCXXCompilerFlag)
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
|
if("${DPCPP_SYCL_TARGET}" STREQUAL "amdgcn-amd-amdhsa" AND
|
||||||
|
"${DPCPP_SYCL_ARCH}" STREQUAL "")
|
||||||
|
message(FATAL_ERROR "Architecture required for AMD DPCPP builds,"
|
||||||
|
" please specify in DPCPP_SYCL_ARCH")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(DPCPP_USER_FLAGS "" CACHE STRING
|
||||||
|
"Additional user-specified compiler flags for DPC++")
|
||||||
|
|
||||||
|
get_filename_component(DPCPP_BIN_DIR ${CMAKE_CXX_COMPILER} DIRECTORY)
|
||||||
|
find_library(DPCPP_LIB_DIR NAMES sycl sycl6 PATHS "${DPCPP_BIN_DIR}/../lib")
|
||||||
|
|
||||||
|
add_library(DPCPP::DPCPP INTERFACE IMPORTED)
|
||||||
|
|
||||||
|
set(DPCPP_FLAGS "-fsycl;-fsycl-targets=${DPCPP_SYCL_TARGET};-fsycl-unnamed-lambda;${DPCPP_USER_FLAGS};-ftemplate-backtrace-limit=0")
|
||||||
|
if(NOT "${DPCPP_SYCL_ARCH}" STREQUAL "")
|
||||||
|
if("${DPCPP_SYCL_TARGET}" STREQUAL "amdgcn-amd-amdhsa")
|
||||||
|
list(APPEND DPCPP_FLAGS "-Xsycl-target-backend")
|
||||||
|
list(APPEND DPCPP_FLAGS "--offload-arch=${DPCPP_SYCL_ARCH}")
|
||||||
|
elseif("${DPCPP_SYCL_TARGET}" STREQUAL "nvptx64-nvidia-cuda")
|
||||||
|
list(APPEND DPCPP_FLAGS "-Xsycl-target-backend")
|
||||||
|
list(APPEND DPCPP_FLAGS "--cuda-gpu-arch=${DPCPP_SYCL_ARCH}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(UNIX)
|
||||||
|
set_target_properties(DPCPP::DPCPP PROPERTIES
|
||||||
|
INTERFACE_COMPILE_OPTIONS "${DPCPP_FLAGS}"
|
||||||
|
INTERFACE_LINK_OPTIONS "${DPCPP_FLAGS}"
|
||||||
|
INTERFACE_LINK_LIBRARIES ${DPCPP_LIB_DIR}
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${DPCPP_BIN_DIR}/../include/sycl;${DPCPP_BIN_DIR}/../include")
|
||||||
|
message(STATUS ">>>>>>>>> DPCPP INCLUDE DIR: ${DPCPP_BIN_DIR}/../include/sycl")
|
||||||
|
else()
|
||||||
|
set_target_properties(DPCPP::DPCPP PROPERTIES
|
||||||
|
INTERFACE_COMPILE_OPTIONS "${DPCPP_FLAGS}"
|
||||||
|
INTERFACE_LINK_LIBRARIES ${DPCPP_LIB_DIR}
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${DPCPP_BIN_DIR}/../include/sycl")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
function(add_sycl_to_target)
|
||||||
|
set(options)
|
||||||
|
set(one_value_args TARGET)
|
||||||
|
set(multi_value_args SOURCES)
|
||||||
|
cmake_parse_arguments(SB_ADD_SYCL
|
||||||
|
"${options}"
|
||||||
|
"${one_value_args}"
|
||||||
|
"${multi_value_args}"
|
||||||
|
${ARGN}
|
||||||
|
)
|
||||||
|
target_compile_options(${SB_ADD_SYCL_TARGET} PUBLIC ${DPCPP_FLAGS})
|
||||||
|
target_link_libraries(${SB_ADD_SYCL_TARGET} DPCPP::DPCPP)
|
||||||
|
target_compile_features(${SB_ADD_SYCL_TARGET} PRIVATE cxx_std_17)
|
||||||
|
get_target_property(target_type ${SB_ADD_SYCL_TARGET} TYPE)
|
||||||
|
if (NOT target_type STREQUAL "OBJECT_LIBRARY")
|
||||||
|
target_link_options(${SB_ADD_SYCL_TARGET} PUBLIC ${DPCPP_FLAGS})
|
||||||
|
endif()
|
||||||
|
endfunction()
|
64
cmake/SyclConfigureTesting.cmake
Normal file
64
cmake/SyclConfigureTesting.cmake
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
# Forward CMake options as preprocessor definitions
|
||||||
|
if(EIGEN_SYCL_USE_DEFAULT_SELECTOR)
|
||||||
|
add_definitions(-DEIGEN_SYCL_USE_DEFAULT_SELECTOR=${EIGEN_SYCL_USE_DEFAULT_SELECTOR})
|
||||||
|
endif()
|
||||||
|
if(EIGEN_SYCL_NO_LOCAL_MEM)
|
||||||
|
add_definitions(-DEIGEN_SYCL_NO_LOCAL_MEM=${EIGEN_SYCL_NO_LOCAL_MEM})
|
||||||
|
endif()
|
||||||
|
if(EIGEN_SYCL_LOCAL_MEM)
|
||||||
|
add_definitions(-DEIGEN_SYCL_LOCAL_MEM=${EIGEN_SYCL_LOCAL_MEM})
|
||||||
|
endif()
|
||||||
|
if(EIGEN_SYCL_MAX_GLOBAL_RANGE)
|
||||||
|
add_definitions(-DEIGEN_SYCL_MAX_GLOBAL_RANGE=${EIGEN_SYCL_MAX_GLOBAL_RANGE})
|
||||||
|
endif()
|
||||||
|
if(EIGEN_SYCL_LOCAL_THREAD_DIM0)
|
||||||
|
add_definitions(-DEIGEN_SYCL_LOCAL_THREAD_DIM0=${EIGEN_SYCL_LOCAL_THREAD_DIM0})
|
||||||
|
endif()
|
||||||
|
if(EIGEN_SYCL_LOCAL_THREAD_DIM1)
|
||||||
|
add_definitions(-DEIGEN_SYCL_LOCAL_THREAD_DIM1=${EIGEN_SYCL_LOCAL_THREAD_DIM1})
|
||||||
|
endif()
|
||||||
|
if(EIGEN_SYCL_REG_M)
|
||||||
|
add_definitions(-DEIGEN_SYCL_REG_M=${EIGEN_SYCL_REG_M})
|
||||||
|
endif()
|
||||||
|
if(EIGEN_SYCL_REG_N)
|
||||||
|
add_definitions(-DEIGEN_SYCL_REG_N=${EIGEN_SYCL_REG_N})
|
||||||
|
endif()
|
||||||
|
if(EIGEN_SYCL_ASYNC_EXECUTION)
|
||||||
|
add_definitions(-DEIGEN_SYCL_ASYNC_EXECUTION=${EIGEN_SYCL_ASYNC_EXECUTION})
|
||||||
|
endif()
|
||||||
|
if(EIGEN_SYCL_DISABLE_SKINNY)
|
||||||
|
add_definitions(-DEIGEN_SYCL_DISABLE_SKINNY=${EIGEN_SYCL_DISABLE_SKINNY})
|
||||||
|
endif()
|
||||||
|
if(EIGEN_SYCL_DISABLE_DOUBLE_BUFFER)
|
||||||
|
add_definitions(-DEIGEN_SYCL_DISABLE_DOUBLE_BUFFER=${EIGEN_SYCL_DISABLE_DOUBLE_BUFFER})
|
||||||
|
endif()
|
||||||
|
if(EIGEN_SYCL_DISABLE_SCALAR)
|
||||||
|
add_definitions(-DEIGEN_SYCL_DISABLE_SCALAR=${EIGEN_SYCL_DISABLE_SCALAR})
|
||||||
|
endif()
|
||||||
|
if(EIGEN_SYCL_DISABLE_GEMV)
|
||||||
|
add_definitions(-DEIGEN_SYCL_DISABLE_GEMV=${EIGEN_SYCL_DISABLE_GEMV})
|
||||||
|
endif()
|
||||||
|
if(EIGEN_SYCL_DISABLE_ARM_GPU_CACHE_OPTIMISATION)
|
||||||
|
add_definitions(-DEIGEN_SYCL_DISABLE_ARM_GPU_CACHE_OPTIMISATION=${EIGEN_SYCL_DISABLE_ARM_GPU_CACHE_OPTIMISATION})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(EIGEN_SYCL_ComputeCpp)
|
||||||
|
if(MSVC)
|
||||||
|
list(APPEND COMPUTECPP_USER_FLAGS -DWIN32)
|
||||||
|
else()
|
||||||
|
list(APPEND COMPUTECPP_USER_FLAGS -Wall)
|
||||||
|
endif()
|
||||||
|
# The following flags are not supported by Clang and can cause warnings
|
||||||
|
# if used with -Werror so they are removed here.
|
||||||
|
if(COMPUTECPP_USE_COMPILER_DRIVER)
|
||||||
|
set(CMAKE_CXX_COMPILER ${ComputeCpp_DEVICE_COMPILER_EXECUTABLE})
|
||||||
|
string(REPLACE "-Wlogical-op" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||||
|
string(REPLACE "-Wno-psabi" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||||
|
endif()
|
||||||
|
list(APPEND COMPUTECPP_USER_FLAGS
|
||||||
|
-DEIGEN_NO_ASSERTION_CHECKING=1
|
||||||
|
-no-serial-memop
|
||||||
|
-Xclang
|
||||||
|
-cl-mad-enable)
|
||||||
|
endif(EIGEN_SYCL_ComputeCpp)
|
@ -6,6 +6,7 @@ foreach(example_src ${examples_SRCS})
|
|||||||
if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
|
if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
|
||||||
target_link_libraries(${example} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
|
target_link_libraries(${example} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
|
||||||
endif()
|
endif()
|
||||||
|
target_link_libraries(${example} Eigen3::Eigen)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET ${example}
|
TARGET ${example}
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
@ -14,7 +15,3 @@ foreach(example_src ${examples_SRCS})
|
|||||||
)
|
)
|
||||||
add_dependencies(all_examples ${example})
|
add_dependencies(all_examples ${example})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
if(EIGEN_COMPILER_SUPPORT_CPP11)
|
|
||||||
ei_add_target_property(nullary_indexing COMPILE_FLAGS "-std=c++11")
|
|
||||||
endif()
|
|
@ -15,6 +15,7 @@ foreach(snippet_src ${snippets_SRCS})
|
|||||||
if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
|
if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
|
||||||
target_link_libraries(${compile_snippet_target} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
|
target_link_libraries(${compile_snippet_target} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
|
||||||
endif()
|
endif()
|
||||||
|
target_link_libraries(${compile_snippet_target} Eigen3::Eigen)
|
||||||
if(${snippet_src} MATCHES "cxx11")
|
if(${snippet_src} MATCHES "cxx11")
|
||||||
set_target_properties(${compile_snippet_target} PROPERTIES COMPILE_FLAGS "-std=c++11")
|
set_target_properties(${compile_snippet_target} PROPERTIES COMPILE_FLAGS "-std=c++11")
|
||||||
endif()
|
endif()
|
||||||
|
@ -7,7 +7,7 @@ endif()
|
|||||||
|
|
||||||
if(QT4_FOUND)
|
if(QT4_FOUND)
|
||||||
add_executable(Tutorial_sparse_example Tutorial_sparse_example.cpp Tutorial_sparse_example_details.cpp)
|
add_executable(Tutorial_sparse_example Tutorial_sparse_example.cpp Tutorial_sparse_example_details.cpp)
|
||||||
target_link_libraries(Tutorial_sparse_example ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
|
target_link_libraries(Tutorial_sparse_example ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} Eigen3::Eigen)
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET Tutorial_sparse_example
|
TARGET Tutorial_sparse_example
|
||||||
@ -23,7 +23,7 @@ if(EIGEN_COMPILER_SUPPORT_CPP11)
|
|||||||
add_executable(random_cpp11 random_cpp11.cpp)
|
add_executable(random_cpp11 random_cpp11.cpp)
|
||||||
target_link_libraries(random_cpp11 ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
|
target_link_libraries(random_cpp11 ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
|
||||||
add_dependencies(all_examples random_cpp11)
|
add_dependencies(all_examples random_cpp11)
|
||||||
ei_add_target_property(random_cpp11 COMPILE_FLAGS "-std=c++11")
|
target_compile_options(random_cpp11 PRIVATE "-std=c++11")
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET random_cpp11
|
TARGET random_cpp11
|
||||||
|
@ -111,6 +111,7 @@ foreach(target IN LISTS EIGEN_LAPACK_TARGETS)
|
|||||||
if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
|
if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
|
||||||
target_link_libraries(${target} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
|
target_link_libraries(${target} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
|
||||||
endif()
|
endif()
|
||||||
|
target_link_libraries(${target} Eigen3::Eigen)
|
||||||
add_dependencies(lapack ${target})
|
add_dependencies(lapack ${target})
|
||||||
install(TARGETS ${target}
|
install(TARGETS ${target}
|
||||||
RUNTIME DESTINATION bin
|
RUNTIME DESTINATION bin
|
||||||
|
@ -286,7 +286,6 @@ ei_add_test(special_numbers)
|
|||||||
ei_add_test(rvalue_types)
|
ei_add_test(rvalue_types)
|
||||||
ei_add_test(dense_storage)
|
ei_add_test(dense_storage)
|
||||||
ei_add_test(ctorleak)
|
ei_add_test(ctorleak)
|
||||||
ei_add_test(mpl2only)
|
|
||||||
ei_add_test(inplace_decomposition)
|
ei_add_test(inplace_decomposition)
|
||||||
ei_add_test(half_float)
|
ei_add_test(half_float)
|
||||||
ei_add_test(bfloat16_float)
|
ei_add_test(bfloat16_float)
|
||||||
@ -311,7 +310,7 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
ei_add_test(fastmath " ${EIGEN_FASTMATH_FLAGS} ")
|
ei_add_test(fastmath "${EIGEN_FASTMATH_FLAGS}")
|
||||||
|
|
||||||
# # ei_add_test(denseLM)
|
# # ei_add_test(denseLM)
|
||||||
|
|
||||||
@ -396,6 +395,16 @@ if(CUDA_FOUND AND EIGEN_TEST_CUDA)
|
|||||||
else()
|
else()
|
||||||
set(CUDA_PROPAGATE_HOST_FLAGS OFF)
|
set(CUDA_PROPAGATE_HOST_FLAGS OFF)
|
||||||
set(NVCC_ARCH_FLAGS)
|
set(NVCC_ARCH_FLAGS)
|
||||||
|
# Define an -arch=sm_<arch>, otherwise if GPU does not exactly match one of
|
||||||
|
# those in the arch list for -gencode, the kernels will fail to run with
|
||||||
|
# cudaErrorNoKernelImageForDevice
|
||||||
|
# This can happen with newer cards (e.g. sm_75) and compiling with older
|
||||||
|
# versions of nvcc (e.g. 9.2) that do not support their specific arch.
|
||||||
|
list(LENGTH EIGEN_CUDA_COMPUTE_ARCH EIGEN_CUDA_COMPUTE_ARCH_SIZE)
|
||||||
|
if(EIGEN_CUDA_COMPUTE_ARCH_SIZE)
|
||||||
|
list(GET EIGEN_CUDA_COMPUTE_ARCH 0 EIGEN_CUDA_COMPUTE_DEFAULT)
|
||||||
|
set(NVCC_ARCH_FLAGS " -arch=sm_${EIGEN_CUDA_COMPUTE_DEFAULT}")
|
||||||
|
endif()
|
||||||
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()
|
||||||
@ -416,34 +425,44 @@ endif()
|
|||||||
option(EIGEN_TEST_HIP "Add HIP support." OFF)
|
option(EIGEN_TEST_HIP "Add HIP support." OFF)
|
||||||
if (EIGEN_TEST_HIP)
|
if (EIGEN_TEST_HIP)
|
||||||
|
|
||||||
set(HIP_PATH "/opt/rocm/hip" CACHE STRING "Path to the HIP installation.")
|
set(ROCM_PATH "/opt/rocm" CACHE STRING "Path to the ROCm installation.")
|
||||||
|
|
||||||
if (EXISTS ${HIP_PATH})
|
|
||||||
|
|
||||||
|
if (EXISTS ${ROCM_PATH}/hip)
|
||||||
|
set(HIP_PATH ${ROCM_PATH}/hip)
|
||||||
list(APPEND CMAKE_MODULE_PATH ${HIP_PATH}/cmake)
|
list(APPEND CMAKE_MODULE_PATH ${HIP_PATH}/cmake)
|
||||||
|
elseif (EXISTS ${ROCM_PATH}/lib/cmake/hip)
|
||||||
find_package(HIP REQUIRED)
|
set(HIP_PATH ${ROCM_PATH})
|
||||||
if (HIP_FOUND)
|
list(APPEND CMAKE_MODULE_PATH ${HIP_PATH}/lib/cmake/hip)
|
||||||
|
|
||||||
execute_process(COMMAND ${HIP_PATH}/bin/hipconfig --platform OUTPUT_VARIABLE HIP_PLATFORM)
|
|
||||||
|
|
||||||
if ((${HIP_PLATFORM} STREQUAL "hcc") OR (${HIP_PLATFORM} STREQUAL "amd"))
|
|
||||||
|
|
||||||
include_directories(${HIP_PATH}/include)
|
|
||||||
|
|
||||||
set(EIGEN_ADD_TEST_FILENAME_EXTENSION "cu")
|
|
||||||
ei_add_test(gpu_basic)
|
|
||||||
unset(EIGEN_ADD_TEST_FILENAME_EXTENSION)
|
|
||||||
|
|
||||||
elseif ((${HIP_PLATFORM} STREQUAL "nvcc") OR (${HIP_PLATFORM} STREQUAL "nvidia"))
|
|
||||||
message(FATAL_ERROR "HIP_PLATFORM = nvcc is not supported within Eigen")
|
|
||||||
else ()
|
|
||||||
message(FATAL_ERROR "Unknown HIP_PLATFORM = ${HIP_PLATFORM}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
else ()
|
else ()
|
||||||
message(FATAL_ERROR "EIGEN_TEST_HIP is ON, but the specified HIP_PATH (${HIP_PATH}) does not exist")
|
message(FATAL_ERROR "EIGEN_TEST_HIP is ON, but could not find the ROCm installation under ${ROCM_PATH}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
find_package(HIP REQUIRED)
|
||||||
|
if (HIP_FOUND)
|
||||||
|
execute_process(COMMAND ${HIP_PATH}/bin/hipconfig --platform OUTPUT_VARIABLE HIP_PLATFORM)
|
||||||
|
|
||||||
|
if ((${HIP_PLATFORM} STREQUAL "hcc") OR (${HIP_PLATFORM} STREQUAL "amd"))
|
||||||
|
|
||||||
|
include_directories(${HIP_PATH}/include)
|
||||||
|
|
||||||
|
set(EIGEN_ADD_TEST_FILENAME_EXTENSION "cu")
|
||||||
|
ei_add_test(gpu_basic)
|
||||||
|
unset(EIGEN_ADD_TEST_FILENAME_EXTENSION)
|
||||||
|
|
||||||
|
elseif ((${HIP_PLATFORM} STREQUAL "nvcc") OR (${HIP_PLATFORM} STREQUAL "nvidia"))
|
||||||
|
message(FATAL_ERROR "HIP_PLATFORM = nvcc is not supported within Eigen")
|
||||||
|
else ()
|
||||||
|
message(FATAL_ERROR "Unknown HIP_PLATFORM = ${HIP_PLATFORM}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(EIGEN_TEST_SYCL)
|
||||||
|
set(EIGEN_SYCL ON)
|
||||||
|
include(SyclConfigureTesting)
|
||||||
|
|
||||||
|
ei_add_test(sycl_basic)
|
||||||
|
set(EIGEN_SYCL OFF)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
cmake_dependent_option(EIGEN_TEST_BUILD_DOCUMENTATION "Test building the doxygen documentation" OFF "EIGEN_BUILD_DOC" OFF)
|
cmake_dependent_option(EIGEN_TEST_BUILD_DOCUMENTATION "Test building the doxygen documentation" OFF "EIGEN_BUILD_DOC" OFF)
|
||||||
|
@ -4,7 +4,7 @@ if(EIGEN_BUILD_DOC)
|
|||||||
endif()
|
endif()
|
||||||
if(EIGEN_BUILD_TESTING)
|
if(EIGEN_BUILD_TESTING)
|
||||||
if(EIGEN_LEAVE_TEST_IN_ALL_TARGET)
|
if(EIGEN_LEAVE_TEST_IN_ALL_TARGET)
|
||||||
add_subdirectory(test) # can't do EXCLUDE_FROM_ALL here, breaks CTest
|
add_subdirectory(test) # CTest automatic test building relies on the "all" target.
|
||||||
else()
|
else()
|
||||||
add_subdirectory(test EXCLUDE_FROM_ALL)
|
add_subdirectory(test EXCLUDE_FROM_ALL)
|
||||||
endif()
|
endif()
|
||||||
|
@ -112,83 +112,8 @@ ei_add_test(special_packetmath "-DEIGEN_FAST_MATH=1")
|
|||||||
if(EIGEN_TEST_CXX11)
|
if(EIGEN_TEST_CXX11)
|
||||||
if(EIGEN_TEST_SYCL)
|
if(EIGEN_TEST_SYCL)
|
||||||
set(EIGEN_SYCL ON)
|
set(EIGEN_SYCL ON)
|
||||||
# Forward CMake options as preprocessor definitions
|
include(SyclConfigureTesting)
|
||||||
if(EIGEN_SYCL_USE_DEFAULT_SELECTOR)
|
|
||||||
add_definitions(-DEIGEN_SYCL_USE_DEFAULT_SELECTOR=${EIGEN_SYCL_USE_DEFAULT_SELECTOR})
|
|
||||||
endif()
|
|
||||||
if(EIGEN_SYCL_NO_LOCAL_MEM)
|
|
||||||
add_definitions(-DEIGEN_SYCL_NO_LOCAL_MEM=${EIGEN_SYCL_NO_LOCAL_MEM})
|
|
||||||
endif()
|
|
||||||
if(EIGEN_SYCL_LOCAL_MEM)
|
|
||||||
add_definitions(-DEIGEN_SYCL_LOCAL_MEM=${EIGEN_SYCL_LOCAL_MEM})
|
|
||||||
endif()
|
|
||||||
if(EIGEN_SYCL_MAX_GLOBAL_RANGE)
|
|
||||||
add_definitions(-DEIGEN_SYCL_MAX_GLOBAL_RANGE=${EIGEN_SYCL_MAX_GLOBAL_RANGE})
|
|
||||||
endif()
|
|
||||||
if(EIGEN_SYCL_LOCAL_THREAD_DIM0)
|
|
||||||
add_definitions(-DEIGEN_SYCL_LOCAL_THREAD_DIM0=${EIGEN_SYCL_LOCAL_THREAD_DIM0})
|
|
||||||
endif()
|
|
||||||
if(EIGEN_SYCL_LOCAL_THREAD_DIM1)
|
|
||||||
add_definitions(-DEIGEN_SYCL_LOCAL_THREAD_DIM1=${EIGEN_SYCL_LOCAL_THREAD_DIM1})
|
|
||||||
endif()
|
|
||||||
if(EIGEN_SYCL_REG_M)
|
|
||||||
add_definitions(-DEIGEN_SYCL_REG_M=${EIGEN_SYCL_REG_M})
|
|
||||||
endif()
|
|
||||||
if(EIGEN_SYCL_REG_N)
|
|
||||||
add_definitions(-DEIGEN_SYCL_REG_N=${EIGEN_SYCL_REG_N})
|
|
||||||
endif()
|
|
||||||
if(EIGEN_SYCL_USE_PROGRAM_CLASS)
|
|
||||||
add_definitions(-DEIGEN_SYCL_USE_PROGRAM_CLASS=${EIGEN_SYCL_USE_PROGRAM_CLASS})
|
|
||||||
endif()
|
|
||||||
if(EIGEN_SYCL_ASYNC_EXECUTION)
|
|
||||||
add_definitions(-DEIGEN_SYCL_ASYNC_EXECUTION=${EIGEN_SYCL_ASYNC_EXECUTION})
|
|
||||||
endif()
|
|
||||||
if(EIGEN_SYCL_DISABLE_SKINNY)
|
|
||||||
add_definitions(-DEIGEN_SYCL_DISABLE_SKINNY=${EIGEN_SYCL_DISABLE_SKINNY})
|
|
||||||
endif()
|
|
||||||
if(EIGEN_SYCL_DISABLE_DOUBLE_BUFFER)
|
|
||||||
add_definitions(-DEIGEN_SYCL_DISABLE_DOUBLE_BUFFER=${EIGEN_SYCL_DISABLE_DOUBLE_BUFFER})
|
|
||||||
endif()
|
|
||||||
if(EIGEN_SYCL_DISABLE_RANK1)
|
|
||||||
add_definitions(-DEIGEN_SYCL_DISABLE_RANK1=${EIGEN_SYCL_DISABLE_RANK1})
|
|
||||||
endif()
|
|
||||||
if(EIGEN_SYCL_DISABLE_SCALAR)
|
|
||||||
add_definitions(-DEIGEN_SYCL_DISABLE_SCALAR=${EIGEN_SYCL_DISABLE_SCALAR})
|
|
||||||
endif()
|
|
||||||
if(EIGEN_SYCL_DISABLE_GEMV)
|
|
||||||
add_definitions(-DEIGEN_SYCL_DISABLE_GEMV=${EIGEN_SYCL_DISABLE_GEMV})
|
|
||||||
endif()
|
|
||||||
if(EIGEN_SYCL_DISABLE_ARM_GPU_CACHE_OPTIMISATION)
|
|
||||||
add_definitions(-DEIGEN_SYCL_DISABLE_ARM_GPU_CACHE_OPTIMISATION=${EIGEN_SYCL_DISABLE_ARM_GPU_CACHE_OPTIMISATION})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(EIGEN_SYCL_TRISYCL)
|
|
||||||
# triSYCL now requires c++17.
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
|
||||||
else()
|
|
||||||
if(MSVC)
|
|
||||||
# Set the host and device compilers C++ standard to C++14. On Windows setting this to C++11
|
|
||||||
# can cause issues with the ComputeCpp device compiler parsing Visual Studio Headers.
|
|
||||||
set(CMAKE_CXX_STANDARD 14)
|
|
||||||
list(APPEND COMPUTECPP_USER_FLAGS -DWIN32)
|
|
||||||
else()
|
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
|
||||||
list(APPEND COMPUTECPP_USER_FLAGS -Wall)
|
|
||||||
endif()
|
|
||||||
# The following flags are not supported by Clang and can cause warnings
|
|
||||||
# if used with -Werror so they are removed here.
|
|
||||||
if(COMPUTECPP_USE_COMPILER_DRIVER)
|
|
||||||
set(CMAKE_CXX_COMPILER ${ComputeCpp_DEVICE_COMPILER_EXECUTABLE})
|
|
||||||
string(REPLACE "-Wlogical-op" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
|
||||||
string(REPLACE "-Wno-psabi" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
|
||||||
string(REPLACE "-ansi" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
|
||||||
endif()
|
|
||||||
list(APPEND COMPUTECPP_USER_FLAGS
|
|
||||||
-DEIGEN_NO_ASSERTION_CHECKING=1
|
|
||||||
-no-serial-memop
|
|
||||||
-Xclang
|
|
||||||
-cl-mad-enable)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
ei_add_test(cxx11_tensor_sycl ${STD_CXX_FLAG})
|
ei_add_test(cxx11_tensor_sycl ${STD_CXX_FLAG})
|
||||||
ei_add_test(cxx11_tensor_image_op_sycl ${STD_CXX_FLAG})
|
ei_add_test(cxx11_tensor_image_op_sycl ${STD_CXX_FLAG})
|
||||||
@ -281,11 +206,11 @@ if(EIGEN_TEST_CXX11)
|
|||||||
ei_add_test(cxx11_tensor_thread_pool "-pthread" "${CMAKE_THREAD_LIBS_INIT}")
|
ei_add_test(cxx11_tensor_thread_pool "-pthread" "${CMAKE_THREAD_LIBS_INIT}")
|
||||||
ei_add_test(cxx11_tensor_trace)
|
ei_add_test(cxx11_tensor_trace)
|
||||||
ei_add_test(cxx11_tensor_volume_patch)
|
ei_add_test(cxx11_tensor_volume_patch)
|
||||||
# ei_add_test(cxx11_tensor_symmetry)
|
# ei_add_test(cxx11_tensor_symmetry)
|
||||||
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8" AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8" AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||||
# This test requires __uint128_t which is only available on 64bit systems
|
# This test requires __uint128_t which is only available on 64bit systems
|
||||||
ei_add_test(cxx11_tensor_uint128)
|
ei_add_test(cxx11_tensor_uint128)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -311,6 +236,16 @@ if(CUDA_FOUND AND EIGEN_TEST_CUDA)
|
|||||||
else()
|
else()
|
||||||
set(CUDA_PROPAGATE_HOST_FLAGS OFF)
|
set(CUDA_PROPAGATE_HOST_FLAGS OFF)
|
||||||
set(NVCC_ARCH_FLAGS)
|
set(NVCC_ARCH_FLAGS)
|
||||||
|
# Define an -arch=sm_<arch>, otherwise if GPU does not exactly match one of
|
||||||
|
# those in the arch list for -gencode, the kernels will fail to run with
|
||||||
|
# cudaErrorNoKernelImageForDevice
|
||||||
|
# This can happen with newer cards (e.g. sm_75) and compiling with older
|
||||||
|
# versions of nvcc (e.g. 9.2) that do not support their specific arch.
|
||||||
|
list(LENGTH EIGEN_CUDA_COMPUTE_ARCH EIGEN_CUDA_COMPUTE_ARCH_SIZE)
|
||||||
|
if(EIGEN_CUDA_COMPUTE_ARCH_SIZE)
|
||||||
|
list(GET EIGEN_CUDA_COMPUTE_ARCH 0 EIGEN_CUDA_COMPUTE_DEFAULT)
|
||||||
|
set(NVCC_ARCH_FLAGS " -arch=sm_${EIGEN_CUDA_COMPUTE_DEFAULT}")
|
||||||
|
endif()
|
||||||
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()
|
||||||
@ -347,63 +282,57 @@ if(CUDA_FOUND AND EIGEN_TEST_CUDA)
|
|||||||
ei_add_test(cxx11_tensor_random_gpu)
|
ei_add_test(cxx11_tensor_random_gpu)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
unset(EIGEN_ADD_TEST_FILENAME_EXTENSION)
|
unset(EIGEN_ADD_TEST_FILENAME_EXTENSION)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Add HIP specific tests
|
# Add HIP specific tests
|
||||||
if (EIGEN_TEST_HIP)
|
if (EIGEN_TEST_HIP)
|
||||||
|
|
||||||
set(HIP_PATH "/opt/rocm/hip" CACHE STRING "Path to the HIP installation.")
|
set(ROCM_PATH "/opt/rocm" CACHE STRING "Path to the ROCm installation.")
|
||||||
|
|
||||||
if (EXISTS ${HIP_PATH})
|
|
||||||
|
|
||||||
|
if (EXISTS ${ROCM_PATH}/hip)
|
||||||
|
set(HIP_PATH ${ROCM_PATH}/hip)
|
||||||
list(APPEND CMAKE_MODULE_PATH ${HIP_PATH}/cmake)
|
list(APPEND CMAKE_MODULE_PATH ${HIP_PATH}/cmake)
|
||||||
|
elseif (EXISTS ${ROCM_PATH}/lib/cmake/hip)
|
||||||
find_package(HIP REQUIRED)
|
set(HIP_PATH ${ROCM_PATH})
|
||||||
if (HIP_FOUND)
|
list(APPEND CMAKE_MODULE_PATH ${HIP_PATH}/lib/cmake/hip)
|
||||||
|
|
||||||
execute_process(COMMAND ${HIP_PATH}/bin/hipconfig --platform OUTPUT_VARIABLE HIP_PLATFORM)
|
|
||||||
|
|
||||||
if ((${HIP_PLATFORM} STREQUAL "hcc") OR (${HIP_PLATFORM} STREQUAL "amd"))
|
|
||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
include_directories(${HIP_PATH}/include)
|
|
||||||
|
|
||||||
set(EIGEN_ADD_TEST_FILENAME_EXTENSION "cu")
|
|
||||||
#
|
|
||||||
# complex datatype is not yet supported by HIP
|
|
||||||
# so leaving out those tests for now
|
|
||||||
#
|
|
||||||
# ei_add_test(cxx11_tensor_complex_gpu)
|
|
||||||
# ei_add_test(cxx11_tensor_complex_cwise_ops_gpu)
|
|
||||||
#
|
|
||||||
ei_add_test(cxx11_tensor_reduction_gpu)
|
|
||||||
ei_add_test(cxx11_tensor_argmax_gpu)
|
|
||||||
ei_add_test(cxx11_tensor_cast_float16_gpu)
|
|
||||||
ei_add_test(cxx11_tensor_scan_gpu)
|
|
||||||
ei_add_test(cxx11_tensor_device)
|
|
||||||
|
|
||||||
ei_add_test(cxx11_tensor_gpu)
|
|
||||||
ei_add_test(cxx11_tensor_contract_gpu)
|
|
||||||
ei_add_test(cxx11_tensor_of_float16_gpu)
|
|
||||||
ei_add_test(cxx11_tensor_random_gpu)
|
|
||||||
|
|
||||||
unset(EIGEN_ADD_TEST_FILENAME_EXTENSION)
|
|
||||||
|
|
||||||
elseif ((${HIP_PLATFORM} STREQUAL "nvcc") OR (${HIP_PLATFORM} STREQUAL "nvidia"))
|
|
||||||
message(FATAL_ERROR "HIP_PLATFORM = nvcc is not supported within Eigen")
|
|
||||||
else ()
|
|
||||||
message(FATAL_ERROR "Unknown HIP_PLATFORM = ${HIP_PLATFORM}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
endif()
|
|
||||||
|
|
||||||
else ()
|
else ()
|
||||||
|
message(FATAL_ERROR "EIGEN_TEST_HIP is ON, but could not find the ROCm installation under ${ROCM_PATH}")
|
||||||
message(FATAL_ERROR "EIGEN_TEST_HIP is ON, but the specified HIP_PATH (${HIP_PATH}) does not exist")
|
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endif()
|
find_package(HIP REQUIRED)
|
||||||
|
if (HIP_FOUND)
|
||||||
|
execute_process(COMMAND ${HIP_PATH}/bin/hipconfig --platform OUTPUT_VARIABLE HIP_PLATFORM)
|
||||||
|
|
||||||
|
if ((${HIP_PLATFORM} STREQUAL "hcc") OR (${HIP_PLATFORM} STREQUAL "amd"))
|
||||||
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
include_directories(${HIP_PATH}/include)
|
||||||
|
|
||||||
|
set(EIGEN_ADD_TEST_FILENAME_EXTENSION "cu")
|
||||||
|
#
|
||||||
|
# complex datatype is not yet supported by HIP
|
||||||
|
# so leaving out those tests for now
|
||||||
|
#
|
||||||
|
# ei_add_test(cxx11_tensor_complex_gpu)
|
||||||
|
# ei_add_test(cxx11_tensor_complex_cwise_ops_gpu)
|
||||||
|
#
|
||||||
|
ei_add_test(cxx11_tensor_reduction_gpu)
|
||||||
|
ei_add_test(cxx11_tensor_argmax_gpu)
|
||||||
|
ei_add_test(cxx11_tensor_cast_float16_gpu)
|
||||||
|
ei_add_test(cxx11_tensor_scan_gpu)
|
||||||
|
ei_add_test(cxx11_tensor_device)
|
||||||
|
|
||||||
|
ei_add_test(cxx11_tensor_gpu)
|
||||||
|
ei_add_test(cxx11_tensor_contract_gpu)
|
||||||
|
ei_add_test(cxx11_tensor_of_float16_gpu)
|
||||||
|
ei_add_test(cxx11_tensor_random_gpu)
|
||||||
|
|
||||||
|
unset(EIGEN_ADD_TEST_FILENAME_EXTENSION)
|
||||||
|
|
||||||
|
elseif ((${HIP_PLATFORM} STREQUAL "nvcc") OR (${HIP_PLATFORM} STREQUAL "nvidia"))
|
||||||
|
message(FATAL_ERROR "HIP_PLATFORM = nvcc is not supported within Eigen")
|
||||||
|
else ()
|
||||||
|
message(FATAL_ERROR "Unknown HIP_PLATFORM = ${HIP_PLATFORM}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user