Compilation

Kokkos Projects

Kokkos.KokkosProjectType
KokkosProject

Abstract type representing a C++ project using Kokkos, where it is located and how to compile it using which options.

source
Kokkos.CMakeKokkosProjectType
CMakeKokkosProject(source_dir, target_lib_path;
    target = "all",
    build_type = "Release",
    build_dir = joinpath(source_dir, "cmake-build-$(lowercase(build_type))"),
    cmake_options = [],
    kokkos_path = nothing,
    kokkos_options = nothing,
    inherit_options = true
)

Construct a new Kokkos project in source_dir built to build_dir using CMake. After compilation, the target library should be found at joinpath(build_dir, target_lib_path).

The shared library extension of target_lib_path can be omitted, as it is added if needed by Libdl.dlopen.

target is the CMake target needed to build the library.

build_type controls the CMAKE_BUILD_TYPE variable, and cmake_options contains all other options passed to each CMake command.

kokkos_path sets the Kokkos_ROOT CMake variable, to be used by find_package.

kokkos_path should be left to nothing in most cases, as it will be replaced by the installation directory of Kokkos correctly configured with the current options (see get_kokkos_install_dir).

Warning

The Kokkos version of the project must match the version used by the internal wrapper library. If this is not the case, the program may silently fail. Use the kokkos_path configuration variable to change the Kokkos version throughout Kokkos.jl.

kokkos_options is a Dict of Kokkos variables needed to configure the project (see the docs). Values of type Bool are converted to "ON" and "OFF", all other types directly are converted to strings. Each variable is then passed to CMake as "-D$(name)=$(value)".

If inherit_options is true, the cmake_options of the Kokkos wrapper project will be appended at the front of the new project's cmake_options. kokkos_options are not inherited here since Kokkos's CMake mechanisms do this automatically.

All commands are invoked from the current working directory.

source
CMakeKokkosProject(project::CMakeKokkosProject, target, target_lib_path)

Construct a project from another, for a different target.

The source and build directories will stay the same, and options will be copied.

source
Kokkos.lib_pathFunction
lib_path(project::KokkosProject)

Return the path to the target library for project.

source
Kokkos.optionsFunction
options(project::KokkosProject)

Return the set of options to the target library for project.

source
Kokkos.option!Function
option!(project::KokkosProject, name::String, val; prefix="Kokkos_")

Sets the given Kokkos option for the project to val. This will result in the following compilation option: "-D$(prefix)$(name)=$(val)".

source
Kokkos.configuration_changedFunction
configuration_changed(project::KokkosProject)

Return true if the configuration of project changed, and needs to be recompiled.

source
Kokkos.configureFunction
configure(project::KokkosProject)

Configure the project with its current options.

source
Kokkos.compileFunction
compile(project::KokkosProject)

Builds all source files of the project.

If the project's configuration changed, it is reconfigured first.

source
Kokkos.cleanFunction
clean(project::KokkosProject; reset=false)

Clean the project, forcing a recompilation of all source files.

If reset == true, the entire build_dir is removed, therefore ensuring that no cached CMake variable can interfere with the build.

source

Utilities

Kokkos.Wrapper.get_jlcxx_rootFunction
get_jlcxx_root()

Return the directory where the file "JlCxxConfig.cmake" is located for the currently loaded CxxWrap package.

Setting the CMake variable JlCxx_ROOT to this path allows the CMake function find_package to load JlCxx.

source
Kokkos.Wrapper.get_kokkos_dirFunction
get_kokkos_dir()

The directory where the sources of Kokkos are located.

If KOKKOS_PATH is not set, it defaults to the sources of Kokkos packaged with Kokkos.jl.

This directory is meant to be passed to the CMake function add_subdirectory in order to load Kokkos as an in-tree build.

source
Kokkos.Wrapper.get_kokkos_install_dirFunction
get_kokkos_install_dir()

The directory where Kokkos is installed.

This directory can be passed to the CMake function find_package through the Kokkos_ROOT variable in order to load Kokkos with the same options and backends as the ones used by Kokkos.jl.

source