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
11 changes: 9 additions & 2 deletions .github/workflows/tutorial-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
env:
REGISTRY: ghcr.io
IMAGE_NAME: llnl/raja-suite-tutorial/tutorial
CUDA_ARCHITECTURES: "89"

permissions:
contents: read
Expand All @@ -34,8 +35,14 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: build docker image
run: docker build --build-arg njobs=2 --file containers/tutorial/Dockerfile --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest .
- name: Build Docker image
run: |
docker build --pull \
--build-arg CUDA_ARCHITECTURES="${{ env.CUDA_ARCHITECTURES }}" \
--build-arg njobs=2 \
--file containers/tutorial/Dockerfile \
--tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \
.

- name: push docker image
if: github.event_name != 'pull_request'
Expand Down
17 changes: 8 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.23.1)
cmake_minimum_required(VERSION 3.25.2)

project(RajaSuiteTutorial LANGUAGES C CXX)

Expand All @@ -10,19 +10,18 @@ set (RAJA_ENABLE_EXERCISES Off CACHE BOOL "")
set (ENABLE_DOCUMENTATION Off CACHE BOOL "")
set (ENABLE_BENCHMARKS Off CACHE BOOL "")

set(BLT_CXX_STD "c++14")
include(blt/SetupBLT.cmake)
set(BLT_CXX_STD "c++20")

