Preface
*******

This manual documents the usage of StarPU

Introduction to StarPU
**********************

Motivation
==========

The use of specialized hardware such as accelerators or coprocessors offers an interesting approach to overcome the physical limits encountered by processor architects. As a result, many machines are now equipped with one or several accelerators (eg. a GPU), in addition to the usual processor(s). While a lot of efforts have been devoted to offload computation onto such accelerators, very little attention as been paid to portability concerns on the one hand, and to the possibility of having heterogeneous accelerators and processors to interact on the other hand.

StarPU is a runtime system that offers support for heterogeneous multicore architectures, it not only offers a unified view of the computational resources (ie. CPUs and accelerators at the same time), but it also takes care to efficiently map and execute tasks onto an heterogeneous machine while transparently handling low-level issues in a portable fashion.

StarPU in a Nutshell
====================

From a programming point of view, StarPU is not a new language but a library that executes tasks explicitly submitted by the application.  The data that a task manipulate are automatically transferred onto the accelerator so that the programmer does not have to take care of complex data movements.  StarPU also takes particular care of scheduling those tasks efficiently and allows scheduling experts to implement custom scheduling policies in a portable fashion.

Codelet and Tasks
-----------------

One of StarPU primary data structure is the codelet. A codelet describes a computational kernel that can possibly be implemented on multiple architectures such as a CPU, a CUDA device or a Cell's SPU.

Another important data structure is the task. Executing a StarPU task consists in applying a codelet on a data set, on one of the architecture on which the codelet is implemented. In addition to the codelet that a task implements, it also describes which data are accessed, and how they are accessed during the computation (read and/or write). StarPU tasks are asynchronous: submitting a task to StarPU is a non-blocking operation. The task structure can also specify a callback function that is called once StarPU has properly executed the task. It also contains optional fields that the application may use to give hints to the scheduler (such as priority levels).

A task may be identified by a unique 64-bit number which we refer as a tag. Task dependencies can be enforced either by the means of callback functions, or by expressing dependencies between tags.

StarPU Data Management Library
------------------------------

Because StarPU schedules tasks at runtime, data transfers have to be done automatically and ``just-in-time'' between processing units, relieving the application programmer from explicit data transfers. Moreover, to avoid unnecessary transfers, StarPU keeps data where it was last needed, even if was modified there, and it allows multiple copies of the same data to reside at the same time on several processing units as long as it is not modified.

Installing StarPU
*****************

StarPU can be built and installed by the standard means of the GNU autotools. The following chapter is intended to briefly remind how these tools can be used to install StarPU.

Configuring StarPU
==================

Generating Makefiles and configuration scripts
----------------------------------------------

This step is not necessary when using the tarball releases of StarPU.  If you are using the source code from the svn repository, you first need to generate the configure scripts and the Makefiles.

     $ autoreconf -vfi

Configuring StarPU
------------------

     $ ./configure

Building and Installing StarPU
==============================

Building
--------

     $ make

Sanity Checks
-------------

In order to make sure that StarPU is working properly on the system, it is also possible to run a test suite.

     $ make check

Installing
----------

In order to install StarPU at the location that was specified during configuration:

     $ make install

pkg-config configuration
------------------------

It is possible that compiling and linking an application against StarPU requires to use specific flags or libraries (for instance CUDA or libspe2). Therefore, it is possible to use the pkg-config tool.

If StarPU was not installed at some standard location, the path of StarPU's library must be specified in the PKG_CONFIG_PATH environment variable so that pkg-config can find it. So if StarPU was installed in $(prefix_dir):

     $ PKG_CONFIG_PATH = {PKG_CONFIG_PATH}:$(prefix_dir)/lib/

The flags required to compiled or linked against StarPU are then accessible with the following commands:

     $ pkg-config --cflags libstarpu  # options for the compiler
     $ pkg-config --libs libstarpu    # options for the linker

Configuration options
*********************

TODO

Environment variables
*********************

TODO, explicit configuration (passed to starpu_init) overrides env variables.

Configuring workers
===================

NCPUS -- Number of CPU workers
------------------------------

Description:
     TODO

NCUDA -- Number of CUDA workers
-------------------------------

Description:
     TODO

NGORDON -- Number of SPU workers (Cell)
---------------------------------------

Description:
     TODO

WORKERS_CPUID -- Bind workers to specific CPUs
----------------------------------------------

