# Standalone kernel from the Patatrack application

## Introduction

A single kernel (first of the chain) has been extracted into a
standalone program to exercise various portability technologies. It
has minimal dependencies to other software packages that depend on the
technology:
* CPU implementation (dependencies)
* CUDA implementation
  * depends on CUDA
* [Alpaka](https://github.com/ComputationalRadiationPhysics/alpaka) implementation (with and without [Cupla](https://github.com/ComputationalRadiationPhysics/cupla))
  * Depends on boost
  * TBB backend depends on TBB
  * CUDA backend depends on CUDA
* [Kokkos](https://github.com/kokkos/kokkos) implementation
  * CUDA backend epends on CUDA
* [oneAPI/DPC++](https://software.intel.com/en-us/oneapi) implementation

The code can be found from https://github.com/makortel/pixel-standalone/ .

## Instructions for Cori


### Building

In some directory
```bash
module load cuda
export CUDA_BASE=$CUDA_ROOT

# Download Kokkos
git clone --branch 3.0.00 https://github.com/kokkos/kokkos.git
export KOKKOS_BASE=$PWD/kokkos

# Download app
git clone https://github.com/makortel/pixel-standalone.git
cd pixel-standalone

# Build CPU test program
make CUDA_BASE=$CUDA_ROOT naive
# Build CUDA test program
make CUDA_BASE=$CUDA_ROOT cuda
# Build Kokkos test programs (CPU serial, CPU OpenMP, CUDA)
make CUDA_BASE=$CUDA_ROOT kokkos
```

### Running


```bash
module load esslurm
salloc -A m2845 -C gpu -N 1 --gres=gpu:1 -t 30
srun -n 1 -c 1 --pty /bin/bash -i 

# CPU test program
./test-naive
# CUDA test program
./test-cuda

# Kokkos CPU Serial
./test-kokkos-serial
# Kokkos CPU OpenMP
./test-kokkos-openmp
# Kokkos CUDA
./test-kokkos-cuda
```
