Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pkestene/euler2d_kokkos

Simple 2d finite volume solver for Euler equations using c++ kokkos library
https://github.com/pkestene/euler2d_kokkos

cea cfd cpp cuda euler finite-volume gpu gpu-computing hydrodynamics kokkos miniapp multithreading openmp parallelism parallelization performance-portability

Last synced: 4 days ago
JSON representation

Simple 2d finite volume solver for Euler equations using c++ kokkos library

Awesome Lists containing this project

README

        

[![Build Status](https://travis-ci.org/pkestene/euler2d_kokkos.svg?branch=master)](https://travis-ci.org/pkestene/euler2d_kokkos)

![C/C++ CI](https://github.com/pkestene/euler2d_kokkos/workflows/C/C++%20CI/badge.svg)

![blast2d_1024x1536](https://github.com/pkestene/euler2d_kokkos/blob/master/blast2d.gif)

This miniapp solves the [compressible fluid dynamics (Euler) equations](https://en.wikipedia.org/wiki/Euler_equations_(fluid_dynamics)) using 2D cartesian grids, parallelized for shared memory system. The full application for 2D/3D grids with [MPI](https://www.mpi-forum.org/) and [Kokkos](https://github.com/kokkos/kokkos) is available here : https://github.com/pkestene/euler_kokkos

# Get the source

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):

```shell
git clone [email protected]:pkestene/euler2d_kokkos.git
```

# Build

We strongly recommend the out-of-source build, so that one can have one build directory per architecture.

## If you already have Kokkos installed

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.

```shell
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
```shell
cd src
./euler2d ./test_implode.ini
```

## Kokkos is not already installed => build for Kokkos/OpenMP

To build for Kokkos/OpenMP backend (which is the default backend):
```shell
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
```shell
cd src
./euler2d ./test_implode.ini
```

Optionally, you can (recommended) activate HWLOC support by turning ON the flag Kokkos_ENABLE_HWLOC.

## Kokkos is not already installed => build for Kokkos/CUDA

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:
```shell
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.

```shell
cd src
./euler2d ./test_implode.ini
```