Kokkos::device_id#

Defined in header <Kokkos_Core.hpp>

[[nodiscard]] int device_id() noexcept;  // (since 4.1)

Returns the id of the device that is used by DefaultExecutionSpace or -1 if only host backends are enabled.


See also

num_devices: returns the number of devices available to Kokkos

num_threads: returns the number of threads used by Kokkos

initialize: initializes the Kokkos execution environment

InitializationSettings: settings for initializing Kokkos