Here, the purpose of this exercise is to just understand the simplistic Kokkos hello world program hello.cpp
, and the Makefile
implementing Kokkos inline build strategy.
- If not already done, clone the Kokkos repository in a location of your choice by
git clone https://github.com/kokkos/kokkos.git
. Set environment variableKOKKOS_PATH
to point into that directory, e.g.
export KOKKOS_PATH=/projappl/proj_xxxx/$USER/kokkos
You can also add KOKKOS_PATH=/projappl/proj_xxxx/$USER/kokkos
to the beginning of the Makefile
-
Edit the Makefile and pick up
CXX
,KOKKOS_DEVICES
, andKOKKOS_ARCH
appropriate to your system. We recommend that you try this exercise both in LUMI and Mahti, and if your laptop has software development tools (e.g. GCC) also there. Build the code by typingmake
to compile. If you encounter compilation errors, make sure the backend compiler for the desired architecture is available, ie,nvcc
for Mahti (usemodule load cuda
) orhipcc
for Lumi (usemodule load rocm
). -
Run on Lumi or Mahti by
srun ./executable
(add required flags according to the underlying system and user, eg, --account=XXX, --partition=YYY, etc.)
The exercise code is based on ENCCS material (CC-BY-4.0 license).