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
27 changes: 18 additions & 9 deletions .gitlab-ci-gputest.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
test:rocm241:
extends: .unittest
test:vega20:
extends: .test
dependencies:
- build:rocm
tags:
- tag241
- vega20
- rocm

test:rocm243:
extends: .unittest
test:s9300:
extends: .test
dependencies:
- build:rocm
tags:
- tag243
- s9300
- rocm

test:rocm244:
extends: .unittest
test:mi25:
extends: .test
dependencies:
- build:rocm
tags:
- tag244
- mi25
- rocm
27 changes: 13 additions & 14 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,40 +45,39 @@ before_script:
- export CXXFLAGS=$CXXFLAGS" "$LOCAL_CXXFLAGS
- export CMAKE_OPTIONS=$CXXFLAGS" "$LOCAL_CMAKE_OPTIONS

build:rocm:
.build:
stage: build
tags:
- rocm
variables:
SUDO_CMD: "sudo -E"
script:
- mkdir build
- cd build
- CXX=hcc cmake -DBUILD_TEST=ON -DBUILD_EXAMPLE=ON -DBUILD_BENCHMARK=ON ../.
- make -j16
- make package
artifacts:
paths:
- build/library/
- build/test/test_*
- build/test/rocprim/test_*
- build/test/hipcub/test_*
- build/test/CTestTestfile.cmake
- build/test/rocprim/CTestTestfile.cmake
- build/test/hipcub/CTestTestfile.cmake
- build/gtest/
- build/CMakeCache.txt
- build/CTestTestfile.cmake
- build/rocprim*.deb
- build/rocprim*.zip
expire_in: 2 weeks

build:rocm:
extends: .build
tags:
- rocm
script:
- mkdir build
- cd build
- CXX=hcc cmake -DBUILD_TEST=ON -DBUILD_EXAMPLE=ON -DBUILD_BENCHMARK=ON ../.
- make -j16
- make package

.unittest:
.test:
stage: test
variables:
SUDO_CMD: "sudo -E"
dependencies:
- build:rocm
script:
- cd build
- $SUDO_CMD ctest --output-on-failure --repeat-until-fail 2
Expand Down
57 changes: 17 additions & 40 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,61 +76,38 @@ set(AMDGPU_TARGETS gfx803;gfx900;gfx906 CACHE STRING "List of specific machine t
include(cmake/Summary.cmake)
print_configuration_summary()

# rocPRIM works only on hcc
if(HIP_PLATFORM STREQUAL "hcc")
# rocPRIM library
add_subdirectory(rocprim)
endif()

# hipCUB library
add_subdirectory(hipcub)
# rocPRIM library
add_subdirectory(rocprim)

# Tests
if(BUILD_TEST AND NOT ONLY_INSTALL)
enable_testing()
add_subdirectory(test)
endif()

# Benchmarks and examples are only for rocPRIM
if(HIP_PLATFORM STREQUAL "hcc")
# Benchmarks
if(BUILD_BENCHMARK AND NOT ONLY_INSTALL)
add_subdirectory(benchmark)
endif()

# Examples
if(BUILD_EXAMPLE AND NOT ONLY_INSTALL)
add_subdirectory(example)
endif()
# Benchmarks
if(BUILD_BENCHMARK AND NOT ONLY_INSTALL)
add_subdirectory(benchmark)
endif()

# Examples
if(BUILD_EXAMPLE AND NOT ONLY_INSTALL)
add_subdirectory(example)
endif()

# Package

if(HIP_PLATFORM STREQUAL "hcc")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "hip_hcc (>= 1.5.18263)") # 1.5.18263 is HIP version in ROCm 1.8.2
set(CPACK_RPM_PACKAGE_REQUIRES "hip_hcc >= 1.5.18263")
else()
set(CPACK_DEBIAN_PACKAGE_DEPENDS "hip_nvcc (>= 1.5.18263)")
set(CPACK_RPM_PACKAGE_REQUIRES "hip_nvcc >= 1.5.18263")
endif()
set(CPACK_DEBIAN_PACKAGE_DEPENDS "hip_hcc (>= 1.5.18263)") # 1.5.18263 is HIP version in ROCm 1.8.2
set(CPACK_RPM_PACKAGE_REQUIRES "hip_hcc >= 1.5.18263")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt")
if(NOT CPACK_PACKAGING_INSTALL_PREFIX)
set(CPACK_PACKAGING_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
endif()

set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "\${CPACK_PACKAGING_INSTALL_PREFIX}" "\${CPACK_PACKAGING_INSTALL_PREFIX}/include" )

# For CUDA backend the package contains only hipcub
if(HIP_PLATFORM STREQUAL "hcc")
rocm_create_package(
NAME rocprim
DESCRIPTION "Radeon Open Compute Parallel Primitives Library"
MAINTAINER "Stream HPC Maintainers <maintainer@streamhpc.com>"
)
else()
rocm_create_package(
NAME rocprim-hipcub
DESCRIPTION "Radeon Open Compute Parallel Primitives Library (hipCUB only)"
MAINTAINER "Stream HPC Maintainers <maintainer@streamhpc.com>"
)
endif()
rocm_create_package(
NAME rocprim
DESCRIPTION "Radeon Open Compute Parallel Primitives Library"
MAINTAINER "Stream HPC Maintainers <maintainer@streamhpc.com>"
)
23 changes: 11 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,12 @@ define `ROCPRIM_HC_API` before the `#include` statement. Alternatively, user can
#include <rocprim/rocprim_hc.hpp> // HC API
```

Recommended way of including rocPRIM or hipCUB into a CMake project is by using their package
configuration files. hipCUB package name is `hipcub`, rocPRIM package name is `rocprim`.
Recommended way of including rocPRIM into a CMake project is by using its package
configuration files. rocPRIM package name is `rocprim`.

```cmake
# "/opt/rocm" - default install prefix
find_package(rocprim REQUIRED CONFIG PATHS "/opt/rocm/rocprim")
find_package(hipcub REQUIRED CONFIG PATHS "/opt/rocm/hipcub")

