Commit 9efb64b4 authored by Kevin Harms's avatar Kevin Harms

Split MPI_Init/MPI_Finalize off into its own object file so that it can be linked separately.

fixes #49


git-svn-id: https://svn.mcs.anl.gov/repos/darshan/trunk@489 3b7491f3-a168-0410-bf4b-c445ed680a29
parent a22ca221
......@@ -32,10 +32,16 @@ LIBS = -lz @LIBBZ2@
lib::
@mkdir -p $@
lib/darshan-mpi-io.o: lib/darshan-mpi-io.c darshan.h $(DARSHAN_LOG_FORMAT) | lib
lib/darshan-mpi-io.o: lib/darshan-mpi-io.c darshan.h darshan-dynamic.h $(DARSHAN_LOG_FORMAT) | lib
$(CC) $(CFLAGS) -c $< -o $@
lib/darshan-mpi-io.po: lib/darshan-mpi-io.c darshan.h $(DARSHAN_LOG_FORMAT) | lib
lib/darshan-mpi-io.po: lib/darshan-mpi-io.c darshan.h darshan-dynamic.h $(DARSHAN_LOG_FORMAT) | lib
$(CC) $(CFLAGS_SHARED) -c $< -o $@
lib/darshan-mpi-init-finalize.o: lib/darshan-mpi-init-finalize.c darshan.h darshan-dynamic.h $(DARSHAN_LOG_FORMAT) | lib
$(CC) $(CFLAGS) -c $< -o $@
lib/darshan-mpi-init-finalize.po: lib/darshan-mpi-init-finalize.c darshan.h darshan-dynamic.h $(DARSHAN_LOG_FORMAT) | lib
$(CC) $(CFLAGS_SHARED) -c $< -o $@
lib/darshan-pnetcdf.o: lib/darshan-pnetcdf.c darshan.h $(DARSHAN_LOG_FORMAT) | lib
......@@ -71,13 +77,13 @@ lib/lookup8.po: lib/lookup8.c
%.i: %.c
$(CC) -E $(CFLAGS) -c $< -o $@
lib/libdarshan-mpi-io.a: lib/darshan-mpi-io.o lib/darshan-pnetcdf.o lib/darshan-hdf5.o
lib/libdarshan-mpi-io.a: lib/darshan-mpi-io.o lib/darshan-mpi-init-finalize.o lib/darshan-pnetcdf.o lib/darshan-hdf5.o
ar rcs $@ $^
lib/libdarshan-posix.a: lib/darshan-posix.o lib/lookup3.o lib/lookup8.o
ar rcs $@ $^
lib/libdarshan.so: lib/darshan-mpi-io.po lib/darshan-pnetcdf.po lib/darshan-hdf5.po lib/darshan-posix.po lib/lookup3.po lib/lookup8.po
lib/libdarshan.so: lib/darshan-mpi-io.po lib/darshan-mpi-init-finalize.po lib/darshan-pnetcdf.po lib/darshan-hdf5.po lib/darshan-posix.po lib/lookup3.po lib/lookup8.po
$(CC) $(CFLAGS_SHARED) $(LDFLAGS) -ldl -o $@ $^ -lpthread -lrt -lz
install:: all
......
/*
* (C) 2012 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#ifndef __DARSHAN_DYNAMIC_H
#define __DARSHAN_DYNAMIC_H
#ifdef DARSHAN_PRELOAD
#include <dlfcn.h>
#include <stdlib.h>
#define DARSHAN_MPI_CALL(func) __real_ ## func
#define DARSHAN_EXTERN_DECL(name,ret,args) \
extern ret (*__real_ ## name)args;
DARSHAN_EXTERN_DECL(PMPI_File_close, int, (MPI_File *fh));
DARSHAN_EXTERN_DECL(PMPI_File_set_size, int, (MPI_File fh, MPI_Offset size));
DARSHAN_EXTERN_DECL(PMPI_File_iread_at, int, (MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, __D_MPI_REQUEST *request));
DARSHAN_EXTERN_DECL(PMPI_File_iread, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, __D_MPI_REQUEST *request));
DARSHAN_EXTERN_DECL(PMPI_File_iread_shared, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, __D_MPI_REQUEST *request));
DARSHAN_EXTERN_DECL(PMPI_File_iwrite_at, int, (MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, __D_MPI_REQUEST *request));
DARSHAN_EXTERN_DECL(PMPI_File_iwrite, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, __D_MPI_REQUEST *request));
DARSHAN_EXTERN_DECL(PMPI_File_iwrite_shared, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, __D_MPI_REQUEST *request));
DARSHAN_EXTERN_DECL(PMPI_File_open, int, (MPI_Comm comm, char *filename, int amode, MPI_Info info, MPI_File *fh));
DARSHAN_EXTERN_DECL(PMPI_File_read_all_begin, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype));
DARSHAN_EXTERN_DECL(PMPI_File_read_all, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_EXTERN_DECL(PMPI_File_read_at_all, int, (MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_EXTERN_DECL(PMPI_File_read_at_all_begin, int, (MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype));
DARSHAN_EXTERN_DECL(PMPI_File_read_at, int, (MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_EXTERN_DECL(PMPI_File_read, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_EXTERN_DECL(PMPI_File_read_ordered_begin, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype));
DARSHAN_EXTERN_DECL(PMPI_File_read_ordered, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_EXTERN_DECL(PMPI_File_read_shared, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_EXTERN_DECL(PMPI_File_set_view, int, (MPI_File fh, MPI_Offset disp, MPI_Datatype etype, MPI_Datatype filetype, char *datarep, MPI_Info info));
DARSHAN_EXTERN_DECL(PMPI_File_sync, int, (MPI_File fh));
DARSHAN_EXTERN_DECL(PMPI_File_write_all_begin, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype));
DARSHAN_EXTERN_DECL(PMPI_File_write_all, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_EXTERN_DECL(PMPI_File_write_at_all_begin, int, (MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype));
DARSHAN_EXTERN_DECL(PMPI_File_write_at_all, int, (MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_EXTERN_DECL(PMPI_File_write_at, int, (MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_EXTERN_DECL(PMPI_File_write, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_EXTERN_DECL(PMPI_File_write_ordered_begin, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype));
DARSHAN_EXTERN_DECL(PMPI_File_write_ordered, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_EXTERN_DECL(PMPI_File_write_shared, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_EXTERN_DECL(PMPI_Finalize, int, ());
DARSHAN_EXTERN_DECL(PMPI_Init, int, (int *argc, char ***argv));
DARSHAN_EXTERN_DECL(PMPI_Init_thread, int, (int *argc, char ***argv, int required, int *provided));
DARSHAN_EXTERN_DECL(PMPI_Wtime, double, ());
DARSHAN_EXTERN_DECL(PMPI_Allreduce, int, (void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm));
DARSHAN_EXTERN_DECL(PMPI_Bcast, int, (void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm));
DARSHAN_EXTERN_DECL(PMPI_Comm_rank, int, (MPI_Comm comm, int *rank));
DARSHAN_EXTERN_DECL(PMPI_Comm_size, int, (MPI_Comm comm, int *size));
DARSHAN_EXTERN_DECL(PMPI_Scan, int, (void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm));
DARSHAN_EXTERN_DECL(PMPI_Type_commit, int, (MPI_Datatype *datatype));
DARSHAN_EXTERN_DECL(PMPI_Type_contiguous, int, (int count, MPI_Datatype oldtype, MPI_Datatype *newtype));
DARSHAN_EXTERN_DECL(PMPI_Type_extent, int, (MPI_Datatype datatype, MPI_Aint *extent));
DARSHAN_EXTERN_DECL(PMPI_Type_free, int, (MPI_Datatype *datatype));
DARSHAN_EXTERN_DECL(PMPI_Type_hindexed, int, (int count, int *array_of_blocklengths, MPI_Aint *array_of_displacements, MPI_Datatype oldtype, MPI_Datatype *newtype));
DARSHAN_EXTERN_DECL(PMPI_Op_create, int, (MPI_User_function *function, int commute, MPI_Op *op));
DARSHAN_EXTERN_DECL(PMPI_Op_free, int, (MPI_Op *op));
DARSHAN_EXTERN_DECL(PMPI_Reduce, int, (void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm));
DARSHAN_EXTERN_DECL(PMPI_Type_get_envelope, int, (MPI_Datatype datatype, int *num_integers, int *num_addresses, int *num_datatypes, int *combiner));
DARSHAN_EXTERN_DECL(PMPI_Type_size, int, (MPI_Datatype datatype, int *size));
#else
#define DARSHAN_MPI_CALL(func) func
#endif
#endif
/*
* (C) 2012 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#define _XOPEN_SOURCE 500
#define _GNU_SOURCE /* for RTLD_NEXT */
#include "darshan-runtime-config.h"
#include <stdlib.h>
#include <stdio.h>
#include "mpi.h"
#include "darshan.h"
#include "darshan-dynamic.h"
#ifdef DARSHAN_PRELOAD
#include <dlfcn.h>
#define DARSHAN_FORWARD_DECL(name,ret,args) \
ret (*__real_ ## name)args = NULL;
#define MAP_OR_FAIL(func) \
__real_ ## func = dlsym(RTLD_NEXT, #func); \
if (!(__real_ ## func)) { \
fprintf(stderr, "Darshan failed to map symbol: %s\n", #func); \
}
DARSHAN_FORWARD_DECL(PMPI_File_close, int, (MPI_File *fh));
DARSHAN_FORWARD_DECL(PMPI_File_set_size, int, (MPI_File fh, MPI_Offset size));
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));
DARSHAN_FORWARD_DECL(PMPI_File_iread, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, __D_MPI_REQUEST *request));
DARSHAN_FORWARD_DECL(PMPI_File_iread_shared, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, __D_MPI_REQUEST *request));
DARSHAN_FORWARD_DECL(PMPI_File_iwrite_at, int, (MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, __D_MPI_REQUEST *request));
DARSHAN_FORWARD_DECL(PMPI_File_iwrite, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, __D_MPI_REQUEST *request));
DARSHAN_FORWARD_DECL(PMPI_File_iwrite_shared, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, __D_MPI_REQUEST *request));
DARSHAN_FORWARD_DECL(PMPI_File_open, int, (MPI_Comm comm, char *filename, int amode, MPI_Info info, MPI_File *fh));
DARSHAN_FORWARD_DECL(PMPI_File_read_all_begin, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype));
DARSHAN_FORWARD_DECL(PMPI_File_read_all, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_FORWARD_DECL(PMPI_File_read_at_all, int, (MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_FORWARD_DECL(PMPI_File_read_at_all_begin, int, (MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype));
DARSHAN_FORWARD_DECL(PMPI_File_read_at, int, (MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_FORWARD_DECL(PMPI_File_read, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_FORWARD_DECL(PMPI_File_read_ordered_begin, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype));
DARSHAN_FORWARD_DECL(PMPI_File_read_ordered, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_FORWARD_DECL(PMPI_File_read_shared, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_FORWARD_DECL(PMPI_File_set_view, int, (MPI_File fh, MPI_Offset disp, MPI_Datatype etype, MPI_Datatype filetype, char *datarep, MPI_Info info));
DARSHAN_FORWARD_DECL(PMPI_File_sync, int, (MPI_File fh));
DARSHAN_FORWARD_DECL(PMPI_File_write_all_begin, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype));
DARSHAN_FORWARD_DECL(PMPI_File_write_all, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_FORWARD_DECL(PMPI_File_write_at_all_begin, int, (MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype));
DARSHAN_FORWARD_DECL(PMPI_File_write_at_all, int, (MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_FORWARD_DECL(PMPI_File_write_at, int, (MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_FORWARD_DECL(PMPI_File_write, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_FORWARD_DECL(PMPI_File_write_ordered_begin, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype));
DARSHAN_FORWARD_DECL(PMPI_File_write_ordered, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_FORWARD_DECL(PMPI_File_write_shared, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_FORWARD_DECL(PMPI_Finalize, int, ());
DARSHAN_FORWARD_DECL(PMPI_Init, int, (int *argc, char ***argv));
DARSHAN_FORWARD_DECL(PMPI_Init_thread, int, (int *argc, char ***argv, int required, int *provided));
DARSHAN_FORWARD_DECL(PMPI_Wtime, double, ());
DARSHAN_FORWARD_DECL(PMPI_Allreduce, int, (void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm));
DARSHAN_FORWARD_DECL(PMPI_Bcast, int, (void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm));
DARSHAN_FORWARD_DECL(PMPI_Comm_rank, int, (MPI_Comm comm, int *rank));
DARSHAN_FORWARD_DECL(PMPI_Comm_size, int, (MPI_Comm comm, int *size));
DARSHAN_FORWARD_DECL(PMPI_Scan, int, (void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm));
DARSHAN_FORWARD_DECL(PMPI_Type_commit, int, (MPI_Datatype *datatype));
DARSHAN_FORWARD_DECL(PMPI_Type_contiguous, int, (int count, MPI_Datatype oldtype, MPI_Datatype *newtype));
DARSHAN_FORWARD_DECL(PMPI_Type_extent, int, (MPI_Datatype datatype, MPI_Aint *extent));
DARSHAN_FORWARD_DECL(PMPI_Type_free, int, (MPI_Datatype *datatype));
DARSHAN_FORWARD_DECL(PMPI_Type_hindexed, int, (int count, int *array_of_blocklengths, MPI_Aint *array_of_displacements, MPI_Datatype oldtype, MPI_Datatype *newtype));
DARSHAN_FORWARD_DECL(PMPI_Op_create, int, (MPI_User_function *function, int commute, MPI_Op *op));
DARSHAN_FORWARD_DECL(PMPI_Op_free, int, (MPI_Op *op));
DARSHAN_FORWARD_DECL(PMPI_Reduce, int, (void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm));
DARSHAN_FORWARD_DECL(PMPI_Type_get_envelope, int, (MPI_Datatype datatype, int *num_integers, int *num_addresses, int *num_datatypes, int *combiner));
DARSHAN_FORWARD_DECL(PMPI_Type_size, int, (MPI_Datatype datatype, int *size));
void resolve_mpi_symbols (void)
{
/*
* Overloaded functions
*/
MAP_OR_FAIL(PMPI_File_close);
MAP_OR_FAIL(PMPI_File_set_size);
MAP_OR_FAIL(PMPI_File_iread_at);
MAP_OR_FAIL(PMPI_File_iread);
MAP_OR_FAIL(PMPI_File_iread_shared);
MAP_OR_FAIL(PMPI_File_iwrite_at);
MAP_OR_FAIL(PMPI_File_iwrite);
MAP_OR_FAIL(PMPI_File_iwrite_shared);
MAP_OR_FAIL(PMPI_File_open);
MAP_OR_FAIL(PMPI_File_read_all_begin);
MAP_OR_FAIL(PMPI_File_read_all);
MAP_OR_FAIL(PMPI_File_read_at_all_begin);
MAP_OR_FAIL(PMPI_File_read_at_all);
MAP_OR_FAIL(PMPI_File_read_at);
MAP_OR_FAIL(PMPI_File_read);
MAP_OR_FAIL(PMPI_File_read_ordered_begin);
MAP_OR_FAIL(PMPI_File_read_ordered);
MAP_OR_FAIL(PMPI_File_read_shared);
MAP_OR_FAIL(PMPI_File_set_view);
MAP_OR_FAIL(PMPI_File_sync);
MAP_OR_FAIL(PMPI_File_write_all_begin);
MAP_OR_FAIL(PMPI_File_write_all);
MAP_OR_FAIL(PMPI_File_write_at_all_begin);
MAP_OR_FAIL(PMPI_File_write_at_all);
MAP_OR_FAIL(PMPI_File_write_at);
MAP_OR_FAIL(PMPI_File_write);
MAP_OR_FAIL(PMPI_File_write_ordered_begin);
MAP_OR_FAIL(PMPI_File_write_ordered);
MAP_OR_FAIL(PMPI_File_write_shared);
MAP_OR_FAIL(PMPI_Finalize);
MAP_OR_FAIL(PMPI_Init);
MAP_OR_FAIL(PMPI_Init_thread);
/*
* These function are not intercepted but are used
* by darshan itself.
*/
MAP_OR_FAIL(PMPI_Wtime);
MAP_OR_FAIL(PMPI_Allreduce);
MAP_OR_FAIL(PMPI_Bcast);
MAP_OR_FAIL(PMPI_Comm_rank);
MAP_OR_FAIL(PMPI_Comm_size);
MAP_OR_FAIL(PMPI_Scan);
MAP_OR_FAIL(PMPI_Type_commit);
MAP_OR_FAIL(PMPI_Type_contiguous);
MAP_OR_FAIL(PMPI_Type_extent);
MAP_OR_FAIL(PMPI_Type_free);
MAP_OR_FAIL(PMPI_Type_size);
MAP_OR_FAIL(PMPI_Type_hindexed);
MAP_OR_FAIL(PMPI_Op_create);
MAP_OR_FAIL(PMPI_Op_free);
MAP_OR_FAIL(PMPI_Reduce);
MAP_OR_FAIL(PMPI_Type_get_envelope);
return;
}
#endif
int MPI_Init(int *argc, char ***argv)
{
int ret;
#ifdef DARSHAN_PRELOAD
resolve_mpi_symbols();
#endif
ret = DARSHAN_MPI_CALL(PMPI_Init)(argc, argv);
if(ret != MPI_SUCCESS)
{
return(ret);
}
darshan_mpi_initialize(argc, argv);
return(ret);
}
int MPI_Init_thread (int *argc, char ***argv, int required, int *provided)
{
int ret;
ret = DARSHAN_MPI_CALL(PMPI_Init_thread)(argc, argv, required, provided);
if (ret != MPI_SUCCESS)
{
return(ret);
}
darshan_mpi_initialize(argc, argv);
return(ret);
}
int MPI_Finalize(void)
{
int ret;
if(getenv("DARSHAN_INTERNAL_TIMING"))
darshan_shutdown(1);
else
darshan_shutdown(0);
ret = DARSHAN_MPI_CALL(PMPI_Finalize)();
return(ret);
}
......@@ -26,139 +26,7 @@
#include "mpi.h"
#include "darshan.h"
#ifdef DARSHAN_PRELOAD
#include <dlfcn.h>
#include <stdlib.h>
#define DARSHAN_MPI_CALL(func) __real_ ## func
#define DARSHAN_FORWARD_DECL(name,ret,args) \
ret (*__real_ ## name)args = NULL;
#define MAP_OR_FAIL(func) \
__real_ ## func = dlsym(RTLD_NEXT, #func); \
if (!(__real_ ## func)) { \
fprintf(stderr, "Darshan failed to map symbol: %s\n", #func); \
}
DARSHAN_FORWARD_DECL(PMPI_File_close, int, (MPI_File *fh));
DARSHAN_FORWARD_DECL(PMPI_File_set_size, int, (MPI_File fh, MPI_Offset size));
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));
DARSHAN_FORWARD_DECL(PMPI_File_iread, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, __D_MPI_REQUEST *request));
DARSHAN_FORWARD_DECL(PMPI_File_iread_shared, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, __D_MPI_REQUEST *request));
DARSHAN_FORWARD_DECL(PMPI_File_iwrite_at, int, (MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, __D_MPI_REQUEST *request));
DARSHAN_FORWARD_DECL(PMPI_File_iwrite, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, __D_MPI_REQUEST *request));
DARSHAN_FORWARD_DECL(PMPI_File_iwrite_shared, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, __D_MPI_REQUEST *request));
DARSHAN_FORWARD_DECL(PMPI_File_open, int, (MPI_Comm comm, char *filename, int amode, MPI_Info info, MPI_File *fh));
DARSHAN_FORWARD_DECL(PMPI_File_read_all_begin, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype));
DARSHAN_FORWARD_DECL(PMPI_File_read_all, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_FORWARD_DECL(PMPI_File_read_at_all, int, (MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_FORWARD_DECL(PMPI_File_read_at_all_begin, int, (MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype));
DARSHAN_FORWARD_DECL(PMPI_File_read_at, int, (MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_FORWARD_DECL(PMPI_File_read, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_FORWARD_DECL(PMPI_File_read_ordered_begin, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype));
DARSHAN_FORWARD_DECL(PMPI_File_read_ordered, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_FORWARD_DECL(PMPI_File_read_shared, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_FORWARD_DECL(PMPI_File_set_view, int, (MPI_File fh, MPI_Offset disp, MPI_Datatype etype, MPI_Datatype filetype, char *datarep, MPI_Info info));
DARSHAN_FORWARD_DECL(PMPI_File_sync, int, (MPI_File fh));
DARSHAN_FORWARD_DECL(PMPI_File_write_all_begin, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype));
DARSHAN_FORWARD_DECL(PMPI_File_write_all, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_FORWARD_DECL(PMPI_File_write_at_all_begin, int, (MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype));
DARSHAN_FORWARD_DECL(PMPI_File_write_at_all, int, (MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_FORWARD_DECL(PMPI_File_write_at, int, (MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_FORWARD_DECL(PMPI_File_write, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_FORWARD_DECL(PMPI_File_write_ordered_begin, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype));
DARSHAN_FORWARD_DECL(PMPI_File_write_ordered, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_FORWARD_DECL(PMPI_File_write_shared, int, (MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
DARSHAN_FORWARD_DECL(PMPI_Finalize, int, ());
DARSHAN_FORWARD_DECL(PMPI_Init, int, (int *argc, char ***argv));
DARSHAN_FORWARD_DECL(PMPI_Init_thread, int, (int *argc, char ***argv, int required, int *provided));
DARSHAN_FORWARD_DECL(PMPI_Wtime, double, ());
DARSHAN_FORWARD_DECL(PMPI_Allreduce, int, (void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm));
DARSHAN_FORWARD_DECL(PMPI_Bcast, int, (void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm));
DARSHAN_FORWARD_DECL(PMPI_Comm_rank, int, (MPI_Comm comm, int *rank));
DARSHAN_FORWARD_DECL(PMPI_Comm_size, int, (MPI_Comm comm, int *size));
DARSHAN_FORWARD_DECL(PMPI_Scan, int, (void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm));
DARSHAN_FORWARD_DECL(PMPI_Type_commit, int, (MPI_Datatype *datatype));
DARSHAN_FORWARD_DECL(PMPI_Type_contiguous, int, (int count, MPI_Datatype oldtype, MPI_Datatype *newtype));
DARSHAN_FORWARD_DECL(PMPI_Type_extent, int, (MPI_Datatype datatype, MPI_Aint *extent));
DARSHAN_FORWARD_DECL(PMPI_Type_free, int, (MPI_Datatype *datatype));
DARSHAN_FORWARD_DECL(PMPI_Type_hindexed, int, (int count, int *array_of_blocklengths, MPI_Aint *array_of_displacements, MPI_Datatype oldtype, MPI_Datatype *newtype));
DARSHAN_FORWARD_DECL(PMPI_Op_create, int, (MPI_User_function *function, int commute, MPI_Op *op));
DARSHAN_FORWARD_DECL(PMPI_Op_free, int, (MPI_Op *op));
DARSHAN_FORWARD_DECL(PMPI_Reduce, int, (void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm));
DARSHAN_FORWARD_DECL(PMPI_Type_get_envelope, int, (MPI_Datatype datatype, int *num_integers, int *num_addresses, int *num_datatypes, int *combiner));
DARSHAN_FORWARD_DECL(PMPI_Type_size, int, (MPI_Datatype datatype, int *size));
void resolve_mpi_symbols (void)
{
/*
* Overloaded functions
*/
MAP_OR_FAIL(PMPI_File_close);
MAP_OR_FAIL(PMPI_File_set_size);
MAP_OR_FAIL(PMPI_File_iread_at);
MAP_OR_FAIL(PMPI_File_iread);
MAP_OR_FAIL(PMPI_File_iread_shared);
MAP_OR_FAIL(PMPI_File_iwrite_at);
MAP_OR_FAIL(PMPI_File_iwrite);
MAP_OR_FAIL(PMPI_File_iwrite_shared);
MAP_OR_FAIL(PMPI_File_open);
MAP_OR_FAIL(PMPI_File_read_all_begin);
MAP_OR_FAIL(PMPI_File_read_all);
MAP_OR_FAIL(PMPI_File_read_at_all_begin);
MAP_OR_FAIL(PMPI_File_read_at_all);
MAP_OR_FAIL(PMPI_File_read_at);
MAP_OR_FAIL(PMPI_File_read);
MAP_OR_FAIL(PMPI_File_read_ordered_begin);
MAP_OR_FAIL(PMPI_File_read_ordered);
MAP_OR_FAIL(PMPI_File_read_shared);
MAP_OR_FAIL(PMPI_File_set_view);
MAP_OR_FAIL(PMPI_File_sync);
MAP_OR_FAIL(PMPI_File_write_all_begin);
MAP_OR_FAIL(PMPI_File_write_all);
MAP_OR_FAIL(PMPI_File_write_at_all_begin);
MAP_OR_FAIL(PMPI_File_write_at_all);
MAP_OR_FAIL(PMPI_File_write_at);
MAP_OR_FAIL(PMPI_File_write);
MAP_OR_FAIL(PMPI_File_write_ordered_begin);
MAP_OR_FAIL(PMPI_File_write_ordered);
MAP_OR_FAIL(PMPI_File_write_shared);
MAP_OR_FAIL(PMPI_Finalize);
MAP_OR_FAIL(PMPI_Init);
MAP_OR_FAIL(PMPI_Init_thread);
/*
* These function are not intercepted but are used
* by darshan itself.
*/
MAP_OR_FAIL(PMPI_Wtime);
MAP_OR_FAIL(PMPI_Allreduce);
MAP_OR_FAIL(PMPI_Bcast);
MAP_OR_FAIL(PMPI_Comm_rank);
MAP_OR_FAIL(PMPI_Comm_size);
MAP_OR_FAIL(PMPI_Scan);
MAP_OR_FAIL(PMPI_Type_commit);
MAP_OR_FAIL(PMPI_Type_contiguous);
MAP_OR_FAIL(PMPI_Type_extent);
MAP_OR_FAIL(PMPI_Type_free);
MAP_OR_FAIL(PMPI_Type_size);
MAP_OR_FAIL(PMPI_Type_hindexed);
MAP_OR_FAIL(PMPI_Op_create);
MAP_OR_FAIL(PMPI_Op_free);
MAP_OR_FAIL(PMPI_Reduce);
MAP_OR_FAIL(PMPI_Type_get_envelope);
return;
}
#else
#define DARSHAN_MPI_CALL(func) func
#endif
#include "darshan-dynamic.h"
extern char* __progname;
......@@ -325,7 +193,7 @@ static void darshan_file_reduce(void* infile_v,
static int cp_log_compress(struct darshan_job_runtime* final_job,
int rank, int* inout_count, int* lengths, void** pointers);
static int file_compare(const void* a, const void* b);
static void darshan_mpi_initialize(int *argc, char ***argv);
void darshan_mpi_initialize(int *argc, char ***argv);
static char* darshan_get_exe_and_mounts(struct darshan_job_runtime* final_job);
static int darshan_file_variance(
struct darshan_file *infile_array,
......@@ -353,41 +221,7 @@ struct variance_dt
double S;
};
int MPI_Init(int *argc, char ***argv)
{
int ret;
#ifdef DARSHAN_PRELOAD
resolve_mpi_symbols();
#endif
ret = DARSHAN_MPI_CALL(PMPI_Init)(argc, argv);
if(ret != MPI_SUCCESS)
{
return(ret);
}
darshan_mpi_initialize(argc, argv);
return(ret);
}
int MPI_Init_thread (int *argc, char ***argv, int required, int *provided)
{
int ret;
ret = DARSHAN_MPI_CALL(PMPI_Init_thread)(argc, argv, required, provided);
if (ret != MPI_SUCCESS)
{
return(ret);
}
darshan_mpi_initialize(argc, argv);
return(ret);
}
static void darshan_mpi_initialize(int *argc, char ***argv)
void darshan_mpi_initialize(int *argc, char ***argv)
{
int nprocs;
int rank;
......@@ -816,19 +650,6 @@ void darshan_shutdown(int timing_flag)
return;
}
int MPI_Finalize(void)
{
int ret;
if(getenv("DARSHAN_INTERNAL_TIMING"))
darshan_shutdown(1);
else
darshan_shutdown(0);
ret = DARSHAN_MPI_CALL(PMPI_Finalize)();
return(ret);
}
int MPI_File_open(MPI_Comm comm, char *filename, int amode, MPI_Info info, MPI_File *fh)
{
int ret;
......
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