Line data Source code
1 0 : \cond NEVER 2 : Distributed under the MIT License. 3 : See LICENSE.txt for details. 4 : \endcond 5 : 6 : # GPU support {#gpu_support} 7 : 8 : \tableofcontents 9 : 10 : # Overview 11 : 12 : \warning GPU support is experimental and this page will be updated as the 13 : implementation matures. 14 : 15 : SpECTRE supports GPU acceleration through the [Kokkos](https://github.com/kokkos/kokkos) 16 : library. 17 : 18 : ## Build configuration 19 : 20 : To enable GPU support, set the CMake option `-D SPECTRE_KOKKOS=ON` when 21 : configuring the build. Either point CMake to a Kokkos installation with 22 : `-D Kokkos_ROOT=path/to/kokkos` or set `-D SPECTRE_FETCH_MISSING_DEPS=ON` to 23 : fetch Kokkos automatically and build it as part of SpECTRE. You also have to 24 : select a parallelization backend for Kokkos and possibly more configuration 25 : options like the GPU architecture to build for. Read the 26 : [Kokkos documentation](https://kokkos.org/kokkos-core-wiki/get-started/configuration-guide.html) 27 : for details on how to configure Kokkos. Here's an example for fetching Kokkos 28 : automatically and building it as part of SpECTRE with the CUDA backend: 29 : 30 : ```sh 31 : cmake -D SPECTRE_KOKKOS=ON \ 32 : -D SPECTRE_FETCH_MISSING_DEPS=ON \ 33 : -D Kokkos_ENABLE_CUDA=ON \ 34 : ... 35 : ``` 36 : 37 : Here's an example for using an existing Kokkos installation: 38 : 39 : ```sh 40 : cmake -D SPECTRE_KOKKOS=ON \ 41 : -D Kokkos_ROOT=path/to/kokkos/build \ 42 : -D CMAKE_CXX_COMPILER=path/to/kokkos/bin/nvcc_wrapper \ 43 : ... 44 : ``` 45 : 46 : When building Kokkos separately with the CUDA backend, you have to set the 47 : following configuration options: 48 : 49 : - `Kokkos_ENABLE_CUDA_CONSTEXPR=ON` 50 : - `Kokkos_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE`