| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 | /* * This file is part of the StarPU Handbook. * Copyright (C) 2009--2011  Universit@'e de Bordeaux * Copyright (C) 2010, 2011, 2012, 2013, 2014  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_Workers_Properties Workers’ Properties\def STARPU_NMAXWORKERS\ingroup API_Workers_PropertiesDefine the maximum number of workers managed by StarPU.\enum starpu_node_kind\ingroup API_Workers_PropertiesTODO\var starpu_node_kind::STARPU_UNUSED\ingroup API_Workers_PropertiesTODO\ingroup API_Workers_Properties\var starpu_node_kind::STARPU_CPU_RAM\ingroup API_Workers_PropertiesTODO\var starpu_node_kind::STARPU_CUDA_RAM\ingroup API_Workers_PropertiesTODO\var starpu_node_kind::STARPU_OPENCL_RAM\ingroup API_Workers_PropertiesTODO\var starpu_node_kind::STARPU_MIC_RAM\ingroup API_Workers_PropertiesTODO\var starpu_node_kind::STARPU_SCC_RAM\ingroup API_Workers_PropertiesThis node kind is not used anymore, but implementations in interfaceswill be useful for MPI.\var starpu_node_kind::STARPU_SCC_SHM\ingroup API_Workers_PropertiesTODO\enum starpu_worker_archtype\ingroup API_Workers_PropertiesWorker Architecture Type\var starpu_worker_archtype::STARPU_ANY_WORKER\ingroup API_Workers_Propertiesany worker, used in the hypervisor\var starpu_worker_archtype::STARPU_CPU_WORKER\ingroup API_Workers_PropertiesCPU core\var starpu_worker_archtype::STARPU_CUDA_WORKER\ingroup API_Workers_PropertiesNVIDIA CUDA device\var starpu_worker_archtype::STARPU_OPENCL_WORKER\ingroup API_Workers_PropertiesOpenCL device\var starpu_worker_archtype::STARPU_MIC_WORKER\ingroup API_Workers_PropertiesIntel MIC device\var starpu_worker_archtype::STARPU_SCC_WORKER\ingroup API_Workers_PropertiesIntel SCC device\struct starpu_worker_collection\ingroup API_Workers_PropertiesA scheduling context manages a collection of workers that canbe memorized using different data structures. Thus, a genericstructure is available in order to simplify the choice of its type.Only the list data structure is available but further datastructures(like tree) implementations are foreseen.\var void *starpu_worker_collection::workerids        The workerids managed by the collection\var unsigned starpu_worker_collection::nworkers        The number of workers in the collection\var enum starpu_worker_collection_type starpu_worker_collection::type        The type of structure (currently ::STARPU_WORKER_LIST is the only one available)\var unsigned (*starpu_worker_collection::has_next)(struct starpu_worker_collection *workers, struct starpu_sched_ctx_iterator *it)        Checks if there is another element in collection\var int (*starpu_worker_collection::get_next)(struct starpu_worker_collection *workers, struct starpu_sched_ctx_iterator *it)        return the next element in the collection\var int (*starpu_worker_collection::add)(struct starpu_worker_collection *workers, int worker)        add a new element in the collection\var int (*starpu_worker_collection::remove)(struct starpu_worker_collection *workers, int worker)        remove an element from the collection\var void (*starpu_worker_collection::init)(struct starpu_worker_collection *workers)        Initialize the collection\var void (*starpu_worker_collection::deinit)(struct starpu_worker_collection *workers)        Deinitialize the colection\var void (*starpu_worker_collection::init_iterator)(struct starpu_worker_collection *workers, struct starpu_sched_ctx_iterator *it)        Initialize the cursor if there is one\enum starpu_worker_collection_type\ingroup API_Workers_PropertiesTypes of structures the worker collection can implement\var starpu_worker_collection_type::STARPU_WORKER_LIST\ingroup API_Workers_PropertiesThe collection is an array\struct starpu_sched_ctx_iterator\ingroup API_Workers_PropertiesStructure needed to iterate on the collection\var int starpu_sched_ctx_iterator::cursorThe index of the current worker in the collection, needed when iterating onthe collection.\fn unsigned starpu_worker_get_count(void)\ingroup API_Workers_PropertiesThis function returns the number of workers (i.e. processingunits executing StarPU tasks). The returned value should be at most\ref STARPU_NMAXWORKERS.\fn int starpu_worker_get_count_by_type(enum starpu_worker_archtype type)\ingroup API_Workers_PropertiesReturns the number of workers of the given type. A positive (orNULL) value is returned in case of success, -EINVAL indicates that thetype is not valid otherwise.\fn unsigned starpu_cpu_worker_get_count(void)\ingroup API_Workers_PropertiesThis function returns the number of CPUs controlled by StarPU. Thereturned value should be at most \ref STARPU_MAXCPUS.\fn unsigned starpu_cuda_worker_get_count(void)\ingroup API_Workers_PropertiesThis function returns the number of CUDA devices controlled byStarPU. The returned value should be at most \ref STARPU_MAXCUDADEVS.\fn unsigned starpu_mic_worker_get_count(void)\ingroup API_Workers_PropertiesThis function returns the number of MIC workers controlled by StarPU.\fn unsigned starpu_mic_device_get_count(void)\ingroup API_Workers_PropertiesThis function returns the number of MIC devices controlled by StarPU.The returned value should be at most \ref STARPU_MAXMICDEVS.\fn unsigned starpu_scc_worker_get_count(void)\ingroup API_Workers_PropertiesThis function returns the number of SCC devices controlled by StarPU.The returned value should be at most \ref STARPU_MAXSCCDEVS.\fn unsigned starpu_opencl_worker_get_count(void)\ingroup API_Workers_PropertiesThis function returns the number of OpenCL devices controlled byStarPU. The returned value should be at most \ref STARPU_MAXOPENCLDEVS.\fn int starpu_worker_get_id(void)\ingroup API_Workers_PropertiesThis function returns the identifier of the current worker, i.ethe one associated to the calling thread. The returned value is either-1 if the current context is not a StarPU worker (i.e. when calledfrom the application outside a task or a callback), or an integerbetween 0 and starpu_worker_get_count() - 1.\fn int starpu_worker_get_ids_by_type(enum starpu_worker_archtype type, int *workerids, int maxsize)\ingroup API_Workers_PropertiesThis function gets the list of identifiers of workers with thegiven type. It fills the array \p workerids with the identifiers of theworkers that have the type indicated in the first argument. Theargument \p maxsize indicates the size of the array \p workerids. The returnedvalue gives the number of identifiers that were put in the array.-ERANGE is returned is \p maxsize is lower than the number of workerswith the appropriate type: in that case, the array is filled with the\p maxsize first elements. To avoid such overflows, the value of maxsizecan be chosen by the means of the functionstarpu_worker_get_count_by_type(), or by passing a value greater orequal to \ref STARPU_NMAXWORKERS.\fn int starpu_worker_get_by_type(enum starpu_worker_archtype type, int num)\ingroup API_Workers_PropertiesThis returns the identifier of the num-th worker that has thespecified type type. If there are no such worker, -1 is returned.\fn int starpu_worker_get_by_devid(enum starpu_worker_archtype type, int devid)\ingroup API_Workers_PropertiesThis returns the identifier of the worker that has the specified type\p type and device id \p devid (which may not be the n-th, if somedevices are skipped for instance). If there are no such worker, -1 is returned.\fn int starpu_worker_get_devid(int id)\ingroup API_Workers_PropertiesThis function returns the device id of the given worker. Theworker should be identified with the value returned by thestarpu_worker_get_id() function. In the case of a CUDA worker, thisdevice identifier is the logical device identifier exposed by CUDA(used by the function cudaGetDevice() for instance). The deviceidentifier of a CPU worker is the logical identifier of the core onwhich the worker was bound; this identifier is either provided by theOS or by the library <c>hwloc</c> in case it is available.\fn enum starpu_worker_archtype starpu_worker_get_type(int id)\ingroup API_Workers_PropertiesThis function returns the type of processing unit associated toa worker. The worker identifier is a value returned by the functionstarpu_worker_get_id()). The returned value indicates thearchitecture of the worker: ::STARPU_CPU_WORKER for a CPU core,::STARPU_CUDA_WORKER for a CUDA device, and ::STARPU_OPENCL_WORKER for aOpenCL device. The value returned for an invalid identifier isunspecified.\fn void starpu_worker_get_name(int id, char *dst, size_t maxlen)\ingroup API_Workers_PropertiesThis function allows to get the name of a given worker. StarPUassociates a unique human readable string to each processing unit.This function copies at most the maxlen first bytes of the uniquestring associated to a worker identified by its identifier id into thedst buffer. The caller is responsible for ensuring that \p dst is avalid pointer to a buffer of \p maxlen bytes at least. Calling thisfunction on an invalid identifier results in an unspecified behaviour.\fn unsigned starpu_worker_get_memory_node(unsigned workerid)\ingroup API_Workers_PropertiesThis function returns the identifier of the memory nodeassociated to the worker identified by \p workerid.\fn enum starpu_node_kind starpu_node_get_kind(unsigned node)\ingroup API_Workers_PropertiesReturns the type of the given node as defined by::starpu_node_kind. For example, when defining a new data interface,this function should be used in the allocation function to determineon which device the memory needs to be allocated.\fn char *starpu_worker_get_type_as_string(enum starpu_worker_archtype type)\ingroup API_Workers_PropertiesReturns the given worker type as a string.*/
 |