Skip to content

Commit

Permalink
Develop stream 2023 05 18 (#286)
Browse files Browse the repository at this point in the history
* WIN32 -> _WIN32

* Add copyright check script based on hipCUB

* Resolve "Remove `#if THRUST_CPP_DIALECT >= 2011` checks and similar."

* fix transform iterator for device-only operators

* add workaround for sdma oversubscription

* Use THRUST_NAMESPACE_BEGIN everywhere

* Remove references to and workarounds for hcc

* fix warnings

* review comments round 1

* review comments round 2

* fix gtest dependency

* Update ROCm version in Changelog

---------

Co-authored-by: Máté Ferenc Nagy-Egri <mate@streamhpc.com>
Co-authored-by: Gergely Meszaros <gergely@streamhpc.com>
Co-authored-by: Beatriz Navidad Vilches <beatriz@streamhpc.com>
Co-authored-by: Nol Moonen <nol@streamhpc.com>
  • Loading branch information
5 people authored May 30, 2023
1 parent b222e5b commit 2b80e29
Show file tree
Hide file tree
Showing 69 changed files with 1,240 additions and 1,526 deletions.
8 changes: 8 additions & 0 deletions .githooks/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

cd "$(git rev-parse --git-dir)"
cd hooks

echo "Installing hooks..."
ln -s ../../.githooks/pre-commit pre-commit
echo "Done!"
25 changes: 25 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh

# Redirect output to stderr.
exec 1>&2

check_failed=false

# Do the copyright check
# update & apply copyright when hook config is set, otherwise just verify
opts="-qc"
if [ "$(git config --get --type bool --default false hooks.updateCopyright)" = "true" ]; then
opts="-qca"
fi

if ! "$(git rev-parse --show-toplevel)/scripts/copyright-date/check-copyright.sh" "$opts" 1>&2; then
printf "\n\033[31mFailed\033[0m: copyright date check.\n"
check_failed=true
fi

if $check_failed; then
printf "
Pre-commit check failed, please fix the reported errors.
Note: Use '\033[33mgit commit --no-verify\033[0m' to bypass checks.\n"
exit 1
fi
22 changes: 20 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ########################################################################
# Copyright 2019-2022 Advanced Micro Devices, Inc.
# Copyright 2019-2023 Advanced Micro Devices, Inc.
# ########################################################################

include:
Expand All @@ -14,6 +14,7 @@ include:
- /rules.yaml

stages:
- lint
- build # Tests if builds succeed (CMake)
- test # Tests if unit tests are passing (CTest)

Expand All @@ -22,6 +23,20 @@ variables:
PACKAGE_DIR: $BUILD_DIR/package
ROCPRIM_GIT_BRANCH: develop_stream

copyright-date:
extends:
- .deps:rocm
stage: lint
needs: []
tags:
- rocm-build
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
script:
- cd $CI_PROJECT_DIR
- git config --global --add safe.directory $CI_PROJECT_DIR
- scripts/copyright-date/check-copyright.sh -v -d $CI_MERGE_REQUEST_DIFF_BASE_SHA

.cmake-latest:
extends:
- .deps:rocm
Expand Down Expand Up @@ -179,7 +194,10 @@ test:
-D CMAKE_PREFIX_PATH=/opt/rocm
-P $CI_PROJECT_DIR/cmake/GenerateResourceSpec.cmake
- cat ./resources.json
- ctest
# Parallel execution (with other AMDGPU processes) can oversubscribe the SDMA queue.
# This causes the hipMemcpy to fail, which is not reported as an error by HIP.
# As a temporary workaround, disable the SDMA for test stability.
- HSA_ENABLE_SDMA=0 ctest
--output-on-failure
--repeat-until-fail 2
--tests-regex $GPU_TARGET
Expand Down
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

Full documentation for rocThrust is available at [https://rocthrust.readthedocs.io/en/latest/](https://rocthrust.readthedocs.io/en/latest/)

## (Unreleased) rocThrust 2.18.0 for ROCm 5.6
## (Unreleased) rocThrust 2.18.0 for ROCm 5.7
### Fixed
- `lower_bound`, `upper_bound`, and `binary_search` failed to compile for certain types.
- Fixed issue where `transform_iterator` would not compile with `__device__`-only operators.
### Changed
- Updated `docs` directory structure to match the standard of [rocm-docs-core](https://github.com/RadeonOpenCompute/rocm-docs-core).
- Removed references to and workarounds for deprecated hcc

## (Unreleased) rocThrust 2.17.0 for ROCm 5.5
## rocThrust 2.17.0 for ROCm 5.5
### Added
- Updated to match upstream Thrust 1.17.2
### Fixed
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ########################################################################
# Copyright 2019-2020 Advanced Micro Devices, Inc.
# Copyright 2019-2023 Advanced Micro Devices, Inc.
# ########################################################################

cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
Expand Down Expand Up @@ -74,7 +74,7 @@ set(AMDGPU_TARGETS "${DEFAULT_AMDGPU_TARGETS}" CACHE STRING "List of specific ma
# Get dependencies
include(cmake/Dependencies.cmake)

# Verify that hcc or hipcc compiler is used on ROCM platform
# Verify that supported compilers are used
if (NOT WIN32)
include(cmake/VerifyCompiler.cmake)
endif()
Expand Down
5 changes: 2 additions & 3 deletions cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ########################################################################
# Copyright 2019 Advanced Micro Devices, Inc.
# Copyright 2019-2023 Advanced Micro Devices, Inc.
# ########################################################################

# ###########################
Expand Down Expand Up @@ -60,7 +60,6 @@ if(BUILD_TEST)
BUILD_PROJECT TRUE
UPDATE_DISCONNECTED TRUE
)
list( APPEND CMAKE_PREFIX_PATH ${GTEST_ROOT} )
find_package(GTest REQUIRED)
find_package(GTest REQUIRED CONFIG PATHS ${GTEST_ROOT})
endif()
endif()
4 changes: 2 additions & 2 deletions cmake/Summary.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2019-2020 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2019-2023 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -32,7 +32,7 @@ function (print_configuration_summary)
message(STATUS " CXX flags : ${CMAKE_CXX_FLAGS_STRIP}")
message(STATUS " Build type : ${CMAKE_BUILD_TYPE}")
message(STATUS " Install prefix : ${CMAKE_INSTALL_PREFIX}")
if(HIP_COMPILER STREQUAL "hcc" OR HIP_COMPILER STREQUAL "clang")
if(HIP_COMPILER STREQUAL "clang")
message(STATUS " Device targets : ${AMDGPU_TARGETS}")
endif()
message(STATUS "")
Expand Down
18 changes: 5 additions & 13 deletions cmake/VerifyCompiler.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2019-2020 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2019-2023 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand All @@ -25,18 +25,10 @@ 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 "hcc" OR HIP_COMPILER STREQUAL "clang")
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.")
elseif(NOT CXX_VERSION_STRING MATCHES "clang")
list(APPEND CMAKE_PREFIX_PATH /opt/rocm/hcc)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-command-line-argument")
endif()

if(HIP_COMPILER STREQUAL "hcc")
list(APPEND CMAKE_PREFIX_PATH /opt/rocm/hcc)
find_package(hcc REQUIRED CONFIG PATHS /opt/rocm)
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.")
endif()
else()
message(FATAL_ERROR "HIP_COMPILER must be 'hcc' or 'clang' (AMD ROCm platform)")
message(FATAL_ERROR "HIP_COMPILER must be `clang` (AMD ROCm platform)")
endif()
4 changes: 2 additions & 2 deletions extra/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ########################################################################
# Copyright 2019 Advanced Micro Devices, Inc.
# Copyright 2019-2023 Advanced Micro Devices, Inc.
# ########################################################################

cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
Expand Down Expand Up @@ -31,7 +31,7 @@ else()
set(AMDGPU_TARGETS gfx803;gfx900;gfx906;gfx908 CACHE STRING "List of specific machine types for library to target")
endif()

# Verify that hcc or hipcc compiler is used on ROCM platform
# Verify that supported compilers are used
include(VerifyCompiler)
include(DownloadProject)

Expand Down
17 changes: 3 additions & 14 deletions install
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@ if [[ "${build_relocatable}" == true ]]; then
fi
fi

# Instal the pre-commit hook
#bash .githooks/install


# Create and go to the build directory.
mkdir -p build; cd build

Expand All @@ -126,14 +122,7 @@ else
fi

# Configure rocThrust, setup options for your system.
# Build options:
# BUILD_TEST - off by default,
# BUILD_BENCHMARK - off by default.
#
# ! IMPORTANT !
# On ROCm platform set C++ compiler to HIPCC. You can do it by adding 'CXX=<path-to-hcc>'
# before 'cmake' or setting cmake option 'CMAKE_CXX_COMPILER' to path to the HIPCC compiler.
#
# See README.md under "Build And Install" for options and defaults.

# Set compiler
compiler="hipcc"
Expand Down Expand Up @@ -174,8 +163,8 @@ make -j$(nproc)
check_exit_code "$?"

if ($run_tests); then
# Optionally, run tests if they're enabled.
ctest --output-on-failure
# Optionally, run tests if they're enabled.
ctest --output-on-failure
fi

if ($install_package); then
Expand Down
2 changes: 1 addition & 1 deletion internal/benchmark/timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class cuda_timer

#endif

#if (THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_MSVC || defined(WIN32))
#if(THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_MSVC || defined(_WIN32))
#include <windows.h>

class steady_timer
Expand Down
Loading

0 comments on commit 2b80e29

Please sign in to comment.