mirror of
https://github.com/vosen/ZLUDA.git
synced 2025-04-28 21:47:57 +03:00
Implemet enough of nvml for geekbench
This commit is contained in:
parent
ed98dca26d
commit
22679fff82
2 changed files with 31 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
||||||
use cuda_types::nvml::nvmlReturn_t;
|
use cuda_types::nvml::*;
|
||||||
|
use std::{ffi::CStr, ptr};
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
pub(crate) fn unimplemented() -> nvmlReturn_t {
|
pub(crate) fn unimplemented() -> nvmlReturn_t {
|
||||||
|
@ -10,8 +11,34 @@ pub(crate) fn unimplemented() -> nvmlReturn_t {
|
||||||
nvmlReturn_t::NVML_ERROR_NOT_SUPPORTED
|
nvmlReturn_t::NVML_ERROR_NOT_SUPPORTED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(non_snake_case)]
|
||||||
pub(crate) fn nvmlErrorString(
|
pub(crate) fn nvmlErrorString(
|
||||||
_result: cuda_types::nvml::nvmlReturn_t,
|
_result: cuda_types::nvml::nvmlReturn_t,
|
||||||
) -> *const ::core::ffi::c_char {
|
) -> *const ::core::ffi::c_char {
|
||||||
c"".as_ptr()
|
c"".as_ptr()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(non_snake_case)]
|
||||||
|
pub(crate) fn nvmlInit_v2() -> cuda_types::nvml::nvmlReturn_t {
|
||||||
|
nvmlReturn_t::SUCCESS
|
||||||
|
}
|
||||||
|
|
||||||
|
const VERSION: &'static CStr = c"550.77";
|
||||||
|
|
||||||
|
#[allow(non_snake_case)]
|
||||||
|
pub(crate) fn nvmlSystemGetDriverVersion(
|
||||||
|
result: *mut ::core::ffi::c_char,
|
||||||
|
length: ::core::ffi::c_uint,
|
||||||
|
) -> cuda_types::nvml::nvmlReturn_t {
|
||||||
|
if result == ptr::null_mut() {
|
||||||
|
return nvmlReturn_t::ERROR_INVALID_ARGUMENT;
|
||||||
|
}
|
||||||
|
let version = VERSION.to_bytes_with_nul();
|
||||||
|
let copy_length = usize::min(length as usize, version.len());
|
||||||
|
let slice = unsafe { std::slice::from_raw_parts_mut(result.cast(), copy_length) };
|
||||||
|
slice.copy_from_slice(&version[..copy_length]);
|
||||||
|
if let Some(null) = slice.last_mut() {
|
||||||
|
*null = 0;
|
||||||
|
}
|
||||||
|
nvmlReturn_t::SUCCESS
|
||||||
|
}
|
||||||
|
|
|
@ -27,6 +27,8 @@ macro_rules! implemented_fn {
|
||||||
cuda_base::nvml_function_declarations!(
|
cuda_base::nvml_function_declarations!(
|
||||||
unimplemented_fn,
|
unimplemented_fn,
|
||||||
implemented_fn <= [
|
implemented_fn <= [
|
||||||
nvmlErrorString
|
nvmlErrorString,
|
||||||
|
nvmlInit_v2,
|
||||||
|
nvmlSystemGetDriverVersion
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue