Commit f5f23bc1 authored by Glenn K. Lockwood's avatar Glenn K. Lockwood

implemented a simple get_output_data that doesn't use MPI; all ranks except...

implemented a simple get_output_data that doesn't use MPI; all ranks except rank0 just drop their shared records
parent ab49f325
......@@ -229,7 +229,6 @@ static void lustre_begin_shutdown(void)
return;
}
/* XXX - still need to update 5/26/2016 */
static void lustre_get_output_data(
MPI_Comm mod_comm,
darshan_record_id *shared_recs,
......@@ -239,10 +238,6 @@ static void lustre_get_output_data(
{
struct lustre_record_runtime *file;
int i;
struct darshan_lustre_record *red_send_buf = NULL;
struct darshan_lustre_record *red_recv_buf = NULL;
MPI_Datatype red_type;
MPI_Op red_op;
assert(lustre_runtime);
......@@ -250,7 +245,7 @@ static void lustre_get_output_data(
/* NOTE: the shared file reduction is also skipped if the
* DARSHAN_DISABLE_SHARED_REDUCTION environment variable is set.
*/
if(shared_rec_count && !getenv("DARSHAN_DISABLE_SHARED_REDUCTION"))
if (shared_rec_count && !getenv("DARSHAN_DISABLE_SHARED_REDUCTION"))
{
/* necessary initialization of shared records */
for(i = 0; i < shared_rec_count; i++)
......@@ -268,44 +263,9 @@ static void lustre_get_output_data(
*/
sort_lustre_records();
/* make *send_buf point to the shared files at the end of sorted array
red_send_buf =
&(lustre_runtime->record_runtime_array[lustre_runtime->record_count-shared_rec_count]);
*******************************************************************************/
/* allocate memory for the reduction output on rank 0
if(my_rank == 0)
{
red_recv_buf = malloc(shared_rec_count * sizeof(struct darshan_lustre_record));
if(!red_recv_buf)
{
return;
}
}
DARSHAN_MPI_CALL(PMPI_Type_contiguous)(sizeof(struct darshan_lustre_record),
MPI_BYTE, &red_type);
DARSHAN_MPI_CALL(PMPI_Type_commit)(&red_type);
DARSHAN_MPI_CALL(PMPI_Op_create)(lustre_record_reduction_op, 1, &red_op);
DARSHAN_MPI_CALL(PMPI_Reduce)(red_send_buf, red_recv_buf,
shared_rec_count, red_type, red_op, 0, mod_comm);
*******************************************************************************/
/* clean up reduction state
if(my_rank == 0)
{
memcpy(&(lustre_runtime->record_array[lustre_runtime->record_count - shared_rec_count]), red_recv_buf,
shared_rec_count * sizeof(struct darshan_lustre_record));
free(red_recv_buf);
}
else
{
/* allocate memory for the reduction output on rank 0 */
if (my_rank != 0)
lustre_runtime->record_count -= shared_rec_count;
}
DARSHAN_MPI_CALL(PMPI_Type_free)(&red_type);
DARSHAN_MPI_CALL(PMPI_Op_free)(&red_op);
*******************************************************************************/
}
*lustre_buf = (void *)(lustre_runtime->record_buffer);
......@@ -333,11 +293,18 @@ static int lustre_record_compare(const void* a_p, const void* b_p)
const struct lustre_record_runtime* a = a_p;
const struct lustre_record_runtime* b = b_p;
if(a->record->rank < b->record->rank)
if (a->record->rank < b->record->rank)
return 1;
if(a->record->rank > b->record->rank)
if (a->record->rank > b->record->rank)
return -1;
/* if ( a->record->rank == b->record->rank ) we MUST do a secondary
* sort so that the order of qsort is fully deterministic and consistent
* across all MPI ranks. Without a secondary sort, the sort order can
* be affected by rank-specific variations (e.g., the order in which
* files are first opened).
*/
return 0;
}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment