From 18c9fc82c8237c0e263ba1e2ab66497ea1ff3080 Mon Sep 17 00:00:00 2001 From: Cedric Chevalier Date: Thu, 13 Jun 2024 23:13:25 +0200 Subject: [PATCH 1/4] Adding kokkos+openmp environment --- .gitignore | 2 ++ spack-envs/kokkos/openmp/spack.yaml | 12 ++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 spack-envs/kokkos/openmp/spack.yaml diff --git a/.gitignore b/.gitignore index 52652cd8..b0487284 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ spack-build/ spack-build-env.txt spack-build-out.txt +spack.lock +.spack-env/ cmake_install.cmake CMakeFiles/ LibInstalls/ diff --git a/spack-envs/kokkos/openmp/spack.yaml b/spack-envs/kokkos/openmp/spack.yaml new file mode 100644 index 00000000..ee822d3d --- /dev/null +++ b/spack-envs/kokkos/openmp/spack.yaml @@ -0,0 +1,12 @@ +# This is a Spack Environment file. +# +# It describes a set of packages to be installed, along with +# configuration settings. +spack: + # add package specs to the `specs` list + specs: + - kokkos+openmp~serial + view: false + concretizer: + unify: true + From 4aa2e238498b7d333a261e22238d58b37ed23b78 Mon Sep 17 00:00:00 2001 From: Cedric Chevalier Date: Thu, 13 Jun 2024 23:17:42 +0200 Subject: [PATCH 2/4] Adding kokkos-kernels+openmp environment --- spack-envs/kokkos-kernels/openmp/spack.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 spack-envs/kokkos-kernels/openmp/spack.yaml diff --git a/spack-envs/kokkos-kernels/openmp/spack.yaml b/spack-envs/kokkos-kernels/openmp/spack.yaml new file mode 100644 index 00000000..f7ae7994 --- /dev/null +++ b/spack-envs/kokkos-kernels/openmp/spack.yaml @@ -0,0 +1,11 @@ +# This is a Spack Environment file. +# +# It describes a set of packages to be installed, along with +# configuration settings. +spack: + # add package specs to the `specs` list + specs: + - kokkos-kernels+openmp + view: false + concretizer: + unify: true From 1d596b2eabd48506898d9387f019232544beddd3 Mon Sep 17 00:00:00 2001 From: Cedric Chevalier Date: Fri, 14 Jun 2024 12:40:43 +0200 Subject: [PATCH 3/4] Update README.md for spack --- README.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/README.md b/README.md index 7b848bfe..5c35df95 100644 --- a/README.md +++ b/README.md @@ -81,3 +81,39 @@ in the `Exercises` directory. Compatible means: * X86 with a NVIDIA V100 GPU * kokkos was cloned to ${HOME}/Kokkos/kokkos + +# Using `spack` to build Kokkos and Kokkos-Kernels + +[`spack`](https://spack.io) is a package manager for supercomputers, Linux, and macOS. It makes installing scientific +software easy. With `spack`, you can build Kokkos and its dependencies with a single command. + +We provide environments to ease the setup of Kokkos and Kokkos-Kernels for the tutorials. The environments are located +in the `spack-envs` directory. + +To use the environments, first install `spack` by following the +instructions [here](https://spack.readthedocs.io/en/latest/getting_started.html). + +To build Kokkos and Kokkos-Kernels with OpenMP backend, you can use the following commands: + +```bash +source /share/spack/setup-env.sh +spack compiler add # find compilers on your system +spack env activate spack-envs/kokkos-kernels/openmp +spack install +spack load kokkos-kernels +``` + +Now you can go to the tutorial directory and build the tutorials using the installed Kokkos-Kernels library. + +For example: + +```bash +# Select the exercise, and cheat to the solution directory +cd Exercises/kokkoskernels/GaussSeidel/Solution +# Configure the build +cmake -B build_dir +# Build the exercise +cmake --build build_dir +# Run the exercise +./build_dir/gauss_seidel +``` From 18fa35e3e512af080cb33800a70ff5dfa377136b Mon Sep 17 00:00:00 2001 From: Cedric Chevalier Date: Fri, 14 Jun 2024 12:47:54 +0200 Subject: [PATCH 4/4] Fix end-of-file --- spack-envs/kokkos/openmp/spack.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/spack-envs/kokkos/openmp/spack.yaml b/spack-envs/kokkos/openmp/spack.yaml index ee822d3d..f156f458 100644 --- a/spack-envs/kokkos/openmp/spack.yaml +++ b/spack-envs/kokkos/openmp/spack.yaml @@ -9,4 +9,3 @@ spack: view: false concretizer: unify: true -