Description:
     TODO

WORKERS_GPUID -- Select specific CUDA devices
---------------------------------------------

Description:
     TODO

Configuring the Scheduling engine
=================================

SCHED -- Scheduling policy
--------------------------

Description:
     TODO

CALIBRATE -- Calibrate performance models
-----------------------------------------

Description:
     TODO

PREFETCH -- Use data prefetch
-----------------------------

Description:
     TODO

Miscellaneous and debug
=======================

LOGFILENAME -- Select debug file name
-------------------------------------

Description:
     TODO

StarPU API
**********

Initialization and Termination
==============================

starpu_init -- Initialize StarPU
--------------------------------

Description:
     This is StarPU initialization method, which must be called prior to any other StarPU call.  It is possible to specify StarPU's configuration (eg. scheduling policy, number of cores, ...) by passing a non-null argument. Default configuration is used if the passed argument is NULL.

Return value:
     Upon successful completion, this function returns 0. Otherwise, -ENODEV indicates that no worker was available (so that StarPU was not be initialized).

Prototype:
     int starpu_init(struct starpu_conf *conf);

struct starpu_conf -- StarPU runtime configuration
--------------------------------------------------

Description:
     This structure is passed to the starpu_init function in order configure StarPU. When the default value is used, StarPU automatically select the number of processing units and takes the default scheduling policy. This parameters overwrite the equivalent environnement variables.

Fields:

     sched_policy (default = NULL):
          This is the name of the scheduling policy. This can also be specified with the SCHED environment variable.

     ncpus (default = -1):
          This is the maximum number of CPU cores that StarPU can use. This can also be specified with the NCPUS environment variable.

     ncuda (default = -1):
          This is the maximum number of CUDA devices that StarPU can use. This can also be specified with the NCUDA environment variable.

     nspus (default = -1):
          This is the maximum number of Cell SPUs that StarPU can use. This can also be specified with the NGORDON environment variable.

     calibrate (default = 0):
          If this flag is set, StarPU will calibrate the performance models when executing tasks. This can also be specified with the CALIBRATE environment variable.

starpu_shutdown -- Terminate StarPU
-----------------------------------

Description:
     This is StarPU termination method. It must be called at the end of the application: statistics and other post-mortem debugging information are not garanteed to be available until this method has been called.

Prototype:
     void starpu_shutdown(void);

Workers' Properties
===================

starpu_get_worker_count -- Get the number of processing units
-------------------------------------------------------------

Description:
     This function returns the number of workers (ie. processing units executing StarPU tasks). The returned value should be at most STARPU_NMAXWORKERS.

Prototype:
     unsigned starpu_get_worker_count(void);

starpu_get_worker_id -- Get the identifier of the current worker
----------------------------------------------------------------

Description:
     This function returns the identifier of the worker associated to the calling thread. The returned value is either -1 if the current context is not a StarPU worker (ie. when called from the application outside a task or a callback), or an integer between 0 and starpu_get_worker_count() - 1.

Prototype:
     int starpu_get_worker_count(void);

starpu_get_worker_type -- Get the type of processing unit associated to a worker
--------------------------------------------------------------------------------

Description:
     This function returns the type of worker associated to an identifier (as returned by the starpu_get_worker_id function). The returned value indicates the architecture of the worker: STARPU_CORE_WORKER for a CPU core, STARPU_CUDA_WORKER for a CUDA device, and STARPU_GORDON_WORKER for a Cell SPU. The value returned for an invalid identifier is unspecified.

Prototype:
     enum starpu_archtype starpu_get_worker_type(int id);

starpu_get_worker_name -- Get the name of a worker
--------------------------------------------------

Description:
     StarPU associates a unique human readable string to each processing unit. This function copies at most the maxlen first bytes of the unique string associated to a worker identified by its identifier id into the dst buffer. The caller is responsible for ensuring that the dst is a valid pointer to a buffer of maxlen bytes at least. Calling this function on an invalid identifier results in an unspecified behaviour.

Prototype:
     void starpu_get_worker_name(int id, char *dst, size_t maxlen);

Data Library
============

Codelets and Tasks
==================

struct starpu_codelet -- StarPU codelet structure
-------------------------------------------------

Description:
     The codelet structure describes a kernel that is possibly implemented on various targets.

