Skip to content
Open
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
1 change: 1 addition & 0 deletions .github/workflows/radeon-repo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.2 https://repo.radeon.com/amdgpu-install/7.2/ubuntu/noble/amdgpu-install_7.2.70200-1_all.deb
93 changes: 93 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: test

on:
pull_request:

push:
branches:
- main

workflow_call:

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
build-cuda:
name: CUDA ${{ matrix.cuda }}
runs-on: ubuntu-24.04
container:
image: nvidia/cuda:${{ matrix.cuda }}-devel-ubuntu24.04
strategy:
fail-fast: false
matrix:
cuda: ["12.8.1"]
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install build dependencies
run: |
apt-get update
apt-get install --yes cmake
- name: Configure
run: |
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install \
-DHIPPER_TEST_PLATFORM=nvidia \
-DCMAKE_CUDA_ARCHITECTURES=80
- name: Build
run: |
cmake --build build
- name: Install
run: |
cmake --install build

build-hip:
name: ROCm ${{ matrix.rocm }}
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
rocm: ["7.2"]
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Find ROCm repository
id: set-rocm-repo
run: |
rocmdeb=$(grep "^${{ matrix.rocm }} " ./.github/workflows/radeon-repo.txt | awk '{print $2}')
if [[ -n $rocmdeb ]]; then
echo "rocmdeb=$rocmdeb" >> $GITHUB_OUTPUT
else
echo "Unknown ROCm version" && exit 1
fi
- name: Install ROCm
run: |

wget ${{ steps.set-rocm-repo.outputs.rocmdeb }} -O amdgpu-install.deb
sudo apt-get install --yes ./amdgpu-install.deb
sudo apt-get update
sudo apt-get install --yes rocm-hip-sdk

sudo tee --append /etc/ld.so.conf.d/rocm.conf <<EOF
/opt/rocm/lib
/opt/rocm/lib64
EOF
sudo ldconfig
- name: Install build dependencies
run: |
sudo apt-get install --yes cmake
- name: Configure
run: |
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install \
-DHIPPER_TEST_PLATFORM=amd
- name: Build
run: |
cmake --build build
- name: Install
run: |
cmake --install build
15 changes: 15 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ci:
autofix_prs: false
autoupdate_schedule: quarterly

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-added-large-files
- id: check-merge-conflict
- id: check-yaml
- id: end-of-file-fixer
- id: mixed-line-ending
- id: requirements-txt-fixer
- id: trailing-whitespace
18 changes: 9 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

# Maintainer: mphoward

cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.28)

project(hipper VERSION 0.2.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/tools")

# check if hipper is being used directly or via add_subdirectory
Expand All @@ -16,7 +16,7 @@ if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(HIPPER_MASTER_PROJECT ON)
endif()
option(HIPPER_INSTALL "Install hipper files?" ${HIPPER_MASTER_PROJECT})
option(HIPPER_TEST "Build hipper tests?" ${HIPPER_MASTER_PROJECT})
set(HIPPER_TEST_PLATFORM "" CACHE STRING "Platform for hipper tests [nvidia, amd]")

# header-only targets
include(GNUInstallDirs)
Expand All @@ -25,12 +25,6 @@ add_library(hipper::hipper ALIAS hipper)
target_include_directories(hipper INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

# add tests
if(HIPPER_TEST)
enable_testing()
add_subdirectory(tests)
endif()

# install headers
if(HIPPER_INSTALL)
include(CMakePackageConfigHelpers)
Expand All @@ -54,3 +48,9 @@ if(HIPPER_INSTALL)
NAMESPACE hipper::
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/hipper)
endif()

# add tests
if(HIPPER_TEST_PLATFORM)
enable_testing()
add_subdirectory(tests)
endif()
1 change: 0 additions & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,3 @@ enforcement ladder](https://github.com/mozilla/diversity).
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.

1 change: 0 additions & 1 deletion doc/runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,4 +376,3 @@
| `cudaProfilerStop` | `hipProfilerStop` | `hipper::profilerStop`\* |

\*: feature only available with `HIPPER_USE_DEPRECATED`.

32 changes: 22 additions & 10 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
# Copyright (c) 2021, Auburn University
# This file is released under the Modified BSD License.

# enable the language used for testing
if(HIPPER_TEST_PLATFORM STREQUAL "nvidia")
enable_language(CUDA)
elseif(HIPPER_TEST_PLATFORM STREQUAL "amd")
enable_language(HIP)
else()
message(FATAL_ERROR "HIPPER_TEST_PLATFORM value ${HIPPER_TEST_PLATFORM} not recognized, must be nvidia or amd")
endif()

# the list of all source files
set(HIPPER_TEST_FILES
test_hipper.cc
Expand All @@ -14,14 +23,11 @@ set(HIPPER_TEST_LABELS
CUB
)

# look for catch quietly, and pull down v2.12.2 if not found
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
find_package(Catch2 QUIET)
# look for catch quietly, and pull down v2.13.10 if not found
find_package(Catch2 2 QUIET)
if(NOT Catch2_FOUND)
message(STATUS "Downloading Catch2...")
set(url https://github.com/catchorg/Catch2/releases/download/v2.12.2/catch.hpp)
set(url https://github.com/catchorg/Catch2/releases/download/v2.13.10/catch.hpp)
file(DOWNLOAD ${url} "${CMAKE_CURRENT_BINARY_DIR}/catch2/catch.hpp" STATUS status)
list(GET status 0 error)
if(error)
Expand All @@ -31,8 +37,14 @@ if(NOT Catch2_FOUND)
find_package(Catch2 REQUIRED)
endif()

# set full path to files for use in subdirectories
list(TRANSFORM HIPPER_TEST_FILES PREPEND "${CMAKE_CURRENT_LIST_DIR}/")
add_executable(test_hipper ${HIPPER_TEST_FILES})
target_link_libraries(test_hipper PRIVATE hipper::hipper Catch2::Catch2)
if(HIPPER_TEST_PLATFORM STREQUAL "nvidia")
target_compile_definitions(test_hipper PRIVATE HIPPER_CUDA)
elseif(HIPPER_TEST_PLATFORM STREQUAL "amd")
target_compile_definitions(test_hipper PRIVATE HIPPER_HIP)
endif()

add_subdirectory(cuda)
add_subdirectory(hip)
foreach(label ${HIPPER_TEST_LABELS})
add_test(NAME hipper-${label} COMMAND test_hipper "[${label}]")
endforeach()
37 changes: 0 additions & 37 deletions tests/cuda/CMakeLists.txt

This file was deleted.

26 changes: 0 additions & 26 deletions tests/hip/CMakeLists.txt

This file was deleted.