Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,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 Down
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ include(CMakeDependentOption)
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.
Expand Down Expand Up @@ -162,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
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
17 changes: 9 additions & 8 deletions cmake/Summary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@ else()
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()
29 changes: 11 additions & 18 deletions test/hipstdpar/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ function(add_hipstdpar_test TEST TEST_TYPE INTERPOSE_ALLOC)
PRIVATE
--hipstdpar
--hipstdpar-path=${HIPSTDPAR_LOCATION}
--hipstdpar-thrust-path=${THRUST_LOCATION})
--hipstdpar-thrust-path=${THRUST_LOCATION}
--hipstdpar-prim-path=${ROCPRIM_LOCATION})
if(INTERPOSE_ALLOC)
target_compile_options(${TEST_TARGET}
PRIVATE
Expand All @@ -24,9 +25,15 @@ function(add_hipstdpar_test TEST TEST_TYPE INTERPOSE_ALLOC)
target_link_libraries(${TEST_TARGET}
PRIVATE
--hipstdpar
TBB::tbb
Threads::Threads
)

if(TARGET TBB::tbb OR TARGET tbb)
target_link_libraries(${TEST_TARGET}
PRIVATE
TBB::tbb
)
endif()

if (NOT WIN32)
foreach(gpu_target ${GPU_TARGETS})
Expand Down Expand Up @@ -79,26 +86,12 @@ set(ROCTHRUST_CMAKE_CXX_STANDARD ${CMAKE_CXX_STANDARD})
set(CMAKE_CXX_STANDARD 17)

# Dependencies
find_package(TBB QUIET)
if(NOT TARGET TBB::tbb AND NOT TARGET tbb)
message(STATUS "Thread Building Blocks not found. Fetching...")
FetchContent_Declare(
thread-building-blocks
GIT_REPOSITORY https://github.com/oneapi-src/oneTBB.git
GIT_TAG 1c4c93fc5398c4a1acb3492c02db4699f3048dea # v2021.13.0
)
# Disable tests for TBB
set(TBB_TEST OFF CACHE BOOL "Disable TBB tests" FORCE)

FetchContent_MakeAvailable(thread-building-blocks)
else()
find_package(TBB REQUIRED)
endif()
find_package(Threads REQUIRED)

# Define where to find rocThrust and hipstdpar headers
# Define where to find rocThrust, hipstdpar and rocPRIM headers
set(THRUST_LOCATION ${PROJECT_SOURCE_DIR})
set(HIPSTDPAR_LOCATION ${THRUST_LOCATION}/thrust/system/hip/hipstdpar)
set(ROCPRIM_LOCATION ${ROCPRIM_INCLUDE_DIR})

# Add tests
add_hipstdpar_test("algorithms" "compile" OFF)
Expand Down