...

Expand All @@ -80,12 +79,8 @@ target_link_libraries(<your_target> roc::rocprim)
# Includes rocPRIM headers and required HC dependencies
target_link_libraries(<your_target> roc::rocprim_hc)

# Includes rocPRIM headers and required HIP dependencies
# Includes rocPRIM headers and required HIP dependencies
target_link_libraries(<your_target> roc::rocprim_hip)

# On ROCm: includes hipCUB headers and roc::rocprim_hip target
# On CUDA: includes only hipCUB headers, user has to include CUB directory
target_link_libraries(<your_target> hip::hipcub)
```

## Running Unit Tests
Expand All @@ -97,9 +92,6 @@ cd rocPRIM; cd build
# To run all tests
ctest

# To run unit tests for hipCUB
./test/hipcub/<unit-test-name>

# To run unit tests for rocPRIM
./test/rocprim/<unit-test-name>
```
Expand Down Expand Up @@ -150,9 +142,16 @@ cd rocPRIM; cd doc
doxygen Doxyfile

# open html/index.html

```

## hipCUB

hipCUB is a thin wrapper library on top of [rocPRIM](https://github.com/ROCmSoftwarePlatform/rocPRIM) or
[CUB](https://github.com/NVlabs/cub). It enables developers to port project that uses CUB library to the
[HIP](https://github.com/ROCm-Developer-Tools/HIP) layer and to run them on AMD hardware. In [ROCm](https://rocm.github.io/)
environment hipCUB uses rocPRIM library as the backend, however, on CUDA platforms it uses CUB instead.


## Support

Bugs and feature requests can be reported through [the issue tracker](https://github.com/ROCmSoftwarePlatform/rocPRIM/issues).
Expand Down
31 changes: 1 addition & 30 deletions cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,36 +42,7 @@ find_package(Git REQUIRED)
if (NOT Git_FOUND)
message(FATAL_ERROR "Please ensure Git is installed on the system")
endif()

# CUB (only for CUDA platform)
if(HIP_PLATFORM STREQUAL "nvcc")
if(NOT DEFINED CUB_INCLUDE_DIR)
file(
DOWNLOAD https://github.com/NVlabs/cub/archive/1.8.0.zip
${CMAKE_CURRENT_BINARY_DIR}/cub-1.8.0.zip
STATUS cub_download_status LOG cub_download_log
)
list(GET cub_download_status 0 cub_download_error_code)
if(cub_download_error_code)
message(FATAL_ERROR "Error: downloading "
"https://github.com/NVlabs/cub/archive/1.8.0.zip failed "
"error_code: ${cub_download_error_code} "
"log: ${cub_download_log} "
)
endif()

execute_process(
COMMAND ${CMAKE_COMMAND} -E tar xzf ${CMAKE_CURRENT_BINARY_DIR}/cub-1.8.0.zip
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
RESULT_VARIABLE cub_unpack_error_code
)
if(cub_unpack_error_code)
message(FATAL_ERROR "Error: unpacking ${CMAKE_CURRENT_BINARY_DIR}/cub-1.8.0.zip failed")
endif()
set(CUB_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/cub-1.8.0/ CACHE PATH "")
endif()
endif()


# Test dependencies
if(BUILD_TEST)
# Google Test (https://github.com/google/googletest)
Expand Down
102 changes: 0 additions & 102 deletions cmake/SetupNVCC.cmake

This file was deleted.

11 changes: 3 additions & 8 deletions cmake/VerifyCompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,12 @@
# SOFTWARE.

# Find HIP package and verify that correct C++ compiler was selected for available
# platfrom. On ROCm platform host and device code is compiled by the same compiler:
# hcc. On CUDA host can be compiled by any C++ compiler while device code is compiled
# by nvcc compiler (CMake's CUDA package handles this).
# platfrom. On ROCm platform host and device code is compiled by the same compiler: hcc.

# Find HIP package
find_package(HIP 1.5.18263 REQUIRED) # 1.5.18263 is HIP version in ROCm 1.8.2

if(HIP_PLATFORM STREQUAL "nvcc")
include(cmake/SetupNVCC.cmake)
message(STATUS "rocPRIM does not support NVCC. Only hipCUB will be available.")
elseif(HIP_PLATFORM STREQUAL "hcc")
if(HIP_PLATFORM STREQUAL "hcc")
if(NOT (CMAKE_CXX_COMPILER MATCHES ".*/hcc$" OR CMAKE_CXX_COMPILER MATCHES ".*/hipcc$"))
message(FATAL_ERROR "On ROCm platform 'hcc' or 'clang' must be used as C++ compiler.")
else()
Expand Down Expand Up @@ -63,5 +58,5 @@ elseif(HIP_PLATFORM STREQUAL "hcc")
find_package(hip REQUIRED CONFIG PATHS /opt/rocm)
endif()
else()
message(FATAL_ERROR "HIP_PLATFORM must be 'hcc' or 'clang' (AMD ROCm platform) or `nvcc` (NVIDIA CUDA platform).")
message(FATAL_ERROR "HIP_PLATFORM must be 'hcc' or 'clang' (AMD ROCm platform)")
endif()
Loading