Skip to content

Tutorials for the Kokkos C++ Performance Portability Programming Ecosystem

License

Notifications You must be signed in to change notification settings

alphataubio/alphataubio-kokkos-tutorials

 
 

Repository files navigation

Kokkos

Kokkos Tutorials

This repository contains tutorials for the Kokkos C++ programming model (github.com/kokkos/kokkos).

The Kokkos Lectures

We are currently running The Kokkos Lectures - an extended version of our Intro-Full Tutorial, spanning 8 modules. For information on that, Slides and Recordings visit: The Kokkos Lectures Wiki

Other Tutorial Compilations

Tutorials in the Intro-Short directory cover

  • simple data parallel patterns and policies
  • multidimensional array views
  • execution and memory spaces

Tutorials in the Intro-Full directory cover

  • simple data parallel patterns and policies
  • multidimensional array views
  • execution and memory spaces
  • thread safety and atomic operations
  • hierarchical data parallel patterns

Building the Tutorials

All the tutorial folders can be built using either the Makefile or the CMake CMakeLists.txt file in each folder.

CMake

CMake can build against an installed Kokkos library or download one automatically using FetchContent.

Without any Kokkos already installed, from an exercise directory, one can run the following:

cmake -B build_dir # -DKokkos_* options
cmake --build build_dir

Kokkos options are described in CMake options.

For example, OpenMP CPU exercises can be built as:

cmake -B build_openmp -DKokkos_ENABLE_OPENMP=ON
cmake --build build_openmp

On Mac, if OpenMP is not available, one can use the Threads backend:

cmake -B build_threads -DKokkos_ENABLE_THREADS=ON
cmake --build build_threads

For a NVIDIA gpu, using gpu arch autodetection:

cmake -B build_cuda -DKokkos_ENABLE_CUDA=ON
cmake --build build_cuda

To pass an already installed Kokkos library, you can use classical CMake variables, such as Kokkos_ROOT, or CMAKE_PREFIX_PATH.

Makefiles

The raw Makefiles require Makefile variables to be properly configured. In most examples, this is KOKKOS_PATH pointing to the Kokkos source directory and KOKKOS_DEVICES which contains the list of device backends to build. This will build a new Kokkos library for each exercise.

If you are on a system compatible to our AWS instances, you can type

make
make test

in the Exercises directory.

Compatible means:

  • X86 with a NVIDIA V100 GPU
  • kokkos was cloned to ${HOME}/Kokkos/kokkos

About

Tutorials for the Kokkos C++ Performance Portability Programming Ecosystem

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 83.7%
  • Makefile 5.7%
  • Shell 3.9%
  • C 3.8%
  • CMake 2.0%
  • Fortran 0.9%