Skip to content

Commit f3801ae

Browse files
authored
Merge pull request #169 from UoB-HPC/develop
Merge develop for v5.0
2 parents 29b2d88 + 773814f commit f3801ae

File tree

115 files changed

+7974
-1845
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+7974
-1845
lines changed

.github/workflows/main.yaml

Lines changed: 82 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ on:
1212
jobs:
1313

1414
test-rust:
15-
runs-on: ubuntu-18.04
15+
runs-on: ubuntu-22.04
1616
defaults:
1717
run:
1818
working-directory: ./src/rust/rust-stream
1919
steps:
20-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v4
2121
- name: Setup project
2222
run: rustup install nightly
2323
- name: Compile project
@@ -28,25 +28,25 @@ jobs:
2828
run: ./target/release/rust-stream --arraysize 2048
2929

3030
test-java:
31-
runs-on: ubuntu-18.04
31+
runs-on: ubuntu-22.04
3232
defaults:
3333
run:
3434
working-directory: ./src/java/java-stream
3535
steps:
36-
- uses: actions/checkout@v2
36+
- uses: actions/checkout@v4
3737
- name: Test build project
3838
run: ./mvnw clean package
3939
- name: Test run
4040
if: ${{ ! cancelled() }}
4141
run: java -jar target/java-stream.jar --arraysize 2048
4242

4343
test-julia:
44-
runs-on: ubuntu-18.04
44+
runs-on: ubuntu-22.04
4545
defaults:
4646
run:
4747
working-directory: ./src/julia/JuliaStream.jl
4848
steps:
49-
- uses: actions/checkout@v2
49+
- uses: actions/checkout@v4
5050
- name: Setup project
5151
run: julia --project -e 'import Pkg; Pkg.instantiate()'
5252
- name: Test run PlainStream.jl
@@ -70,14 +70,22 @@ jobs:
7070

7171

7272
test-cpp:
73-
runs-on: ubuntu-18.04
73+
runs-on: ubuntu-22.04
7474
steps:
75-
- uses: actions/checkout@v2
75+
- name: Maximize build space
76+
uses: easimon/maximize-build-space@v8
77+
with:
78+
root-reserve-mb: 8192
79+
swap-size-mb: 512
80+
remove-android: 'true'
81+
remove-codeql: 'true'
82+
83+
- uses: actions/checkout@v4
7684

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

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

