mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 21:33:55 +00:00
Merge topic 'expand_kokkos_device_to_support_hip'
7475c318b VTK-m now uses CMake's future HIP lang for Kokkos+HIP Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Sujin Philip <sujin.philip@kitware.com> Merge-request: !2351
This commit is contained in:
commit
004f320e20
@ -344,6 +344,12 @@ if(VTKm_ENABLE_KOKKOS AND NOT TARGET vtkm::kokkos)
|
||||
message(STATUS "Detected Cuda arch from Kokkos: ${cuda_arch}")
|
||||
|
||||
add_library(vtkm::kokkos_cuda INTERFACE IMPORTED GLOBAL)
|
||||
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 "")
|
||||
endif()
|
||||
|
||||
add_library(vtkm::kokkos INTERFACE IMPORTED GLOBAL)
|
||||
|
@ -327,6 +327,12 @@ function(vtkm_add_target_information uses_vtkm_target)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if((TARGET vtkm::cuda) OR (TARGET vtkm::kokkos_cuda))
|
||||
set_source_files_properties(${VTKm_TI_DEVICE_SOURCES} PROPERTIES LANGUAGE "CUDA")
|
||||
elseif(TARGET vtkm::kokkos_hip)
|
||||
set_source_files_properties(${VTKm_TI_DEVICE_SOURCES} PROPERTIES LANGUAGE "HIP")
|
||||
endif()
|
||||
|
||||
# Validate that following:
|
||||
# - We are building with CUDA enabled.
|
||||
# - We are building a VTK-m library or a library that wants cross library
|
||||
@ -335,7 +341,6 @@ function(vtkm_add_target_information uses_vtkm_target)
|
||||
# This is required as CUDA currently doesn't support device side calls across
|
||||
# dynamic library boundaries.
|
||||
if((TARGET vtkm::cuda) OR (TARGET vtkm::kokkos_cuda))
|
||||
set_source_files_properties(${VTKm_TI_DEVICE_SOURCES} PROPERTIES LANGUAGE "CUDA")
|
||||
foreach(target IN LISTS targets)
|
||||
get_target_property(lib_type ${target} TYPE)
|
||||
if (TARGET vtkm::cuda)
|
||||
|
@ -47,9 +47,15 @@ function(vtkm_create_test_executable
|
||||
vtkm_add_drop_unused_function_flags(${prog})
|
||||
target_compile_definitions(${prog} PRIVATE ${defines})
|
||||
|
||||
#if all backends are enabled, we can use cuda compiler to handle all possible backends.
|
||||
#determine if we have a device that requires a separate compiler enabled
|
||||
set(device_lang_enabled FALSE)
|
||||
if( (TARGET vtkm::cuda) OR (TARGET vtkm::kokkos_cuda) OR (TARGET vtkm::kokkos_hip))
|
||||
set(device_lang_enabled TRUE)
|
||||
endif()
|
||||
|
||||
#if all backends are enabled, we can use the device compiler to handle all possible backends.
|
||||
set(device_sources)
|
||||
if(((TARGET vtkm::cuda) OR (TARGET vtkm::kokkos_cuda)) AND enable_all_backends)
|
||||
if(device_lang_enabled AND enable_all_backends)
|
||||
set(device_sources ${sources})
|
||||
endif()
|
||||
vtkm_add_target_information(${prog} DEVICE_SOURCES ${device_sources})
|
||||
|
@ -32,7 +32,10 @@ if (TARGET vtkm::kokkos)
|
||||
|
||||
if (TARGET vtkm::kokkos_cuda)
|
||||
set_source_files_properties(${sources} TARGET_DIRECTORY vtkm_cont PROPERTIES LANGUAGE CUDA)
|
||||
elseif(TARGET vtkm::kokkos_hip)
|
||||
set_source_files_properties(${sources} TARGET_DIRECTORY vtkm_cont PROPERTIES LANGUAGE HIP)
|
||||
endif()
|
||||
|
||||
else()
|
||||
target_sources(vtkm_cont PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/DeviceAdapterRuntimeDetectorKokkos.cxx)
|
||||
|
@ -29,4 +29,6 @@ vtkm_unit_tests(SOURCES ${unit_tests} LABEL "KOKKOS" LIBRARIES vtkm_worklet)
|
||||
|
||||
if (TARGET vtkm::kokkos_cuda)
|
||||
set_source_files_properties(${unit_tests} PROPERTIES LANGUAGE CUDA)
|
||||
elseif(TARGET vtkm::kokkos_hip)
|
||||
set_source_files_properties(${unit_tests} PROPERTIES LANGUAGE HIP)
|
||||
endif()
|
||||
|
@ -33,6 +33,8 @@ endif()
|
||||
|
||||
if (TARGET vtkm::kokkos_cuda)
|
||||
set(VTKM_KOKKOS_CUDA ON)
|
||||
elseif(TARGET vtkm::kokkos_hip)
|
||||
set(VTKM_KOKKOS_HIP ON)
|
||||
endif()
|
||||
|
||||
set(VTKM_ENABLE_LOGGING ${VTKm_ENABLE_LOGGING})
|
||||
|
@ -287,6 +287,10 @@
|
||||
#ifndef VTKM_KOKKOS_CUDA
|
||||
#cmakedefine VTKM_KOKKOS_CUDA
|
||||
#endif
|
||||
//Mark if Kokkos has HIP backend enabled
|
||||
#ifndef VTKM_KOKKOS_HIP
|
||||
#cmakedefine VTKM_KOKKOS_HIP
|
||||
#endif
|
||||
|
||||
//Mark if we are building with MPI enabled.
|
||||
#cmakedefine VTKM_ENABLE_MPI
|
||||
|
Loading…
Reference in New Issue
Block a user