Skip to content

Commit b3dfcdc

Browse files
committed
Mostly improvement to the debuging output.
Name the data_t allocated for temporaries allowing developers to track them through the execution. Add the keys to all outputs (tasks and copies). Signed-off-by: George Bosilca <gbosilca@nvidia.com>
1 parent 1900c80 commit b3dfcdc

File tree

8 files changed

+46
-25
lines changed

8 files changed

+46
-25
lines changed

parsec/arena.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,10 @@ int parsec_arena_allocate_device_private(parsec_data_copy_t *copy,
238238
#include "parsec/utils/zone_malloc.h"
239239
#include "mca/device/device_gpu.h"
240240

241+
#if defined(PARSEC_DEBUG)
242+
static int64_t parsec_countable_incoming_message = 0xF000000000000000;
243+
#endif /* defined(PARSEC_DEBUG) */
244+
241245
static inline parsec_data_copy_t *
242246
parsec_arena_internal_copy_new(parsec_arena_t *arena,
243247
parsec_data_t *data,
@@ -251,6 +255,11 @@ parsec_arena_internal_copy_new(parsec_arena_t *arena,
251255
if( NULL == ldata ) {
252256
return NULL;
253257
}
258+
#if defined(PARSEC_DEBUG)
259+
/* Name the data with a default key to facilitate debuging */
260+
ldata->key = (uint64_t)parsec_atomic_fetch_inc_int64(&parsec_countable_incoming_message);
261+
ldata->key |= ((uint64_t)device) << 56;
262+
#endif /* defined(PARSEC_DEBUG) */
254263
}
255264
if( 0 == device ) {
256265
copy = parsec_data_copy_new(ldata, device, dtt,

parsec/class/info.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,8 @@ void *parsec_info_get(parsec_info_object_array_t *oa, parsec_info_id_t iid)
312312
if(NULL == ie->constructor)
313313
return ret;
314314
nio = ie->constructor(oa->cons_obj, ie->cons_data);
315+
if( NULL == nio )
316+
return ret;
315317
ret = parsec_info_test_and_set(oa, iid, nio, NULL);
316318
if(ret != nio && NULL != ie->destructor) {
317319
ie->destructor(nio, ie->des_data);

parsec/data.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,10 +466,11 @@ void parsec_data_copy_dump(parsec_data_copy_t* copy)
466466
if( PARSEC_DATA_COHERENCY_SHARED == copy->coherency_state ) coherency = "shared";
467467

468468
parsec_debug_verbose(0, 0, "%s [%d]: copy %p [ref %d] coherency %s readers %d version %u transit %s flags %s\n"
469-
" older %p orig %p arena %p dev_priv %p\n",
469+
" older %p orig %p [%llx] arena %p dev_priv %p\n",
470470
((NULL != copy->original) && (copy->original->owner_device == copy->device_index)) ? "*" : " ",
471471
(int)copy->device_index, copy, copy->super.super.obj_reference_count, coherency, copy->readers, copy->version, tranfer, flags,
472-
(void *)copy->older, (void *)copy->original, (void *)copy->arena_chunk, copy->device_private);
472+
(void *)copy->older, (void *)copy->original,
473+
(NULL != copy->original) ? (unsigned long)copy->original->key : (unsigned long)-1, (void *)copy->arena_chunk, copy->device_private);
473474
}
474475

475476
void parsec_data_dump(parsec_data_t* data)

parsec/mca/device/device_gpu.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ void parsec_device_dump_exec_stream(parsec_gpu_exec_stream_t* exec_stream)
300300
int i;
301301

302302
parsec_debug_verbose(0, parsec_gpu_output_stream,
303-
"Dev: GPU stream %d{%p} [events = %d, start = %d, end = %d, executed = %d]",
303+
"Dev: GPU stream %s{%p} [events = %d, start = %d, end = %d, executed = %d]",
304304
exec_stream->name, exec_stream, exec_stream->max_events, exec_stream->start, exec_stream->end,
305305
exec_stream->executed);
306306
for( i = 0; i < exec_stream->max_events; i++ ) {
@@ -321,12 +321,12 @@ void parsec_device_dump_gpu_state(parsec_device_gpu_module_t* gpu_device)
321321
data_in_dev += gpu_device->super.data_in_from_device[i];
322322
}
323323

324-
parsec_output(parsec_gpu_output_stream, "\n\n");
325-
parsec_output(parsec_gpu_output_stream, "Device %d:%d (%p) epoch\n", gpu_device->super.device_index,
326-
gpu_device->super.device_index, gpu_device, gpu_device->data_avail_epoch);
327-
parsec_output(parsec_gpu_output_stream, "\tpeer mask %x executed tasks with %llu streams %d\n",
328-
gpu_device->peer_access_mask, (unsigned long long)gpu_device->super.executed_tasks, gpu_device->num_exec_streams);
329-
parsec_output(parsec_gpu_output_stream, "\tstats transferred [in: %llu from host %llu from other device out: %llu] required [in: %llu out: %llu]\n",
324+
parsec_output(parsec_gpu_output_stream,
325+
"\n\nDevice %s:%d (%p) epoch %zu\n"
326+
"\tpeer mask %x executed tasks %llu streams %d\n"
327+
"\tstats transferred [in: %llu from host %llu from other device out: %llu] required [in: %llu out: %llu]\n",
328+
gpu_device->super.name, gpu_device->super.device_index, gpu_device, gpu_device->data_avail_epoch,
329+
gpu_device->peer_access_mask, (unsigned long long)gpu_device->super.executed_tasks, gpu_device->num_exec_streams,
330330
(unsigned long long)data_in_host, (unsigned long long)data_in_dev,
331331
(unsigned long long)gpu_device->super.data_out_to_host,
332332
(unsigned long long)gpu_device->super.required_data_in, (unsigned long long)gpu_device->super.required_data_out);
@@ -1030,7 +1030,7 @@ parsec_device_data_reserve_space( parsec_device_gpu_module_t* gpu_device,
10301030
for( j = 0; j <= i; j++ ) {
10311031
/* This flow could be a control flow */
10321032
if( NULL == temp_loc[j] ) continue;
1033-
this_task->data[j].data_out = gpu_elem; /* reset the data out */
1033+
this_task->data[j].data_out = NULL; /* reset the data out */
10341034
/* This flow could be non-parsec-owned, in which case we can't reclaim it */
10351035
if( 0 == (temp_loc[j]->flags & PARSEC_DATA_FLAG_PARSEC_OWNED) ) continue;
10361036
PARSEC_DEBUG_VERBOSE(20, parsec_gpu_output_stream,
@@ -1044,6 +1044,9 @@ parsec_device_data_reserve_space( parsec_device_gpu_module_t* gpu_device,
10441044
PARSEC_DATA_COPY_RELEASE(gpu_elem);
10451045
#endif
10461046
parsec_atomic_unlock(&master->lock);
1047+
if( data_avail_epoch ) { /* update the memory epoch */
1048+
gpu_device->data_avail_epoch++;
1049+
}
10471050
return PARSEC_HOOK_RETURN_AGAIN;
10481051
}
10491052

@@ -1382,7 +1385,7 @@ parsec_device_data_stage_in( parsec_device_gpu_module_t* gpu_device,
13821385
"GPU[%d:%s]: Prefetch task %p is staging in",
13831386
gpu_device->super.device_index, gpu_device->super.name, gpu_task);
13841387
}
1385-
if( NULL == gpu_elem ) {
1388+
if( gpu_elem == candidate ) { /* data already located in the right place */
13861389
if( candidate->device_index == gpu_device->super.device_index ) {
13871390
/* the candidate is already located on the GPU, no transfer should be necessary but let's do the bookkeeping */
13881391
if( (PARSEC_FLOW_ACCESS_WRITE & type) && (gpu_task->task_type != PARSEC_GPU_TASK_TYPE_PREFETCH) ) {
@@ -2105,7 +2108,7 @@ parsec_device_kernel_push( parsec_device_gpu_module_t *gpu_device,
21052108
gpu_task->last_data_check_epoch = gpu_device->data_avail_epoch;
21062109
return ret;
21072110
}
2108-
2111+
gpu_task->last_status = 0; /* mark the task as clean */
21092112
for( i = 0; i < this_task->task_class->nb_flows; i++ ) {
21102113

21112114
flow = gpu_task->flow[i];
@@ -2133,11 +2136,10 @@ parsec_device_kernel_push( parsec_device_gpu_module_t *gpu_device,
21332136
return ret;
21342137
}
21352138
}
2136-
21372139
PARSEC_DEBUG_VERBOSE(10, parsec_gpu_output_stream,
21382140
"GPU[%d:%s]: Push task %s DONE",
21392141
gpu_device->super.device_index, gpu_device->super.name,
2140-
parsec_task_snprintf(tmp, MAX_TASK_STRLEN, this_task) );
2142+
parsec_task_snprintf(tmp, MAX_TASK_STRLEN, this_task));
21412143
gpu_task->complete_stage = parsec_device_callback_complete_push;
21422144
#if defined(PARSEC_PROF_TRACE)
21432145
gpu_task->prof_key_end = -1; /* We do not log that event as the completion of this task */

parsec/parsec.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1942,10 +1942,20 @@ parsec_task_snprintf( char* str, size_t size,
19421942
task->locals[i].value );
19431943
if( index >= size ) return str;
19441944
}
1945-
index += snprintf(str + index, size - index, "]<%d>", task->priority );
1945+
index += snprintf(str + index, size - index, "]<%d> keys = {", task->priority );
1946+
if( index >= size ) return str;
1947+
for( i = 0; i < tc->nb_flows; i++ ) {
1948+
char *prefix = (i == 0) ? "" : ", ";
1949+
if ((NULL == task->data[i].data_in) || (NULL == task->data[i].data_in->original))
1950+
index += snprintf(str + index, size - index, "%s*", prefix);
1951+
else
1952+
index += snprintf(str + index, size - index, "%s%lx", prefix, task->data[i].data_in->original->key);
1953+
if( index >= size ) return str;
1954+
}
1955+
index += snprintf(str + index, size - index, "}" );
19461956
if( index >= size ) return str;
19471957
if( NULL != task->taskpool ) {
1948-
index += snprintf(str + index, size - index, "{%u}", task->taskpool->taskpool_id );
1958+
index += snprintf(str + index, size - index, " {tp: %u}", task->taskpool->taskpool_id );
19491959
if( index >= size ) return str;
19501960
}
19511961
return str;

parsec/remote_dep_mpi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ remote_dep_cmd_to_string(remote_dep_wire_activate_t* origin,
8080
if( NULL == task.task_class ) return snprintf(str, len, "UNKNOWN_of_TASKCLASS_%d", origin->task_class_id), str;
8181
memcpy(&task.locals, origin->locals, sizeof(parsec_assignment_t) * task.task_class->nb_locals);
8282
task.priority = 0xFFFFFFFF;
83+
for(int i = 0; i < task.task_class->nb_flows; task.data[i++].data_in = NULL);
8384
return parsec_task_snprintf(str, len, &task);
8485
}
8586

parsec/utils/debug.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ extern void (*parsec_weaksym_exit)(int status);
160160
#else /* defined(PARSEC_DEBUG_NOISIER) */
161161

162162
#define PARSEC_DEBUG_VERBOSE(...) do{} while(0)
163-
#endif /* defined(PARSEC_DEBUG_VERBOSE) */
163+
#endif /* defined(PARSEC_DEBUG_NOISIER) */
164164

165165
/** $brief To check if any parsec function returned error.
166166
*/

parsec/utils/zone_malloc.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,10 @@ void *zone_malloc(zone_malloc_t *gdata, size_t size)
8383
current_segment = SEGMENT_AT_TID(gdata, current_tid);
8484
if( NULL == current_segment ) {
8585
/* Maybe there is a free slot in the beginning. Let's cycle at least once before we bail out */
86-
if( cycled_through == 0 ) {
87-
current_tid = 0;
88-
cycled_through = 1;
89-
current_segment = SEGMENT_AT_TID(gdata, current_tid);
90-
} else {
91-
parsec_atomic_unlock(&gdata->lock);
92-
return NULL;
93-
}
86+
if( 0 != cycled_through ) break;
87+
current_tid = 0;
88+
cycled_through = 1;
89+
current_segment = SEGMENT_AT_TID(gdata, current_tid);
9490
}
9591

9692
if( current_segment->status == SEGMENT_EMPTY && current_segment->nb_units >= nb_units ) {

0 commit comments

Comments
 (0)