Fields:

     where:
          Indicates which types of processing units are able to execute that codelet. CORE|CUDA for instance indicates that the codelet is implemented for both CPU cores and CUDA devices while GORDON indicates that it is only available on Cell SPUs.

     core_func (optionnal):
          Is a function pointer to the CPU implementation of the codelet. Its prototype must be: void core_func(starpu_data_interface_t *descr, void *arg). The first argument being the array of data managed by the data management library, and the second argument is a pointer to the argument (possibly a copy of it) passed from the .cl_arg field of the starpu_task structure. This pointer is ignored if CORE does not appear in the .where field, it must be non-null otherwise.

     cuda_func (optionnal):
          Is a function pointer to the CUDA implementation of the codelet. This must be a host-function written in the CUDA runtime API. Its prototype must be: void cuda_func(starpu_data_interface_t *descr, void *arg);. This pointer is ignored if CUDA does not appear in the .where field, it must be non-null otherwise.

     gordon_func (optionnal):
          This is the index of the Cell SPU implementation within the Gordon library. TODO

     nbuffers:
          Specifies the number of arguments taken by the codelet. These arguments are managed by the DSM and are accessed from the starpu_data_interface_t * array. The constant argument passed with the .cl_arg field of the starpu_task structure is not counted in this number.  This value should not be above STARPU_NMAXBUFS.

     model (optionnal):
          This is a pointer to the performance model associated to this codelet. This optionnal field is ignored when null. TODO

struct starpu_task -- StarPU task structure
-------------------------------------------

Description:
     The starpu_task structure describes a task that can be offloaded on the various processing units managed by StarPU. It instanciates a codelet. It can either be allocated dynamically with the starpu_task_create method, or declared statically. In the latter case, the programmer has to zero the starpu_task structure and to fill the different fields properly. The indicated default values correspond to the configuration of a task allocated with starpu_task_create.

Fields:

     cl:
          Is a pointer to the corresponding starpu_codelet data structure. This describes where the kernel should be executed, and supplies the appropriate implementations. When set to NULL, no code is executed during the tasks, such empty tasks can be useful for synchronization purposes.

     buffers:
          TODO

     cl_arg (optional) (default = NULL):
          TODO

     cl_arg_size (optional):
          TODO

     callback_func (optional) (default = NULL):
          This is a function pointer of prototype void (*f)(void *) which specifies a possible callback. If that pointer is non-null, the callback function is executed on the host after the execution of the task. The callback is passed the value contained in the callback_arg field. No callback is executed if that field is null.

     callback_arg (optional) (default = NULL):
          This is the pointer passed to the callback function. This field is ignored if the callback_func is null.

     use_tag (optional) (default = 0):
          If set, this flag indicates that the task should be associated with the tag conained in the tag_id field. Tag allow the application to synchronize with the task and to express task dependencies easily.

     tag_id:
          This fields contains the tag associated to the tag if the use_tag field was set, it is ignored otherwise.

     synchronous:
          If this flag is set, the starpu_submit_task function is blocking and returns only when the task has been executed (or if no worker is able to process the task). Otherwise, starpu_submit_task returns immediately.

     priority (optionnal) (default = DEFAULT_PRIO):
          This field indicates a level of priority for the task. This is an integer value that must be selected between MIN_PRIO (for the least important tasks) and MAX_PRIO (for the most important tasks) included. Default priority is DEFAULT_PRIO.  Scheduling strategies that take priorities into account can use this parameter to take better scheduling decisions, but the scheduling policy may also ignore it.

     execute_on_a_specific_worker (default = 0):
          If this flag is set, StarPU will bypass the scheduler and directly affect this task to the worker specified by the workerid field.

     workerid (optional):
          If the execute_on_a_specific_worker field is set, this field indicates which is the identifier of the worker that should process this task (as returned by starpu_get_worker_id). This field is ignored if execute_on_a_specific_worker field is set to 0.

     detach (optional) (default = 1):
          If this flag is set, it is not possible to synchronize with the task by the means of starpu_wait_task later on. Internal data structures are only garanteed to be liberated once starpu_wait_task is called if that flag is not set.

     destroy (optional) (default = 1):
          If that flag is set, the task structure will automatically be liberated, either after the execution of the callback if the task is detached, or during starpu_task_wait otherwise. If this flag is not set, dynamically allocated data structures will not be liberated until starpu_task_destroy is called explicitely. Setting this flag for a statically allocated task structure will result in undefined behaviour.

