Skip to content

Build HIP and SYCL

Sam Reeve edited this page May 17, 2023 · 1 revision

HIP

Building Kokkos

To build Kokkos for AMD GPU, analogous settings to the NVIDIA build above are needed. This includes enabling the Kokkos HIP backend, using hipcc compiler, and setting the architecture of the GPU being used:

    # TODO: YOU, THE USER, SHOULD CHANGE THIS TO YOUR DESIRED PATH
    export KOKKOS_INSTALL_DIR=`pwd`/kokkos/build/install

    cd ./kokkos
    mkdir build
    cd build
    cmake \
      -D CMAKE_BUILD_TYPE="Release" \
      -D CMAKE_CXX_COMPILER=hipcc \
      -D CMAKE_INSTALL_PREFIX=$KOKKOS_INSTALL_DIR \
      -D Kokkos_ENABLE_HIP=ON \
      -D Kokkos_ARCH_VEGA908=ON \
      .. ;
    make install

Building Cabana

    # TODO: YOU, THE USER, SHOULD CHANGE THESE TO YOUR DESIRED PATHS
    export KOKKOS_INSTALL_DIR=`pwd`/kokkos/build/install
    export CABANA_INSTALL_DIR=`pwd`/Cabana/build/install

    cd ./Cabana
    mkdir build
    cd build
    cmake \
     -D CMAKE_BUILD_TYPE="Release" \
     -D CMAKE_CXX_COMPILER=hipcc \
     -D CMAKE_PREFIX_PATH=$KOKKOS_INSTALL_DIR \
     -D CMAKE_INSTALL_PREFIX=$CABANA_INSTALL_DIR \
     -D Cabana_ENABLE_TESTING=ON \
     -D Cabana_ENABLE_EXAMPLES=ON \
     .. ;
    make install

Note the only necessary change here is the hipcc compiler; the Cabana_REQUIRE_HIP can also be used if desired.

SYCL

Building Kokkos

To build Kokkos for Intel GPU, similar settings to the above GPU builds are needed. This includes enabling the Kokkos SYCL backend, using an appropriate compiler, and setting the architecture of the GPU being used. Kokkos SYCL also requires C++17.

    # TODO: YOU, THE USER, SHOULD CHANGE THIS TO YOUR DESIRED PATH
    export KOKKOS_INSTALL_DIR=`pwd`/kokkos/build/install

    cd ./kokkos
    mkdir build
    cd build
    cmake \
      -D CMAKE_BUILD_TYPE="Release" \
      -D CMAKE_CXX_STANDARD=17 \
      -D CMAKE_CXX_COMPILER=icpx \
      -D CMAKE_INSTALL_PREFIX=$KOKKOS_INSTALL_DIR \
      -D Kokkos_ENABLE_SYCL=ON \
      -D Kokkos_ARCH_INTEL_GEN=ON \
      .. ;
    make install

Building Cabana

    # TODO: YOU, THE USER, SHOULD CHANGE THESE TO YOUR DESIRED PATHS
    export KOKKOS_INSTALL_DIR=`pwd`/kokkos/build/install
    export CABANA_INSTALL_DIR=`pwd`/Cabana/build/install

    cd ./Cabana
    mkdir build
    cd build
    cmake \
     -D CMAKE_BUILD_TYPE="Release" \
     -D CMAKE_CXX_STANDARD=17 \
     -D CMAKE_CXX_COMPILER=icpx \
     -D CMAKE_PREFIX_PATH=$KOKKOS_INSTALL_DIR \
     -D CMAKE_INSTALL_PREFIX=$CABANA_INSTALL_DIR \
     -D Cabana_ENABLE_TESTING=ON \
     -D Cabana_ENABLE_EXAMPLES=ON \
     .. ;
    make install

Again, the only necessary change here is for the compiler to match the one used to build Kokkos (the Cabana_REQUIRE_SYCL flag is optional).

Clone this wiki locally