docsapi referencedarkforest-cuda-runtime-cuda_device_count
API Referencecrate: darkforest-cudasince v0.1.0-alpha

cuda_device_count

Returns number of available CUDA-capable devices on host.

cuda_device_count

darkforest-cuda module: runtime since v0.1.0-alpha

Signature

rust
pub fn cuda_device_count() -> Result<usize, CudaError>

Overview

Returns number of available CUDA-capable devices on host.

Invariants & Design Principles

  • Invariant: Adheres strictly to Dark Forest 64-byte alignment and strided memory invariants.
  • Invariant: Verified via unit tests, Miri memory model, and PyTorch cross-checks.

Usage Example

rust
// Example calling cuda_device_count
let _res = darkforest_cuda::runtime::cuda_device_count();

Related Components