Skip to content

Commit

Permalink
Merge branch 'develop' into update_stddata
Browse files Browse the repository at this point in the history
  • Loading branch information
tomdeakin authored Oct 2, 2023
2 parents 7301b1c + 2e3ebee commit b2a538b
Show file tree
Hide file tree
Showing 53 changed files with 3,659 additions and 1,680 deletions.
84 changes: 71 additions & 13 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ on:
jobs:

test-rust:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
defaults:
run:
working-directory: ./src/rust/rust-stream
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup project
run: rustup install nightly
- name: Compile project
Expand All @@ -28,25 +28,25 @@ jobs:
run: ./target/release/rust-stream --arraysize 2048

test-java:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
defaults:
run:
working-directory: ./src/java/java-stream
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Test build project
run: ./mvnw clean package
- name: Test run
if: ${{ ! cancelled() }}
run: java -jar target/java-stream.jar --arraysize 2048

test-julia:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
defaults:
run:
working-directory: ./src/julia/JuliaStream.jl
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup project
run: julia --project -e 'import Pkg; Pkg.instantiate()'
- name: Test run PlainStream.jl
Expand All @@ -70,14 +70,22 @@ jobs:


test-cpp:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Maximize build space
uses: easimon/maximize-build-space@v8
with:
root-reserve-mb: 8192
swap-size-mb: 512
remove-android: 'true'
remove-codeql: 'true'

- uses: actions/checkout@v4

- name: Cache compiler
if: ${{ !env.ACT }}
id: prepare-compilers
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ./compilers
key: ${{ runner.os }}-${{ hashFiles('./src/ci-prepare-bionic.sh') }}
Expand All @@ -90,9 +98,9 @@ jobs:
run: source ./src/ci-prepare-bionic.sh ./compilers VARS false || true

# Enable tmate debugging of manually-triggered workflows if the input option was provided
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
# if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}

- name: Test compile gcc @ CMake 3.13
if: ${{ ! cancelled() }}
Expand Down Expand Up @@ -167,4 +175,54 @@ jobs:
run: ./src/ci-test-compile.sh ./build dpcpp all ${{ env.CMAKE_3_18_BIN }}
- name: Test compile hipsycl @ CMake 3.18
if: ${{ ! cancelled() }}
run: ./src/ci-test-compile.sh ./build hipsycl all ${{ env.CMAKE_3_18_BIN }}
run: ./src/ci-test-compile.sh ./build hipsycl all ${{ env.CMAKE_3_18_BIN }}

- name: Test compile gcc @ CMake 3.20
if: ${{ ! cancelled() }}
run: ./src/ci-test-compile.sh ./build gcc all ${{ env.CMAKE_3_20_BIN }}
- name: Test compile clang @ CMake 3.20
if: ${{ ! cancelled() }}
run: ./src/ci-test-compile.sh ./build clang all ${{ env.CMAKE_3_20_BIN }}
- name: Test compile nvhpc @ CMake 3.20
if: ${{ ! cancelled() }}
run: ./src/ci-test-compile.sh ./build nvhpc all ${{ env.CMAKE_3_20_BIN }}
- name: Test compile aocc @ CMake 3.20
if: ${{ ! cancelled() }}
run: ./src/ci-test-compile.sh ./build aocc all ${{ env.CMAKE_3_20_BIN }}
- name: Test compile aomp @ CMake 3.20
if: ${{ ! cancelled() }}
run: ./src/ci-test-compile.sh ./build aomp all ${{ env.CMAKE_3_20_BIN }}
- name: Test compile hip @ CMake 3.20
if: ${{ ! cancelled() }}
run: ./src/ci-test-compile.sh ./build hip all ${{ env.CMAKE_3_20_BIN }}
- name: Test compile dpcpp @ CMake 3.20
if: ${{ ! cancelled() }}
run: ./src/ci-test-compile.sh ./build dpcpp all ${{ env.CMAKE_3_20_BIN }}
- name: Test compile hipsycl @ CMake 3.20
if: ${{ ! cancelled() }}
run: ./src/ci-test-compile.sh ./build hipsycl all ${{ env.CMAKE_3_20_BIN }}

