Hyperspectral imaging parallelization

August 30, 2023 · View on GitHub

license

Hyperspectral imaging parallelization with different programming models such as OpenMP, SYCL or Kokkos

1. Requirements

To run the code, you will need to install the following dependencies beforehand:

  • >= Make 4.2
  • >= CMake 3.20.5
  • >= Intel oneAPI Base Toolkit 2023.1, which contains the Intel C++ compiler and the oneMKL library.

Up till this point, you should be able to run the Sequential, OpenMP and SYCL(on CPU and Intel GPU) codes.

1.1 Kokkos Requirements

To run with Kokkos implementation you should install Kokkos and Kokkos Kernels libraries. The versions tested were:

  • Kokkos 4.0.00
  • Kokkos Kernels 3.7.01

Since the Kokkos implementation were thought to run under CPU, NVIDIA GPU and Intel GPU, we greatly recommend you to create two builds of both Kokkos and Kokkos Kernels. The first one could run under CUDA (nvcc) supporting CPU under OpenMP and NVIDIA GPU under CUDA. The second build should support Intel GPUs using oneAPI SYCL as backend.

1.2 CUDA Requirements

To enable CUDA GPU support for running with OpenMP, SYCL, and Kokkos, you will need to install the following:

Additionally for SYCL, you will require:

2. How to run it?

You first need to download the repository:

> git clone https://github.com/artecs-group/hyperspectral_imaging_parallelization
> cd hyperspectral_imaging_parallelization
> git checkout develop

Now, set the environment variables for the standalon compiler, Kokkos or oneAPI toolkit. In the case of oneAPI:

> source path/to/oneapi/setvars.sh

To build the project you can use the following variables to specify in which device you want to run and what programmin model to use.

VariableDescriptionValuesDefault
IMPLSelects the implementation to run.sequential, sycl, openmp, kokkosnon-default
DEVICESelects the device whre to run the code.cpu, igpu (Intel GPU), ngpu (NVIDIA GPU)cpu
PDEBUGUsed to show debug info during the execution.yes, nono
KOKKOS_INSTALL_DIRPath where the user had installed Kokkospath/opt/kokkos/build/
KOKKOS_KERNELS_INSTALL_DIRPath where the user had installed Kokkos Kernelspath/opt/kokkos-kernels/build

Then, to build and run the code in sequential mode for the CPU:

> mkdir build
> cd build
> cmake .. -DCMAKE_CXX_COMPILER=icpx -DIMPL=sequential
> make
> make run

NOTE: just for sequential, sycl, openmp, you must include the following flag "-DCMAKE_CXX_COMPILER=icpx"

2.1 Running with Kokkos

In order to execute with Kokkos framework, you have to set where Kokkos is installed, e.g.:

> mkdir build
> cd build
> cmake .. -DIMPL=kokkos -DKOKKOS_INSTALL_DIR=/opt/kokkos/build -DKOKKOS_KERNELS_INSTALL_DIR=/opt/kokkos-kernels/build
> make
> make run

Acknowledgements

This paper has been supported by the EU (FEDER), the Spanish MINECO and CM under grants S2018/TCS-4423, PID2021-126576NB-I00 funded by MCIN/AEI/10.13039/501100011033 and by “ERDF A way of making Europe”.