Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions parsec/include/parsec/execution_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ struct parsec_context_s {
parsec_hash_table_t dtd_arena_datatypes_hash_table; /**< Hash table that stores the arena datatypes used by DTD */
int dtd_arena_datatypes_next_id; /**< Next ID to use for the next Arena Datatype by DTD */

parsec_lifo_t activities; /**< list of tasks with outstanding activities, high-priority */

#if defined(PARSEC_SIM)
int largest_simulation_date;
#endif
Expand Down
8 changes: 7 additions & 1 deletion parsec/mca/device/device_gpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -2623,14 +2623,20 @@ parsec_device_kernel_scheduler( parsec_device_module_t *module,
gpu_task->ec = NULL;
goto remove_gpu_task;
}

parsec_device_kernel_epilog( gpu_device, gpu_task );
__parsec_complete_execution( es, gpu_task->ec );
__parsec_schedule_activity( es, gpu_task->ec );
gpu_device->super.executed_tasks++;

remove_gpu_task:
PARSEC_DEBUG_VERBOSE(10, parsec_gpu_output_stream, "GPU[%d:%s]: gpu_task %p freed",
gpu_device->super.device_index, gpu_device->super.name,
gpu_task);

// TODO: this should only be done for internal gpu tasks
// and the DSL should be responsible for freeing the memory it allocated
free( gpu_task );

rc = parsec_atomic_fetch_dec_int32( &(gpu_device->mutex) );
if( 1 == rc ) { /* I was the last one */
#if defined(PARSEC_PROF_TRACE)
Expand Down
9 changes: 8 additions & 1 deletion parsec/parsec.c
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,8 @@ parsec_context_t* parsec_init( int nb_cores, int* pargc, char** pargv[] )
context->comm_th_core = -1;
#endif /* defined(PARSEC_HAVE_HWLOC) */

PARSEC_OBJ_CONSTRUCT(&context->activities, parsec_lifo_t);

/* TODO: nb_cores should depend on the vp_id */
nb_total_comp_threads = 0;
for(p = 0; p < nb_vp; p++) {
Expand Down Expand Up @@ -1225,7 +1227,7 @@ int parsec_fini( parsec_context_t** pcontext )
#endif /* PARSEC_PROF_TRACE */

/* PAPI SDE needs to process the shutdown before resources exposed to it are freed.
* This includes scheduling resources, so SDE needs to be finalized before the
* This includes scheduling resources, so SDE needs to be finalized before the
* computation threads leave */
PARSEC_PAPI_SDE_FINI();

Expand Down Expand Up @@ -1265,6 +1267,11 @@ int parsec_fini( parsec_context_t** pcontext )
parsec_hwloc_fini();
#endif /* PARSEC_HAVE_HWLOC_BITMAP */

if (!parsec_lifo_is_empty(&context->activities)) {
parsec_warning("/!\\ Warning: not all activities were executing before shutdown!\n");
}
PARSEC_OBJ_DESTRUCT(&context->activities);

if (parsec_app_name != NULL ) {
free(parsec_app_name);
parsec_app_name = NULL;
Expand Down
12 changes: 12 additions & 0 deletions parsec/scheduling.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,11 @@ int __parsec_reschedule(parsec_execution_stream_t* es, parsec_task_t* task)
return __parsec_schedule(es, task, 0);
}

int __parsec_schedule_activity(parsec_execution_stream_t *es, parsec_task_t *task) {
parsec_lifo_push(&es->virtual_process->parsec_context->activities, &task->super);
return PARSEC_SUCCESS;
}

int __parsec_complete_execution( parsec_execution_stream_t *es,
parsec_task_t *task )
{
Expand Down Expand Up @@ -532,6 +537,13 @@ __parsec_get_next_task( parsec_execution_stream_t *es,
{
parsec_task_t* task;

if (!parsec_list_nolock_is_empty(&es->virtual_process->parsec_context->activities)) {
task = (parsec_task_t*)parsec_lifo_pop(&es->virtual_process->parsec_context->activities);
if (NULL != task) {
return task;
}
}

if( NULL == (task = es->next_task) ) {
task = parsec_current_scheduler->module.select(es, distance);
} else {
Expand Down
3 changes: 3 additions & 0 deletions parsec/scheduling.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ int __parsec_schedule_vp( parsec_execution_stream_t*,
parsec_task_t**,
int32_t distance);

int __parsec_schedule_activity( parsec_execution_stream_t *es,
parsec_task_t *task);

/**
* @brief Reschedule a task on the most appropriate resource.
*
Expand Down