if (ENABLE_CUDA)
if (DEFINED CMAKE_CUDA_ARCHITECTURES)
if ("${CMAKE_CUDA_ARCHITECTURES}" STREQUAL "70")
message(STATUS "CUDA compute architecture set to 70")
else ()
set(CMAKE_CUDA_ARCHITECTURES "70" CACHE STRING "Set CMAKE_CUDA_ARCHITECTURES to RAJA minimum supported" FORCE)
endif ()
if (NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
set(CMAKE_CUDA_ARCHITECTURES "89" CACHE STRING "Set CMAKE_CUDA_ARCHITECTURES to default 89")
else()
message(STATUS "CUDA compute architecture user-defined to ${CMAKE_CUDA_ARCHITECTURES}")
endif()
endif()

include(blt/SetupBLT.cmake)

add_subdirectory(tpl)
add_subdirectory(Intro_Tutorial)
add_subdirectory(Intermediate_Tutorial)
Expand Down
6 changes: 3 additions & 3 deletions Intro_Tutorial/lessons/02_raja_umpire/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ In this lesson, you will learn how to add RAJA and Umpire as dependencies
to your application.

RAJA and Umpire are included in this project as **targets** that we tell CMake
our application depends on: [RAJA and Umpire Depend](https://github.com/LLNL/raja-suite-tutorial/blob/main/tpl/CMakeLists.txt).
our application depends on: [RAJA and Umpire Dependencies](https://github.com/LLNL/raja-suite-tutorial/blob/main/tpl/CMakeLists.txt).

Additionally, we can specify other dependency targets, such as CUDA, in the
`blt_add_executable` macro for our application executable. The macro has
an argument for this, `DEPENDS_ON`, that you can use to list dependencies.

```
blt_add_executable(
NAME 01_blt_cmake
SOURCES 01_blt_cmake.cpp
NAME 02_raja_umpire
SOURCES 02_raja_umpire.cpp
DEPENDS_ON )
```

Expand Down
4 changes: 2 additions & 2 deletions Intro_Tutorial/lessons/03_umpire_allocator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ with the desired size for your allocation:
void* memory = allocator.allocate(size in bytes);
```

Moving and modifying data in a heterogenous memory system can be subtle
Moving and modifying data in a heterogeneous memory system can be subtle
because you have to keep track of the source and destination memory spaces,
and often use vendor-specific APIs to perform the modifications. In Umpire,
all data modification and movement, regardless of memory resource or platform,
is done using **Umpire Operations**.

Next, we will use the `memset` Operator provided by Umpire's Resource Manager
Next, we will use the `memset` operator provided by Umpire's Resource Manager
to set the memory we just allocated to zero.

Don't forget to deallocate your memory afterwards!
Expand Down
4 changes: 2 additions & 2 deletions Intro_Tutorial/lessons/04_raja_forall/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ for (int i = 0; i < N; ++i) {

Each loop iterate sets the array element at the iterate index to the index
value. Clearly, each iterate is independent of the others. If this OpenMP
kernel were run with M thread, then depending on how the loop work is
kernel were run with M threads, then depending on how the loop work is
scheduled, iterates may be partitioned into chunks of size N/M with each
thread executing one chunk of iterates. This is illustrated in the figure.

Expand Down Expand Up @@ -89,7 +89,7 @@ $ ./bin/04_raja_forall
```

If you need help, you can compare your version of the code to the solution
code using the command `diff 04_raja_forall.cpp solution/04_raja_forall_solution.cpp`.
code using the command `diff 04_raja_forall.cpp 04_raja_forall_solution.cpp`.

Are the array elements that are printed out the same in each case? How do the
execution times compare? Which kernel ran faster?
Expand Down
6 changes: 3 additions & 3 deletions Intro_Tutorial/lessons/05_raja_reduce/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ for (int i = 0; i < N; ++i) {
```

This kernel implementation does not have a race condition. However, the results
could still be non-deterministic due to order in which the values are
could still be non-deterministic due to the order in which the values are
accumulated in the sum in parallel.

It is important to note that not all parallel programming models provide a
Expand All @@ -50,7 +50,7 @@ other reduction operations that RAJA supports, can be found in the
[RAJA Reduction Operations](https://raja.readthedocs.io/en/develop/sphinx/user_guide/feature/reduction.html).

In this lesson, we will use a `RAJA::ReduceSum` object to approximate $\pi$,
the ratio of the area in a circle over its diameter, using a Riemann integral
the ratio of the circle's circumference to its diameter, using a Riemann integral
approximation of the formula
```math
\frac{ \pi }{4} = \tan^{-1}(1) = \int_0^1 \frac{1}{1+x^2}\,dx \approx \sum_{i=0}^{N} \frac{1}{1 + ( (i+0.5) \Delta x )^{2}} \Delta x
Expand Down Expand Up @@ -81,7 +81,7 @@ familiar `3.145...` as expected.

After that, you will find a `TODO` asking you to implement an OpenMP version of
the kernel. You will use `RAJA::omp_parallel_for_exec` for the execution policy
to specialize the `RAJA::forall` template and `RAJA::omp_reduce` for the reduce
to specialize the `RAJA::forall` template and `RAJA::omp_reduce` for the reduction
policy to specialize the `RAJA::ReduceSum` object.

Once you have filled in the correct reduction statement, compile and run:
Expand Down
14 changes: 7 additions & 7 deletions Intro_Tutorial/lessons/07_raja_algs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ run the code:

```
$ make 07_raja_atomic
$ .bin/07_raja_atomic
$ ./bin/07_raja_atomic
```

Additional information about RAJA atomic operation support can be found in
Expand All @@ -108,7 +108,7 @@ partial sums of the input array. To illustrate, consider the following code,
which appears in the file `07_raja_scan.cpp`.

```
constexpr N = 10;
constexpr int N = 10;

int in[N] = {8,-1,2,9,10,3,4,1,6,7};
int is_out[N] = {};
Expand Down Expand Up @@ -143,10 +143,10 @@ The code shows a `RAJA::inclusive_scan` and a `RAJA::exclusive_scan`. Each
scan method is specialized on an execution policy. RAJA scan methods use the
same execution policies as `RAJA::forall` methods. Second, the arguments to
the scan methods are RAJA *span* objects that are made using the
`RAJA::make_span` helper method that. The helper method takes the address of
`RAJA::make_span` helper method. The helper method takes the address of
an array element and the number of elements in the span, `N` in this example.

Note that output of the scan operations is similar, but not the same.
Note that the output of the scan operations is similar, but not the same.

The *inclusive scan* fills the output array with partial sums of the input
array. Here, the first element of the input array is 8, so the first element
Expand Down Expand Up @@ -176,7 +176,7 @@ example code above:
RAJA::inclusive_scan_inplace<EXEC_POL>( RAJA::make_span(in, N) );

std::cout << "Output (inclusive in-place): ";
for (int i = 0; i < N; ++i) }
for (int i = 0; i < N; ++i) {
std::cout << in[i] << " ";
}
std::cout << std::endl;
Expand All @@ -185,7 +185,7 @@ std::cout << std::endl;
This code produces the following output, which is the same as the result in the
output array in the `RAJA::inclusive_scan` above:
```
Output (inclusive-inplace): 8 7 9 18 28 31 35 36 42 49
Output (inclusive in-place): 8 7 9 18 28 31 35 36 42 49
```

RAJA provides operators that can be used with all scan methods, such as
Expand All @@ -202,7 +202,7 @@ type to run on a CUDA GPU device. To compile and run the code:

```
$ make 07_raja_scan
$ .bin/07_raja_scan
$ ./bin/07_raja_scan
```

Is the result what you expected it to be? Can you explain why the first value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "umpire/strategy/QuickPool.hpp"

//Uncomment to compile
//#define COMPILE
#define COMPILE

int main()
{
Expand Down
4 changes: 2 additions & 2 deletions Intro_Tutorial/lessons/08_raja_umpire_quick_pool/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ the `ResourceManager`:
This newly created `pool` is an `umpire::Allocator` that uses the `QuickPool`
allocation strategy. In the code example above, we call the
`ResourceManager::makeAllocator` function to create the pool allocator. We
pass in: (1) the name we choose for the the pool, and (2) an allocator we
pass in: (1) the name we choose for the pool, and (2) an allocator we
previously created with the `ResourceManager`. Note that you will need to
include the Umpire header file for the pool type you wish to use, in this case
```
#include "umpire/strategy/QuickPool.hpp"
```

When you have created your QuickPool allocator, uncomment the COMPILE define on line 7;
When you have created your QuickPool allocator, uncomment the COMPILE definition on line 7;
then compile and run the code:
```
$ make 08_raja_umpire_quick_pool
Expand Down
2 changes: 1 addition & 1 deletion Intro_Tutorial/lessons/09_raja_view/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ a data pointer and three extents, one for each View dimension. And so on for
higher dimensions.

The `RAJA::Layout<DIM, TYPE>` takes two template parameters. The `DIM` parameter
is the number of indexing dimension, and the `TYPE` parameter is the data type
is the number of indexing dimensions, and the `TYPE` parameter is the data type
of the indices used to index into the underlying data. For example, a
two-dimensional layout for a view that takes `int` values to index into the
data is defined as:
Expand Down
6 changes: 3 additions & 3 deletions Intro_Tutorial/lessons/10_raja_launch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ policies shown here for the x-dimension (similar policies exist for the y- and z
RAJA::LaunchParams(RAJA::Teams(teams), RAJA::Threads(team_size)),
[=] RAJA_HOST_DEVICE(RAJA::LaunchContext ctx) {

// ``RAJA::Loops`` may be nested within an kernel execution space
// ``RAJA::loop`` may be nested within an kernel execution space
RAJA::loop<LOOP_POL>(ctx, RAJA::TypedRangeSegment<int>(0,M), [&] (int row) {
RAJA::loop<LOOP_POL>(ctx, RAJA::TypedRangeSegment<int>(0,M), [&] (int row) {
RAJA::loop<LOOP_POL>(ctx, RAJA::TypedRangeSegment<int>(0,N), [&] (int col) {
// Computation
});
});

});
```

In this final lesson we invite the particpants to complete the policy selection for a matrix-transpose example.
In this final lesson, we invite the particpants to complete the policy selection for a matrix-transpose example.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[comment]: # (#################################################################)
[comment]: # (Copyright 2016-25, Lawrence Livermore National Security, LLC)
[comment]: # (Copyright 2016-26, Lawrence Livermore National Security, LLC)
[comment]: # (and RAJA project contributors. See the RAJA/LICENSE file)
[comment]: # (for details.)
[comment]: #
Expand Down Expand Up @@ -39,22 +39,22 @@ Other platforms will be similar.
* Tutorial lesson executable files will be located in the *bin* sub-directory
in your build directory

Note that you need to use a CMake version greater or equal to 3.23.1 and you
need a C++ compiler (e.g., g++) that supports c++17.
Note that you need to use a CMake version greater or equal to 3.25.2 and you
need a C++ compiler (e.g., g++) that supports c++20.

* On a CPU-only TOSS4 system:
```
module load cmake/3.23.1
module load cmake/3.25.2
module load gcc/10.3.1
cmake -DCMAKE_CXX_COMPILER=g++ -DBLT_CXX_STD=c++17 -DENABLE_CUDA=Off -DENABLE_OPENMP=On -DRAJA_ENABLE_EXERCISES=Off -DCMAKE_BUILD_TYPE=Release ..
cmake -DCMAKE_CXX_COMPILER=g++ -DBLT_CXX_STD=c++20 -DENABLE_CUDA=Off -DENABLE_OPENMP=On -DRAJA_ENABLE_EXERCISES=Off -DCMAKE_BUILD_TYPE=Release ..
```

* On a GPU-enabled system, such as blueos:
* On a GPU-enabled system:
```
module load cmake/3.23.1
module load gcc/8.3.1
module load cuda/11.2.0
cmake -DBLT_CXX_STD=c++17 -DENABLE_CUDA=On -DENABLE_OPENMP=On -DCMAKE_CUDA_ARCHITECTURES=70 -DCMAKE_CUDA_COMPILER=/usr/tce/packages/cuda/cuda-11.2.0/bin/nvcc -DCUDA_TOOLKIT_ROOT_DIR=/usr/tce/packages/cuda/cuda-11.2.0 -DCMAKE_CUDA_FLAGS=--extended-lambda -DRAJA_ENABLE_EXERCISES=Off -DCMAKE_BUILD_TYPE=Release ..
module load cmake/3.25.2
module load gcc/10.3.1
module load cuda/13.1.1
cmake -DBLT_CXX_STD=c++20 -DENABLE_CUDA=On -DENABLE_OPENMP=On -DCMAKE_CUDA_ARCHITECTURES=89 -DCMAKE_CUDA_COMPILER=/usr/tce/packages/cuda/cuda-13.1.1/bin/nvcc -DCUDA_TOOLKIT_ROOT_DIR=/usr/tce/packages/cuda/cuda-13.1.1 -DCMAKE_CUDA_FLAGS="--extended-lambda --expt-relaxed-constexpr" -DCMAKE_BUILD_TYPE=Release ..
```

License
Expand Down
2 changes: 1 addition & 1 deletion blt
Submodule blt updated 618 files
30 changes: 23 additions & 7 deletions containers/tutorial/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
# SPDX-License-Identifier: (BSD-3-Clause)
###############################################################################

FROM ghcr.io/llnl/radiuss:cuda-12-3-ubuntu-22.04
FROM ghcr.io/llnl/radiuss:cuda-13-0-ubuntu-24.04

ARG USER=rajadev
ARG CUDA_HOME=/usr/local/cuda-13.0
ARG CUDA_ARCHITECTURES=89
ARG njobs=2
ENV HOME /home/${USER}

RUN sudo apt-get update && sudo apt-get install -y supervisor
Expand All @@ -23,15 +26,28 @@ USER ${USER}
COPY --chown=rajadev:rajadev . $HOME/tutorial/

RUN mkdir -p ${HOME}/tutorial/caliper_build && cd ${HOME}/tutorial/caliper_build && \
cmake -DWITH_NVTX=ON -DWITH_CUPTI=ON -DCMAKE_INSTALL_PREFIX=$(pwd) ../tpl/caliper/ && make install -j
cmake -DCUDAToolkit_ROOT=${CUDA_HOME} -DWITH_NVTX=ON -DWITH_CUPTI=ON -DCMAKE_INSTALL_PREFIX=$(pwd) ../tpl/caliper/ && \
make install -j"${njobs}"

ENV CALIPER_PATH ${HOME}/tutorial/caliper_build

RUN mkdir -p ${HOME}/tutorial/build && cd ${HOME}/tutorial/build && \
cmake -DCMAKE_CXX_COMPILER=g++ -DCUDAToolkit_ROOT=/usr/local/cuda-12.3 -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-12.3 -DCMAKE_CUDA_COMPILER=/usr/local/cuda-12.3/bin/nvcc -DENABLE_CUDA=On -DBLT_CXX_STD=c++14 -DCMAKE_CUDA_ARCHITECTURES=70 -DCMAKE_CUDA_FLAGS="--expt-extended-lambda" -DENABLE_OPENMP=On -DRAJA_ENABLE_CALIPER=ON -Dcaliper_DIR=$CALIPER_PATH/share/cmake/caliper .. \
&& make -j RAJA \
&& make -j umpire \
&& make -j
RUN mkdir -p ${HOME}/tutorial/build && cd ${HOME}/tutorial/build && \
cmake -DCMAKE_CXX_COMPILER=g++ \
-DCUDAToolkit_ROOT=${CUDA_HOME} \
-DCUDA_TOOLKIT_ROOT_DIR=${CUDA_HOME} \
-DCMAKE_CUDA_COMPILER=${CUDA_HOME}/bin/nvcc \
-DENABLE_CUDA=On \
-DBLT_CXX_STD=c++20 \
"-DCMAKE_CUDA_ARCHITECTURES=${CUDA_ARCHITECTURES}" \
-DCMAKE_CUDA_FLAGS="--extended-lambda --expt-relaxed-constexpr" \
-DENABLE_OPENMP=On \
-DRAJA_ENABLE_CALIPER=ON \
-Dcaliper_DIR=${CALIPER_PATH}/share/cmake/caliper \
-DCMAKE_BUILD_TYPE=Release \
.. \
&& make -j"${njobs}" RAJA \
&& make -j"${njobs}" umpire \
&& make -j"${njobs}"

USER root
ADD ./containers/tutorial/supervisord.conf /etc/supervisord.conf
Expand Down
2 changes: 1 addition & 1 deletion tpl/caliper
Submodule caliper updated 195 files
2 changes: 1 addition & 1 deletion tpl/raja
Submodule raja updated 1175 files
2 changes: 1 addition & 1 deletion tpl/umpire
Submodule umpire updated 509 files
Loading