Set THRUST_DEVICE_SYSTEM_HIP  on HCC/HIP-clang automatically
MODIFY
extra/CMakeLists.txt
extra/CMakeLists.txt
@@ -87,11 +87,6 @@ function(add_rocthrust_test TEST_NAME TEST_SOURCES)
--amdgpu-target=${amdgpu_target}
)
endforeach()
- # Set HIP as device system for Thrust
- target_compile_definitions(${TEST_TARGET}
- PRIVATE
- THRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_HIP
- )
add_test(${TEST_NAME} ${TEST_TARGET})
endfunction()

MODIFY
test/CMakeLists.txt
test/CMakeLists.txt
@@ -40,11 +40,6 @@ function(add_rocthrust_test TEST_NAME TEST_SOURCES)
--amdgpu-target=${amdgpu_target}
)
endforeach()
- # Set HIP as device system for Thrust
- target_compile_definitions(${TEST_TARGET}
- PRIVATE
- THRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_HIP
- )
set_target_properties(${TEST_TARGET}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/test/"

MODIFY
testing/CMakeLists.txt
testing/CMakeLists.txt
@@ -41,11 +41,6 @@ function(add_thrust_test TEST_TARGET)
--amdgpu-target=${amdgpu_target}
)
endforeach()
- # Set HIP as device system for Thrust
- target_compile_definitions(${TEST_TARGET}
- PRIVATE
- THRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_HIP
- )
set_target_properties(${TEST_TARGET}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/testing/"

MODIFY
thrust/detail/config/device_system.h
thrust/detail/config/device_system.h
#define THRUST_DEVICE_SYSTEM_HIP 5
#ifndef THRUST_DEVICE_SYSTEM
+#if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_HCC
+#define THRUST_DEVICE_SYSTEM THRUST_DEVICE_SYSTEM_HIP
+#else
#define THRUST_DEVICE_SYSTEM THRUST_DEVICE_SYSTEM_CUDA
-// #define THRUST_DEVICE_SYSTEM THRUST_DEVICE_SYSTEM_HIP
+#endif
#endif // THRUST_DEVICE_SYSTEM
// XXX make the use of THRUST_DEVICE_BACKEND an error in Thrust 1.7
#endif
#define __THRUST_DEVICE_SYSTEM_ROOT thrust/system/__THRUST_DEVICE_SYSTEM_NAMESPACE
-

Set THRUST_DEVICE_SYSTEM_HIP  on HCC/HIP-clang automatically