INNER CODE UNIT · Rust

opaque_handles_have_the_expected_representation

NVIDIA/nccl · contrib/nccl4rust/crates/nccl-device-sys/src/lib.rs:164

    fn opaque_handles_have_the_expected_representation() {
        assert_eq!(size_of::<ncclDevComm_t>(), 0);
        assert_eq!(align_of::<ncclDevComm_t>(), 1);
        assert_eq!(size_of::<ncclWindow_t>(), size_of::<*mut c_void>());
        assert_eq!(align_of::<ncclWindow_t>(), align_of::<*mut c_void>());
    }

    #[cfg(not(feature = "cuda-oxide"))]
    mod host_c_abi_signatures {
        use super::*;

        // These assignments intentionally have no runtime assertions:
        // compiling them detects accidental changes to the host C ABI
        // declarations. `#[device]` gives these declarations Rust ABI inside
        // a CUDA-Oxide build, so that configuration is compile-checked by the
        // device smoke package instead.
        const _: unsafe extern "C" fn(*const ncclDevComm_t) -> i32 = nccl4rust_dev_comm_rank;
        const _: unsafe extern "C" fn(*const ncclDevComm_t) -> i32 = nccl4rust_dev_comm_n_ranks;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…