This is the multi-page printable view of this section. Click here to print.
Kokkos
1 - Building Kokkos with CMake on SCOREC (rhel9) machines
- Clone the Kokkos Repository: Create a new directory called Kokkos and clone Kokkos repository from GitHUb in that directory. You can do this using Git:
git clone https://github.com/kokkos/kokkos.git
- Load required modules: Kokkos requires compiler and cmake to build. Load the following modules. (Note: The modules are as per rhel9 machines. You can’t use it on rhel7 machines.)
module use /opt/scorec/spack/rhel9/v0201_4/lmod/linux-rhel9-x86_64/Core/
module load gcc/12.3.0-iil3lno mpich/4.1.1-xpoyz4t cuda/12.1.1-zxa4msk
module load cmake/3.20.0
- Configure with CMake: Create a new file config.sh (you can name anything) in a source directory. Inside config.sh, add the following CMake instructions:
cmake -S . \
-B build \
-DCMAKE_CXX_COMPILER=g++ \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_INSTALL_PREFIX=/lore/<username>/Kokkos/Install \
-DKokkos_ENABLE_OPENMP=ON
Build and Install: Run the config.sh file with the command
. config.sh
and go to thebuild
directory (cd build
). Run the commandmake install
.Add in your environment variable: Add the executable to the
LD_LIBRARY_PATH
environment variable. Use the following command to add to the environment variable.
export LD_LIBRARY_PATH=/lore/<username>/Kokkos/Install/lib64:$LD_LIBRARY_PATH
2 - Building kokkos-tutorials
The following instructions is for building a new Kokkos library for each exercise. For more details, check Kokkos Tutorials.
- Clone the Kokkos Tutorials Repository: The tutorials for the Kokkos C++ programming. You can clone the tutorials with the following command.
git clone https://github.com/kokkos/kokkos-tutorials.git
- Load required modules: Kokkos tutorials requires compiler and make to build. Load the following modules. (Note: The modules are as per rhel9 machines. You can’t use it on rhel7 machines.)
module use /opt/scorec/spack/rhel9/v0201_4/lmod/linux-rhel9-x86_64/Core/
module load gcc/12.3.0-iil3lno mpich/4.1.1-xpoyz4t cuda/12.1.1-zxa4msk
Find the GPU architecture of your machine: To find out the GPU architecture of your machine, follow this.
Build with make: Inside kokkos-tutorials folder, go to
Exercises
folder.In each exercise folder, there is a makefile to build each exercise. Open the Makefile and make the following changes.
KOKKOS_PATH = /path/to/kokkos
KOKKOS_DEVICES = "<your GPU language>"
KOKKOS_ARCH = "<your GPU Architecture>"
For example,
KOKKOS_PATH = /lore/<username>/Kokkos/kokkos`
KOKKOS_DEVICES = "Cuda"
KOKKOS_ARCH = "Ada89"
After making changes, run the command make -j8
- Run the executable: Once configuring and building the exercise, run an exexutable. ```bash
./