diff --git a/Cargo.toml b/Cargo.toml index ba0ec54..09d0a0f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ description = "OpenCL Stream execution framework" repository = "https://github.com/parallel-programming-hwr/ocl-stream-rs" license = "Apache-2.0" readme = "README.md" -version = "0.2.0" +version = "0.2.1" authors = ["Trivernis "] edition = "2018" diff --git a/README.md b/README.md index de5b2ef..15d3f61 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ fn main() { let stream_executor = OCLStreamExecutor::new(pro_que); // execute a closure that provides the results in the given stream - let mut stream = stream_executor.execute(|ctx| { + let mut stream = stream_executor.execute_unbound(|ctx| { let pro_que = ctx.pro_que(); let tx = ctx.sender(); let input_buffer = pro_que.buffer_builder().len(100).fill_val(0u32).build()?; diff --git a/src/executor/context.rs b/src/executor/context.rs index ec3e193..695512b 100644 --- a/src/executor/context.rs +++ b/src/executor/context.rs @@ -4,7 +4,7 @@ * See LICENSE for more information */ -use crate::executor::ocl_stream::OCLStreamSender; +use crate::executor::stream::OCLStreamSender; use ocl::ProQue; /// Context passed to the executing closure diff --git a/src/executor/mod.rs b/src/executor/mod.rs index 4a1f363..27c3140 100644 --- a/src/executor/mod.rs +++ b/src/executor/mod.rs @@ -5,14 +5,14 @@ */ use crate::executor::context::ExecutorContext; -use crate::executor::ocl_stream::{OCLStream, OCLStreamSender}; +use crate::executor::stream::{OCLStream, OCLStreamSender}; use crate::utils::result::OCLStreamResult; use ocl::ProQue; use scheduled_thread_pool::ScheduledThreadPool; use std::sync::Arc; pub mod context; -pub mod ocl_stream; +pub mod stream; /// Stream executor for OpenCL Programs #[derive(Clone)] @@ -24,6 +24,12 @@ pub struct OCLStreamExecutor { impl OCLStreamExecutor { /// Creates a new OpenCL Stream executor + /// ```rust + /// use ocl::ProQue; + /// use ocl_stream::OCLStreamExecutor; + /// let pro_que = ProQue::builder().src("__kernel void bench_int() {}").build().unwrap(); + /// let executor = OCLStreamExecutor::new(pro_que); + /// ``` pub fn new(pro_que: ProQue) -> Self { Self { pro_que, @@ -54,7 +60,7 @@ impl OCLStreamExecutor { F: Fn(ExecutorContext) -> OCLStreamResult<()> + Send + Sync + 'static, T: Send + Sync + 'static, { - let (stream, sender) = ocl_stream::bounded(size); + let (stream, sender) = stream::bounded(size); self.execute(func, sender); stream @@ -67,7 +73,7 @@ impl OCLStreamExecutor { F: Fn(ExecutorContext) -> OCLStreamResult<()> + Send + Sync + 'static, T: Send + Sync + 'static, { - let (stream, sender) = ocl_stream::unbounded(); + let (stream, sender) = stream::unbounded(); self.execute(func, sender); stream diff --git a/src/executor/ocl_stream.rs b/src/executor/stream.rs similarity index 100% rename from src/executor/ocl_stream.rs rename to src/executor/stream.rs diff --git a/src/lib.rs b/src/lib.rs index 4517b0f..edd9dce 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,7 +7,7 @@ pub mod executor; pub mod utils; -pub use executor::ocl_stream; +pub use executor::stream; pub use executor::OCLStreamExecutor; // reexport the ocl crate pub use ocl;