mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Merge topic 'fix-vtkm-devices-namespaces'
d5ce96789 CMAKE: fix vtkm devices namespaces Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Sujin Philip <sujin.philip@kitware.com> Merge-request: !2953
This commit is contained in:
commit
3a620941dd
@ -186,7 +186,7 @@ function(setup_cuda_flags)
|
||||
endfunction()
|
||||
|
||||
#common warnings for all platforms when building cuda
|
||||
if ((TARGET vtkm_cuda) OR (TARGET vtkm::kokkos_cuda))
|
||||
if ((TARGET vtkm_cuda) OR (TARGET vtkm_kokkos_cuda))
|
||||
setup_cuda_flags()
|
||||
endif()
|
||||
|
||||
|
@ -41,7 +41,7 @@ function(vtkm_extract_real_library library real_library)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
if(VTKm_ENABLE_TBB AND NOT TARGET vtkm_tbb)
|
||||
if(VTKm_ENABLE_TBB AND NOT (TARGET vtkm_tbb OR TARGET vtkm::tbb))
|
||||
# Skip find_package(TBB) if we already have it
|
||||
if (NOT TARGET TBB::tbb)
|
||||
find_package(TBB REQUIRED)
|
||||
@ -54,7 +54,7 @@ if(VTKm_ENABLE_TBB AND NOT TARGET vtkm_tbb)
|
||||
install(TARGETS vtkm_tbb EXPORT ${VTKm_EXPORT_NAME})
|
||||
endif()
|
||||
|
||||
if(VTKm_ENABLE_OPENMP AND NOT TARGET vtkm_openmp)
|
||||
if(VTKm_ENABLE_OPENMP AND NOT (TARGET vtkm_openmp OR TARGET vtkm::openmp))
|
||||
find_package(OpenMP 4.0 REQUIRED COMPONENTS CXX QUIET)
|
||||
|
||||
add_library(vtkm_openmp INTERFACE)
|
||||
@ -85,7 +85,7 @@ if(VTKm_ENABLE_CUDA)
|
||||
message(FATAL_ERROR "VTK-m CUDA support requires version 9.2+")
|
||||
endif()
|
||||
|
||||
if(NOT TARGET vtkm_cuda)
|
||||
if(NOT (TARGET vtkm_cuda OR TARGET vtkm::cuda))
|
||||
add_library(vtkm_cuda INTERFACE)
|
||||
set_target_properties(vtkm_cuda PROPERTIES EXPORT_NAME cuda)
|
||||
|
||||
@ -313,13 +313,13 @@ function(kokkos_fix_compile_options)
|
||||
endforeach()
|
||||
endwhile()
|
||||
|
||||
set_property(TARGET vtkm::kokkos PROPERTY INTERFACE_LINK_OPTIONS "$<DEVICE_LINK:${cuda_arch}>")
|
||||
set_property(TARGET vtkm_kokkos PROPERTY INTERFACE_LINK_OPTIONS "$<DEVICE_LINK:${cuda_arch}>")
|
||||
if (OPENMP IN_LIST Kokkos_DEVICES)
|
||||
set_property(TARGET vtkm::kokkos PROPERTY INTERFACE_LINK_OPTIONS "$<HOST_LINK:-fopenmp>")
|
||||
set_property(TARGET vtkm_kokkos PROPERTY INTERFACE_LINK_OPTIONS "$<HOST_LINK:-fopenmp>")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
if(VTKm_ENABLE_KOKKOS AND NOT TARGET vtkm::kokkos)
|
||||
if(VTKm_ENABLE_KOKKOS AND NOT TARGET vtkm_kokkos)
|
||||
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
|
||||
|
||||
find_package(Kokkos REQUIRED)
|
||||
@ -344,19 +344,25 @@ if(VTKm_ENABLE_KOKKOS AND NOT TARGET vtkm::kokkos)
|
||||
set(CMAKE_CUDA_ARCHITECTURES ${cuda_arch})
|
||||
message(STATUS "Detected Cuda arch from Kokkos: ${cuda_arch}")
|
||||
|
||||
add_library(vtkm::kokkos_cuda INTERFACE IMPORTED GLOBAL)
|
||||
add_library(vtkm_kokkos_cuda INTERFACE)
|
||||
set_property(TARGET vtkm_kokkos_cuda PROPERTY EXPORT_NAME kokkos_cuda)
|
||||
install(TARGETS vtkm_kokkos_cuda EXPORT ${VTKm_EXPORT_NAME})
|
||||
elseif(HIP IN_LIST Kokkos_DEVICES)
|
||||
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
|
||||
enable_language(HIP)
|
||||
add_library(vtkm::kokkos_hip INTERFACE IMPORTED GLOBAL)
|
||||
set_property(TARGET Kokkos::kokkoscore PROPERTY INTERFACE_COMPILE_OPTIONS "")
|
||||
set_property(TARGET Kokkos::kokkoscore PROPERTY INTERFACE_LINK_OPTIONS "")
|
||||
set_target_properties(Kokkos::kokkoscore PROPERTIES
|
||||
INTERFACE_COMPILE_OPTIONS ""
|
||||
INTERFACE_LINK_OPTIONS ""
|
||||
)
|
||||
add_library(vtkm_kokkos_hip INTERFACE)
|
||||
set_property(TARGET vtkm_kokkos_hip PROPERTY EXPORT_NAME kokkos_hip)
|
||||
install(TARGETS vtkm_kokkos_hip EXPORT ${VTKm_EXPORT_NAME})
|
||||
endif()
|
||||
|
||||
add_library(vtkm::kokkos INTERFACE IMPORTED GLOBAL)
|
||||
set_target_properties(vtkm::kokkos PROPERTIES INTERFACE_LINK_LIBRARIES "Kokkos::kokkos")
|
||||
add_library(vtkm_kokkos INTERFACE IMPORTED GLOBAL)
|
||||
set_target_properties(vtkm_kokkos PROPERTIES INTERFACE_LINK_LIBRARIES "Kokkos::kokkos")
|
||||
|
||||
if (TARGET vtkm::kokkos_cuda)
|
||||
if (TARGET vtkm_kokkos_cuda)
|
||||
kokkos_fix_compile_options()
|
||||
endif()
|
||||
endif()
|
||||
|
@ -434,9 +434,9 @@ function(vtkm_add_target_information uses_vtkm_target)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if((TARGET vtkm_cuda) OR (TARGET vtkm::kokkos_cuda))
|
||||
if(TARGET vtkm_cuda OR TARGET vtkm::cuda OR TARGET vtkm_kokkos_cuda OR TARGET vtkm::kokkos_cuda)
|
||||
set_source_files_properties(${VTKm_TI_DEVICE_SOURCES} PROPERTIES LANGUAGE "CUDA")
|
||||
elseif(TARGET vtkm::kokkos_hip)
|
||||
elseif(TARGET vtkm_kokkos_hip OR TARGET vtkm::kokkos_hip)
|
||||
set_source_files_properties(${VTKm_TI_DEVICE_SOURCES} PROPERTIES LANGUAGE "HIP")
|
||||
kokkos_compilation(SOURCE ${VTKm_TI_DEVICE_SOURCES})
|
||||
endif()
|
||||
|
@ -116,7 +116,7 @@ function(vtkm_test_against_install dir)
|
||||
set(args -C ${build_config})
|
||||
endif()
|
||||
|
||||
if(WIN32 AND TARGET vtkm::tbb)
|
||||
if(WIN32 AND TARGET vtkm_tbb)
|
||||
#on windows we need to specify these as FindTBB won't
|
||||
#find the installed version just with the prefix path
|
||||
list(APPEND args
|
||||
@ -126,7 +126,7 @@ function(vtkm_test_against_install dir)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(TARGET vtkm::kokkos)
|
||||
if(TARGET vtkm_kokkos)
|
||||
list(APPEND args "-DKokkos_DIR=${Kokkos_DIR}")
|
||||
endif()
|
||||
|
||||
|
@ -280,8 +280,8 @@ endif()
|
||||
if(TARGET vtkm_openmp)
|
||||
list(APPEND backends vtkm_openmp)
|
||||
endif()
|
||||
if(TARGET vtkm::kokkos)
|
||||
list(APPEND backends vtkm::kokkos)
|
||||
if(TARGET vtkm_kokkos)
|
||||
list(APPEND backends vtkm_kokkos)
|
||||
endif()
|
||||
|
||||
target_link_libraries(vtkm_cont PUBLIC vtkm_compiler_flags ${backends})
|
||||
|
@ -20,7 +20,7 @@ set(headers
|
||||
|
||||
vtkm_declare_headers(${headers})
|
||||
|
||||
if (TARGET vtkm::kokkos)
|
||||
if (TARGET vtkm_kokkos)
|
||||
set(sources
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/DeviceAdapterAlgorithmKokkos.cxx
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/DeviceAdapterMemoryManagerKokkos.cxx
|
||||
@ -29,9 +29,9 @@ if (TARGET vtkm::kokkos)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/KokkosTypes.cxx)
|
||||
target_sources(vtkm_cont PRIVATE ${sources})
|
||||
|
||||
if (TARGET vtkm::kokkos_cuda)
|
||||
if (TARGET vtkm_kokkos_cuda)
|
||||
set_source_files_properties(${sources} TARGET_DIRECTORY vtkm_cont PROPERTIES LANGUAGE CUDA)
|
||||
elseif(TARGET vtkm::kokkos_hip)
|
||||
elseif(TARGET vtkm_kokkos_hip)
|
||||
set_source_files_properties(${sources} TARGET_DIRECTORY vtkm_cont PROPERTIES LANGUAGE HIP)
|
||||
kokkos_compilation(SOURCE ${sources})
|
||||
endif()
|
||||
|
@ -15,9 +15,9 @@ set(unit_tests
|
||||
|
||||
vtkm_unit_tests(SOURCES ${unit_tests} LABEL "KOKKOS" LIBRARIES vtkm_worklet BACKEND kokkos)
|
||||
|
||||
if (TARGET vtkm::kokkos_cuda)
|
||||
if (TARGET vtkm_kokkos_cuda)
|
||||
set_source_files_properties(${unit_tests} PROPERTIES LANGUAGE CUDA)
|
||||
elseif(TARGET vtkm::kokkos_hip)
|
||||
elseif(TARGET vtkm_kokkos_hip)
|
||||
set_source_files_properties(${unit_tests} PROPERTIES LANGUAGE HIP)
|
||||
kokkos_compilation(SOURCE ${unit_tests})
|
||||
endif()
|
||||
|
@ -6,4 +6,4 @@ DEPENDS
|
||||
vtkm_cont
|
||||
TEST_DEPENDS
|
||||
vtkm_worklet
|
||||
vtkm::kokkos
|
||||
vtkm_kokkos
|
||||
|
@ -31,9 +31,9 @@ if(VTKM_ENABLE_CUDA)
|
||||
string(REGEX REPLACE "([0-9]+)\\.([0-9]+).*" "\\2" VTKM_CUDA_VERSION_MINOR ${CMAKE_CUDA_COMPILER_VERSION})
|
||||
endif()
|
||||
|
||||
if (TARGET vtkm::kokkos_cuda)
|
||||
if (TARGET vtkm_kokkos_cuda)
|
||||
set(VTKM_KOKKOS_CUDA ON)
|
||||
elseif(TARGET vtkm::kokkos_hip)
|
||||
elseif(TARGET vtkm_kokkos_hip)
|
||||
set(VTKM_KOKKOS_HIP ON)
|
||||
endif()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user