Add empty implementation of cuDeviceGetLuid (#30)

This function is required by recent versions of CUDA runtime on Windows
This commit is contained in:
Andrzej Janik 2021-01-08 19:43:46 +01:00 committed by GitHub
parent 237a6c113a
commit 5cd9a5fbc4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View file

@ -2232,6 +2232,15 @@ pub extern "C" fn cuDeviceGetUuid(uuid: *mut CUuuid, dev: CUdevice) -> CUresult
r#impl::device::get_uuid(uuid, dev.decuda()).encuda()
}
#[cfg_attr(not(test), no_mangle)]
pub extern "C" fn cuDeviceGetLuid(
luid: *mut ::std::os::raw::c_char,
deviceNodeMask: *mut ::std::os::raw::c_uint,
dev: CUdevice,
) -> CUresult {
r#impl::device::get_luid(luid, deviceNodeMask, dev.decuda()).encuda()
}
#[cfg_attr(not(test), no_mangle)]
pub extern "C" fn cuDeviceTotalMem_v2(bytes: *mut usize, dev: CUdevice) -> CUresult {
r#impl::device::total_mem_v2(bytes, dev.decuda()).encuda()

View file

@ -3,7 +3,7 @@ use crate::cuda;
use cuda::{CUdevice_attribute, CUuuid_st};
use std::{
cmp, mem,
os::raw::{c_char, c_int},
os::raw::{c_char, c_int, c_uint},
ptr,
sync::atomic::{AtomicU32, Ordering},
};
@ -350,6 +350,13 @@ pub fn get_uuid(uuid: *mut CUuuid_st, dev_idx: Index) -> Result<(), CUresult> {
Ok(())
}
// TODO: add support if Level 0 exposes it
pub fn get_luid(luid: *mut c_char, dev_node_mask: *mut c_uint, _dev_idx: Index) -> Result<(), CUresult> {
unsafe { ptr::write_bytes(luid, 0u8, 8) };
unsafe { *dev_node_mask = 0 };
Ok(())
}
pub fn primary_ctx_get_state(
dev_idx: Index,
flags: *mut u32,