starpu_task_init -- Initialize a Task
-------------------------------------

Description:
     TODO

Prototype:
     void starpu_task_init(struct starpu_task *task);

starpu_task_create -- Allocate and Initialize a Task
----------------------------------------------------

Description:
     TODO (Describe the different default fields ...)

Prototype:
     struct starpu_task *starpu_task_create(void);

starpu_task_destroy -- Destroy a dynamically allocated Task
-----------------------------------------------------------

Description:
     Liberate the ressource allocated during starpu_task_create. This function can be called automatically after the execution of a task by setting the .destroy flag of the starpu_task structure (default behaviour). Calling this function on a statically allocated task results in an undefined behaviour.

Prototype:
     void starpu_task_destroy(struct starpu_task *task);

starpu_wait_task -- Wait for the termination of a Task
------------------------------------------------------

Description:
     This function blocks until the task was executed. It is not possible to synchronize with a task more than once. It is not possible to wait synchronous or detached tasks.

Return value:
     Upon successful completion, this function returns 0. Otherwise, -EINVAL indicates that the waited task was either synchronous or detached.

Prototype:
     int starpu_wait_task(struct starpu_task *task);

starpu_submit_task -- Submit a Task
-----------------------------------

Description:
     This function submits task task to StarPU. Calling this function does not mean that the task will be executed immediatly as there can be data or task (tag) dependencies that are not fulfilled yet: StarPU will take care to schedule this task with respect to such dependencies. This function returns immediately if the synchronous field of the starpu_task structure was set to 0, and block until the termination of the task otherwise. It is also possible to synchronize the application with asynchronous tasks by the means of tags, using the starpu_tag_wait function for instance.

     In case of success, this function returns 0, a return value of -ENODEV means that there is no worker able to process that task (eg. there is no GPU available and this task is only implemented on top of CUDA).

Prototype:
     int starpu_submit_task(struct starpu_task *task);

starpu_wait_all_tasks -- Wait for the termination of all Tasks
--------------------------------------------------------------

Description:
     This function blocks until all the tasks that were submitted are terminated.

Prototype:
     void starpu_wait_all_tasks(void);

Tags
====

starpu_tag_t -- Task identifier
-------------------------------

Description:
     It is possible to associate a task with a unique "tag" and to express dependencies between tasks by the means of those tags. To do so, fill the tag_id field of the starpu_task structure with a tag number (can be arbitrary) and set the use_tag field to 1.

     If starpu_tag_declare_deps is called with that tag number, the task will not be started until the task which wears the declared dependency tags are complete.

starpu_tag_declare_deps -- Declare the Dependencies of a Tag
------------------------------------------------------------

Description:
     Specify the dependencies of the task identified by tag id. The first argument specifies the tag which is configured, the second argument gives the number of tag(s) on which id depends. The following arguments are the tags which have to terminated to unlock the task.

     This function must be called before the associated task is submitted to StarPU with starpu_submit_task.

Remark
     Because of the variable arity of starpu_tag_declare_deps, note that the last arguments must be of type starpu_tag_t: constant values typically need to be explicitely casted. Using the starpu_tag_declare_deps_array function avoids this hazard.

Prototype:
     void starpu_tag_declare_deps(starpu_tag_t id, unsigned ndeps, ...);

Example:

          /*  Tag 0x1 depends on tags 0x32 and 0x52 */
          starpu_tag_declare_deps((starpu_tag_t)0x1,
                  2, (starpu_tag_t)0x32, (starpu_tag_t)0x52);

starpu_tag_declare_deps_array -- Declare the Dependencies of a Tag
------------------------------------------------------------------

Description:
     This function is similar to starpu_tag_declare_deps, except that its does not take a variable number of arguments but an array of tags of size ndeps.

Prototype:
     void starpu_tag_declare_deps_array(starpu_tag_t id, unsigned ndeps, starpu_tag_t *array);

Example:

          /*  Tag 0x1 depends on tags 0x32 and 0x52 */
          starpu_tag_t tag_array[2] = {0x32, 0x52};
          starpu_tag_declare_deps((starpu_tag_t)0x1, 2, tag_array);

starpu_tag_wait -- Block until a Tag is terminated
--------------------------------------------------

