A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://kokkos.github.io/kokkos-core-wiki/API/core/utilities/num_devices.html below:

Kokkos::num_devices - Kokkos documentation

Toggle table of contents sidebar

Kokkos::num_devices

Defined in header <Kokkos_Core.hpp>

[[nodiscard]] int num_devices() noexcept;  // (since 4.3)

Returns the number of available devices on the system or -1 if only host backends are enabled.

Notes

Kokkos::num_devices() may be used to determine the number of devices that are available to Kokkos for execution. It is one of the few runtime functions that may be called before Kokkos::initialize() or after Kokkos::finalize().

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

int main(int argc, char* argv[]) {
  if (Kokkos::num_devices() == 0) {
    std::cerr << "no device available for execution\n";
    return 1;
  }
  Kokkos::initialize(argc, argv);
  // do stuff
  Kokkos::finalize();
  return 0;
}

See also

device_id: returns the id of the device used by Kokkos

num_threads: returns the number of threads used by Kokkos

initialize: initializes the Kokkos execution environment

InitializationSettings: settings for initializing Kokkos


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4