Skip to content

Commit 11f1ea2

Browse files
committed
Add logo
1 parent 79ad0ff commit 11f1ea2

File tree

6 files changed

+38
-8
lines changed

6 files changed

+38
-8
lines changed

Diff for: Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ readme = "README.md"
1414
lazy_static = "1.4.0"
1515

1616
[features]
17-
default = ["opencl", "cuda"]
17+
default = ["opencl"]
1818
opencl = []
1919
cuda = []
2020
realloc = []

Diff for: README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# custos
1+
![custos logo](assets/custos.png)
2+
3+
<hr/>
24

35
[![Crates.io version](https://img.shields.io/crates/v/custos.svg)](https://crates.io/crates/custos)
46
[![Docs](https://docs.rs/custos/badge.svg?version=0.4.4)](https://docs.rs/custos/0.4.4/custos/)

Diff for: assets/custos.png

39.7 KB
Loading

Diff for: src/libs/opencl/kernel_enqueue.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{mem::size_of, ffi::c_void};
22
use crate::{CLDevice, number::Number, Buffer};
3-
use super::{api::{OCLErrorKind, set_kernel_arg, enqueue_nd_range_kernel}};
3+
use super::api::{OCLErrorKind, set_kernel_arg, enqueue_nd_range_kernel};
44

55
pub trait AsClCvoidPtr {
66
fn as_cvoid_ptr(&self) -> *const c_void;

Diff for: src/libs/opencl/mod.rs

-3
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ pub unsafe fn construct_buffer<'a, T: Copy + Default + Debug>(
5555
) -> crate::Result<Buffer<'a, T>> {
5656

5757
if no_drop.flag == BufFlag::None {
58-
if cfg!(feature="realloc") {
59-
60-
}
6158
return Err(DeviceError::ConstructError.into())
6259
}
6360

Diff for: tests/opencl_unified.rs

+33-2
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ fn slice_add<T: Copy + std::ops::Add<Output = T>>(a: &[T], b: &[T], c: &mut [T])
138138
}
139139
}
140140

141+
/*
141142
#[cfg(feature = "opencl")]
142143
#[test]
143144
fn test_unified_mem_ops() -> Result<(), custos::Error> {
@@ -160,7 +161,7 @@ fn test_unified_mem_ops() -> Result<(), custos::Error> {
160161
161162
Ok(())
162163
}
163-
164+
164165
#[cfg(feature = "opencl")]
165166
#[test]
166167
fn test_unified_mem_iterate() -> custos::Result<()> {
@@ -182,7 +183,7 @@ fn test_unified_mem_iterate() -> custos::Result<()> {
182183
assert_eq!(&cl_data, &[3, 4, 5, 6, 7,]);
183184
184185
Ok(())
185-
}
186+
}*/
186187

187188
#[cfg(not(feature="realloc"))]
188189
#[test]
@@ -200,6 +201,7 @@ fn test_cpu_to_unified() -> custos::Result<()> {
200201
Ok(())
201202
}
202203

204+
203205
#[cfg(not(feature="realloc"))]
204206
#[test]
205207
fn test_cpu_to_unified_leak() -> custos::Result<()> {
@@ -225,5 +227,34 @@ fn test_cpu_to_unified_leak() -> custos::Result<()> {
225227
assert_eq!(cl_cpu_buf.as_slice(), &[1, 2, 3, 4, 5, 6]);
226228
assert_eq!(cl_cpu_buf.read(), &[1, 2, 3, 4, 5, 6]);
227229
}
230+
Ok(())
231+
}
232+
233+
#[cfg(not(feature="realloc"))]
234+
#[test]
235+
fn test_cpu_to_unified_perf() -> custos::Result<()> {
236+
use std::time::Instant;
237+
238+
let cl_dev = CLDevice::new(0)?;
239+
let device = CPU::new();
240+
241+
let mut dur = 0.;
242+
243+
for _ in range(100) {
244+
245+
let mut buf = Cache::get::<i32, CPU>(&device, 6);
246+
247+
buf.copy_from_slice(&[1, 2, 3, 4, 5, 6]);
248+
249+
let start = Instant::now();
250+
let cl_cpu_buf = unsafe { custos::opencl::construct_buffer(&cl_dev, buf)? };
251+
dur += start.elapsed().as_secs_f64();
252+
253+
assert_eq!(cl_cpu_buf.as_slice(), &[1, 2, 3, 4, 5, 6]);
254+
assert_eq!(cl_cpu_buf.read(), &[1, 2, 3, 4, 5, 6]);
255+
}
256+
257+
println!("duration: {dur}");
258+
228259
Ok(())
229260
}

0 commit comments

Comments
 (0)