pub struct Job { /* private fields */ }
Expand description
Groups compute units (Sub
) within a Context
to execute device kernels in parallel.
This struct wraps a FFI pointer to the C++ pxl::runtime::Job
class.
It provides methods for loading jobs from binary files or modules, and for creating execute interfaces(eg. Map
).
Implementations§
Source§impl Job
Implementation of the Job
struct.
impl Job
Implementation of the Job
struct.
Sourcepub fn get(&self) -> *mut Job
pub fn get(&self) -> *mut Job
gets the raw pointer of the underlying FFI Job
object.
§Returns
A raw pointer to the underlying FFI Job
object.
§Safety
Caller must ensure that the job is valid and that the job is properly managed.
§Example
let job = context.create_job(2); // Create a job with 2 `Sub`
let job_ptr = job.get(); // Get the raw pointer of the job
Sourcepub fn load_module(&mut self, module: &Module) -> PxlResult
pub fn load_module(&mut self, module: &Module) -> PxlResult
Sourcepub fn sub_id_list(&self) -> Vec<u32>
pub fn sub_id_list(&self) -> Vec<u32>
Sourcepub fn sub_alloc_with_num(&mut self, num_sub: u32) -> PxlResult
pub fn sub_alloc_with_num(&mut self, num_sub: u32) -> PxlResult
Allocates a specified number of subs for this job.
§Arguments
num_sub
- The number of subs to allocate.
§Returns
PxlResult indicating the success or failure of the operation.
§Safety
Caller must ensure that the job is valid and there are enough available subs.
§Example
let mut job = context.create_job();
let result = job.sub_alloc_with_num(2);
assert_eq!(result, PxlResult::Success);
Sourcepub fn sub_free_with_num(&mut self, num_sub: u32)
pub fn sub_free_with_num(&mut self, num_sub: u32)
Sourcepub fn build_map_with_func_name(
&mut self,
mu_func_name: &str,
test_count: u32,
) -> Map
pub fn build_map_with_func_name( &mut self, mu_func_name: &str, test_count: u32, ) -> Map
Creates a new Map
object from the job using function name.
§Arguments
mu_func_name
- Name of the function to be executed.test_count
- The number of tasks to launch.
§Returns
A new Map
object.
§Safety
Caller must ensure that the function name is valid.
§Example
let mut job = context.create_job();
job.load("test.mubin");
let map = job.build_map_with_func_name("myFunction", 100);