StarPU Handbook
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Data Structures | Functions
Initialization and Termination

Data Structures

struct  starpu_driver
union  starpu_driver.id
struct  starpu_vector_interface
struct  starpu_conf

Functions

int starpu_init (struct starpu_conf *conf) STARPU_WARN_UNUSED_RESULT
int starpu_conf_init (struct starpu_conf *conf)
void starpu_shutdown (void)
void starpu_pause ()
void starpu_resume ()
int starpu_asynchronous_copy_disabled (void)
int starpu_asynchronous_cuda_copy_disabled (void)
int starpu_asynchronous_opencl_copy_disabled (void)
void starpu_topology_print (FILE *f)

Detailed Description


Data Structure Documentation

struct starpu_driver

structure for a driver

Data Fields
enum starpu_worker_archtype type The type of the driver. Only STARPU_CPU_WORKER, STARPU_CUDA_WORKER and STARPU_OPENCL_WORKER are currently supported.
union starpu_driver id The identifier of the driver.
union starpu_driver.id
Data Fields
unsigned cpu_id
unsigned cuda_id
cl_device_id opencl_id
struct starpu_vector_interface

Vector interface

vector interface for contiguous (non-strided) buffers

Data Fields
uintptr_t ptr local pointer of the vector
uintptr_t dev_handle device handle of the vector.
size_t offset offset in the vector
uint32_t nx number of elements on the x-axis of the vector
size_t elemsize size of the elements of the vector
struct starpu_conf

This structure is passed to the starpu_init() function in order to configure StarPU. It has to be initialized with starpu_conf_init(). When the default value is used, StarPU automatically selects the number of processing units and takes the default scheduling policy. The environment variables overwrite the equivalent parameters.

Data Fields
int magic Will be initialized by starpu_conf_init(). Should not be set by hand.
const char * sched_policy_name This is the name of the scheduling policy. This can also be specified with the environment variable STARPU_SCHED. (default = NULL).
struct starpu_sched_policy * sched_policy This is the definition of the scheduling policy. This field is ignored if starpu_conf::sched_policy_name is set. (default = NULL)
int ncpus This is the number of CPU cores that StarPU can use. This can also be specified with the environment variable STARPU_NCPU . (default = -1)
int ncuda This is the number of CUDA devices that StarPU can use. This can also be specified with the environment variable STARPU_NCUDA. (default = -1)
int nopencl This is the number of OpenCL devices that StarPU can use. This can also be specified with the environment variable STARPU_NOPENCL. (default = -1)
unsigned use_explicit_workers_bindid If this flag is set, the starpu_conf::workers_bindid array indicates where the different workers are bound, otherwise StarPU automatically selects where to bind the different workers. This can also be specified with the environment variable STARPU_WORKERS_CPUID. (default = 0)
unsigned workers_bindid If the starpu_conf::use_explicit_workers_bindid flag is set, this array indicates where to bind the different workers. The i-th entry of the starpu_conf::workers_bindid indicates the logical identifier of the processor which should execute the i-th worker. Note that the logical ordering of the CPUs is either determined by the OS, or provided by the hwloc library in case it is available.
unsigned use_explicit_workers_cuda_gpuid If this flag is set, the CUDA workers will be attached to the CUDA devices specified in the starpu_conf::workers_cuda_gpuid array. Otherwise, StarPU affects the CUDA devices in a round-robin fashion. This can also be specified with the environment variable STARPU_WORKERS_CUDAID. (default = 0)
unsigned workers_cuda_gpuid If the starpu_conf::use_explicit_workers_cuda_gpuid flag is set, this array contains the logical identifiers of the CUDA devices (as used by cudaGetDevice()).
unsigned use_explicit_workers_opencl_gpuid If this flag is set, the OpenCL workers will be attached to the OpenCL devices specified in the starpu_conf::workers_opencl_gpuid array. Otherwise, StarPU affects the OpenCL devices in a round-robin fashion. This can also be specified with the environment variable STARPU_WORKERS_OPENCLID. (default = 0)
unsigned workers_opencl_gpuid If the starpu_conf::use_explicit_workers_opencl_gpuid flag is set, this array contains the logical identifiers of the OpenCL devices to be used.
int bus_calibrate If this flag is set, StarPU will recalibrate the bus. If this value is equal to -1, the default value is used. This can also be specified with the environment variable STARPU_BUS_CALIBRATE. (default = 0)
int calibrate If this flag is set, StarPU will calibrate the performance models when executing tasks. If this value is equal to -1, the default value is used. If the value is equal to 1, it will force continuing calibration. If the value is equal to 2, the existing performance models will be overwritten. This can also be specified with the environment variable STARPU_CALIBRATE. (default = 0)
int single_combined_worker By default, StarPU executes parallel tasks concurrently. Some parallel libraries (e.g. most OpenMP implementations) however do not support concurrent calls to parallel code. In such case, setting this flag makes StarPU only start one parallel task at a time (but other CPU and GPU tasks are not affected and can be run concurrently). The parallel task scheduler will however still however still try varying combined worker sizes to look for the most efficient ones. This can also be specified with the environment variable STARPU_SINGLE_COMBINED_WORKER. (default = 0)
int disable_asynchronous_copy This flag should be set to 1 to disable asynchronous copies between CPUs and all accelerators. This can also be specified with the environment variable STARPU_DISABLE_ASYNCHRONOUS_COPY. The AMD implementation of OpenCL is known to fail when copying data asynchronously. When using this implementation, it is therefore necessary to disable asynchronous data transfers. This can also be specified at compilation time by giving to the configure script the option --disable-asynchronous-copy. (default = 0)
int disable_asynchronous_cuda_copy This flag should be set to 1 to disable asynchronous copies between CPUs and CUDA accelerators. This can also be specified with the environment variable STARPU_DISABLE_ASYNCHRONOUS_CUDA_COPY. This can also be specified at compilation time by giving to the configure script the option --disable-asynchronous-cuda-copy. (default = 0)
int disable_asynchronous_opencl_copy This flag should be set to 1 to disable asynchronous copies between CPUs and OpenCL accelerators. This can also be specified with the environment variable STARPU_DISABLE_ASYNCHRONOUS_OPENCL_COPY. The AMD implementation of OpenCL is known to fail when copying data asynchronously. When using this implementation, it is therefore necessary to disable asynchronous data transfers. This can also be specified at compilation time by giving to the configure script the option --disable-asynchronous-opencl-copy. (default = 0)
unsigned * cuda_opengl_interoperability Enable CUDA/OpenGL interoperation on these CUDA devices. This can be set to an array of CUDA device identifiers for which cudaGLSetGLDevice() should be called instead of cudaSetDevice(). Its size is specified by the starpu_conf::n_cuda_opengl_interoperability field below (default = NULL)
unsigned n_cuda_opengl_interoperability
struct starpu_driver * not_launched_drivers Array of drivers that should not be launched by StarPU. The application will run in one of its own threads. (default = NULL)
unsigned n_not_launched_drivers The number of StarPU drivers that should not be launched by StarPU. (default = 0)
unsigned trace_buffer_size Specifies the buffer size used for FxT tracing. Starting from FxT version 0.2.12, the buffer will automatically be flushed when it fills in, but it may still be interesting to specify a bigger value to avoid any flushing (which would disturb the trace).

