Environment
Initialization
Kokkos.initialize
— Functioninitialize(;
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.
Kokkos.is_initialized
— Functionis_initialized()
Return Kokkos::is_initialized()
.
Can be called before the wrapper library is loaded.
Kokkos.finalize
— Functionfinalize()
Calls Kokkos::finalize()
.
Kokkos.is_finalized
— Functionis_finalized()
Return Kokkos::is_finalized()
.
Can be called before the wrapper library is loaded.
Kokkos.Wrapper.load_wrapper_lib
— Functionload_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.
Kokkos.is_kokkos_wrapper_loaded
— Functionis_kokkos_wrapper_loaded()
Return true
if load_wrapper_lib
has been called.
Configuration
Kokkos.build_in_scratch
— Functionbuild_in_scratch()
Sets the build_dir
configuration option to a scratch directory (the default).
Kokkos.build_in_tmp
— Functionbuild_in_tmp()
Sets the build_dir
configuration option to a temporary directory, cleaned at the end of the Julia session.
Kokkos.build_in_project
— Functionbuild_in_project(name = ".kokkos-build")
Sets the build_dir
configuration option to the directory name
in the active project directory.
Kokkos.configinfo
— Functionconfiginfo(io::IO = stdout)
Print information about all configuration options.
Kokkos.versioninfo
— Functionversioninfo(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.
Kokkos.print_configuration
— Functionprint_configuration(io::IO, verbose::Bool)
Prints the internal Kokkos configuration to io
.
Equivalent to Kokkos::print_configuration(out, verbose)
.
Kokkos.set_omp_vars
— Functionset_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.
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.
Synchronization
Kokkos.fence
— Functionfence()
fence(label::String)
Wait for all asynchronous Kokkos operations to complete.
Equivalent to Kokkos::fence()
.
Constants
Kokkos.KOKKOS_VERSION
— ConstantKOKKOS_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.