pub struct TaskArg<'a> { /* private fields */ }
Expand description
Represents a data argument for an MCL task along with the use flags (e.g. input, output, access type etc.)
Implementations§
Source§impl<'a> TaskArg<'a>
impl<'a> TaskArg<'a>
Sourcepub fn input_slice<T>(slice: &'a [T]) -> Self
pub fn input_slice<T>(slice: &'a [T]) -> Self
Create a new task input argument from slice
§Examples
let mcl = mcl_rs::MclEnvBuilder::new().initialize();
mcl.create_prog("my_prog",mcl_rs::PrgType::Src)
.with_compile_args("-D MYDEF").load();
let data = vec![0; 4];
let task = mcl.task("my_kernel", 1)
.arg(mcl_rs::TaskArg::input_slice(&data));
Sourcepub fn input_scalar<T>(scalar: &'a T) -> Self
pub fn input_scalar<T>(scalar: &'a T) -> Self
Create a new task input argument from scalar
§Examples
let mcl = mcl_rs::MclEnvBuilder::new().initialize();
mcl.create_prog("my_prog",mcl_rs::PrgType::Src)
.with_compile_args("-D MYDEF").load();
let data = 4;
let task = mcl.task("my_kernel", 1)
.arg(mcl_rs::TaskArg::input_scalar(&data));
Available on crate feature shared_mem
only.
shared_mem
only.Create an new task input argument using a shared memory buffer
§Examples
let mcl = mcl_rs::MclEnvBuilder::new().initialize();
mcl.create_prog("my_prog",mcl_rs::PrgType::Src)
.with_compile_args("-D MYDEF").load();
let num_elems = 100;
let buffer = mcl.create_shared_buffer(mcl_rs::TaskArg::input_shared::<f32>("my_buffer",num_elems).resident(true));
let task = mcl.task("my_kernel",1)
.input_shared(buffer);
Sourcepub fn output_slice<T>(slice: &'a mut [T]) -> Self
pub fn output_slice<T>(slice: &'a mut [T]) -> Self
Create a new task output argument from slice
Returns a new TaskArg
§Examples
let mcl = mcl_rs::MclEnvBuilder::new().initialize();
mcl.create_prog("my_prog",mcl_rs::PrgType::Src)
.with_compile_args("-D MYDEF").load();
let mut data = vec![0; 4];
let mcl_future = mcl.task("my_kernel", 1)
.arg(mcl_rs::TaskArg::output_slice(&mut data));
Available on crate feature shared_mem
only.
shared_mem
only.Create an new task output argument using a shared memory buffer
§Examples
let mcl = mcl_rs::MclEnvBuilder::new().initialize();
mcl.create_prog("my_prog",mcl_rs::PrgType::Src)
.with_compile_args("-D MYDEF").load();
let num_elems = 100;
let buffer = mcl.create_shared_buffer(mcl_rs::TaskArg::output_shared::<f32>("my_buffer",num_elems).resident(true));
let task = mcl.task("my_kernel",1)
.output_shared(buffer);
Sourcepub fn output_scalar<T>(scalar: &'a T) -> Self
pub fn output_scalar<T>(scalar: &'a T) -> Self
Create a new task output argument from scalar
Returns a new TaskArg
§Examples
let mcl = mcl_rs::MclEnvBuilder::new().initialize();
mcl.create_prog("my_prog",mcl_rs::PrgType::Src)
.with_compile_args("-D MYDEF").load();
let mut data = 4;
let mcl_future = mcl.task("my_kernel", 1)
.arg(mcl_rs::TaskArg::output_scalar(&mut data));
Sourcepub fn inout_slice<T>(slice: &'a [T]) -> Self
pub fn inout_slice<T>(slice: &'a [T]) -> Self
Create a new task input+output argument from slice
Returns a new TaskArg
§Examples
let mcl = mcl_rs::MclEnvBuilder::new().initialize();
mcl.create_prog("my_prog",mcl_rs::PrgType::Src)
.with_compile_args("-D MYDEF").load();
let mut data = vec![0; 4];
let mcl_future = mcl.task("my_kernel", 1)
.arg(mcl_rs::TaskArg::inout_slice(&mut data));
Available on crate feature shared_mem
only.
shared_mem
only.Create an new task input+output argument using a shared memory buffer
§Examples
let mcl = mcl_rs::MclEnvBuilder::new().initialize();
mcl.create_prog("my_prog",mcl_rs::PrgType::Src)
.with_compile_args("-D MYDEF").load();
let num_elems = 100;
let buffer = mcl.create_shared_buffer(mcl_rs::TaskArg::inout_shared::<f32>("my_buffer",num_elems).resident(true));
let task = mcl.task("my_kernel",1)
.inout_shared(buffer);
Sourcepub fn inout_scalar<T>(scalar: &'a T) -> Self
pub fn inout_scalar<T>(scalar: &'a T) -> Self
Create a new task input+output argument from scalar
Returns a new TaskArg
§Examples
let mcl = mcl_rs::MclEnvBuilder::new().initialize();
mcl.create_prog("my_prog",mcl_rs::PrgType::Src)
.with_compile_args("-D MYDEF").load();
let mut data = 4;
let mcl_future = mcl.task("my_kernel", 1)
.arg(mcl_rs::TaskArg::inout_scalar(&mut data));
Sourcepub fn resident(self, val: bool) -> Self
pub fn resident(self, val: bool) -> Self
Sets the resident memory flag for the argument
Returns the TaskArg with the preference set
§Examples
let mcl = mcl_rs::MclEnvBuilder::new().initialize();
mcl.create_prog("my_prog",mcl_rs::PrgType::Src)
.with_compile_args("-D MYDEF").load();
let data = vec![0; 4];
let les: [u64; 3] = [1, 1, 1];
let pes: [u64; 3] = [1, 1, 1];
let mcl_future = mcl.task("my_kernel", 1)
.arg(mcl_rs::TaskArg::input_slice(&data).resident(true))
.exec(pes);
futures::executor::block_on(mcl_future);
Sourcepub fn dynamic(self, val: bool) -> Self
pub fn dynamic(self, val: bool) -> Self
Sets the dynamic memory flag for the argument
Returns the TaskArg with the preference set
§Examples
let mcl = mcl_rs::MclEnvBuilder::new().initialize();
mcl.load_prog("my_prog",mcl_rs::PrgType::Src);
let data = vec![0; 4];
let les: [u64; 3] = [1, 1, 1];
let pes: [u64; 3] = [1, 1, 1];
let mcl_future = mcl.task("my_kernel", 1)
.arg(mcl_rs::TaskArg::input_slice(&data).dynamic(true))
.exec(pes);
futures::executor::block_on(mcl_future);
Sourcepub fn done(self, val: bool) -> Self
pub fn done(self, val: bool) -> Self
Sets the done flag for the argument
Returns the TaskArg with the preference set
§Examples
let mcl = mcl_rs::MclEnvBuilder::new().initialize();
mcl.create_prog("my_prog",mcl_rs::PrgType::Src)
.with_compile_args("-D MYDEF").load();
let data = vec![0; 4];
let les: [u64; 3] = [1, 1, 1];
let pes: [u64; 3] = [1, 1, 1];
let mcl_future = mcl.task("my_kernel", 1)
.arg(mcl_rs::TaskArg::input_slice(&data).done(true))
.exec(pes);
futures::executor::block_on(mcl_future);
Sourcepub fn invalid(self, val: bool) -> Self
pub fn invalid(self, val: bool) -> Self
Sets the invalid flag for the argument
Returns the TaskArg with the preference set
§Examples
let mcl = mcl_rs::MclEnvBuilder::new().initialize();
mcl.create_prog("my_prog",mcl_rs::PrgType::Src)
.with_compile_args("-D MYDEF").load();
let data = vec![0; 4];
let les: [u64; 3] = [1, 1, 1];
let pes: [u64; 3] = [1, 1, 1];
let mcl_future = mcl.task("my_kernel", 1)
.arg(mcl_rs::TaskArg::input_slice(&data).invalid(true))
.exec(pes);
futures::executor::block_on(mcl_future);
Sourcepub fn read_only(self, val: bool) -> Self
pub fn read_only(self, val: bool) -> Self
Sets the read_only flag for the argument
Returns the TaskArg with the preference set
§Examples
let mcl = mcl_rs::MclEnvBuilder::new().initialize();
mcl.create_prog("my_prog",mcl_rs::PrgType::Src)
.with_compile_args("-D MYDEF").load();
let data = vec![0; 4];
let les: [u64; 3] = [1, 1, 1];
let pes: [u64; 3] = [1, 1, 1];
let mcl_future = mcl.task("my_kernel", 1)
.arg(mcl_rs::TaskArg::input_slice(&data).read_only(true))
.exec(pes);
futures::executor::block_on(mcl_future);
Sourcepub fn write_only(self, val: bool) -> Self
pub fn write_only(self, val: bool) -> Self
Sets the write_only flag for the argument
Returns the TaskArg with the preference set
§Examples
let mcl = mcl_rs::MclEnvBuilder::new().initialize();
mcl.create_prog("my_prog",mcl_rs::PrgType::Src)
.with_compile_args("-D MYDEF").load();
let data = vec![0; 4];
let les: [u64; 3] = [1, 1, 1];
let pes: [u64; 3] = [1, 1, 1];
let mcl_future = mcl.task("my_kernel", 1)
.arg(mcl_rs::TaskArg::input_slice(&data).write_only(true))
.exec(pes);
futures::executor::block_on(mcl_future);