Hyperspectral imaging parallelization with different programming models such as OpenMP, SYCL or Kokkos
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.
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.
To enable CUDA GPU support for running with OpenMP, SYCL, and Kokkos, you will need to install the following:
- >= CUDA 11.4
Additionally for SYCL, you will require:
- The Intel standalon compiler.
- The oneMKL toolchain for the compiler.
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.
Variable | Description | Values | Default |
---|---|---|---|
IMPL | Selects the implementation to run. | sequential, sycl, openmp, kokkos | non-default |
DEVICE | Selects the device whre to run the code. | cpu, igpu (Intel GPU), ngpu (NVIDIA GPU) | cpu |
PDEBUG | Used to show debug info during the execution. | yes, no | no |
KOKKOS_INSTALL_DIR | Path where the user had installed Kokkos | path | /opt/kokkos/build/ |
KOKKOS_KERNELS_INSTALL_DIR | Path where the user had installed Kokkos Kernels | path | /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"
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
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”.