This miniapp solves the compressible fluid dynamics (Euler) equations using 2D cartesian grids, parallelized for shared memory system. The full application for 2D/3D grids with MPI and Kokkos is available here : https://github.com/pkestene/euler_kokkos
Our miniApp uses kokkos as a git submodule, configured to use the develop
branch of kokkos.
In order to download the sources all-in-one (miniApp + kokkos):
git clone [email protected]:pkestene/euler2d_kokkos.git
We strongly recommend the out-of-source build, so that one can have one build directory per architecture.
Just make sure that your env variable CMAKE_PREFIX_PATH
point to the location where Kokkos where installed. More precisely if Kokkos is installed in KOKKOS_ROOT
, you add $KOKKOS_ROOT/lib/cmake
to your CMAKE_PREFIX_PATH
; this way kokkos will be found automagically by cmake, and the right Kokkos backend will be selected.
mkdir -p _build; cd _build
cmake -DEULER2D_KOKKOS_BUILD=OFF ..
make
You should now have executable euler2d. You can run a simply implode test like this
cd src
./euler2d ./test_implode.ini
To build for Kokkos/OpenMP backend (which is the default backend):
mkdir -p _build/openmp; cd _build/openmp
cmake -DEULER2D_KOKKOS_BUILD=ON -DEULER2D_KOKKOS_BACKEND=OpenMP ../..
make
You should now have executable euler2d. You can run a simply implode test like this
cd src
./euler2d ./test_implode.ini
Optionally, you can (recommended) activate HWLOC support by turning ON the flag Kokkos_ENABLE_HWLOC.
Obviously, you need to have Nvidia/CUDA driver and toolkit installed on your platform.
- if you are building on a machine with a GPU, the Kokkos build system will auto detect the GPU architecture
- if you are building on a front node of a supercomputer, you will probably need to tell cmake for which GPU architecture you want to build; e.g. add flag
-DKokkos_ARCH_AMPERE80=ON
to build for Nvidia Ampere A100 architecture.
Example configuration:
mkdir _build/cuda; cd _build/cuda
cmake -DEULER2D_KOKKOS_BUILD=ON -DEULER2D_KOKKOS_BACKEND=Cuda ../..
make
Be aware that, kokkos will not use Nvidia compiler nvcc
directly, but will use a wrapper instead (located in Kokkos source directory).
then make
should give you a working executable euler2d
running on GPU.
cd src
./euler2d ./test_implode.ini