Environment

Initialization

Kokkos.initializeFunction
initialize(;
    num_threads=nothing,
    device_id=nothing, map_device_id_by=nothing,
    disable_warnings=nothing, print_configuration=nothing,
    tune_internals=nothing,
    tools_libs=nothing, tools_args=nothing
)

Initializes Kokkos by calling Kokkos::initialize().

The keyword arguments build are passed to the InitializationSettings constructor which is then passed to Kokkos::initialize(). A value of nothing keeps the default behaviour of Kokkos.

The Kokkos wrapper library is loaded (and recompiled if needed) if it is not already the case. This locks the current Configuration Options until the end of the current Julia session.

source
Kokkos.is_initializedFunction
is_initialized()

Return Kokkos::is_initialized().

Can be called before the wrapper library is loaded.

source
Kokkos.finalizeFunction
finalize()

Calls Kokkos::finalize().

Info

If Kokkos isn't already finalized, finalize will be called automatically at process exit through Base.atexit.

Warning

Kokkos requires that all view destructors should be called before calling finalize. This is done automatically for all views allocated through Kokkos.jl upon calling finalize, and therefore they will all become invalid.

source
Kokkos.is_finalizedFunction
is_finalized()

Return Kokkos::is_finalized().

Can be called before the wrapper library is loaded.

source
Kokkos.Wrapper.load_wrapper_libFunction
load_wrapper_lib(; no_compilation=false, no_git=false, loading_bar=true)

Configures, compiles then loads the wrapper library using the current Configuration Options.

After calling this method, all configuration options become locked.

If no_compilation is true, then the CMake project of the wrapper library will not be configured or compiled.

If no_git is true, then if we need to use the Kokkos installation of the package, no Git operations (clone + checkout) will be done.

Both no_compilation=true and no_git=true are needed when initializing Kokkos.jl in non-root MPI processes.

source

Configuration

Kokkos.build_in_tmpFunction
build_in_tmp()

Sets the build_dir configuration option to a temporary directory, cleaned at the end of the Julia session.

source
Kokkos.build_in_projectFunction
build_in_project(name = ".kokkos-build")

Sets the build_dir configuration option to the directory name in the active project directory.

source
Kokkos.versioninfoFunction
versioninfo(io::IO = stdout; internal=true, verbose=false)

Print the version and various information about the underlying Kokkos library.

If internal is true, Kokkos::print_configuration() is called. verbose is passed to that call.

This function does not require for Kokkos to be initialized, however if internal=true then the output will be incomplete.

source
Kokkos.print_configurationFunction
print_configuration(io::IO, verbose::Bool)

Prints the internal Kokkos configuration to io.

Equivalent to Kokkos::print_configuration(out, verbose).

source
Kokkos.set_omp_varsFunction
set_omp_vars(;
    places = "cores",
    bind = "close",
    num_threads = Threads.nthreads()
)

Helper function to set the main OpenMP environment variables used by Kokkos. It must be called before calling initialize.

places sets OMP_PLACES. bind sets OMP_PROC_BIND. num_threads sets OMP_NUM_THREADS.

Note that since Julia threads and OpenMP threads are decoupled, there is no constraint imposed by Julia on OpenMP threads: there can be as many threads as needed.

Warning

Pinning the Julia threads with ThreadPinning.jl or with the JULIA_EXCLUSIVE environment variable can have an impact on OpenMP thread affinities, making the OpenMP variables useless.

source

Synchronization

Constants

Kokkos.KOKKOS_VERSIONConstant
KOKKOS_VERSION::VersionNumber

The Kokkos version currently loaded.

nothing if Kokkos is not yet loaded. See kokkos_version for the version of the packaged installation of Kokkos, which is defined before loading Kokkos.

source