torch_sys_cuda/lib.rs
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * LICENSE file in the root directory of this source tree.
7 */
8
9/// A companion to the `torch-sys` crate that provides bindings for
10/// CUDA-specific functionality from libtorch. This crate is separated out to
11/// make it easier for clients who want to avoid compiling CUDA code.
12///
13/// The same safety logic described in the `torch-sys` crate applies here.
14///
15/// When the `cuda` feature is enabled, the `cuda` and `nccl` modules provide
16/// full CUDA/NCCL bindings. When disabled, `cuda` provides Python-based CUDA
17/// stream/event wrappers (which panic if no GPU is available at runtime), and
18/// `nccl` provides stub types for compilation without NCCL headers.
19pub mod cuda;
20#[cfg(feature = "cuda")]
21pub mod nccl;
22pub mod nccl_common;
23#[cfg(not(feature = "cuda"))]
24pub mod nccl_stubs;
25#[cfg(not(feature = "cuda"))]
26pub use nccl_stubs as nccl;