97105
- name: Test compile gcc @ CMake 3.13
98106
if: ${{ ! cancelled() }}
@@ -167,4 +175,65 @@ jobs:
167175
run: ./src/ci-test-compile.sh ./build dpcpp all ${{ env.CMAKE_3_18_BIN }}
168176
- name: Test compile hipsycl @ CMake 3.18
169177
if: ${{ ! cancelled() }}
170-
run: ./src/ci-test-compile.sh ./build hipsycl all ${{ env.CMAKE_3_18_BIN }}
178+
run: ./src/ci-test-compile.sh ./build hipsycl all ${{ env.CMAKE_3_18_BIN }}
179+
180+
- name: Test compile gcc @ CMake 3.20
181+
if: ${{ ! cancelled() }}
182+
run: ./src/ci-test-compile.sh ./build gcc all ${{ env.CMAKE_3_20_BIN }}
183+
- name: Test compile clang @ CMake 3.20
184+
if: ${{ ! cancelled() }}
185+
run: ./src/ci-test-compile.sh ./build clang all ${{ env.CMAKE_3_20_BIN }}
186+
- name: Test compile nvhpc @ CMake 3.20
187+
if: ${{ ! cancelled() }}
188+
run: ./src/ci-test-compile.sh ./build nvhpc all ${{ env.CMAKE_3_20_BIN }}
189+
- name: Test compile aocc @ CMake 3.20
190+
if: ${{ ! cancelled() }}
191+
run: ./src/ci-test-compile.sh ./build aocc all ${{ env.CMAKE_3_20_BIN }}
192+
- name: Test compile aomp @ CMake 3.20
193+
if: ${{ ! cancelled() }}
194+
run: ./src/ci-test-compile.sh ./build aomp all ${{ env.CMAKE_3_20_BIN }}
195+
- name: Test compile hip @ CMake 3.20
196+
if: ${{ ! cancelled() }}
197+
run: ./src/ci-test-compile.sh ./build hip all ${{ env.CMAKE_3_20_BIN }}
198+
- name: Test compile dpcpp @ CMake 3.20
199+
if: ${{ ! cancelled() }}
200+
run: ./src/ci-test-compile.sh ./build dpcpp all ${{ env.CMAKE_3_20_BIN }}
201+
- name: Test compile hipsycl @ CMake 3.20
202+
if: ${{ ! cancelled() }}
203+
run: ./src/ci-test-compile.sh ./build hipsycl all ${{ env.CMAKE_3_20_BIN }}
204+
205+
- name: Test compile gcc @ CMake 3.24
206+
if: ${{ ! cancelled() }}
207+
run: ./src/ci-test-compile.sh ./build gcc all ${{ env.CMAKE_3_24_BIN }}
208+
- name: Test compile clang @ CMake 3.24
209+
if: ${{ ! cancelled() }}
210+
run: ./src/ci-test-compile.sh ./build clang all ${{ env.CMAKE_3_24_BIN }}
211+
- name: Test compile nvhpc @ CMake 3.24
212+
if: ${{ ! cancelled() }}
213+
run: ./src/ci-test-compile.sh ./build nvhpc all ${{ env.CMAKE_3_24_BIN }}
214+
- name: Test compile aocc @ CMake 3.24
215+
if: ${{ ! cancelled() }}
216+
run: ./src/ci-test-compile.sh ./build aocc all ${{ env.CMAKE_3_24_BIN }}
217+
- name: Test compile aomp @ CMake 3.24
218+
if: ${{ ! cancelled() }}
219+
run: ./src/ci-test-compile.sh ./build aomp all ${{ env.CMAKE_3_24_BIN }}
220+
- name: Test compile hip @ CMake 3.24
221+
if: ${{ ! cancelled() }}
222+
run: ./src/ci-test-compile.sh ./build hip all ${{ env.CMAKE_3_24_BIN }}
223+
- name: Test compile dpcpp @ CMake 3.24
224+
if: ${{ ! cancelled() }}
225+
run: ./src/ci-test-compile.sh ./build dpcpp all ${{ env.CMAKE_3_24_BIN }}
226+
- name: Test compile hipsycl @ CMake 3.24
227+
if: ${{ ! cancelled() }}
228+
run: ./src/ci-test-compile.sh ./build hipsycl all ${{ env.CMAKE_3_24_BIN }}
229+
230+
test-futhark:
231+
runs-on: ubuntu-22.04
232+
steps:
233+
- uses: actions/checkout@v4
234+
- name: Prepare Futhark compiler
235+
uses: diku-dk/install-futhark@HEAD
236+
with:
237+
version: 'latest'
238+
- run: cmake -Bbuild -H. -DMODEL=futhark -DFUTHARK_BACKEND=multicore
239+
- run: cmake --build build

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,18 @@ sycl-stream
1010
hip-stream
1111
tbb-stream
1212

13+
src/fortran/BabelStream
14+
src/fortran/BabelStream.*
15+
1316
*.o
1417
*.bc
1518
*.sycl
1619
*.tar
1720
*.gz
1821
*.a
22+
*.mod
23+
*.cub
24+
*.ptx
1925

2026
KokkosCore_config.*
2127

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,32 @@
22
All notable changes to this project will be documented in this file.
33

