Skip to content

Commit 55f110e

Browse files
committed
Fixing cufile on windows
1 parent 91f508d commit 55f110e

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

src/cufile/result.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,13 @@ pub unsafe fn read(
101101
file_offset: i64,
102102
buf_ptr_offset: i64,
103103
) -> Result<isize, CufileError> {
104-
let bytes_read = sys::cuFileRead(fh, buf_ptr_base, size, file_offset, buf_ptr_offset);
104+
let bytes_read = sys::cuFileRead(
105+
fh,
106+
buf_ptr_base,
107+
size,
108+
file_offset as _,
109+
buf_ptr_offset as _,
110+
);
105111

106112
if bytes_read == -1 {
107113
Err(CufileError::IO(std::io::Error::last_os_error()))
@@ -126,7 +132,13 @@ pub unsafe fn write(
126132
file_offset: i64,
127133
buf_ptr_offset: i64,
128134
) -> Result<isize, CufileError> {
129-
let bytes_written = sys::cuFileWrite(fh, buf_ptr_base, size, file_offset, buf_ptr_offset);
135+
let bytes_written = sys::cuFileWrite(
136+
fh,
137+
buf_ptr_base,
138+
size,
139+
file_offset as _,
140+
buf_ptr_offset as _,
141+
);
130142

131143
if bytes_written == -1 {
132144
Err(CufileError::IO(std::io::Error::last_os_error()))

src/cufile/safe.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,13 @@ impl Cufile {
156156

157157
// NOTE: placeholder, shouldn't ever reach this
158158
#[cfg(not(any(target_os = "linux", target_os = "windows")))]
159-
let descr = Default::default();
159+
let descr = sys::CUfileDescr_t {
160+
type_: sys::CUfileFileHandleType::CU_FILE_HANDLE_TYPE_USERSPACE_FS,
161+
handle: sys::CUfileDescr_t__bindgen_ty_1 {
162+
handle: std::ptr::null_mut(),
163+
},
164+
fs_ops: std::ptr::null(),
165+
};
160166

161167
let handle = result::handle_register(&descr)?;
162168

0 commit comments

Comments
 (0)