InitializationSettings
#
Defined in header <KokkosCore.cpp>
Usage:
auto settings = Kokkos::InitializationSettings()
.set_num_threads(8)
.set_device_id(0)
.set_disable_warnings(false);
New in version 3.7: InitializationSettings
is a class that can be used to define the settings for
initializing Kokkos programmatically without having to call the two parameter
form (argc
and argv
) of Kokkos::initialize().
It was introduced as a replacement for the Kokkos::InitArguments structure.
Interface#
-
class InitializationSettings#
-
InitializationSettings();#
Constructs a new object that does not contain any value for any of the settings.
-
InitializationSettings(InitArguments const &arguments);#
DEPRECATED Converts the deprecated structure to a new object. Data members from the structure that compare equal to their default value are assumed to be unset. Let
PARAMETER-NAME
be a valid setting of typePARAMETER-TYPE
as defined in the table below.
-
InitializationSettings &set_PARAMETER_NAME(PARAMETER_TYPE value);#
Replaces the content of the
PARAMETER_NAME
setting withvalue
and return a reference to the object.value
must be a valid value forPARAMETER_NAME
.
-
bool has_PARAMETER_NAME() const;#
Checks whether the object contains a value for the
PARAMETER_NAME
setting. Returnstrue
if it contains a value,false
otherwise.
-
PARAMETER_TYPE get_PARAMETER_NAME() const;#
Accesses the contained value for the
PARAMETER_NAME
setting. The behavior is undefined if the object does not contain a value for settingPARAMETER_NAME
.
-
InitializationSettings();#
The table below summarizes what settings are available.
PARAMETER_NAME |
PARAMETER_TYPE |
Description |
---|---|---|
|
|
Number of threads to use with the host parallel backend. Must be greater than zero. |
|
|
Device to use with the device parallel backend. Valid IDs are zero to number of GPU(s) available for execution minus one. |
|
|
Strategy to select a device automatically from the GPUs available for execution. Must be either |
|
|
Whether to disable warning messages. |
|
|
Whether to print the configuration after initialization. |
|
|
Whether to allow autotuning internals instead of using heuristics. |
|
|
Which tool dynamic library to load. Must either be the full path to library or the name of library if the path is present in the runtime library search path (e.g. |
|
|
Query the loaded tool for its command-line options support. |
|
|
Options to pass to the loaded tool as command-line arguments. |
Example#
#include <Kokkos_Core.hpp>
int main() {
Kokkos::initialize(Kokkos::InitializationSettings()
.set_print_configuration(true)
.set_map_device_id_by("random")
.set_num_threads(1));
// ...
Kokkos::finalize();
}
See also#
Kokkos::initialize: initializes the Kokkos execution environment