Function Documentation

int starpu_init ( struct starpu_conf conf)

This is StarPU initialization method, which must be called prior to any other StarPU call. It is possible to specify StarPU’s configuration (e.g. scheduling policy, number of cores, ...) by passing a non-null argument. Default configuration is used if the passed argument is NULL. Upon successful completion, this function returns 0. Otherwise, -ENODEV indicates that no worker was available (so that StarPU was not initialized).

int starpu_conf_init ( struct starpu_conf conf)

This function initializes the conf structure passed as argument with the default values. In case some configuration parameters are already specified through environment variables, starpu_conf_init() initializes the fields of the structure according to the environment variables. For instance if STARPU_CALIBRATE is set, its value is put in the field starpu_conf::calibrate of the structure passed as argument. Upon successful completion, this function returns 0. Otherwise, -EINVAL indicates that the argument was NULL.

void starpu_shutdown ( void  )

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

void starpu_pause ( void  )

This call is used to suspend the processing of new tasks by workers. It can be used in a program where StarPU is used during only a part of the execution. Without this call, the workers continue to poll for new tasks in a tight loop, wasting CPU time. The symmetric call to starpu_resume() should be used to unfreeze the workers.

void starpu_resume ( void  )

This is the symmetrical call to starpu_pause(), used to resume the workers polling for new tasks.

int starpu_asynchronous_copy_disabled ( void  )

Return 1 if asynchronous data transfers between CPU and accelerators are disabled.

int starpu_asynchronous_cuda_copy_disabled ( void  )

Return 1 if asynchronous data transfers between CPU and CUDA accelerators are disabled.

int starpu_asynchronous_opencl_copy_disabled ( void  )

Return 1 if asynchronous data transfers between CPU and OpenCL accelerators are disabled.

void starpu_topology_print ( FILE *  f)

Prints a description of the topology on f.