Skip to content

A simple example application using cmake build system, and kokkos as a third party

Notifications You must be signed in to change notification settings

tpadioleau/mandelbrot_kokkos_cmake

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mandelbrot

Mandelbrot_kokkos_cmake

This is a simple example to illustrate one possible way to use Kokkos inside an application built with CMake.

Download / clone sources

Please note that in this application kokkos is used as a git submodule. As such kokkos will be built by the top level cmake using the provided architecture information.

In order to download both mandelbrot_kokkos sources and kokkos itself, either use the following lines

git clone https://github.com/tpadioleau/mandelbrot_kokkos_cmake.git
cd mandelbrot_kokkos
git submodule init
git submodule update

or do the same in one step (clone mandelbrot_kokkos and kokkos):

git clone --recursive https://github.com/tpadioleau/mandelbrot_kokkos_cmake.git

How to build ?

  1. Build with target no device
mkdir build_serial && cd build_serial
cmake ..
make
# then you can run the application
./src/mandelbrot_kokkos
  1. Build with target device OpenMP
mkdir build_openmp && cd build_openmp
cmake -DCMAKE_CXX_COMPILER=YOUR COMPILER HERE -DKOKKOS_ENABLE_OPENMP=ON ..
make
# then you can run the application
./src/mandelbrot_kokkos

Optionally you can enable HWLOC by passing -DKOKKOS_ENABLE_HWLOC=ON on cmake's command line (or in ccmake curse gui).

  1. Build with target device CUDA

You NEED to use nvcc_wrapper as the CXX compiler. nvcc_wrapper is located in kokkos sources, bin subdirectory.

mkdir build_cuda && cd build_cuda
cmake -DCMAKE_CXX_COMPILER=path/to/kokkos/bin/nvcc_wrapper -DKOKKOS_ENABLE_CUDA=ON -DKOKKOS_ARCH=Maxwell ..
make
# then you can run the application as before
./src/mandelbrot_kokkos

Of course, you will need to adapt variable KOKKOS_ARCH to your actual GPU architecture (use cuda sample device_query to probe the architecture).

About

A simple example application using cmake build system, and kokkos as a third party

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 68.6%
  • CMake 31.4%