- name: Test compile gcc @ CMake 3.24
if: ${{ ! cancelled() }}
run: ./src/ci-test-compile.sh ./build gcc all ${{ env.CMAKE_3_24_BIN }}
- name: Test compile clang @ CMake 3.24
if: ${{ ! cancelled() }}
run: ./src/ci-test-compile.sh ./build clang all ${{ env.CMAKE_3_24_BIN }}
- name: Test compile nvhpc @ CMake 3.24
if: ${{ ! cancelled() }}
run: ./src/ci-test-compile.sh ./build nvhpc all ${{ env.CMAKE_3_24_BIN }}
- name: Test compile aocc @ CMake 3.24
if: ${{ ! cancelled() }}
run: ./src/ci-test-compile.sh ./build aocc all ${{ env.CMAKE_3_24_BIN }}
- name: Test compile aomp @ CMake 3.24
if: ${{ ! cancelled() }}
run: ./src/ci-test-compile.sh ./build aomp all ${{ env.CMAKE_3_24_BIN }}
- name: Test compile hip @ CMake 3.24
if: ${{ ! cancelled() }}
run: ./src/ci-test-compile.sh ./build hip all ${{ env.CMAKE_3_24_BIN }}
- name: Test compile dpcpp @ CMake 3.24
if: ${{ ! cancelled() }}
run: ./src/ci-test-compile.sh ./build dpcpp all ${{ env.CMAKE_3_24_BIN }}
- name: Test compile hipsycl @ CMake 3.24
if: ${{ ! cancelled() }}
run: ./src/ci-test-compile.sh ./build hipsycl all ${{ env.CMAKE_3_24_BIN }}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ All notable changes to this project will be documented in this file.
### Added
- Ability to build Kokkos and RAJA versions against existing packages.
- Thrust managed memory.
- HIP managed memory.
- New implementation using SYCL2020 USM (sycl2020-acc) and renamed original `sycl2020` to `sycl2020-acc`.

### Changed
- RAJA CUDA CMake build issues resolved.
Expand All @@ -13,6 +15,10 @@ All notable changes to this project will be documented in this file.
- OneAPI DPCPP compiler is deprecated in favour of ICPX, so added new build option to SYCL 2020 version.
- Updates to the HIP kernels and API usage.
- Number of thread-blocks in CUDA dot kernel implementation changed to 1024.
- Fix compatibility of `sycl2020` (now `sycl2020-acc`) with hipSYCL.
- Bumped Julia compat to 1.9
- Bumped Rust to 1.74.0-nightly (13e6f24b9 2023-09-23)


## [v4.0] - 2021-12-22

Expand Down
85 changes: 82 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)

if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
cmake_policy(SET CMP0135 NEW)
endif ()

project(BabelStream VERSION 4.0 LANGUAGES CXX)

# uncomment for debugging build issues:
Expand Down Expand Up @@ -27,8 +31,6 @@ endmacro()
# the final executable name
set(EXE_NAME babelstream)

# select default build type
set(CMAKE_BUILD_TYPE "Release")
# for chrono and some basic CXX features, models can overwrite this if required
set(CMAKE_CXX_STANDARD 11)

