#[repr(C)]pub struct starpu_codelet {Show 34 fields
pub where_: u32,
pub can_execute: Option<unsafe extern "C" fn(workerid: c_uint, task: *mut starpu_task, nimpl: c_uint) -> c_int>,
pub type_: starpu_codelet_type,
pub max_parallelism: c_int,
pub cpu_func: starpu_cpu_func_t,
pub cuda_func: starpu_cuda_func_t,
pub opencl_func: starpu_opencl_func_t,
pub cpu_funcs: [starpu_cpu_func_t; 4],
pub cuda_funcs: [starpu_cuda_func_t; 4],
pub cuda_flags: [c_char; 4],
pub hip_funcs: [starpu_hip_func_t; 4],
pub hip_flags: [c_char; 4],
pub opencl_funcs: [starpu_opencl_func_t; 4],
pub opencl_flags: [c_char; 4],
pub max_fpga_funcs: [starpu_max_fpga_func_t; 4],
pub cpu_funcs_name: [*const c_char; 4],
pub bubble_func: starpu_bubble_func_t,
pub bubble_gen_dag_func: starpu_bubble_gen_dag_func_t,
pub nbuffers: c_int,
pub modes: [starpu_data_access_mode; 8],
pub dyn_modes: *mut starpu_data_access_mode,
pub specific_nodes: c_uint,
pub nodes: [c_int; 8],
pub dyn_nodes: *mut c_int,
pub model: *mut starpu_perfmodel,
pub energy_model: *mut starpu_perfmodel,
pub per_worker_stats: [c_ulong; 48],
pub name: *const c_char,
pub color: c_uint,
pub callback_func: Option<unsafe extern "C" fn(arg1: *mut c_void)>,
pub flags: c_int,
pub perf_counter_sample: *mut starpu_perf_counter_sample,
pub perf_counter_values: *mut starpu_perf_counter_sample_cl_values,
pub checked: c_int,
}Expand description
The codelet structure describes a kernel that is possibly implemented on various targets. For compatibility, make sure to initialize the whole structure to zero, either by using explicit memset, or the function starpu_codelet_init(), or by letting the compiler implicitly do it in e.g. static storage case.
Note that the codelet structure needs to exist until the task is terminated. If dynamic codelet allocation is desired, release should be done no sooner than the starpu_task::callback_func callback time.
If the application wants to make the structure constant, it needs to be filled exactly as StarPU expects:
-
starpu_codelet::cpu_funcs, starpu_codelet::cuda_funcs, etc. must be used instead of the deprecated starpu_codelet::cpu_func, starpu_codelet::cuda_func, etc.
-
the starpu_codelet::where field must be set.
and additionally, starpu_codelet::checked must be set to 1 to tell StarPU that the conditions above are properly met. Also, the \ref STARPU_CODELET_PROFILING environment variable must be set to 0. An example is provided in tests/main/const_codelet.c
Fields§
§where_: u32Optional field to indicate which types of processing units are able to execute the codelet. The different values ::STARPU_CPU, ::STARPU_CUDA, ::STARPU_HIP, ::STARPU_OPENCL can be combined to specify on which types of processing units the codelet can be executed. ::STARPU_CPU|::STARPU_CUDA for instance indicates that the codelet is implemented for both CPU cores and CUDA devices while ::STARPU_OPENCL indicates that it is only available on OpenCL devices. If the field is unset, its value will be automatically set based on the availability of the XXX_funcs fields defined below. It can also be set to ::STARPU_NOWHERE to specify that no computation has to be actually done.
can_execute: Option<unsafe extern "C" fn(workerid: c_uint, task: *mut starpu_task, nimpl: c_uint) -> c_int>Define a function which should return 1 if the worker designated by \p workerid can execute the \p nimpl -th implementation of \p task, 0 otherwise.
type_: starpu_codelet_typeOptional field to specify the type of the codelet. The default is ::STARPU_SEQ, i.e. usual sequential implementation. Other values (::STARPU_SPMD or ::STARPU_FORKJOIN) declare that a parallel implementation is also available. See \ref ParallelTasks for details.
max_parallelism: c_intOptional field. If a parallel implementation is available, this denotes the maximum combined worker size that StarPU will use to execute parallel tasks for this codelet.
cpu_func: starpu_cpu_func_t@deprecated Optional field which has been made deprecated. One should use instead the field starpu_codelet::cpu_funcs.
cuda_func: starpu_cuda_func_t@deprecated Optional field which has been made deprecated. One should use instead the starpu_codelet::cuda_funcs field.
opencl_func: starpu_opencl_func_t@deprecated Optional field which has been made deprecated. One should use instead the starpu_codelet::opencl_funcs field.
cpu_funcs: [starpu_cpu_func_t; 4]Optional array of function pointers to the CPU
implementations of the codelet. The functions prototype
must be:
\code{.c}
void cpu_func(void *buffers[], void *cl_arg)
\endcode
The first argument being the array of data managed by the
data management library, and the second argument is a
pointer to the argument passed from the field
starpu_task::cl_arg. If the field starpu_codelet::where is
set, then the field tarpu_codelet::cpu_funcs is ignored if
::STARPU_CPU does not appear in the field
starpu_codelet::where, it must be non-
cuda_funcs: [starpu_cuda_func_t; 4]Optional array of function pointers to the CUDA
implementations of the codelet. The functions must be
host-functions written in the CUDA runtime API. Their
prototype must be:
\code{.c}
void cuda_func(void *buffers[], void *cl_arg)
\endcode
If the field starpu_codelet::where is set, then the field
starpu_codelet::cuda_funcs is ignored if ::STARPU_CUDA does
not appear in the field starpu_codelet::where, it must be
non-
cuda_flags: [c_char; 4]Optional array of flags for CUDA execution. They specify some semantic details about CUDA kernel execution, such as asynchronous execution.
hip_funcs: [starpu_hip_func_t; 4]Optional array of function pointers to the HIP
implementations of the codelet. The functions must be
host-functions written in the HIP runtime API. Their
prototype must be:
\code{.c}
void hip_func(void *buffers[], void *cl_arg)
\endcode
If the field starpu_codelet::where is set, then the field
starpu_codelet::hip_funcs is ignored if ::STARPU_HIP does
not appear in the field starpu_codelet::where, it must be
non-
hip_flags: [c_char; 4]Optional array of flags for HIP execution. They specify some semantic details about HIP kernel execution, such as asynchronous execution.
opencl_funcs: [starpu_opencl_func_t; 4]Optional array of function pointers to the OpenCL
implementations of the codelet. The functions prototype
must be:
\code{.c}
void opencl_func(void *buffers[], void *cl_arg)
\endcode
If the field starpu_codelet::where field is set, then the
field starpu_codelet::opencl_funcs is ignored if
::STARPU_OPENCL does not appear in the field
starpu_codelet::where, it must be non-
opencl_flags: [c_char; 4]Optional array of flags for OpenCL execution. They specify some semantic details about OpenCL kernel execution, such as asynchronous execution.
max_fpga_funcs: [starpu_max_fpga_func_t; 4]Optional array of function pointers to the Maxeler FPGA
implementations of the codelet. The functions prototype
must be:
\code{.c}
void fpga_func(void *buffers[], void *cl_arg)
\endcode
The first argument being the array of data managed by the
data management library, and the second argument is a
pointer to the argument passed from the field
starpu_task::cl_arg. If the field starpu_codelet::where is
set, then the field starpu_codelet::max_fpga_funcs is ignored if
::STARPU_MAX_FPGA does not appear in the field
starpu_codelet::where, it must be non-
cpu_funcs_name: [*const c_char; 4]Optional array of strings which provide the name of the CPU functions referenced in the array starpu_codelet::cpu_funcs. This can be used when running on MPI MS devices for StarPU to simply look up the MPI MS function implementation through its name.
bubble_func: starpu_bubble_func_tOptional function to decide if the task is to be transformed into a bubble
bubble_gen_dag_func: starpu_bubble_gen_dag_func_tOptional function to transform the task into a new graph
nbuffers: c_intSpecify the number of arguments taken by the codelet. These
arguments are managed by the DSM and are accessed from the
modes: [starpu_data_access_mode; 8]Is an array of ::starpu_data_access_mode. It describes the required access modes to the data needed by the codelet (e.g. ::STARPU_RW). The number of entries in this array must be specified in the field starpu_codelet::nbuffers, and should not exceed \ref STARPU_NMAXBUFS. If insufficient, this value can be set with the configure option \ref enable-maxbuffers “–enable-maxbuffers”.
dyn_modes: *mut starpu_data_access_modeIs an array of ::starpu_data_access_mode. It describes the required access modes to the data needed by the codelet (e.g. ::STARPU_RW). The number of entries in this array must be specified in the field starpu_codelet::nbuffers. This field should be used for codelets having a number of data greater than \ref STARPU_NMAXBUFS (see \ref SettingManyDataHandlesForATask). When defining a codelet, one should either define this field or the field starpu_codelet::modes defined above.
specific_nodes: c_uintDefault value is 0. If this flag is set, StarPU will not systematically send all data to the memory node where the task will be executing, it will read the starpu_codelet::nodes or starpu_codelet::dyn_nodes array to determine, for each data, whether to send it on the memory node where the task will be executing (-1), or on a specific node (!= -1).
nodes: [c_int; 8]Optional field. When starpu_codelet::specific_nodes is 1, this specifies the memory nodes where each data should be sent to for task execution. The number of entries in this array is starpu_codelet::nbuffers, and should not exceed \ref STARPU_NMAXBUFS.
dyn_nodes: *mut c_intOptional field. When starpu_codelet::specific_nodes is 1, this specifies the memory nodes where each data should be sent to for task execution. The number of entries in this array is starpu_codelet::nbuffers. This field should be used for codelets having a number of data greater than \ref STARPU_NMAXBUFS (see \ref SettingManyDataHandlesForATask). When defining a codelet, one should either define this field or the field starpu_codelet::nodes defined above.
model: *mut starpu_perfmodelOptional pointer to the task duration performance model
associated to this codelet. This optional field is ignored
when set to
energy_model: *mut starpu_perfmodelOptional pointer to the task energy consumption performance
model associated to this codelet (in J). This optional field is
ignored when set to
per_worker_stats: [c_ulong; 48]Optional array for statistics collected at runtime: this is filled by StarPU and should not be accessed directly, but for example by calling the function starpu_codelet_display_stats() (See starpu_codelet_display_stats() for details).
name: *const c_charOptional name of the codelet. This can be useful for debugging purposes.
color: c_uintOptional color of the codelet. This can be useful for debugging purposes. Value 0 acts like if this field wasn’t specified. Color representation is hex triplet (for example: 0xff0000 is red, 0x0000ff is blue, 0xffa500 is orange, …).
callback_func: Option<unsafe extern "C" fn(arg1: *mut c_void)>Optional field, the default value is
flags: c_intVarious flags for the codelet.
perf_counter_sample: *mut starpu_perf_counter_sample§perf_counter_values: *mut starpu_perf_counter_sample_cl_values§checked: c_intWhether _starpu_codelet_check_deprecated_fields was already done or not.
Trait Implementations§
Source§impl Clone for starpu_codelet
impl Clone for starpu_codelet
Source§fn clone(&self) -> starpu_codelet
fn clone(&self) -> starpu_codelet
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more