|
@@ -33,8 +33,6 @@ static unsigned _starpu_worker_get_first_free_sched_ctx(struct _starpu_worker *w
|
|
|
|
|
|
static unsigned _starpu_worker_get_sched_ctx_id(struct _starpu_worker *worker, unsigned sched_ctx_id);
|
|
|
|
|
|
-static unsigned _get_workers_list(struct _starpu_sched_ctx *sched_ctx, int **workerids);
|
|
|
-
|
|
|
static void _starpu_worker_gets_into_ctx(unsigned sched_ctx_id, struct _starpu_worker *worker)
|
|
|
{
|
|
|
unsigned worker_sched_ctx_id = _starpu_worker_get_sched_ctx_id(worker, sched_ctx_id);
|
|
@@ -205,7 +203,7 @@ static void _starpu_sched_ctx_free_scheduling_data(struct _starpu_sched_ctx *sch
|
|
|
{
|
|
|
int *workerids = NULL;
|
|
|
|
|
|
- unsigned nworkers_ctx = _get_workers_list(sched_ctx, &workerids);
|
|
|
+ unsigned nworkers_ctx = starpu_sched_ctx_get_workers_list(sched_ctx->id, &workerids);
|
|
|
|
|
|
if(nworkers_ctx > 0 && sched_ctx->sched_policy->remove_workers)
|
|
|
sched_ctx->sched_policy->remove_workers(sched_ctx->id, workerids, nworkers_ctx);
|
|
@@ -537,7 +535,7 @@ void starpu_sched_ctx_delete(unsigned sched_ctx_id)
|
|
|
STARPU_ASSERT(sched_ctx->id != STARPU_NMAX_SCHED_CTXS);
|
|
|
|
|
|
int *workerids;
|
|
|
- unsigned nworkers_ctx = _get_workers_list(sched_ctx, &workerids);
|
|
|
+ unsigned nworkers_ctx = starpu_sched_ctx_get_workers_list(sched_ctx->id, &workerids);
|
|
|
|
|
|
/*if both of them have all the ressources is pointless*/
|
|
|
/*trying to transfer ressources from one ctx to the other*/
|
|
@@ -560,7 +558,7 @@ void starpu_sched_ctx_delete(unsigned sched_ctx_id)
|
|
|
|
|
|
}
|
|
|
|
|
|
- /* workerids is malloc-ed in _get_workers_list, don't forget to free it when
|
|
|
+ /* workerids is malloc-ed in starpu_sched_ctx_get_workers_list, don't forget to free it when
|
|
|
you don't use it anymore */
|
|
|
free(workerids);
|
|
|
STARPU_PTHREAD_MUTEX_UNLOCK(&changing_ctx_mutex[sched_ctx_id]);
|
|
@@ -796,7 +794,7 @@ void _starpu_decrement_nsubmitted_tasks_of_sched_ctx(unsigned sched_ctx_id)
|
|
|
if(sched_ctx->id != STARPU_NMAX_SCHED_CTXS)
|
|
|
{
|
|
|
int *workerids = NULL;
|
|
|
- unsigned nworkers = _get_workers_list(sched_ctx, &workerids);
|
|
|
+ unsigned nworkers = starpu_sched_ctx_get_workers_list(sched_ctx->id, &workerids);
|
|
|
|
|
|
if(nworkers > 0)
|
|
|
{
|
|
@@ -883,8 +881,9 @@ struct starpu_worker_collection* starpu_sched_ctx_create_worker_collection(unsig
|
|
|
return sched_ctx->workers;
|
|
|
}
|
|
|
|
|
|
-static unsigned _get_workers_list(struct _starpu_sched_ctx *sched_ctx, int **workerids)
|
|
|
+unsigned starpu_sched_ctx_get_workers_list(unsigned sched_ctx_id, int **workerids)
|
|
|
{
|
|
|
+ struct _starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx_struct(sched_ctx_id);
|
|
|
struct starpu_worker_collection *workers = sched_ctx->workers;
|
|
|
*workerids = (int*)malloc(workers->nworkers*sizeof(int));
|
|
|
int worker;
|