Description:
     This function blocks until the task associated to tag id has been executed. This is a blocking call which must therefore not be called within tasks or callbacks, but only from the application directly.  It is possible to synchronize with the same tag multiple times, as long as the starpu_tag_remove function is not called.  Note that it is still possible to synchronize wih a tag associated to a task which starpu_task data structure was liberated (eg. if the destroy flag of the starpu_task was enabled).

Prototype:
     void starpu_tag_wait(starpu_tag_t id);

starpu_tag_wait_array -- Block until a set of Tags is terminated
----------------------------------------------------------------

Description:
     This function is similar to starpu_tag_wait except that it blocks until all the ntags tags contained in the id array are terminated.

Prototype:
     void starpu_tag_wait_array(unsigned ntags, starpu_tag_t *id);

starpu_tag_remove -- Destroy a Tag
----------------------------------

Description:
     This function release the resources associated to tag id. It can be called once the corresponding task has been executed and when there is no tag that depend on that one anymore.

Prototype:
     void starpu_tag_remove(starpu_tag_t id);

starpu_tag_notify_from_apps -- Feed a Tag explicitely
-----------------------------------------------------

Description:
     This function explicitely unlocks tag id. It may be useful in the case of applications which execute part of their computation outside StarPU tasks (eg. third-party libraries).  It is also provided as a convenient tool for the programmer, for instance to entirely construct the task DAG before actually giving StarPU the opportunity to execute the tasks.

Prototype:
     void starpu_tag_notify_from_apps(starpu_tag_t id);

Extensions
==========

CUDA extensions
---------------

Cell extensions
---------------

Basic Examples
**************

Compiling and linking options
=============================

The Makefile could for instance contain the following lines to define which options must be given to the compiler and to the linker:

     CFLAGS+=$$(pkg-config --cflags libstarpu)
     LIBS+=$$(pkg-config --libs libstarpu)

Hello World
===========

In this section, we show how to implement a simple program that submits a task to StarPU.

Required Headers
----------------

The starpu.h header should be included in any code using StarPU.

     #include <starpu.h>

Defining a Codelet
------------------

     void cpu_func(starpu_data_interface_t *buffers, void *func_arg)
     {
         float *array = func_arg;

         printf("Hello world (array = {%f, %f} )\n", array[0], array[1]);
     }

     starpu_codelet cl =
     {
         .where = CORE,
         .core_func = cpu_func,
         .nbuffers = 0
     };

