[Darshan-commits] [Darshan] branch, dev-modular, updated. darshan-2.3.1-95-gdb7b2f7
Service Account
git at mcs.anl.gov
Mon Apr 6 16:34:36 CDT 2015
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "".
The branch, dev-modular has been updated
via db7b2f7b684d83d3f24cbca82f2dbeff9feb9b9d (commit)
from cc000cb3d4f478a614c4115c193fc10ff0e83b59 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit db7b2f7b684d83d3f24cbca82f2dbeff9feb9b9d
Author: Phil Carns <carns at mcs.anl.gov>
Date: Mon Apr 6 17:34:18 2015 -0400
stub in prepare for reduction
- doesn't work yet
-----------------------------------------------------------------------
Summary of changes:
darshan-runtime/lib/darshan-mpiio.c | 70 ++++++++++++++++++++++++++++++++++-
1 files changed, 69 insertions(+), 1 deletions(-)
Diff of changes:
diff --git a/darshan-runtime/lib/darshan-mpiio.c b/darshan-runtime/lib/darshan-mpiio.c
index 98eb024..06f3fa5 100644
--- a/darshan-runtime/lib/darshan-mpiio.c
+++ b/darshan-runtime/lib/darshan-mpiio.c
@@ -123,6 +123,9 @@ static struct mpiio_file_runtime* mpiio_file_by_name_setfh(const char* name, MPI
static struct mpiio_file_runtime* mpiio_file_by_name(const char *name);
static void mpiio_record_reduction_op(void* infile_v, void* inoutfile_v,
int *len, MPI_Datatype *datatype);
+static void mpiio_prepare_for_reduction(darshan_record_id *shared_recs,
+ int *shared_rec_count, void **send_buf, void **recv_buf, int *rec_size);
+static int mpiio_file_compare(const void* a, const void* b);
#ifdef HAVE_MPIIO_CONST
int MPI_File_open(MPI_Comm comm, const char *filename, int amode, MPI_Info info, MPI_File *fh)
@@ -190,7 +193,7 @@ static void mpiio_runtime_initialize()
struct darshan_module_funcs mpiio_mod_fns =
{
.disable_instrumentation = &mpiio_disable_instrumentation,
- .prepare_for_reduction = NULL,
+ .prepare_for_reduction = &mpiio_prepare_for_reduction,
.record_reduction_op = &mpiio_record_reduction_op,
.get_output_data = &mpiio_get_output_data,
.shutdown = &mpiio_shutdown
@@ -430,6 +433,71 @@ static void mpiio_record_reduction_op(
return;
}
+static void mpiio_prepare_for_reduction(
+ darshan_record_id *shared_recs,
+ int *shared_rec_count,
+ void **send_buf,
+ void **recv_buf,
+ int *rec_size)
+{
+ struct mpiio_file_runtime *file;
+ int i;
+
+ assert(mpiio_runtime);
+
+ /* necessary initialization of shared records (e.g., change rank to -1) */
+ for(i = 0; i < *shared_rec_count; i++)
+ {
+ HASH_FIND(hlink, mpiio_runtime->file_hash, &shared_recs[i],
+ sizeof(darshan_record_id), file);
+ assert(file);
+
+ file->file_record->rank = -1;
+ }
+
+ /* sort the array of files descending by rank so that we get all of the
+ * shared files (marked by rank -1) in a contiguous portion at end
+ * of the array
+ */
+ qsort(mpiio_runtime->file_record_array, mpiio_runtime->file_array_ndx,
+ sizeof(struct darshan_mpiio_file), mpiio_file_compare);
+
+ /* make *send_buf point to the shared files at the end of sorted array */
+ *send_buf =
+ &(mpiio_runtime->file_record_array[mpiio_runtime->file_array_ndx-(*shared_rec_count)]);
+
+ /* allocate memory for the reduction output on rank 0 */
+ if(my_rank == 0)
+ {
+ *recv_buf = malloc(*shared_rec_count * sizeof(struct darshan_mpiio_file));
+ if(!(*recv_buf))
+ return;
+ }
+
+ *rec_size = sizeof(struct darshan_mpiio_file);
+
+ /* TODO: cleaner way to do this? */
+ if(my_rank == 0)
+ mpiio_runtime->red_buf = *recv_buf;
+ mpiio_runtime->shared_rec_count = *shared_rec_count;
+
+ return;
+}
+
+/* compare function for sorting file records by descending rank */
+static int mpiio_file_compare(const void* a_p, const void* b_p)
+{
+ const struct darshan_mpiio_file* a = a_p;
+ const struct darshan_mpiio_file* b = b_p;
+
+ if(a->rank < b->rank)
+ return 1;
+ if(a->rank > b->rank)
+ return -1;
+
+ return 0;
+}
+
/*
* Local variables:
* c-indent-level: 4
hooks/post-receive
--
More information about the Darshan-commits
mailing list