| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265 | /* * This file is part of the StarPU Handbook. * Copyright (C) 2009--2011  Universit@'e de Bordeaux 1 * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique * Copyright (C) 2011, 2012 Institut National de Recherche en Informatique et Automatique * See the file version.doxy for copying conditions. *//*! \defgroup API_Initialization_and_Termination Initialization and Termination\struct starpu_driverstructure for a driver\ingroup API_Initialization_and_Termination\var starpu_driver::typeThe type of the driver. Only ::STARPU_CPU_WORKER,::STARPU_CUDA_WORKER and ::STARPU_OPENCL_WORKER are currently supported.\var starpu_driver::idThe identifier of the driver.\struct starpu_vector_interfacevector interface for contiguous (non-strided) buffers\ingroup API_Initialization_and_Termination\struct starpu_conf\ingroup API_Initialization_and_TerminationThis structure is passed to the starpu_init() function in order toconfigure StarPU. It has to be initialized with starpu_conf_init().When the default value is used, StarPU automatically selects thenumber of processing units and takes the default scheduling policy.The environment variables overwrite the equivalent parameters.\var starpu_conf::magic\privateWill be initialized by starpu_conf_init(). Should not be set by hand.\var starpu_conf::sched_policy_nameThis is the name of the scheduling policy. This can also be specifiedwith the environment variable \ref STARPU_SCHED. (default = NULL).\var starpu_conf::sched_policyThis is the definition of the scheduling policy. This field is ignoredif starpu_conf::sched_policy_name is set. (default = NULL)\var starpu_conf::ncpusThis is the number of CPU cores that StarPU can use. This can also bespecified with the environment variable \ref STARPU_NCPU . (default = -1)\var starpu_conf::ncudaThis is the number of CUDA devices that StarPU can use. This can alsobe specified with the environment variable \ref STARPU_NCUDA. (default =-1)\var starpu_conf::nopenclThis is the number of OpenCL devices that StarPU can use. This canalso be specified with the environment variable \ref STARPU_NOPENCL.(default = -1)\var starpu_conf::nmicThis is the number of MIC devices that StarPU can use. This can alsobe specified with the environment variable \ref STARPU_NMIC.(default = -1)\var starpu_conf::nsccThis is the number of SCC devices that StarPU can use. This can alsobe specified with the environment variable \ref STARPU_NSCC.(default = -1)\var starpu_conf::use_explicit_workers_bindidIf this flag is set, the starpu_conf::workers_bindid array indicateswhere the different workers are bound, otherwise StarPU automaticallyselects where to bind the different workers. This can also bespecified with the environment variable \ref STARPU_WORKERS_CPUID. (default = 0)\var starpu_conf::workers_bindidIf the starpu_conf::use_explicit_workers_bindid flag is set, thisarray indicates where to bind the different workers. The i-th entry ofthe starpu_conf::workers_bindid indicates the logical identifier ofthe processor which should execute the i-th worker. Note that thelogical ordering of the CPUs is either determined by the OS, orprovided by the hwloc library in case it is available.\var starpu_conf::use_explicit_workers_cuda_gpuidIf this flag is set, the CUDA workers will be attached to the CUDAdevices 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 \refSTARPU_WORKERS_CUDAID. (default = 0)\var starpu_conf::workers_cuda_gpuidIf the starpu_conf::use_explicit_workers_cuda_gpuid flag is set, thisarray contains the logical identifiers of the CUDA devices (as used bycudaGetDevice()).\var starpu_conf::use_explicit_workers_opencl_gpuidIf this flag is set, the OpenCL workers will be attached to the OpenCLdevices 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 \refSTARPU_WORKERS_OPENCLID. (default = 0)\var starpu_conf::workers_opencl_gpuidIf the starpu_conf::use_explicit_workers_opencl_gpuid flag is set,this array contains the logical identifiers of the OpenCL devices tobe used.\var starpu_conf::use_explicit_workers_mic_deviceidIf this flag is set, the MIC workers will be attached to the MICdevices specified in the array starpu_conf::workers_mic_deviceid.Otherwise, StarPU affects the MIC devices in a round-robin fashion.This can also be specified with the environment variable \refSTARPU_WORKERS_MICID.(default = 0)\var starpu_conf::workers_mic_deviceidIf the flag starpu_conf::use_explicit_workers_mic_deviceid is set, thearray contains the logical identifiers of the MIC devices to be used.\var starpu_conf::use_explicit_workers_scc_deviceidIf this flag is set, the SCC workers will be attached to the SCCdevices specified in the array starpu_conf::workers_scc_deviceid.(default = 0)\var starpu_conf::workers_scc_deviceidIf the flag starpu_conf::use_explicit_workers_scc_deviceid is set, thearray contains the logical identifiers of the SCC devices to be used.Otherwise, StarPU affects the SCC devices in a round-robin fashion.This can also be specified with the environment variable \refSTARPU_WORKERS_SCCID.\var starpu_conf::bus_calibrateIf this flag is set, StarPU will recalibrate the bus.  If this valueis equal to <c>-1</c>, the default value is used.  This can also bespecified with the environment variable \ref STARPU_BUS_CALIBRATE. (default= 0)\var starpu_conf::calibrateIf this flag is set, StarPU will calibrate the performance models whenexecuting tasks. If this value is equal to <c>-1</c>, the defaultvalue is used. If the value is equal to <c>1</c>, it will forcecontinuing calibration. If the value is equal to <c>2</c>, theexisting performance models will be overwritten. This can also bespecified with the environment variable \ref STARPU_CALIBRATE. (default =0)\var starpu_conf::single_combined_workerBy default, StarPU executes parallel tasksconcurrently. Some parallel libraries (e.g. most OpenMPimplementations) however do not support concurrent calls toparallel code. In such case, setting this flag makes StarPUonly start one parallel task at a time (but other CPU andGPU tasks are not affected and can be run concurrently).The parallel task scheduler will however still howeverstill try varying combined worker sizes to look for themost efficient ones. This can also be specified with the environmentvariable \ref STARPU_SINGLE_COMBINED_WORKER.(default = 0)\var starpu_conf::mic_sink_program_pathPath to the kernel to execute on the MIC device, compiled for MICarchitecture. When set to NULL, StarPU automatically looks next to thehost program location.(default = NULL)\var starpu_conf::disable_asynchronous_copyThis flag should be set to 1 to disableasynchronous copies between CPUs and all accelerators. Thiscan also be specified with the environment variable \refSTARPU_DISABLE_ASYNCHRONOUS_COPY. TheAMD implementation of OpenCL is known to fail when copyingdata asynchronously. When using this implementation, it istherefore necessary to disable asynchronous data transfers.This can also be specified at compilation time by giving tothe configure script the option\ref disable-asynchronous-copy "--disable-asynchronous-copy". (default = 0)\var starpu_conf::disable_asynchronous_cuda_copyThis flag should be set to 1 to disableasynchronous copies between CPUs and CUDA accelerators.This can also be specified with the environment variable\ref STARPU_DISABLE_ASYNCHRONOUS_CUDA_COPY.This can also be specified at compilation time by giving tothe configure script the option\ref disable-asynchronous-cuda-copy "--disable-asynchronous-cuda-copy". (default = 0)\var starpu_conf::disable_asynchronous_opencl_copyThis flag should be set to 1 to disableasynchronous copies between CPUs and OpenCL accelerators.This can also be specified with the environmentvariable \ref STARPU_DISABLE_ASYNCHRONOUS_OPENCL_COPY. The AMDimplementation of OpenCL is known to failwhen copying data asynchronously. When using thisimplementation, it is therefore necessary to disableasynchronous data transfers. This can also be specified atcompilation time by giving to the configure script theoption \ref disable-asynchronous-opencl-copy "--disable-asynchronous-opencl-copy".(default = 0)\var starpu_conf::disable_asynchronous_mic_copyThis flag should be set to 1 to disable asynchronous copies betweenCPUs and MIC accelerators. This can also be specified with theenvironment variable \ref STARPU_DISABLE_ASYNCHRONOUS_MIC_COPY.This can also be specified at compilation time by giving to theconfigure script the option \ref disable-asynchronous-mic-copy "--disable-asynchronous-mic-copy".(default = 0).\var starpu_conf::cuda_opengl_interoperabilityEnable CUDA/OpenGL interoperation on these CUDAdevices. This can be set to an array of CUDA deviceidentifiers for which cudaGLSetGLDevice() should be calledinstead of cudaSetDevice(). Its size is specified by thestarpu_conf::n_cuda_opengl_interoperability field below(default = NULL)\var starpu_conf::n_cuda_opengl_interoperability\var starpu_conf::not_launched_driversArray of drivers that should not be launched byStarPU. The application will run in one of its ownthreads. (default = NULL)\var starpu_conf::n_not_launched_driversThe number of StarPU drivers that should not belaunched by StarPU. (default = 0)\var starpu_conf::trace_buffer_sizeSpecifies the buffer size used for FxT tracing.Starting from FxT version 0.2.12, the buffer willautomatically be flushed when it fills in, but it may stillbe interesting to specify a bigger value to avoid anyflushing (which would disturb the trace).\fn int starpu_init(struct starpu_conf *conf)\ingroup API_Initialization_and_TerminationThis is StarPU initialization method, which must be called prior toany other StarPU call. It is possible to specify StarPU’sconfiguration (e.g. scheduling policy, number of cores, ...) bypassing a non-null argument. Default configuration is used if thepassed argument is NULL. Upon successful completion, this functionreturns 0. Otherwise, -ENODEV indicates that no worker was available(so that StarPU was not initialized).\fn int starpu_initialize(struct starpu_conf *user_conf, int *argc, char ***argv)\ingroup API_Initialization_and_TerminationThis is the same as starpu_init(), but also takes the \p argc and \pargv as defined by the application. This is needed for SCC executionto initialize the communication library.Do not call starpu_init() and starpu_initialize() in thesame program.\fn int starpu_conf_init(struct starpu_conf *conf)\ingroup API_Initialization_and_TerminationThis function initializes the conf structure passed as argument withthe default values. In case some configuration parameters are alreadyspecified through environment variables, starpu_conf_init() initializesthe fields of the structure according to the environment variables.For instance if \ref STARPU_CALIBRATE is set, its value is put in thefield starpu_conf::calibrate of the structure passed as argument. Upon successfulcompletion, this function returns 0. Otherwise, -EINVAL indicates thatthe argument was NULL.\fn void starpu_shutdown(void)\ingroup API_Initialization_and_TerminationThis is StarPU termination method. It must be called at the end of theapplication: statistics and other post-mortem debugging informationare not guaranteed to be available until this method has been called.\fn int starpu_asynchronous_copy_disabled(void)\ingroup API_Initialization_and_TerminationReturn 1 if asynchronous data transfers between CPU and acceleratorsare disabled.\fn int starpu_asynchronous_cuda_copy_disabled(void)\ingroup API_Initialization_and_TerminationReturn 1 if asynchronous data transfers between CPU and CUDAaccelerators are disabled.\fn int starpu_asynchronous_opencl_copy_disabled(void)\ingroup API_Initialization_and_TerminationReturn 1 if asynchronous data transfers between CPU and OpenCLaccelerators are disabled.\fn void starpu_topology_print(FILE *f)\ingroup API_Initialization_and_TerminationPrints a description of the topology on f.*/
 |