A codelet is a structure that represents a computational kernel. Such a codelet may contain an implementation of the same kernel on different architectures (eg. CUDA, Cell's SPU, x86, ...).

The ''.nbuffers'' field specifies the number of data buffers that are manipulated by the codelet: here the codelet does not access or modify any data that is controlled by our data management library. Note that the argument passed to the codelet (the ''.cl_arg'' field of the starpu_task structure) does not count as a buffer since it is not managed by our data management library.

We create a codelet which may only be executed on the CPUs. The ''.where'' field is a bitmask that defines where the codelet may be executed. Here, the CORE value means that only CPUs can execute this codelet (see Codelets and Tasks for more details on that field). When a CPU core executes a codelet, it calls the .core_func function, which must have the following prototype:

void (*core_func)(starpu_data_interface_t *, void *)

In this example, we can ignore the first argument of this function which gives a description of the input and output buffers (eg. the size and the location of the matrices). The second argument is a pointer to a buffer passed as an argument to the codelet by the means of the ''.cl_arg'' field of the starpu_task structure. Be aware that this may be a pointer to a copy of the actual buffer, and not the pointer given by the programmer: if the codelet modifies this buffer, there is no garantee that the initial buffer will be modified as well: this for instance implies that the buffer cannot be used as a synchronization medium.

Submitting a Task
-----------------

     void callback_func(void *callback_arg)
     {
         printf("Callback function (arg %x)\n", callback_arg);
     }

     int main(int argc, char **argv)
     {
         /* initialize StarPU */
         starpu_init(NULL);

         struct starpu_task *task = starpu_task_create();

         task->cl = &cl;

         float array[2] = {1.0f, -1.0f};
         task->cl_arg = &array;
         task->cl_arg_size = 2*sizeof(float);

         task->callback_func = callback_func;
         task->callback_arg = 0x42;

         /* starpu_submit_task will be a blocking call */
         task->synchronous = 1;

         /* submit the task to StarPU */
         starpu_submit_task(task);

         /* terminate StarPU */
         starpu_shutdown();

         return 0;
     }

Before submitting any tasks to StarPU, starpu_init must be called. The NULL argument specifies that we use default configuration. Tasks cannot be submitted after the termination of StarPU by a call to starpu_shutdown.

In the example above, a task structure is allocated by a call to starpu_task_create. This function only allocates and fills the corresponding structure with the default settings (see starpu_task_create), but it does not submit the task to StarPU.

The ''.cl'' field is a pointer to the codelet which the task will execute: in other words, the codelet structure describes which computational kernel should be offloaded on the different architectures, and the task structure is a wrapper containing a codelet and the piece of data on which the codelet should operate.

The optional ''.cl_arg'' field is a pointer to a buffer (of size .cl_arg_size) with some parameters for the kernel described by the codelet. For instance, if a codelet implements a computational kernel that multiplies its input vector by a constant, the constant could be specified by the means of this buffer.

Once a task has been executed, an optional callback function can be called. While the computational kernel could be offloaded on various architectures, the callback function is always executed on a CPU. The ''.callback_arg'' pointer is passed as an argument of the callback. The prototype of a callback function must be:

     void (*callback_function)(void *);

If the .synchronous field is non-null, task submission will be synchronous: the starpu_submit_task function will not return until the task was executed. Note that the starpu_shutdown method does not guarantee that asynchronous tasks have been executed before it returns.

Manipulating Data: Scaling a Vector
===================================

The previous example has shown how to submit tasks. In this section we show how StarPU tasks can manipulate data.

Programmers can describe the data layout of their application so that StarPU is responsible for enforcing data coherency and availability accross the machine. Instead of handling complex (and non-portable) mechanisms to perform data movements, programmers only declare which piece of data is accessed and/or modified by a task, and StarPU makes sure that when a computational kernel starts somewhere (eg. on a GPU), its data are available locally.

Before submitting those tasks, the programmer first needs to declare the different pieces of data to StarPU using the starpu_register_*_data functions. To ease the development of applications for StarPU, it is possible to describe multiple types of data layout. A type of data layout is called an interface. By default, there are different interfaces available in StarPU: here we will consider the vector interface.

The following lines show how to declare an array of n elements of type float using the vector interface:

     float tab[n];

     starpu_data_handle tab_handle;
     starpu_register_vector_data(&tab_handle, 0, tab, n, sizeof(float));

The first argument, called the data handle, is an opaque pointer which designates the array in StarPU. This is also the structure which is used to describe which data is used by a task. It is possible to construct a StarPU task that multiplies this vector by a constant factor:

     float factor;
     struct starpu_task *task = starpu_task_create();

     task->cl = &cl;

     task->buffers[0].handle = tab_handle;
     task->buffers[0].mode = STARPU_RW;

     task->cl_arg = &factor;
     task->cl_arg_size = sizeof(float);

Since the factor is constant, it does not need a preliminary declaration, and can just be passed through the cl_arg pointer like in the previous example.  The vector parameter is described by its handle. There are two fields in each element of the buffers array. .handle is the handle of the data, and .mode specifies how the kernel will access the data (STARPU_R for read-only, STARPU_W for write-only and STARPU_RW for read and write access).

The definition of the codelet can be written as follows:

     void scal_func(starpu_data_interface_t *buffers, void *arg)
     {
         unsigned i;
         float *factor = arg;

         /* length of the vector */
         unsigned n = buffers[0].vector.nx;
         /* local copy of the vector pointer */
         float *val = (float *)buffers[0].vector.ptr;

         for (i = 0; i < n; i++)
             val[i] *= *factor;
     }

     starpu_codelet cl = {
         .where = CORE,
         .core_func = scal_func,
         .nbuffers = 1
     };

The second argument of the scal_func function contains a pointer to the parameters of the codelet (given in task->cl_arg), so that we read the constant factor from this pointer. The first argument is an array that gives a description of every buffers passed in the task->buffers array, the number of which is given by the .nbuffers field of the codelet structure. In the vector interface, the location of the vector (resp. its length) is accessible in the .vector.ptr (resp. .vector.nx) of this array. Since the vector is accessed in a read-write fashion, any modification will automatically affect future accesses to that vector made by other tasks.

Vector Scaling on an Hybrid CPU/GPU Machine
===========================================

Contrary to the previous examples, the task submitted in the example may not only be executed by the CPUs, but also by a CUDA device.

TODO

Advanced Topics
***************