...
 
Commits (16)
......@@ -34,6 +34,9 @@
/* Environment variable to override default mmap log path */
#define DARSHAN_MMAP_LOG_PATH_OVERRIDE "DARSHAN_MMAP_LOGPATH"
/* Environment variable to enable profiling without MPI */
#define DARSHAN_ENABLE_NONMPI "DARSHAN_ENABLE_NONMPI"
/* default path for storing mmap log files is '/tmp' */
#define DARSHAN_DEF_MMAP_LOG_PATH "/tmp"
#endif
......
#ifndef __DARSHAN_MPI_H
#define __DARSHAN_MPI_H
#include <mpi.h>
struct darshan_mpi_file {
enum {
FH_TYPE_MPI,
FH_TYPE_POSIX
} fhtype;
union {
MPI_File mpi;
int posix;
} fh;
};
int darshan_mpi_comm_size(MPI_Comm comm, int *_nprocs);
int darshan_mpi_comm_rank(MPI_Comm comm, int *me);
double darshan_mpi_wtime();
int darshan_mpi_allreduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
int darshan_mpi_reduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm);
int darshan_mpi_reduce_records(void *sendbuf, void *recvbuf, int count, int record_size, MPI_Op op, int root, MPI_Comm comm);
int darshan_mpi_scan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
int darshan_mpi_gather(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm);
int darshan_mpi_barrier(MPI_Comm comm);
int darshan_mpi_bcast(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm);
int darshan_mpi_op_create(MPI_User_function *user_fn, int commute, MPI_Op *op);
int darshan_mpi_op_free(MPI_Op *op);
int darshan_mpi_file_open(MPI_Comm comm, const char *filename, int amode, MPI_Info info, struct darshan_mpi_file *fh);
int darshan_mpi_file_close(struct darshan_mpi_file *fh);
int darshan_mpi_file_write_at(struct darshan_mpi_file fh, MPI_Offset offset,
const void *buf, int count, MPI_Datatype datatype, MPI_Status *status);
int darshan_mpi_file_write_at_all(struct darshan_mpi_file fh, MPI_Offset offset,
const void *buf, int count, MPI_Datatype datatype, MPI_Status *status);
int darshan_mpi_info_create(MPI_Info *info);
int darshan_mpi_info_set(MPI_Info info, char *key, char *value);
int darshan_mpi_info_free(MPI_Info *info);
int darshan_mpi_type_contiguous(int count, MPI_Datatype oldtype, MPI_Datatype *newtype);
int darshan_mpi_type_commit(MPI_Datatype *datatype);
int darshan_mpi_type_free(MPI_Datatype *datatype);
#endif /* __DARSHAN_MPI_H */
......@@ -17,6 +17,7 @@
#include "uthash.h"
#include "darshan.h"
#include "darshan-dynamic.h"
#include "darshan-mpi.h"
#include <mpix.h>
#include <spi/include/kernel/location.h>
......@@ -196,13 +197,13 @@ static void bgq_shutdown(
{
bgq_runtime->record->base_rec.rank = -1;
PMPI_Comm_size(mod_comm, &nprocs);
darshan_mpi_comm_size(mod_comm, &nprocs);
ion_ids = malloc(sizeof(*ion_ids)*nprocs);
result = (ion_ids != NULL);
if(!result)
bgq_runtime->record->counters[BGQ_INODES] = -1;
}
PMPI_Bcast(&result, 1, MPI_INT, 0, mod_comm);
darshan_mpi_bcast(&result, 1, MPI_INT, 0, mod_comm);
/* caclulate the number of I/O nodes */
if (result)
......@@ -210,14 +211,14 @@ static void bgq_shutdown(
int i, found;
uint64_t val;
PMPI_Gather(&bgq_runtime->record->counters[BGQ_INODES],
1,
MPI_LONG_LONG_INT,
ion_ids,
1,
MPI_LONG_LONG_INT,
0,
mod_comm);
darshan_mpi_gather(&bgq_runtime->record->counters[BGQ_INODES],
1,
MPI_LONG_LONG_INT,
ion_ids,
1,
MPI_LONG_LONG_INT,
0,
mod_comm);
if (my_rank == 0)
{
qsort(ion_ids, nprocs, sizeof(*ion_ids), cmpr);
......
......@@ -86,6 +86,29 @@ int DARSHAN_DECL(MPI_Finalize)(void)
}
DARSHAN_WRAPPER_MAP(PMPI_Finalize, int, (void), MPI_Finalize())
/*
* Initialization hook that does not rely on MPI
*/
#ifdef __GNUC__
__attribute__((constructor)) void serial_init(void)
{
char *no_mpi;
no_mpi = getenv(DARSHAN_ENABLE_NONMPI);
if (no_mpi)
darshan_core_initialize(0, NULL);
return;
}
__attribute__((destructor)) void serial_finalize(void)
{
char *no_mpi;
no_mpi = getenv(DARSHAN_ENABLE_NONMPI);
if (no_mpi)
darshan_core_shutdown();
return;
}
#endif
/*
* Local variables:
* c-indent-level: 4
......
This diff is collapsed.
......@@ -23,6 +23,7 @@
#include "darshan.h"
#include "darshan-dynamic.h"
#include "darshan-mpi.h"
/* hope this doesn't change any time soon */
typedef int herr_t; //hf5-1.10.0p1: H5public.h:126
......@@ -403,7 +404,6 @@ static void hdf5_shutdown(
int hdf5_rec_count;
struct darshan_hdf5_file *red_send_buf = NULL;
struct darshan_hdf5_file *red_recv_buf = NULL;
MPI_Datatype red_type;
MPI_Op red_op;
int i;
......@@ -448,19 +448,11 @@ static void hdf5_shutdown(
}
}
/* construct a datatype for a HDF5 file record. This is serving no purpose
* except to make sure we can do a reduction on proper boundaries
*/
PMPI_Type_contiguous(sizeof(struct darshan_hdf5_file),
MPI_BYTE, &red_type);
PMPI_Type_commit(&red_type);
/* register a HDF5 file record reduction operator */
PMPI_Op_create(hdf5_record_reduction_op, 1, &red_op);
darshan_mpi_op_create(hdf5_record_reduction_op, 1, &red_op);
/* reduce shared HDF5 file records */
PMPI_Reduce(red_send_buf, red_recv_buf,
shared_rec_count, red_type, red_op, 0, mod_comm);
darshan_mpi_reduce_records(red_send_buf, red_recv_buf, shared_rec_count, sizeof(struct darshan_hdf5_file), red_op, 0, mod_comm);
/* clean up reduction state */
if(my_rank == 0)
......@@ -475,8 +467,7 @@ static void hdf5_shutdown(
hdf5_rec_count -= shared_rec_count;
}
PMPI_Type_free(&red_type);
PMPI_Op_free(&red_op);
darshan_mpi_op_free(&red_op);
}
/* update output buffer size to account for shared file reduction */
......
......@@ -498,7 +498,6 @@ static void mdhim_shutdown(
*(struct darshan_mdhim_record **)mdhim_buf;
struct darshan_mdhim_record *red_send_buf = NULL;
struct darshan_mdhim_record *red_recv_buf = NULL;
MPI_Datatype red_type;
MPI_Op red_op;
int mdhim_rec_count;
......@@ -556,12 +555,10 @@ static void mdhim_shutdown(
return;
}
}
PMPI_Type_contiguous(MDHIM_RECORD_SIZE(nr_servers),
MPI_BYTE, &red_type);
PMPI_Type_commit(&red_type);
PMPI_Op_create(mdhim_record_reduction_op, 1, &red_op);
PMPI_Reduce(red_send_buf, red_recv_buf,
shared_rec_count, red_type, red_op, 0, mod_comm);
darshan_mpi_op_create(mdhim_record_reduction_op, 1, &red_op);
darshan_mpi_reduce(red_send_buf, red_recv_buf, shared_rec_count,
MDHIM_RECORD_SIZE(nr_servers), red_op, 0, mod_comm);
if (my_rank == 0)
{
......@@ -571,8 +568,7 @@ static void mdhim_shutdown(
free(red_recv_buf);
}
PMPI_Type_free(&red_type);
PMPI_Op_free(&red_op);
darshan_mpi_op_free(&red_op);
/* drop shared records from non-root ranks or we'll end up writing too
* much */
if (my_rank != 0)
......
......@@ -24,6 +24,7 @@
#include "darshan.h"
#include "darshan-dynamic.h"
#include "darshan-mpi.h"
DARSHAN_FORWARD_DECL(PMPI_File_close, int, (MPI_File *fh));
DARSHAN_FORWARD_DECL(PMPI_File_iread_at, int, (MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, __D_MPI_REQUEST *request));
......@@ -1385,17 +1386,13 @@ static void mpiio_shared_record_variance(MPI_Comm mod_comm,
struct darshan_mpiio_file *inrec_array, struct darshan_mpiio_file *outrec_array,
int shared_rec_count)
{
MPI_Datatype var_dt;
MPI_Datatype var_dt = MPI_DATATYPE_NULL;
MPI_Op var_op;
int i;
struct darshan_variance_dt *var_send_buf = NULL;
struct darshan_variance_dt *var_recv_buf = NULL;
PMPI_Type_contiguous(sizeof(struct darshan_variance_dt),
MPI_BYTE, &var_dt);
PMPI_Type_commit(&var_dt);
PMPI_Op_create(darshan_variance_reduce, 1, &var_op);
darshan_mpi_op_create(darshan_variance_reduce, 1, &var_op);
var_send_buf = malloc(shared_rec_count * sizeof(struct darshan_variance_dt));
if(!var_send_buf)
......@@ -1420,8 +1417,17 @@ static void mpiio_shared_record_variance(MPI_Comm mod_comm,
inrec_array[i].fcounters[MPIIO_F_META_TIME];
}
PMPI_Reduce(var_send_buf, var_recv_buf, shared_rec_count,
var_dt, var_op, 0, mod_comm);
/* If MPI is enabled, use an MPI datatype. Otherwise var_dt will come back
* as invalid; then we just use the record size directly
*/
darshan_mpi_type_contiguous(sizeof(struct darshan_variance_dt), MPI_BYTE, &var_dt);
darshan_mpi_type_commit(&var_dt);
if (var_dt != MPI_DATATYPE_NULL)
darshan_mpi_reduce(var_send_buf, var_recv_buf, shared_rec_count,
var_dt, var_op, 0, mod_comm);
else
darshan_mpi_reduce_records(var_send_buf, var_recv_buf, shared_rec_count,
sizeof(struct darshan_variance_dt), var_op, 0, mod_comm);
if(my_rank == 0)
{
......@@ -1443,8 +1449,15 @@ static void mpiio_shared_record_variance(MPI_Comm mod_comm,
inrec_array[i].counters[MPIIO_BYTES_WRITTEN];
}
PMPI_Reduce(var_send_buf, var_recv_buf, shared_rec_count,
var_dt, var_op, 0, mod_comm);
/* If MPI is enabled, use an MPI datatype. Otherwise just use the record
* size directly
*/
if (var_dt != MPI_DATATYPE_NULL)
darshan_mpi_reduce(var_send_buf, var_recv_buf, shared_rec_count,
var_dt, var_op, 0, mod_comm);
else
darshan_mpi_reduce_records(var_send_buf, var_recv_buf, shared_rec_count,
sizeof(struct darshan_variance_dt), var_op, 0, mod_comm);
if(my_rank == 0)
{
......@@ -1455,8 +1468,8 @@ static void mpiio_shared_record_variance(MPI_Comm mod_comm,
}
}
PMPI_Type_free(&var_dt);
PMPI_Op_free(&var_op);
darshan_mpi_type_free(&var_dt);
darshan_mpi_op_free(&var_op);
free(var_send_buf);
free(var_recv_buf);
......@@ -1571,7 +1584,6 @@ static void mpiio_shutdown(
double mpiio_time;
struct darshan_mpiio_file *red_send_buf = NULL;
struct darshan_mpiio_file *red_recv_buf = NULL;
MPI_Datatype red_type;
MPI_Op red_op;
int i;
......@@ -1646,19 +1658,12 @@ static void mpiio_shutdown(
}
}
/* construct a datatype for a MPIIO file record. This is serving no purpose
* except to make sure we can do a reduction on proper boundaries
*/
PMPI_Type_contiguous(sizeof(struct darshan_mpiio_file),
MPI_BYTE, &red_type);
PMPI_Type_commit(&red_type);
/* register a MPIIO file record reduction operator */
PMPI_Op_create(mpiio_record_reduction_op, 1, &red_op);
darshan_mpi_op_create(mpiio_record_reduction_op, 1, &red_op);
/* reduce shared MPIIO file records */
PMPI_Reduce(red_send_buf, red_recv_buf,
shared_rec_count, red_type, red_op, 0, mod_comm);
darshan_mpi_reduce_records(red_send_buf, red_recv_buf,
shared_rec_count, sizeof(struct darshan_mpiio_file), red_op, 0, mod_comm);
/* get the time and byte variances for shared files */
mpiio_shared_record_variance(mod_comm, red_send_buf, red_recv_buf,
......@@ -1677,8 +1682,7 @@ static void mpiio_shutdown(
mpiio_rec_count -= shared_rec_count;
}
PMPI_Type_free(&red_type);
PMPI_Op_free(&red_op);
darshan_mpi_op_free(&red_op);
}
*mpiio_buf_sz = mpiio_rec_count * sizeof(struct darshan_mpiio_file);
......
......@@ -23,6 +23,7 @@
#include "darshan.h"
#include "darshan-dynamic.h"
#include "darshan-mpi.h"
DARSHAN_FORWARD_DECL(ncmpi_create, int, (MPI_Comm comm, const char *path, int cmode, MPI_Info info, int *ncidp));
DARSHAN_FORWARD_DECL(ncmpi_open, int, (MPI_Comm comm, const char *path, int omode, MPI_Info info, int *ncidp));
......@@ -357,7 +358,6 @@ static void pnetcdf_shutdown(
int pnetcdf_rec_count;
struct darshan_pnetcdf_file *red_send_buf = NULL;
struct darshan_pnetcdf_file *red_recv_buf = NULL;
MPI_Datatype red_type;
MPI_Op red_op;
int i;
......@@ -403,19 +403,12 @@ static void pnetcdf_shutdown(
}
}
/* construct a datatype for a PNETCDF file record. This is serving no purpose
* except to make sure we can do a reduction on proper boundaries
*/
PMPI_Type_contiguous(sizeof(struct darshan_pnetcdf_file),
MPI_BYTE, &red_type);
PMPI_Type_commit(&red_type);
/* register a PNETCDF file record reduction operator */
PMPI_Op_create(pnetcdf_record_reduction_op, 1, &red_op);
darshan_mpi_op_create(pnetcdf_record_reduction_op, 1, &red_op);
/* reduce shared PNETCDF file records */
PMPI_Reduce(red_send_buf, red_recv_buf,
shared_rec_count, red_type, red_op, 0, mod_comm);
darshan_mpi_reduce_records(red_send_buf, red_recv_buf, shared_rec_count,
sizeof(struct darshan_pnetcdf_file), red_op, 0, mod_comm);
/* clean up reduction state */
if(my_rank == 0)
......@@ -430,8 +423,7 @@ static void pnetcdf_shutdown(
pnetcdf_rec_count -= shared_rec_count;
}
PMPI_Type_free(&red_type);
PMPI_Op_free(&red_op);
darshan_mpi_op_free(&red_op);
}
/* update output buffer size to account for shared file reduction */
......
......@@ -29,6 +29,7 @@
#include "utlist.h"
#include "darshan.h"
#include "darshan-dynamic.h"
#include "darshan-mpi.h"
#ifndef HAVE_OFF64_T
typedef int64_t off64_t;
......@@ -1652,17 +1653,13 @@ static void posix_shared_record_variance(MPI_Comm mod_comm,
struct darshan_posix_file *inrec_array, struct darshan_posix_file *outrec_array,
int shared_rec_count)
{
MPI_Datatype var_dt;
MPI_Datatype var_dt = MPI_DATATYPE_NULL;
MPI_Op var_op;
int i;
struct darshan_variance_dt *var_send_buf = NULL;
struct darshan_variance_dt *var_recv_buf = NULL;
PMPI_Type_contiguous(sizeof(struct darshan_variance_dt),
MPI_BYTE, &var_dt);
PMPI_Type_commit(&var_dt);
PMPI_Op_create(darshan_variance_reduce, 1, &var_op);
darshan_mpi_op_create(darshan_variance_reduce, 1, &var_op);
var_send_buf = malloc(shared_rec_count * sizeof(struct darshan_variance_dt));
if(!var_send_buf)
......@@ -1687,8 +1684,17 @@ static void posix_shared_record_variance(MPI_Comm mod_comm,
inrec_array[i].fcounters[POSIX_F_META_TIME];
}
PMPI_Reduce(var_send_buf, var_recv_buf, shared_rec_count,
var_dt, var_op, 0, mod_comm);
/* If MPI is enabled, use an MPI datatype. Otherwise just use the record
* size directly
*/
darshan_mpi_type_contiguous(sizeof(struct darshan_variance_dt), MPI_BYTE, &var_dt);
darshan_mpi_type_commit(&var_dt);
if (var_dt != MPI_DATATYPE_NULL)
darshan_mpi_reduce(var_send_buf, var_recv_buf, shared_rec_count,
var_dt, var_op, 0, mod_comm);
else
darshan_mpi_reduce_records(var_send_buf, var_recv_buf, shared_rec_count,
sizeof(struct darshan_variance_dt), var_op, 0, mod_comm);
if(my_rank == 0)
{
......@@ -1710,8 +1716,15 @@ static void posix_shared_record_variance(MPI_Comm mod_comm,
inrec_array[i].counters[POSIX_BYTES_WRITTEN];
}
PMPI_Reduce(var_send_buf, var_recv_buf, shared_rec_count,
var_dt, var_op, 0, mod_comm);
/* If MPI is enabled, use an MPI datatype. Otherwise just use the record
* size directly
*/
if (var_dt != MPI_DATATYPE_NULL)
darshan_mpi_reduce(var_send_buf, var_recv_buf, shared_rec_count,
var_dt, var_op, 0, mod_comm);
else
darshan_mpi_reduce_records(var_send_buf, var_recv_buf, shared_rec_count,
sizeof(struct darshan_variance_dt), var_op, 0, mod_comm);
if(my_rank == 0)
{
......@@ -1722,8 +1735,8 @@ static void posix_shared_record_variance(MPI_Comm mod_comm,
}
}
PMPI_Type_free(&var_dt);
PMPI_Op_free(&var_op);
darshan_mpi_type_free(&var_dt);
darshan_mpi_op_free(&var_op);
free(var_send_buf);
free(var_recv_buf);
......@@ -1830,7 +1843,6 @@ static void posix_shutdown(
double posix_time;
struct darshan_posix_file *red_send_buf = NULL;
struct darshan_posix_file *red_recv_buf = NULL;
MPI_Datatype red_type;
MPI_Op red_op;
int i;
......@@ -1905,19 +1917,12 @@ static void posix_shutdown(
}
}
/* construct a datatype for a POSIX file record. This is serving no purpose
* except to make sure we can do a reduction on proper boundaries
*/
PMPI_Type_contiguous(sizeof(struct darshan_posix_file),
MPI_BYTE, &red_type);
PMPI_Type_commit(&red_type);
/* register a POSIX file record reduction operator */
PMPI_Op_create(posix_record_reduction_op, 1, &red_op);
darshan_mpi_op_create(posix_record_reduction_op, 1, &red_op);
/* reduce shared POSIX file records */
PMPI_Reduce(red_send_buf, red_recv_buf,
shared_rec_count, red_type, red_op, 0, mod_comm);
darshan_mpi_reduce_records(red_send_buf, red_recv_buf, shared_rec_count,
sizeof(struct darshan_posix_file), red_op, 0, mod_comm);
/* get the time and byte variances for shared files */
posix_shared_record_variance(mod_comm, red_send_buf, red_recv_buf,
......@@ -1936,8 +1941,7 @@ static void posix_shutdown(
posix_rec_count -= shared_rec_count;
}
PMPI_Type_free(&red_type);
PMPI_Op_free(&red_op);
darshan_mpi_op_free(&red_op);
}
/* update output buffer size to account for shared file reduction */
......
......@@ -83,6 +83,7 @@
#include "darshan.h"
#include "darshan-dynamic.h"
#include "darshan-mpi.h"
#ifndef HAVE_OFF64_T
typedef int64_t off64_t;
......@@ -1115,7 +1116,6 @@ static void stdio_shutdown(
int i;
struct darshan_stdio_file *red_send_buf = NULL;
struct darshan_stdio_file *red_recv_buf = NULL;
MPI_Datatype red_type;
MPI_Op red_op;
int stdio_rec_count;
double stdio_time;
......@@ -1185,19 +1185,12 @@ static void stdio_shutdown(
}
}
/* construct a datatype for a STDIO file record. This is serving no purpose
* except to make sure we can do a reduction on proper boundaries
*/
PMPI_Type_contiguous(sizeof(struct darshan_stdio_file),
MPI_BYTE, &red_type);
PMPI_Type_commit(&red_type);
/* register a STDIO file record reduction operator */
PMPI_Op_create(stdio_record_reduction_op, 1, &red_op);
darshan_mpi_op_create(stdio_record_reduction_op, 1, &red_op);
/* reduce shared STDIO file records */
PMPI_Reduce(red_send_buf, red_recv_buf,
shared_rec_count, red_type, red_op, 0, mod_comm);
darshan_mpi_reduce_records(red_send_buf, red_recv_buf, shared_rec_count,
sizeof(struct darshan_stdio_file), red_op, 0, mod_comm);
/* get the time and byte variances for shared files */
stdio_shared_record_variance(mod_comm, red_send_buf, red_recv_buf,
......@@ -1216,8 +1209,7 @@ static void stdio_shutdown(
stdio_rec_count -= shared_rec_count;
}
PMPI_Type_free(&red_type);
PMPI_Op_free(&red_op);
darshan_mpi_op_free(&red_op);
}
/* filter out any records that have no activity on them; this is
......@@ -1321,17 +1313,13 @@ static void stdio_shared_record_variance(MPI_Comm mod_comm,
struct darshan_stdio_file *inrec_array, struct darshan_stdio_file *outrec_array,
int shared_rec_count)
{
MPI_Datatype var_dt;
MPI_Datatype var_dt = MPI_DATATYPE_NULL;
MPI_Op var_op;
int i;
struct darshan_variance_dt *var_send_buf = NULL;
struct darshan_variance_dt *var_recv_buf = NULL;
PMPI_Type_contiguous(sizeof(struct darshan_variance_dt),
MPI_BYTE, &var_dt);
PMPI_Type_commit(&var_dt);
PMPI_Op_create(darshan_variance_reduce, 1, &var_op);
darshan_mpi_op_create(darshan_variance_reduce, 1, &var_op);
var_send_buf = malloc(shared_rec_count * sizeof(struct darshan_variance_dt));
if(!var_send_buf)
......@@ -1356,8 +1344,17 @@ static void stdio_shared_record_variance(MPI_Comm mod_comm,
inrec_array[i].fcounters[STDIO_F_META_TIME];
}
PMPI_Reduce(var_send_buf, var_recv_buf, shared_rec_count,
var_dt, var_op, 0, mod_comm);
/* If MPI is enabled, use an MPI datatype. Otherwise var_dt will come back
* as invalid; then we just use the record size directly
*/
darshan_mpi_type_contiguous(sizeof(struct darshan_variance_dt), MPI_BYTE, &var_dt);
darshan_mpi_type_commit(&var_dt);
if (var_dt != MPI_DATATYPE_NULL)
darshan_mpi_reduce(var_send_buf, var_recv_buf, shared_rec_count,
var_dt, var_op, 0, mod_comm);
else
darshan_mpi_reduce_records(var_send_buf, var_recv_buf, shared_rec_count,
sizeof(struct darshan_variance_dt), var_op, 0, mod_comm);
if(my_rank == 0)
{
......@@ -1379,8 +1376,15 @@ static void stdio_shared_record_variance(MPI_Comm mod_comm,
inrec_array[i].counters[STDIO_BYTES_WRITTEN];
}
PMPI_Reduce(var_send_buf, var_recv_buf, shared_rec_count,
var_dt, var_op, 0, mod_comm);
/* If MPI is enabled, use an MPI datatype. Otherwise just use the record
* size directly
*/
if (var_dt != MPI_DATATYPE_NULL)
darshan_mpi_reduce(var_send_buf, var_recv_buf, shared_rec_count,
var_dt, var_op, 0, mod_comm);
else
darshan_mpi_reduce(var_send_buf, var_recv_buf, shared_rec_count,
sizeof(struct darshan_variance_dt), var_op, 0, mod_comm);
if(my_rank == 0)
{
......@@ -1391,8 +1395,8 @@ static void stdio_shared_record_variance(MPI_Comm mod_comm,
}
}
PMPI_Type_free(&var_dt);
PMPI_Op_free(&var_op);
darshan_mpi_type_free(&var_dt);
darshan_mpi_op_free(&var_op);
free(var_send_buf);
free(var_recv_buf);
......
This diff is collapsed.
void darshan_core_shutdown_nompi()
{
struct darshan_core_runtime *final_core;
double start_log_time;
int internal_timing_flag = 0;
double open1 = 0, open2 = 0;
double job1 = 0, job2 = 0;
double rec1 = 0, rec2 = 0;
double mod1[DARSHAN_MAX_MODS] = {0};
double mod2[DARSHAN_MAX_MODS] = {0};
double header1 = 0, header2 = 0;
int active_mods[DARSHAN_MAX_MODS] = {0};
uint64_t gz_fp = 0;
char *logfile_name;
int i;
int ret;
/* disable darhan-core while we shutdown */
DARSHAN_CORE_LOCK();
if(!darshan_core)
{
DARSHAN_CORE_UNLOCK();
return;
}
final_core = darshan_core;
darshan_core = NULL;
DARSHAN_CORE_UNLOCK();
/* grab some initial timing information */
start_log_time = darshan_mpi_wtime();
final_core->log_job_p->end_time = time(NULL);
if(getenv("DARSHAN_INTERNAL_TIMING"))
internal_timing_flag = 1;
#ifdef __DARSHAN_ENABLE_MMAP_LOGS
/* remove the temporary mmap log files */
/* NOTE: this unlink is not immediate as it must wait for the mapping
* to no longer be referenced, which in our case happens when the
* executable exits. If the application terminates mid-shutdown, then
* there will be no mmap files and no final log file.
*/
unlink(final_core->mmap_log_name);
#endif
final_core->comp_buf = malloc(darshan_mod_mem_quota);
if(!(final_core->comp_buf))
{
darshan_core_cleanup(final_core);
return;
}
logfile_name = malloc(PATH_MAX);
if(!logfile_name)
{
darshan_core_cleanup(final_core);
return;
}
#if 0
/* set which modules were used locally */
for(i = 0; i < DARSHAN_MAX_MODS; i++)
{
if(final_core->mod_array[i])
active_mods[i] = 1;
}
#endif
/* get the log file name */
darshan_get_logfile_name(logfile_name, final_core->log_job_p->jobid,
final_core->log_job_p->start_time);
if(strlen(logfile_name) == 0)
{
/* failed to generate log file name */
fprintf(stderr, "darshan library warning: unable to determine log file path\n");
free(logfile_name);
darshan_core_cleanup(final_core);
return;
}
if(internal_timing_flag)
open1 = darshan_mpi_wtime();
/* collectively open the darshan log file */
ret = darshan_log_open_nompi(logfile_name, &log_fh);
if(internal_timing_flag)
open2 = darshan_mpi_wtime();
/* error out if unable to open log file */
if(ret != 0)
{
if(my_rank == 0)
{
fprintf(stderr, "darshan library warning: unable to create log file %s\n",
logfile_name);
}
free(logfile_name);
darshan_core_cleanup(final_core);
return;
}
if(internal_timing_flag)
job1 = darshan_mpi_wtime();
if(internal_timing_flag)
job2 = darshan_mpi_wtime();
return;
}