mkdir build cd build # Suppose we enable OpenMP&Serial for CPU, CUDA for GPU. # For each platform, we can only enable ONE framework. # Please choose proper compiler for your environment. cmake .. -DKokkos_ENABLE_CUDA=ON -DKokkos_ENABLE_OpenMP=ON -DKokkos_ENABLE_Serial=ON \\ -DCMAKE_INSTALL_PREFIX=/path/to/install -DCMAKE_CXX_COMPILER=g++ \\ -DCUDA_ROOT=/path/to/cuda # Build and install make -j32 && make install
一个Kokkos示例程序
此时若需要在程序中引入Kokkos,可以使用CMake寻找系统中的Kokkos并与程序进行链接
1 2 3 4 5
# ... find_package(Kokkos REQUIRED) # find other libraries # add your source code target_link_library(myTarget Kokkos::kokkos)