Expand Down Expand Up @@ -71,6 +73,75 @@ hint_flag(CXX_EXTRA_LINKER_FLAGS "
# Honor user's CXX_EXTRA_LINK_FLAGS
set(CXX_EXTRA_LINK_FLAGS ${CXX_EXTRA_FLAGS} ${CXX_EXTRA_LINK_FLAGS})

option(USE_TBB "Enable the oneTBB library for *supported* models. Enabling this on models that
don't explicitly link against TBB is a no-op, see description of your selected
model on how this is used." OFF)

option(FETCH_TBB "Fetch (download) the oneTBB library for *supported* models. This uses CMake's
FetchContent feature. Specify version by setting FETCH_TBB_VERSION" OFF)
set(FETCH_TBB_VERSION "v2021.10.0" CACHE STRING "Specify version of oneTBB to use if FETCH_TBB is ON")

if (FETCH_TBB)
FetchContent_Declare(
TBB
GIT_REPOSITORY https://github.com/oneapi-src/oneTBB.git
GIT_TAG "${FETCH_TBB_VERSION}"
)
# Don't fail builds on waring (TBB has -Wall while not being free of warnings from unused symbols...)
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
set(TBB_STRICT OFF)
# Not using FetchContent_MakeAvailable (CMake>= 3.14) because we need EXCLUDE_FROM_ALL
FetchContent_GetProperties(TBB)
if (NOT TBB_POPULATED)
FetchContent_Populate(TBB)
add_subdirectory(${tbb_SOURCE_DIR} ${tbb_BINARY_DIR} EXCLUDE_FROM_ALL)
endif ()
endif ()

option(USE_ONEDPL "Enable the oneDPL library for *supported* models. Enabling this on models that
don't explicitly link against DPL is a no-op, see description of your selected
model on how this is used." OFF)

option(FETCH_ONEDPL "Fetch (download) the oneDPL library for *supported* models. This uses CMake's
FetchContent feature. Specify version by setting FETCH_ONEDPL_VERSION" OFF)
set(FETCH_ONEDPL_VERSION "oneDPL-2022.2.0-rc1" CACHE STRING "Specify version of oneTBB to use if FETCH_ONEDPL is ON")

if (FETCH_ONEDPL)
FetchContent_Declare(
oneDPL
GIT_REPOSITORY https://github.com/oneapi-src/oneDPL.git
GIT_TAG "${FETCH_ONEDPL_VERSION}"
)
string(TOLOWER ${USE_ONEDPL} ONEDPL_BACKEND)
# XXX oneDPL looks for omp instead of openmp, which mismatches(!) with ONEDPL_PAR_BACKEND if using find_package
if (ONEDPL_BACKEND STREQUAL "openmp")
set(ONEDPL_BACKEND omp)
endif ()
# Not using FetchContent_MakeAvailable (CMake>= 3.14) because we need EXCLUDE_FROM_ALL
FetchContent_GetProperties(oneDPL)
if (NOT oneDPL_POPULATED)
FetchContent_Populate(oneDPL)
if (USE_TBB)
macro(find_package NAME)
if ("${NAME}" STREQUAL "TBB")
message(STATUS "Discarding oneDPL's call to find_package(${NAME} ${ARGN})")
else ()
_find_package(${NAME} ${ARGN})
endif ()
endmacro()
endif ()
add_subdirectory(${onedpl_SOURCE_DIR} ${onedpl_BINARY_DIR} EXCLUDE_FROM_ALL)

# Fixup oneDPL's omission on setting DPCPP definitions.
# We do this after the creation of the oneDPL target.
if (ONEDPL_BACKEND MATCHES "^(dpcpp|dpcpp_only)$")
target_compile_definitions(oneDPL INTERFACE ONEDPL_USE_DPCPP_BACKEND=1)
endif ()

endif ()
endif ()


# include our macros
include(cmake/register_models.cmake)

Expand All @@ -84,7 +155,8 @@ register_model(hip HIP HIPStream.cpp)
register_model(cuda CUDA CUDAStream.cu)
register_model(kokkos KOKKOS KokkosStream.cpp)
register_model(sycl SYCL SYCLStream.cpp)
register_model(sycl2020 SYCL2020 SYCLStream2020.cpp)
register_model(sycl2020-acc SYCL2020 SYCLStream2020.cpp)
register_model(sycl2020-usm SYCL2020 SYCLStream2020.cpp)
register_model(acc ACC ACCStream.cpp)
# defining RAJA collides with the RAJA namespace so USE_RAJA
register_model(raja USE_RAJA RAJAStream.cpp)
Expand All @@ -101,6 +173,12 @@ else ()
message(STATUS "Selected model : ${MODEL}")
endif ()

if (MODEL STREQUAL "sycl2020")
message(FATAL_ERROR "
Model sycl2020 has been renamed to sycl2020-acc, and a new sycl2020-usm model is now available.
Please use sycl2020-acc for SYCL2020 style accessors and sycl2020-usm for USM")
endif ()

# load the $MODEL.cmake file and setup the correct IMPL_* based on $MODEL
load_model(${MODEL})

Expand Down Expand Up @@ -151,6 +229,7 @@ include_directories(src)
add_executable(${EXE_NAME} ${IMPL_SOURCES} src/main.cpp)
target_link_libraries(${EXE_NAME} PUBLIC ${LINK_LIBRARIES})
target_compile_definitions(${EXE_NAME} PUBLIC ${IMPL_DEFINITIONS})
target_include_directories(${EXE_NAME} PUBLIC ${IMPL_DIRECTORIES})

if (CXX_EXTRA_LIBRARIES)
target_link_libraries(${EXE_NAME} PUBLIC ${CXX_EXTRA_LIBRARIES})
Expand Down
34 changes: 32 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# BabelStream

<img src="https://github.com/UoB-HPC/BabelStream/blob/gh-pages/img/BabelStreamlogo.png?raw=true" alt="logo" height="300" align="right" />
<img src="babelstream.png?raw=true" alt="logo" height="300" align="right" />

[![CI](https://github.com/UoB-HPC/BabelStream/actions/workflows/main.yaml/badge.svg?branch=main)](https://github.com/UoB-HPC/BabelStream/actions/workflows/main.yaml)

Expand All @@ -18,6 +18,7 @@ This code was previously called GPU-STREAM.
- [How is this different to STREAM?](#how-is-this-different-to-stream)
- [Building](#building)
- [CMake](#cmake)
- [Spack](#spack)
- [GNU Make (removed)](#gnu-make)
- [Results](#results)
- [Contributing](#contributing)
Expand All @@ -37,7 +38,7 @@ BabelStream is currently implemented in the following parallel programming model
- C++ Parallel STL
- Kokkos
- RAJA
- SYCL and SYCL 2020
- SYCL and SYCL2020 (USM and accessors)
- TBB
- Thrust (via CUDA or HIP)

Expand Down Expand Up @@ -138,6 +139,35 @@ Alternatively, refer to the [CI script](./src/ci-test-compile.sh), which test-co
*It is recommended that you delete the `build` directory when you change any of the build flags.*
### Spack
The project supports building with Spack >= 0.19.0, which can be installed without root via the [official GitHub repo](https://github.com/spack/spack).
The BabelStream Spack Package source code could be accessed from the link [here](https://github.com/spack/spack/tree/develop/var/spack/repos/builtin/packages/babelstream/package.py).
Each BabelStream implementation (programming model) is built as follows:
```shell
# Spack package installation starts with `spack install babelstream` for all programming models
# The programming model wish to be build needs to be specified with `+` option
# The model specific flags needs to be specified after defining model
$ spack install babelstream@<version>%<compiler> +<model> <model specific flags>
# The executables will be generated in:
# SPACK_INSTALL_DIRECTORY/opt/spack/system-name/compiler-name/babelstream-version-identifier/bin/
# this address will be printed at the end of generation which could be easily copied
$ cd SPACK_INSTALL_DIRECTORY/opt/spack/system-name/compiler-name/babelstream-version-identifier/bin/
$ ./<model>-stream
```
More detailed examples are provided in [Spack README file](./docs/spack_instructions.md).
The `MODEL` variant selects one implementation of BabelStream to build.
Currently available models are:
```
omp;ocl;std-data;std-indices;std-ranges;hip;cuda;kokkos;sycl;sycl2020-acc;sycl2020-usm;acc;raja;tbb;thrust
```
### GNU Make
Support for Make has been removed from 4.0 onwards.
Expand Down
Binary file added babelstream.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit b2a538b

Please sign in to comment.