| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272 | /* StarPU --- Runtime system for heterogeneous multicore architectures. * * Copyright (C) 2010-2019                                CNRS * Copyright (C) 2009-2011,2014-2016,2018                 Université de Bordeaux * Copyright (C) 2011,2012                                Inria * * StarPU is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or (at * your option) any later version. * * StarPU is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * See the GNU Lesser General Public License in COPYING.LGPL for more details. *//*! \defgroup API_Insert_Task Task Insert Utility\fn int starpu_insert_task(struct starpu_codelet *cl, ...)\ingroup API_Insert_TaskSimilar to starpu_task_insert(). Kept to avoid breaking old codes.\fn int starpu_task_insert(struct starpu_codelet *cl, ...)\ingroup API_Insert_TaskCreate and submit a task corresponding to \p cl with thefollowing given arguments. The argument list must be zero-terminated.The arguments following the codelet can be of the following types:<ul><li> ::STARPU_R, ::STARPU_W, ::STARPU_RW, ::STARPU_SCRATCH,::STARPU_REDUX an access mode followed by a data handle;<li> ::STARPU_DATA_ARRAY followed by an array of data handles and itsnumber of elements;<li> ::STARPU_DATA_MODE_ARRAY followed by an array of structstarpu_data_descr, i.e data handles with their associated accessmodes, and its number of elements;<li> ::STARPU_EXECUTE_ON_WORKER, ::STARPU_WORKER_ORDER followed by an integer valuespecifying the worker on which to execute the task (as specified bystarpu_task::execute_on_a_specific_worker)<li> the specific values ::STARPU_VALUE, ::STARPU_CALLBACK,::STARPU_CALLBACK_ARG, ::STARPU_CALLBACK_WITH_ARG, ::STARPU_PRIORITY,::STARPU_TAG, ::STARPU_TAG_ONLY, ::STARPU_FLOPS, ::STARPU_SCHED_CTX, ::STARPU_CL_ARGS, ::STARPU_CL_ARGS_NFREE,::STARPU_TASK_DEPS_ARRAY, ::STARPU_TASK_COLOR,::STARPU_HANDLES_SEQUENTIAL_CONSISTENCY, ::STARPU_TASK_SYNCHRONOUS, ::STARPU_TASK_END_DEPfollowed by the appropriated objects as defined elsewhere.</ul>When using ::STARPU_DATA_ARRAY, the access mode of the data handles isnot defined, it will be taken from the codelet starpu_codelet::modes or starpu_codelet::dyn_modes field. Oneshould use ::STARPU_DATA_MODE_ARRAY to define the data handles along with theaccess modes.Parameters to be passed to the codelet implementation are definedthrough the type ::STARPU_VALUE. The functionstarpu_codelet_unpack_args() must be called within the codeletimplementation to retrieve them.\def STARPU_VALUE\ingroup API_Insert_TaskUsed when calling starpu_task_insert(), mustbe followed by a pointer to a constant value and the size of theconstant\def STARPU_CL_ARGS\ingroup API_Insert_TaskUsed when calling starpu_task_insert(), mustbe followed by a memory buffer containing the arguments to be given tothe task, and by the size of the arguments. The memory buffer shouldbe the result of a previous call to starpu_codelet_pack_args(), and will befreed (i.e. starpu_task::cl_arg_free will be set to 1)\def STARPU_CL_ARGS_NFREE\ingroup API_Insert_TaskUsed when calling starpu_task_insert(), similarly to ::STARPU_CL_ARGS, mustbe followed by a memory buffer containing the arguments to be given tothe task, and by the size of the arguments. The memory buffer shouldbe the result of a previous call to starpu_codelet_pack_args(), and will NOT befreed (i.e. starpu_task::cl_arg_free will be set to 0)\def STARPU_CALLBACK\ingroup API_Insert_TaskUsed when calling starpu_task_insert(), mustbe followed by a pointer to a callback function\def STARPU_CALLBACK_WITH_ARG\ingroup API_Insert_TaskUsed when calling starpu_task_insert(), mustbe followed by two pointers: one to a callback function, and the otherto be given as an argument to the callback function; this isequivalent to using both ::STARPU_CALLBACK and::STARPU_CALLBACK_WITH_ARG.\def STARPU_CALLBACK_ARG\ingroup API_Insert_TaskUsed when calling starpu_task_insert(), mustbe followed by a pointer to be given as an argument to the callbackfunction\def STARPU_PRIORITY\ingroup API_Insert_TaskUsed when calling starpu_task_insert(), mustbe followed by a integer defining a priority level\def STARPU_DATA_ARRAY\ingroup API_Insert_TaskTODO\def STARPU_DATA_MODE_ARRAY\ingroup API_Insert_TaskTODO\def STARPU_EXECUTE_ON_WORKER\ingroup API_Insert_TaskUsed when calling starpu_task_insert(), must befollowed by an integer value specifying the worker on which to executethe task (as specified by starpu_task::execute_on_a_specific_worker)\def STARPU_WORKER_ORDER\ingroup API_Insert_Taskused when calling starpu_task_insert(), must befollowed by an integer value specifying the worker order in which to executethe tasks (as specified by starpu_task::workerorder)\def STARPU_TAG\ingroup API_Insert_TaskUsed when calling starpu_task_insert(), must be followed by a tag.\def STARPU_TAG_ONLY\ingroup API_Insert_TaskUsed when calling starpu_task_insert(), must be followed by a tagstored in starpu_task::tag_id. Leave starpu_task::use_tag as 0.\def STARPU_NAME\ingroup API_Insert_TaskUsed when calling starpu_task_insert(), must be followed by a char *stored in starpu_task::name.\def STARPU_FLOPS\ingroup API_Insert_TaskUsed when calling starpu_task_insert(), mustbe followed by an amount of floating point operations, as a double.Users <b>MUST</b> explicitly cast into double, otherwise parameterpassing will not work.\def STARPU_SCHED_CTX\ingroup API_Insert_TaskUsed when calling starpu_task_insert(), mustbe followed by the id of the scheduling context to which to submit thetask to.\def STARPU_TASK_DEPS_ARRAY\ingroup API_Insert_TaskUsed when calling starpu_task_insert(), mustbe followed by a number of tasks as int, and an array containing these tasks.The function starpu_task_declare_deps_array() will be called with thegiven values.\def STARPU_TASK_END_DEPS_ARRAY\ingroup API_Insert_TaskUsed when calling starpu_task_insert(), mustbe followed by a number of tasks as int, and an array containing these tasks.The function starpu_task_declare_end_deps_array() will be called with thegiven values.\def STARPU_TASK_COLOR\ingroup API_Insert_TaskUsed when calling starpu_task_insert(), must be followed by an integerrepresenting a color\def STARPU_TASK_SYNCHRONOUS\ingroup API_Insert_TaskUsed when calling starpu_task_insert(), must be followed by an integerstating if the task is synchronous or not\def STARPU_HANDLES_SEQUENTIAL_CONSISTENCY\ingroup API_Insert_TaskUsed when calling starpu_task_insert(), must be followed by an arrayof characters representing the sequential consistency for each bufferof the task.\def STARPU_TASK_END_DEP\ingroup API_Insert_TaskUsed when calling starpu_task_insert(), must be followed by an integerwhich will be given to starpu_task_end_dep_add()\fn void starpu_task_insert_data_make_room(struct starpu_codelet *cl, struct starpu_task *task, int *allocated_buffers, int current_buffer, int room)\ingroup API_Insert_TaskAssuming that there are already \p current_buffer data handles passed tothe task, and if *allocated_buffers is not 0, the <c>task->dyn_handles</c>array has size \p *allocated_buffers, this function makes room for \p roomother data handles, allocating or reallocating <c>task->dyn_handles</c> asnecessary and updating \p *allocated_buffers accordingly. One can thus startwith *allocated_buffers equal to 0 and current_buffer equal to 0, then make roomby calling this function, then store handles with STARPU_TASK_SET_HANDLE(), makeroom again with this function, store yet more handles, etc.\fn void starpu_task_insert_data_process_arg(struct starpu_codelet *cl, struct starpu_task *task, int *allocated_buffers, int *current_buffer, int arg_type, starpu_data_handle_t handle)\ingroup API_Insert_TaskStore data handle \p handle into task \p task with mode \p arg_type,updating \p *allocated_buffers and \p *current_buffer accordingly.\fn void starpu_task_insert_data_process_array_arg(struct starpu_codelet *cl, struct starpu_task *task, int *allocated_buffers, int *current_buffer, int nb_handles, starpu_data_handle_t *handles)\ingroup API_Insert_TaskStore \p nb_handles data handles \p handles into task \p task, updating \p*allocated_buffers and \p *current_buffer accordingly.\fn void starpu_task_insert_data_process_mode_array_arg(struct starpu_codelet *cl, struct starpu_task *task, int *allocated_buffers, int *current_buffer, int nb_descrs, struct starpu_data_descr *descrs);\ingroup API_Insert_TaskStore \p nb_descrs data handles described by \p descrs into task \p task,updating \p *allocated_buffers and \p *current_buffer accordingly.\fn void starpu_codelet_pack_args(void **arg_buffer, size_t *arg_buffer_size, ...)\ingroup API_Insert_TaskPack arguments of type ::STARPU_VALUE into a buffer which can begiven to a codelet and later unpacked with the functionstarpu_codelet_unpack_args().Instead of calling starpu_codelet_pack_args(), one can also callstarpu_codelet_pack_arg_init(), then starpu_codelet_pack_arg() for eachdata, then starpu_codelet_pack_arg_fini().\fn void starpu_codelet_pack_arg_init(struct starpu_codelet_pack_arg_data *state)\ingroup API_Insert_TaskInitialize struct starpu_codelet_pack_arg before calling starpu_codelet_pack_arg() andstarpu_codelet_pack_arg_fini(). This will simply initialize the content of the structure.\fn void starpu_codelet_pack_arg(struct starpu_codelet_pack_arg_data *state, const void *ptr, size_t ptr_size)\ingroup API_Insert_TaskPack one argument into struct starpu_codelet_pack_arg \p state. That structurehas to be initialized before with starpu_codelet_pack_arg_init(), and after allstarpu_codelet_pack_arg() calls performed, starpu_codelet_pack_arg_fini() has to beused to get the \p cl_arg and \p cl_arg_size to be put in the task.\fn void starpu_codelet_pack_arg_fini(struct starpu_codelet_pack_arg_data *state, void **cl_arg, size_t *cl_arg_size)\ingroup API_Insert_TaskFinish packing data, after calling starpu_codelet_pack_arg_init() once and starpu_codelet_pack_arg() several times.\fn void starpu_codelet_unpack_args(void *cl_arg, ...)\ingroup API_Insert_TaskRetrieve the arguments of type ::STARPU_VALUE associated to atask automatically created using the function starpu_task_insert(). Ifany parameter's value is 0, unpacking will stop there and ignore the remainingparameters.\fn void starpu_codelet_unpack_args_and_copyleft(void *cl_arg, void *buffer, size_t buffer_size, ...)\ingroup API_Insert_TaskSimilar to starpu_codelet_unpack_args(), but if any parameter is0, copy the part of \p cl_arg that has not been read in \p buffer whichcan then be used in a later call to one of the unpack functions.\fn struct starpu_task *starpu_task_build(struct starpu_codelet *cl, ...)\ingroup API_Insert_TaskCreate a task corresponding to \p cl with the following arguments.The argument list must be zero-terminated. The argumentsfollowing the codelet are the same as the ones for the functionstarpu_task_insert().If some arguments of type ::STARPU_VALUE are given, the parameterstarpu_task::cl_arg_free will be set to 1.\fn int starpu_task_set(struct starpu_task *task, struct starpu_codelet *cl, ...)\ingroup API_Insert_TaskSet the given \p task corresponding to \p cl with the following arguments.The argument list must be zero-terminated. The argumentsfollowing the codelet are the same as the ones for the functionstarpu_task_insert().If some arguments of type ::STARPU_VALUE are given, the parameterstarpu_task::cl_arg_free will be set to 1.*/
 |