Skip to content

Commit

Permalink
Mergeback 6.4 Fixes (#523)
Browse files Browse the repository at this point in the history
* Enable HIP language (#493)

If the HIP language can be used, the HIP_USECXX variable sets rocThrust to use the CMake HIP language rather than CXX.

Co-authored-by: Lauren Wrubleski <[email protected]>

* Made TBB optional for hipstdpar tests (#507)

* added TBB in dependencies cmake

* updated changelog

* removed duplicate dependencies declaration in test cmake

* Create optional flag to run tests hipstdpar with TBB

* Add TBB optional flag to CHANGELOG

* Add rocprim location to hipstdpar

* Add default and test for DONWLOAD_ROCRAND

* Build with TBB when available or when FLAG is set

---------

Co-authored-by: NguyenNhuDi <[email protected]>

* Separate CMake BUILD_TEST and BUILD_HIPSTDPAR_TEST options (#508)

* Separate CMake BUILD_TEST and BUILD_HIPSTDPAR_TEST options

Previously, enabling BUILD_TEST would also enable hipstdpar tests
if we detected that a c++17-capable compiler was present. However,
this caused build issues on systems with a c++17 compiler but an
outdated version of libstdc++ that didn't support c++17 (RHEL 8.x).

Currently, we require a minimum cmake version of 3.10.2. There's
no real robust way of detecting the libstdc++ version that will work
that far back.

To workaround this problem for now, this change splits the BUILD_TEST
and BUILD_HIPSTDPAR_TEST cmake options so that they are independent.
This means that in order to enable hipstdpar tests, the user must
explicitly enable the BUILD_HIPSTDPAR_TEST option.

Update the readme to reflect this.

* Update README.md

Co-authored-by: Leo Paoletti <[email protected]>

---------

Co-authored-by: Di Nguyen <[email protected]>
Co-authored-by: Leo Paoletti <[email protected]>

* Updated known issue for inclusive_scan_by_key compiler bug (#513)

* updated the known issue

* Update CHANGELOG.md

Co-authored-by: spolifroni-amd <[email protected]>

* moved known issue to 6.4 section

* updated to include that the issue has been fixed

---------

Co-authored-by: spolifroni-amd <[email protected]>

* Extend fallback coverage for copy_if (#512)

We recently added a "fallback" implementation for thrust::copy_if that
is invoked when copying a custom type that's too large to fit in
shared memory.

This change extends the fallback slightly so that it can be used with
an overload of copy_if that accepts a stencil buffer (to copy by
key). It also adds a unit test to cover this case.

It also fixes a small bug in the fallback implementation that could
cause the scan accumulator type to overflow when the results are
compacted.

---------

Co-authored-by: Lauren Wrubleski <[email protected]>
Co-authored-by: Nick Breed <[email protected]>
Co-authored-by: NguyenNhuDi <[email protected]>
Co-authored-by: Di Nguyen <[email protected]>
Co-authored-by: Leo Paoletti <[email protected]>
Co-authored-by: spolifroni-amd <[email protected]>
  • Loading branch information
7 people authored Feb 26, 2025
1 parent f5bb0ad commit 0006584
Show file tree
Hide file tree
Showing 17 changed files with 338 additions and 113 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Documentation for rocThrust available at

### Added

* Added a section to install Thread Building Block (TBB) inside `cmake/Dependencies.cmake` if TBB is not already available.
* Made Thread Building Block (TBB) an optional dependency with the new `BUILD_HIPSTDPAR_TEST_WITH_TBB` flag, default is `OFF`. When the flag is `OFF` and TBB is not already on the machine it will compile without TBB. Otherwise is will compile it with TBB.
* Added extended tests to `rtest.py`. These tests are extra tests that did not fit the criteria of smoke and regression tests. These tests will take much longer to run relative to smoke and regression tests. Use `python rtest.py [--emulation|-e|--test|-t]=extended` to run these tests.
* Added regression tests to `rtest.py`. These tests recreate scenarios that have caused hardware problems in past emulation environments. Use `python rtest.py [--emulation|-e|--test|-t]=regression` to run these tests.
* Added smoke test options, which runs a subset of the unit tests and ensures that less than 2gb of VRAM will be used. Use `python rtest.py [--emulation|-e|--test|-t]=smoke` to run these tests.
Expand All @@ -31,6 +33,10 @@ Documentation for rocThrust available at
* Split the contents of HIPSTDPAR's forwarding header into several implementation headers.
* Fixed `copy_if` to work with large data types (512 bytes)

### Known Issues
* `thrust::inclusive_scan_by_key` might produce incorrect results when it's used with -O2 or -O3 optimization.
- The error is caused by a recent compiler change. There is a fix available that will be released at a later date.

## rocThrust 3.2.0 for ROCm 6.3

### Added
Expand Down
99 changes: 58 additions & 41 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,39 @@ endif()
# Note: C is required here for dependencies
project(rocthrust LANGUAGES CXX C)

# Set CXX flags
if (NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# Set HIP flags
set(CMAKE_HIP_STANDARD 17)
set(CMAKE_HIP_STANDARD_REQUIRED ON)
set(CMAKE_HIP_EXTENSIONS OFF)

include(CheckLanguage)
include(CMakeDependentOption)

# Build options
# Disable -Werror
option(DISABLE_WERROR "Disable building with Werror" ON)
option(BUILD_TEST "Build tests" OFF)
option(BUILD_HIPSTDPAR_TEST "Build hipstdpar tests" OFF)
option(BUILD_HIPSTDPAR_TEST_WITH_TBB "Build hipstdpar tests with TBB" OFF)
option(BUILD_EXAMPLES "Build examples" OFF)
option(BUILD_BENCHMARKS "Build benchmarks" OFF)
option(DOWNLOAD_ROCPRIM "Download rocPRIM and do not search for rocPRIM package" OFF)
option(DOWNLOAD_ROCRAND "Download rocRAND and do not search for rocRAND package" OFF)
option(BUILD_ADDRESS_SANITIZER "Build with address sanitizer enabled" OFF)
cmake_dependent_option(ENABLE_UPSTREAM_TESTS "Enable upstream (thrust) tests" ON BUILD_TEST OFF)
#Set the header wrapper OFF by default.
option(BUILD_FILE_REORG_BACKWARD_COMPATIBILITY "Build with file/folder reorg with backward compatibility enabled" OFF)

check_language(HIP)
cmake_dependent_option(USE_HIPCXX "Use CMake HIP language support" OFF CMAKE_HIP_COMPILER OFF)

#Adding CMAKE_PREFIX_PATH
list( APPEND CMAKE_PREFIX_PATH /opt/rocm/llvm /opt/rocm ${ROCM_PATH} )

Expand All @@ -34,7 +67,6 @@ endif()

set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE BOOL "Add paths to linker search and installed rpath")

include(CMakeDependentOption)
# rocm-cmake contains common cmake code for rocm projects to help
# setup and install
include( cmake/FindROCMCmake.cmake )
Expand All @@ -47,26 +79,30 @@ include( ROCMHeaderWrapper )
include( ROCMCheckTargetIds )
include( ROCMClients )

# Use target ID syntax if supported for GPU_TARGETS
if (NOT DEFINED AMDGPU_TARGETS)
set(GPU_TARGETS "all" CACHE STRING "GPU architectures to compile for")
if(USE_HIPCXX)
enable_language(HIP)
else()
set(GPU_TARGETS "${AMDGPU_TARGETS}" CACHE STRING "GPU architectures to compile for")
endif()
set_property(CACHE GPU_TARGETS PROPERTY STRINGS "all")

if(GPU_TARGETS STREQUAL "all")
if(BUILD_ADDRESS_SANITIZER)
# ASAN builds require xnack
rocm_check_target_ids(DEFAULT_AMDGPU_TARGETS
TARGETS "gfx908:xnack+;gfx90a:xnack+;gfx942:xnack+;gfx950:xnack+"
)
# Use target ID syntax if supported for GPU_TARGETS
if (NOT DEFINED AMDGPU_TARGETS)
set(GPU_TARGETS "all" CACHE STRING "GPU architectures to compile for")
else()
rocm_check_target_ids(DEFAULT_AMDGPU_TARGETS
TARGETS "gfx803;gfx900:xnack-;gfx906:xnack-;gfx908:xnack-;gfx90a:xnack-;gfx90a:xnack+;gfx942;gfx950;gfx1030;gfx1100;gfx1101;gfx1102;gfx1151;gfx1200;gfx1201"
)
endif()
set(GPU_TARGETS "${DEFAULT_AMDGPU_TARGETS}" CACHE STRING "GPU architectures to compile for" FORCE)
set(GPU_TARGETS "${AMDGPU_TARGETS}" CACHE STRING "GPU architectures to compile for")
endif()
set_property(CACHE GPU_TARGETS PROPERTY STRINGS "all")

if(GPU_TARGETS STREQUAL "all")
if(BUILD_ADDRESS_SANITIZER)
# ASAN builds require xnack
rocm_check_target_ids(DEFAULT_AMDGPU_TARGETS
TARGETS "gfx908:xnack+;gfx90a:xnack+;gfx942:xnack+;gfx950:xnack+"
)
else()
rocm_check_target_ids(DEFAULT_AMDGPU_TARGETS
TARGETS "gfx803;gfx900:xnack-;gfx906:xnack-;gfx908:xnack-;gfx90a:xnack-;gfx90a:xnack+;gfx942;gfx950;gfx1030;gfx1100;gfx1101;gfx1102;gfx1151;gfx1200;gfx1201"
)
endif()
set(GPU_TARGETS "${DEFAULT_AMDGPU_TARGETS}" CACHE STRING "GPU architectures to compile for" FORCE)
endif()
endif()

# Get dependencies
Expand All @@ -76,18 +112,6 @@ include(cmake/Dependencies.cmake)
if (NOT WIN32)
include(cmake/VerifyCompiler.cmake)
endif()
# Build options
# Disable -Werror
option(DISABLE_WERROR "Disable building with Werror" ON)
option(BUILD_TEST "Build tests" OFF)
option(BUILD_HIPSTDPAR_TEST "Build hipstdpar tests" OFF)
option(BUILD_EXAMPLES "Build examples" OFF)
option(BUILD_BENCHMARKS "Build benchmarks" OFF)
option(DOWNLOAD_ROCPRIM "Download rocPRIM and do not search for rocPRIM package" OFF)
option(BUILD_ADDRESS_SANITIZER "Build with address sanitizer enabled" OFF)
cmake_dependent_option(ENABLE_UPSTREAM_TESTS "Enable upstream (thrust) tests" ON BUILD_TEST OFF)
#Set the header wrapper OFF by default.
option(BUILD_FILE_REORG_BACKWARD_COMPATIBILITY "Build with file/folder reorg with backward compatibility enabled" OFF)

set(RNG_SEED_COUNT 0 CACHE STRING "Number of true random sequences to test each input size for")
set(PRNG_SEEDS 1 CACHE STRING "Seeds of pseudo random sequences to test each input size for")
Expand All @@ -106,17 +130,10 @@ if (NOT THRUST_HOST_SYSTEM IN_LIST THRUST_HOST_SYSTEM_OPTIONS)
)
endif ()

# Set CXX flags
if (NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

if(DISABLE_WERROR)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra ")
add_compile_options(-Wall -Wextra)
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror")
add_compile_options(-Wall -Wextra -Werror)
endif()

if (CMAKE_CXX_STANDARD EQUAL 14)
Expand Down Expand Up @@ -147,7 +164,7 @@ print_configuration_summary()
# Thrust (with HIP backend)
add_subdirectory(thrust)

if(BUILD_TEST OR BUILD_BENCHMARKS)
if(BUILD_TEST OR BUILD_BENCHMARKS OR BUILD_HIPSTDPAR_TEST)
rocm_package_setup_component(clients)
endif()

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,7 @@ When compiling with the proper flags (see [LLVM (AMD's fork) docs](https://githu
HIPSTDPAR is currently packaged along rocThrust. The `hipstdpar` package is set up as a virtual package provided by `rocthrust`, so the latter needs to be installed entirely for getting HIPSTDPAR's headers. Conversely, installing the `rocthrust` package will also include HIPSTDPAR's headers in the system.

### Tests

rocThrust also includes some tests for checking the correct building of HIPSTDPAR implementations. These are located under the [tests/hipstdpar](/test/hipstdpar/) folder. When configuring the project with the `BUILD_TEST` option on, these tests will also be enabled. Additionally, one can configure **only** HIPSTDPAR's tests by disabling `BUILD_TEST` and enabling `BUILD_HIPSTDPAR_TEST`. In general, the following steps can be followed for building and running the tests:
rocThrust also includes tests to check the correct building of HIPSTDPAR implementations. They are located in the [tests/hipstdpar](/test/hipstdpar/) folder. When configuring the project with the `BUILD_TEST` option, these tests will not be enabled by default. To enable them, set `BUILD_HIPSTDPAR_TEST=ON`. Additionally, you can configure only HIPSTDPAR's tests by disabling `BUILD_TEST` and enabling `BUILD_HIPSTDPAR_TEST`. In general, the following steps can be followed for building and running the tests:

```sh
git clone https://github.com/ROCm/rocThrust
Expand All @@ -292,7 +291,8 @@ git clone https://github.com/ROCm/rocThrust
cd rocThrust; mkdir build; cd build

# Configure rocThrust.
[CXX=hipcc] cmake ../. -D BUILD_TEST=ON # Configure rocThrust's and HIPSTDPAR's tests.
[CXX=hipcc] cmake ../. -D BUILD_TEST=ON # Configure rocThrust's tests.
[CXX=hipcc] cmake ../. -D BUILD_TEST=ON -D BUILD_HIPSTDPAR_TEST=ON # Configure both rocThrust's tests and HIPSTDPAR's tests.
[CXX=hipcc] cmake ../. -D BUILD_TEST=OFF -D BUILD_HIPSTDPAR_TEST=ON # Only configure HIPSTDPAR's tests.

# Build
Expand Down
15 changes: 11 additions & 4 deletions cmake/Benchmarks.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,17 @@ endfunction()
# Registers a .cu as C++ rocThrust benchmark
function(add_thrust_benchmark BENCHMARK_NAME BENCHMARK_SOURCE NOT_INTERNAL)
set(BENCHMARK_TARGET "benchmark_thrust_${BENCHMARK_NAME}")
set_source_files_properties(${BENCHMARK_SOURCE}
PROPERTIES
LANGUAGE CXX
)
if(USE_HIPCXX)
set_source_files_properties(${BENCHMARK_SOURCE}
PROPERTIES
LANGUAGE HIP
)
else()
set_source_files_properties(${BENCHMARK_SOURCE}
PROPERTIES
LANGUAGE CXX
)
endif()
add_executable(${BENCHMARK_TARGET} ${BENCHMARK_SOURCE})

target_link_libraries(${BENCHMARK_TARGET}
Expand Down
24 changes: 23 additions & 1 deletion cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ if(NOT rocprim_FOUND)
endif()

# Test dependencies
if(BUILD_TEST)
if(BUILD_TEST OR BUILD_HIPSTDPAR_TEST)
if(NOT DEPENDENCIES_FORCE_DOWNLOAD)
# Google Test (https://github.com/google/googletest)
find_package(GTest QUIET)
find_package(TBB QUIET)
else()
message(STATUS "Force installing GTest.")
endif()
Expand All @@ -63,6 +64,27 @@ if(BUILD_TEST)
find_package(GTest REQUIRED CONFIG PATHS ${GTEST_ROOT})
endif()

if (NOT TARGET TBB::tbb AND NOT TARGET tbb AND BUILD_HIPSTDPAR_TEST_WITH_TBB)
message(STATUS "TBB not found or force download TBB on. Downloading and building TBB.")
set(TBB_ROOT ${CMAKE_CURRENT_BINARY_DIR}/deps/tbb CACHE PATH "" FORCE)

download_project(
PROJ TBB
GIT_REPOSITORY https://github.com/oneapi-src/oneTBB.git
GIT_TAG 1c4c93fc5398c4a1acb3492c02db4699f3048dea # v2021.13.0
INSTALL_DIR ${TBB_ROOT}
CMAKE_ARGS -DCMAKE_CXX_COMPILER=g++ -DTBB_TEST=OFF -DTBB_BUILD=ON -DTBB_INSTALL=ON -DTBBMALLOC_PROXY_BUILD=OFF -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
LOG_DOWNLOAD TRUE
LOG_CONFIGURE TRUE
LOG_BUILD TRUE
LOG_INSTALL TRUE
BUILD_PROJECT TRUE
UPDATE_DISCONNECTED TRUE
)
find_package(TBB REQUIRED CONFIG PATHS ${TBB_ROOT})

endif()

# SQlite (for run-to-run bitwise-reproducibility tests)
# Note: SQLite 3.36.0 enabled the backup API by default, which we need
# for cache serialization. We also want to use a static SQLite,
Expand Down
2 changes: 0 additions & 2 deletions cmake/DownloadProject.CMakeLists.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@ if(${DL_ARGS_BUILD_PROJECT})
ExternalProject_Add(${DL_ARGS_PROJ}-download
${DL_ARGS_UNPARSED_ARGUMENTS}
SOURCE_DIR "${DL_ARGS_SOURCE_DIR}"
BUILD_IN_SOURCE TRUE
TEST_COMMAND ""
)
else()
ExternalProject_Add(${DL_ARGS_PROJ}-download
${DL_ARGS_UNPARSED_ARGUMENTS}
SOURCE_DIR "${DL_ARGS_SOURCE_DIR}"
BUILD_IN_SOURCE TRUE
TEST_COMMAND ""
UPDATE_COMMAND ""
CONFIGURE_COMMAND ""
Expand Down
28 changes: 20 additions & 8 deletions cmake/Summary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,34 @@ function (print_configuration_summary)
message(STATUS "General:")
message(STATUS " System : ${CMAKE_SYSTEM_NAME}")
message(STATUS " HIP ROOT : ${HIP_ROOT_DIR}")
if(USE_HIPCXX)
message(STATUS " HIP compiler : ${CMAKE_HIP_COMPILER}")
message(STATUS " HIP compiler version : ${CMAKE_HIP_COMPILER_VERSION}")
string(STRIP "${CMAKE_HIP_FLAGS}" CMAKE_HIP_FLAGS_STRIP)
message(STATUS " HIP flags : ${CMAKE_HIP_FLAGS_STRIP}")
else()
message(STATUS " C++ compiler : ${CMAKE_CXX_COMPILER}")
message(STATUS " C++ compiler version : ${CMAKE_CXX_COMPILER_VERSION}")
string(STRIP "${CMAKE_CXX_FLAGS}" CMAKE_CXX_FLAGS_STRIP)
message(STATUS " CXX flags : ${CMAKE_CXX_FLAGS_STRIP}")
endif()
message(STATUS " Build type : ${CMAKE_BUILD_TYPE}")
message(STATUS " Install prefix : ${CMAKE_INSTALL_PREFIX}")
if(HIP_COMPILER STREQUAL "clang")
if(USE_HIPCXX)
message(STATUS " Device targets : ${CMAKE_HIP_ARCHITECTURES}")
else()
message(STATUS " Device targets : ${GPU_TARGETS}")
endif()
endif()
message(STATUS "")
message(STATUS " DISABLE_WERROR : ${DISABLE_WERROR}")
message(STATUS " DOWNLOAD_ROCPRIM : ${DOWNLOAD_ROCPRIM}")
message(STATUS " DOWNLOAD_ROCRAND : ${DOWNLOAD_ROCRAND}")
message(STATUS " BUILD_TEST : ${BUILD_TEST}")
message(STATUS " BUILD_HIPSTDPAR_TEST : ${BUILD_HIPSTDPAR_TEST}")
message(STATUS " BUILD_EXAMPLES : ${BUILD_EXAMPLES}")
message(STATUS " BUILD_BENCHMARKS : ${BUILD_BENCHMARKS}")
message(STATUS " BUILD_ADDRESS_SANITIZER : ${BUILD_ADDRESS_SANITIZER}")
message(STATUS " DISABLE_WERROR : ${DISABLE_WERROR}")
message(STATUS " DOWNLOAD_ROCPRIM : ${DOWNLOAD_ROCPRIM}")
message(STATUS " DOWNLOAD_ROCRAND : ${DOWNLOAD_ROCRAND}")
message(STATUS " BUILD_TEST : ${BUILD_TEST}")
message(STATUS " BUILD_HIPSTDPAR_TEST : ${BUILD_HIPSTDPAR_TEST}")
message(STATUS " BUILD_HIPSTDPAR_TEST_WITH_TBB : ${BUILD_HIPSTDPAR_TEST_WITH_TBB}")
message(STATUS " BUILD_EXAMPLES : ${BUILD_EXAMPLES}")
message(STATUS " BUILD_BENCHMARKS : ${BUILD_BENCHMARKS}")
message(STATUS " BUILD_ADDRESS_SANITIZER : ${BUILD_ADDRESS_SANITIZER}")
endfunction()
10 changes: 8 additions & 2 deletions cmake/VerifyCompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,14 @@ find_package(hip REQUIRED CONFIG PATHS /opt/rocm)
if(HIP_COMPILER STREQUAL "nvcc")
message(FATAL_ERROR "rocThrust does not support the CUDA backend.")
elseif(HIP_COMPILER STREQUAL "clang")
if(NOT (CMAKE_CXX_COMPILER MATCHES ".*hipcc$" OR CMAKE_CXX_COMPILER MATCHES ".*clang\\+\\+"))
message(FATAL_ERROR "On ROCm platform 'hipcc' or HIP-aware Clang must be used as C++ compiler.")
if(USE_HIPCXX)
if(NOT (CMAKE_HIP_COMPILER MATCHES ".*hipcc$" OR CMAKE_HIP_COMPILER MATCHES ".*clang\\+\\+"))
message(FATAL_ERROR "On ROCm platform 'hipcc' or HIP-aware Clang must be used as HIP compiler.")
endif()
else()
if(NOT (CMAKE_CXX_COMPILER MATCHES ".*hipcc$" OR CMAKE_CXX_COMPILER MATCHES ".*clang\\+\\+"))
message(FATAL_ERROR "On ROCm platform 'hipcc' or HIP-aware Clang must be used as C++ compiler.")
endif()
endif()
else()
message(FATAL_ERROR "HIP_COMPILER must be `clang` (AMD ROCm platform)")
Expand Down
15 changes: 11 additions & 4 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,17 @@ endif()
function(add_thrust_example EXAMPLE)
set(EXAMPLE_SOURCE "${EXAMPLE}.cu")
set(EXAMPLE_TARGET "example_thrust_${EXAMPLE}")
set_source_files_properties(${EXAMPLE_SOURCE}
if(USE_HIPCXX)
set_source_files_properties(${EXAMPLE_SOURCE}
PROPERTIES
LANGUAGE CXX
)
LANGUAGE HIP
)
else()
set_source_files_properties(${EXAMPLE_SOURCE}
PROPERTIES
LANGUAGE CXX
)
endif()
add_executable(${EXAMPLE_TARGET} ${EXAMPLE_SOURCE})

target_link_libraries(${EXAMPLE_TARGET}
Expand Down Expand Up @@ -45,7 +52,7 @@ function(add_thrust_example EXAMPLE)
foreach( file_i ${third_party_dlls})
add_custom_command( TARGET ${EXAMPLE_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${file_i} ${PROJECT_BINARY_DIR}/examples )
endforeach( file_i )
endif()
endif()
endfunction()


Expand Down
9 changes: 9 additions & 0 deletions extra/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ enable_testing()
function(add_rocthrust_test TEST_NAME TEST_SOURCES)
list(GET TEST_SOURCES 0 TEST_MAIN_SOURCE)
get_filename_component(TEST_TARGET ${TEST_MAIN_SOURCE} NAME_WE)

foreach(test_file ${TEST_SOURCES})
if(USE_HIPCXX)
set_source_files_properties(${test_file} PROPERTIES LANGUAGE HIP)
else()
set_source_files_properties(${test_file} PROPERTIES LANGUAGE CXX)
endif()
endforeach()

add_executable(${TEST_TARGET} ${TEST_SOURCES})
target_link_libraries(${TEST_TARGET}
PRIVATE
Expand Down
6 changes: 5 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ endfunction()

function(add_rocthrust_test TEST)
set(TEST_SOURCE "test_${TEST}.cpp")
if(USE_HIPCXX)
set_source_files_properties(${TEST_SOURCE} PROPERTIES LANGUAGE HIP)
endif()

set(TEST_TARGET "${TEST}.hip")
add_executable(${TEST_TARGET} ${TEST_SOURCE})
target_include_directories(${TEST_TARGET} SYSTEM BEFORE
Expand Down Expand Up @@ -245,7 +249,7 @@ if(BUILD_TEST)
endif()

# hipstdpar tests
if(BUILD_TEST OR BUILD_HIPSTDPAR_TEST)
if(BUILD_HIPSTDPAR_TEST)
if(WIN32)
message(
STATUS
Expand Down
Loading

0 comments on commit 0006584

Please sign in to comment.