num_threads

Defined in header <Kokkos_Core.hpp>

Usage

Kokkos::num_threads();

Returns the number of concurrent threads that are used by DefaultHostExecutionSpace.

Interface

[[nodiscard]] int num_threads() noexcept
Returns:

The number of concurrent threads used by DefaultHostExecutionSpace.

Added in version 4.1.

Example

#include <Kokkos_Core.hpp>
#include <iostream>

int main(int argc, char* argv[]) {
    Kokkos::initialize(argc, argv);
    {
      std::cout << "num_threads: " << Kokkos::num_threads() << '\n';
    }
    Kokkos::finalize();
}

See Also

See also

device_id

Returns the id of the device used by Kokkos

num_devices

Returns the number of devices available to Kokkos

print_configuration

Prints Kokkos configuration information to an output stream

initialize

Initialize the Kokkos execution environment

InitializationSettings

Settings for initializing Kokkos