44
## Unreleased
5+
### Added
6+
- Ability to build Kokkos and RAJA versions against existing packages.
7+
- Thrust managed memory.
8+
- HIP managed memory.
9+
- New implementation using SYCL2020 USM (sycl2020-acc) and renamed original `sycl2020` to `sycl2020-acc`.
10+
- New implementation in Fortran
11+
- New implementation in [Futhark](https://futhark-lang.org/)
12+
- Data initialisation and read-back timing for all models, including Java, Scala, Julia, and Rust
13+
- Add support for the latest Aparapi (3.0.0) and TornadoVM (0.15.x) for Java
14+
- JuliaStream.jl published to registry (pending #113)
15+
516
### Changed
17+
- Fix std-data/std-indices compatibility with oneDPL, NVHPC, and AdaptiveCpp (a.k.a. hipSYCL).
618
- RAJA CUDA CMake build issues resolved.
19+
- Kokkos build updates (CXX version upgraded to C++17).
20+
- Fix CUDA memory limit check.
21+
- Fix CUDA CMake options for `-DMEM` and `-DCMAKE_CUDA_FLAGS`.
22+
- Use long double for `check_solution` in case of large problem size.
23+
- OneAPI DPCPP compiler is deprecated in favour of ICPX, so added new build option to SYCL 2020 version.
24+
- Updates to the HIP kernels and API usage.
25+
- Number of thread-blocks in CUDA dot kernel implementation changed to 1024.
26+
- Fix compatibility of `sycl2020` (now `sycl2020-acc`) with AdaptiveCpp.
27+
- Bumped Julia compat to 1.9
28+
- Bumped Scala to 3.3.1
29+
- Bumped Rust to 1.74.0-nightly (13e6f24b9 2023-09-23)
30+
- Upgrade CI to Ubuntu 22.04
731

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

CMakeLists.txt

Lines changed: 84 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
22

3-
project(BabelStream VERSION 4.0 LANGUAGES CXX)
3+
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
4+
cmake_policy(SET CMP0135 NEW)
5+
endif ()
6+
7+
project(BabelStream VERSION 5.0 LANGUAGES CXX C)
48

59
# uncomment for debugging build issues:
610
#set(CMAKE_VERBOSE_MAKEFILE ON)
@@ -27,8 +31,6 @@ endmacro()
2731
# the final executable name
2832
set(EXE_NAME babelstream)
2933

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

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

76+
option(USE_TBB "Enable the oneTBB library for *supported* models. Enabling this on models that
77+
don't explicitly link against TBB is a no-op, see description of your selected
78+
model on how this is used." OFF)
79+
80+
option(FETCH_TBB "Fetch (download) the oneTBB library for *supported* models. This uses CMake's
81+
FetchContent feature. Specify version by setting FETCH_TBB_VERSION" OFF)
82+
set(FETCH_TBB_VERSION "v2021.10.0" CACHE STRING "Specify version of oneTBB to use if FETCH_TBB is ON")
83+
84+
if (FETCH_TBB)
85+
FetchContent_Declare(
86+
TBB
87+
GIT_REPOSITORY https://github.com/oneapi-src/oneTBB.git
88+
GIT_TAG "${FETCH_TBB_VERSION}"
89+
)
90+
# Don't fail builds on waring (TBB has -Wall while not being free of warnings from unused symbols...)
91+
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
92+
set(TBB_STRICT OFF)
93+
# Not using FetchContent_MakeAvailable (CMake>= 3.14) because we need EXCLUDE_FROM_ALL
94+
FetchContent_GetProperties(TBB)
95+
if (NOT TBB_POPULATED)
96+
FetchContent_Populate(TBB)
97+
add_subdirectory(${tbb_SOURCE_DIR} ${tbb_BINARY_DIR} EXCLUDE_FROM_ALL)
98+
endif ()
99+
endif ()
100+
101+
option(USE_ONEDPL "Enable the oneDPL library for *supported* models. Enabling this on models that
102+
don't explicitly link against DPL is a no-op, see description of your selected
103+
model on how this is used." OFF)
104+
105+
option(FETCH_ONEDPL "Fetch (download) the oneDPL library for *supported* models. This uses CMake's
106+
FetchContent feature. Specify version by setting FETCH_ONEDPL_VERSION" OFF)
107+
set(FETCH_ONEDPL_VERSION "oneDPL-2022.2.0-rc1" CACHE STRING "Specify version of oneTBB to use if FETCH_ONEDPL is ON")
108+
109+
if (FETCH_ONEDPL)
110+
FetchContent_Declare(
111+
oneDPL
112+
GIT_REPOSITORY https://github.com/oneapi-src/oneDPL.git
113+
GIT_TAG "${FETCH_ONEDPL_VERSION}"
114+
)
115+
string(TOLOWER ${USE_ONEDPL} ONEDPL_BACKEND)
116+
# XXX oneDPL looks for omp instead of openmp, which mismatches(!) with ONEDPL_PAR_BACKEND if using find_package
117+
if (ONEDPL_BACKEND STREQUAL "openmp")
118+
set(ONEDPL_BACKEND omp)
119+
endif ()
120+
# Not using FetchContent_MakeAvailable (CMake>= 3.14) because we need EXCLUDE_FROM_ALL
121+
FetchContent_GetProperties(oneDPL)
122+
if (NOT oneDPL_POPULATED)
123+
FetchContent_Populate(oneDPL)
124+
if (USE_TBB)
125+
macro(find_package NAME)
126+
if ("${NAME}" STREQUAL "TBB")
127+
message(STATUS "Discarding oneDPL's call to find_package(${NAME} ${ARGN})")
128+
else ()
129+
_find_package(${NAME} ${ARGN})
130+
endif ()
131+
endmacro()
132+
endif ()
133+
add_subdirectory(${onedpl_SOURCE_DIR} ${onedpl_BINARY_DIR} EXCLUDE_FROM_ALL)
134+
135+
# Fixup oneDPL's omission on setting DPCPP definitions.
136+
# We do this after the creation of the oneDPL target.
137+
if (ONEDPL_BACKEND MATCHES "^(dpcpp|dpcpp_only)$")
138+
target_compile_definitions(oneDPL INTERFACE ONEDPL_USE_DPCPP_BACKEND=1)
139+
endif ()
140+
141+
endif ()
142+
endif ()
143+
144+
74145
# include our macros
75146
include(cmake/register_models.cmake)
76147

@@ -84,12 +155,14 @@ register_model(hip HIP HIPStream.cpp)
84155
register_model(cuda CUDA CUDAStream.cu)
85156
register_model(kokkos KOKKOS KokkosStream.cpp)
86157
register_model(sycl SYCL SYCLStream.cpp)
87-
register_model(sycl2020 SYCL2020 SYCLStream2020.cpp)
158+
register_model(sycl2020-acc SYCL2020 SYCLStream2020.cpp)
159+
register_model(sycl2020-usm SYCL2020 SYCLStream2020.cpp)
88160
register_model(acc ACC ACCStream.cpp)
89161
# defining RAJA collides with the RAJA namespace so USE_RAJA
90162
register_model(raja USE_RAJA RAJAStream.cpp)
91163
register_model(tbb TBB TBBStream.cpp)
92164
register_model(thrust THRUST ThrustStream.cu) # Thrust uses cu, even for rocThrust
165+
register_model(futhark FUTHARK FutharkStream.cpp)
93166

94167

95168
set(USAGE ON CACHE BOOL "Whether to print all custom flags for the selected model")
@@ -101,6 +174,12 @@ else ()
101174
message(STATUS "Selected model : ${MODEL}")
102175
endif ()
103176

177+
if (MODEL STREQUAL "sycl2020")
178+
message(FATAL_ERROR "
179+
Model sycl2020 has been renamed to sycl2020-acc, and a new sycl2020-usm model is now available.
180+
Please use sycl2020-acc for SYCL2020 style accessors and sycl2020-usm for USM")
181+
endif ()
182+
104183
# load the $MODEL.cmake file and setup the correct IMPL_* based on $MODEL
105184
load_model(${MODEL})
106185

@@ -151,6 +230,7 @@ include_directories(src)
151230
add_executable(${EXE_NAME} ${IMPL_SOURCES} src/main.cpp)
152231
target_link_libraries(${EXE_NAME} PUBLIC ${LINK_LIBRARIES})
153232
target_compile_definitions(${EXE_NAME} PUBLIC ${IMPL_DEFINITIONS})
233+
target_include_directories(${EXE_NAME} PUBLIC ${IMPL_DIRECTORIES})
154234

155235
if (CXX_EXTRA_LIBRARIES)
156236
target_link_libraries(${EXE_NAME} PUBLIC ${CXX_EXTRA_LIBRARIES})

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ BabelStream is currently implemented in the following parallel programming model
3838
- C++ Parallel STL
3939
- Kokkos
4040
- RAJA
41-
- SYCL and SYCL 2020
41+
- SYCL and SYCL2020 (USM and accessors)
4242
- TBB
4343
- Thrust (via CUDA or HIP)
44+
- Futhark
4445

4546
This project also contains implementations in alternative languages with different build systems:
4647
* Julia - [JuliaStream.jl](./src/julia/JuliaStream.jl)
@@ -101,7 +102,7 @@ The source for each model's implementations are located in `./src/<model>`.
101102

102103
Currently available models are:
103104
```
104-
omp;ocl;std;std20;hip;cuda;kokkos;sycl;sycl2020;acc;raja;tbb;thrust
105+
omp;ocl;std-data;std-indices;std-ranges;hip;cuda;kokkos;sycl;sycl2020;acc;raja;tbb;thrust;futhark
105106
```
106107

107108
#### Overriding default flags
@@ -165,7 +166,7 @@ The `MODEL` variant selects one implementation of BabelStream to build.
165166
166167
Currently available models are:
167168
```
168-
omp;ocl;std;std20;hip;cuda;kokkos;sycl;sycl2020;acc;raja;tbb;thrust
169+
omp;ocl;std-data;std-indices;std-ranges;hip;cuda;kokkos;sycl;sycl2020-acc;sycl2020-usm;acc;raja;tbb;thrust
169170
```
170171
171172
### GNU Make

src/.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
**/*.gz
1717
**/*.a
1818

19+
**/*.swp
20+
1921
**/KokkosCore_Config_*
2022

2123
**/.DS_Store
@@ -26,4 +28,4 @@ cmake-build-*/
2628
CMakeFiles/
2729
.idea/
2830
.vscode/
29-
.directory
31+
.directory

src/acc/ACCStream.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ void ACCStream<T>::nstream()
149149
template <class T>
150150
T ACCStream<T>::dot()
151151
{
152-
T sum = 0.0;
152+
T sum{};
153153

154154
int array_size = this->array_size;
155155
T * restrict a = this->a;

0 commit comments

Comments
 (0)