Commit 57c6540a authored by Shen Yu's avatar Shen Yu
Browse files

new file: openmpi-4.1.1/ompi/mpi/c/_MSGLOG_.h

	modified:   openmpi-4.1.1/ompi/mpi/c/allgather.c
	modified:   openmpi-4.1.1/ompi/mpi/c/allgatherv.c
	modified:   openmpi-4.1.1/ompi/mpi/c/allreduce.c
	modified:   openmpi-4.1.1/ompi/mpi/c/alltoall.c
	modified:   openmpi-4.1.1/ompi/mpi/c/alltoallv.c
	modified:   openmpi-4.1.1/ompi/mpi/c/alltoallw.c
	modified:   openmpi-4.1.1/ompi/mpi/c/bcast.c
	modified:   openmpi-4.1.1/ompi/mpi/c/finalize.c
	modified:   openmpi-4.1.1/ompi/mpi/c/gather.c
	modified:   openmpi-4.1.1/ompi/mpi/c/gatherv.c
	modified:   openmpi-4.1.1/ompi/mpi/c/init.c
	modified:   openmpi-4.1.1/ompi/mpi/c/irecv.c
	modified:   openmpi-4.1.1/ompi/mpi/c/isend.c
	modified:   openmpi-4.1.1/ompi/mpi/c/recv.c
	modified:   openmpi-4.1.1/ompi/mpi/c/reduce.c
	modified:   openmpi-4.1.1/ompi/mpi/c/rsend.c
	modified:   openmpi-4.1.1/ompi/mpi/c/scatter.c
	modified:   openmpi-4.1.1/ompi/mpi/c/scatterv.c
	modified:   openmpi-4.1.1/ompi/mpi/c/send.c
	modified:   openmpi-4.1.1/ompi/mpi/c/ssend.c
	modified:   openmpi-4.1.1/ompi/mpi/c/test.c
	modified:   openmpi-4.1.1/ompi/mpi/c/testall.c
	modified:   openmpi-4.1.1/ompi/mpi/c/testany.c
	modified:   openmpi-4.1.1/ompi/mpi/c/testsome.c
	modified:   openmpi-4.1.1/ompi/mpi/c/wait.c
	modified:   openmpi-4.1.1/ompi/mpi/c/waitall.c
	modified:   openmpi-4.1.1/ompi/mpi/c/waitany.c
	modified:   openmpi-4.1.1/ompi/mpi/c/waitsome.c
	modified:   readme.md
	new file:   replayer/function_list.h
	new file:   replayer/mpi_player.cpp

add some MPI recorder functions
parent d1b04395
// for log messages
#ifndef __MSGLOG_H__
#define __MSGLOG_H__
#include <stdio.h>
#include <sys/time.h>
extern FILE* MSGLOGFILE;
extern struct timeval START_TIME;
extern int LOGMSGMYID;
extern int* INT_POOL;
extern int REQ_POOL_SIZE;
extern int* REQ_POOL;
//inline void LOGMSG(const char FUNCNAME[], const struct timeval call_time, const MPI_Comm COMM,
// const int DSTPROC, const int SENDSIZE,
// const int SRCPROC, const int RECVSIZE);
//inline int LOGMSG_SIZE(const MPI_Datatype t, const int c);
//inline int LOGMSG_SIZE_V(const int NPROC, const MPI_Datatype t, const int c[]);
//inline int LOGMSG_SIZE_W(const int NPROC, const MPI_Datatype t[], const int c[]);
// FUNCNAME: call function name
// COMM: MPI communicator, converted to int
// DSTPROC: destination process id, -1 means not applicable
// SENDSIZE: send message size, -1 means not applicable
// SRCPROC: source process id, -1 means not applicable
// RECVSIZE: receive message size, -1 means not applicable
inline void LOGMSG0(const int FUNC_ID, const struct timeval call_time, const MPI_Comm COMM)
{
struct timeval end_time;
gettimeofday(&end_time, NULL);
double CALLTIME = (call_time.tv_sec - START_TIME.tv_sec) +
(call_time.tv_usec - START_TIME.tv_usec)/1000000.0;
double ENDTIME = (end_time.tv_sec - START_TIME.tv_sec) +
(end_time.tv_usec - START_TIME.tv_usec)/1000000.0;
fprintf(MSGLOGFILE, "%lf, %lf, %d, %d",
CALLTIME, ENDTIME, FUNC_ID, MPI_Comm_c2f(COMM));
}
inline void LOGMSG1(const int FUNC_ID, const struct timeval call_time, const MPI_Comm COMM,
const int ARGC, const int* ARGV)
{
struct timeval end_time;
gettimeofday(&end_time, NULL);
double CALLTIME = (call_time.tv_sec - START_TIME.tv_sec) +
(call_time.tv_usec - START_TIME.tv_usec)/1000000.0;
double ENDTIME = (end_time.tv_sec - START_TIME.tv_sec) +
(end_time.tv_usec - START_TIME.tv_usec)/1000000.0;
fprintf(MSGLOGFILE, "%lf, %lf, %d, %d, %d",
CALLTIME, ENDTIME, FUNC_ID, MPI_Comm_c2f(COMM), ARGC);
for(int i=0; i<ARGC; ++i)
fprintf(MSGLOGFILE, ", %d", ARGV[i]);
fprintf(MSGLOGFILE, "\n");
}
inline void LOGMSG2(const int FUNC_ID, const struct timeval call_time, const MPI_Comm COMM,
const int ARGC1, const int ARGC2, const int* ARGV1, const int* ARGV2)
{
struct timeval end_time;
gettimeofday(&end_time, NULL);
double CALLTIME = (call_time.tv_sec - START_TIME.tv_sec) +
(call_time.tv_usec - START_TIME.tv_usec)/1000000.0;
double ENDTIME = (end_time.tv_sec - START_TIME.tv_sec) +
(end_time.tv_usec - START_TIME.tv_usec)/1000000.0;
fprintf(MSGLOGFILE, "%lf, %lf, %d, %d, %d, %d",
CALLTIME, ENDTIME, FUNC_ID, MPI_Comm_c2f(COMM), ARGC1, ARGC2);
for(int i=0; i<ARGC1; ++i)
fprintf(MSGLOGFILE, ", %d", ARGV1[i]);
for(int i=0; i<ARGC2; ++i)
fprintf(MSGLOGFILE, ", %d", ARGV2[i]);
fprintf(MSGLOGFILE, "\n");
}
inline int LOGMSG_SIZE(const MPI_Datatype t, const int c, int& log_elem_size)
{
MPI_Type_size(t, &log_elem_size);
return c*log_elem_size;
}
inline int LOGMSG_SIZE_V(const int NPROC, const MPI_Datatype t, const int c[], int& log_elem_size[])
{
int TYPESIZE;
MPI_Type_size(t, &TYPESIZE);
int MSGSIZE=0;
for(int i; i<NPROC; ++i)
{
log_elem_size[i]=c[i]*TYPESIZE;
MSGSIZE+=log_elem_size[i];
}
return MSGSIZE;
}
inline int LOGMSG_SIZE_W(const int NPROC, const MPI_Datatype t[], const int c[], int& log_elem_size[])
{
int MSGSIZE=0;
int TYPESIZE;
for(int i; i<NPROC; ++i)
{
MPI_Type_size(t[i], &TYPESIZE);
log_elem_size[i]=c[i]*TYPESIZE;
MSGSIZE+=log_elem_size[i];
}
return MSGSIZE;
}
inline int init_REQ_POOL(int size)
{
if(size > REQ_POOL_SIZE)
{
int* old_pool=REQ_POOL;
int* new_pool=malloc(size*sizeof(int));
if(new_pool)
{
REQ_POOL=new_pool;
delete[] old_pool;
return 0;
}
else
{
return 1;
}
}
}
inline void free_REQ_POOL()
{
free(REQ_POOL);
REQ_POOL_SIZE=0;
}
/* replaced by MPI_Op_c2f
inline int MPI_Op_index(MPI_Op op)
{
int idx;
if(op == MPI_MAX)
idx=0;
else if(op == MPI_MIN)
idx=1;
else if(op == MPI_SUM)
idx=1;
else if(op == MPI_PROD)
idx=2;
else if(op == MPI_LAND)
idx=3;
else if(op == MPI_RAND)
idx=4;
else if(op == MPI_LOR)
idx=5;
else if(op == MPI_BOR)
idx=6;
else if(op == MPI_LXOR)
idx=7;
else if(op == MPI_BXOR)
idx=8;
else if(op == MPI_MAXLOC)
idx=9;
else if(op == MPI_MINLOC)
idx=10;
return idx;
}*/
#endif
// end
......@@ -34,6 +34,10 @@
#include "ompi/memchecker.h"
#include "ompi/runtime/ompi_spc.h"
// for log messages
#include "ompi/mpi/c/_MSGLOG_.h"
// end
#if OMPI_BUILD_MPI_PROFILING
#if OPAL_HAVE_WEAK_SYMBOLS
#pragma weak MPI_Allgather = PMPI_Allgather
......@@ -48,6 +52,11 @@ int MPI_Allgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
void *recvbuf, int recvcount, MPI_Datatype recvtype,
MPI_Comm comm)
{
// for log messages
struct timeval call_time;
gettimeofday(&call_time, NULL);
// end
int err;
SPC_RECORD(OMPI_SPC_ALLGATHER, 1);
......@@ -125,6 +134,17 @@ int MPI_Allgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
err = comm->c_coll->coll_allgather(sendbuf, sendcount, sendtype,
recvbuf, recvcount, recvtype, comm,
comm->c_coll->coll_allgather_module);
// for log messages
const int FUNC_ID=1;
int sendelemsize, recvelemsize;
int LOGMSG_SENDSIZE=LOGMSG_SIZE(sendtype, sendcount, sendelemsize);
int LOGMSG_RECVSIZE=LOGMSG_SIZE(recvtype, recvcount, recvelemsize);
const int LOG_ARGC=4;
int LOG_ARGV[LOG_ARGC]={sendcount, sendelemsize, recvcount, recvelemsize};
LOGMSG1(FUNC_ID, call_time, comm, LOG_ARGC, LOG_ARGV);
// end
OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
}
......@@ -34,6 +34,10 @@
#include "ompi/memchecker.h"
#include "ompi/runtime/ompi_spc.h"
// for log messages
#include "ompi/mpi/c/_MSGLOG_.h"
// end
#if OMPI_BUILD_MPI_PROFILING
#if OPAL_HAVE_WEAK_SYMBOLS
#pragma weak MPI_Allgatherv = PMPI_Allgatherv
......@@ -48,6 +52,11 @@ int MPI_Allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
void *recvbuf, const int recvcounts[],
const int displs[], MPI_Datatype recvtype, MPI_Comm comm)
{
// for log messages
struct timeval call_time;
gettimeofday(&call_time, NULL);
// end
int i, size, err;
SPC_RECORD(OMPI_SPC_ALLGATHERV, 1);
......@@ -147,6 +156,18 @@ int MPI_Allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
recvbuf, (int *) recvcounts,
(int *) displs, recvtype, comm,
comm->c_coll->coll_allgatherv_module);
// for log messages
const int FUNC_ID=2;
int sendelemsize;
int* recvelemsizelist=INT_POOL;
int LOGMSG_SENDSIZE=LOGMSG_SIZE(sendtype, sendcount, sendelemsize);
int LOGMSG_RECVSIZE=LOGMSG_SIZE_V(size, recvtype, recvcount, recvelemsizelist);
const int LOG_ARGC=2;
int LOG_ARGV[LOG_ARGC]={sendcount, sendelemsize};
LOGMSG2(FUNC_ID, call_time, comm, LOG_ARGC, size, LOG_ARGV, recvelemsizelist);
// end
OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
}
......@@ -33,6 +33,10 @@
#include "ompi/memchecker.h"
#include "ompi/runtime/ompi_spc.h"
// for log messages
#include "ompi/mpi/c/_MSGLOG_.h"
// end
#if OMPI_BUILD_MPI_PROFILING
#if OPAL_HAVE_WEAK_SYMBOLS
#pragma weak MPI_Allreduce = PMPI_Allreduce
......@@ -46,6 +50,11 @@ static const char FUNC_NAME[] = "MPI_Allreduce";
int MPI_Allreduce(const void *sendbuf, void *recvbuf, int count,
MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
{
// for log messages
struct timeval call_time;
gettimeofday(&call_time, NULL);
// end
int err;
SPC_RECORD(OMPI_SPC_ALLREDUCE, 1);
......@@ -114,6 +123,17 @@ int MPI_Allreduce(const void *sendbuf, void *recvbuf, int count,
datatype, op, comm,
comm->c_coll->coll_allreduce_module);
OBJ_RELEASE(op);
// for log messages
const int FUNC_ID=3;
int sendelemsize, recvelemsize;
int LOGMSG_SENDSIZE=LOGMSG_SIZE(sendtype, count, sendelemsize);
int LOGMSG_RECVSIZE=LOGMSG_SIZE(recvtype, count, recvelemsize);
const int LOG_ARGC=4;
int LOG_ARGV[LOG_ARGC]={count, sendelemsize, recvelemsize, MPI_Op_c2f(op)};
LOGMSG1(FUNC_ID, call_time, comm, LOG_ARGC, LOG_ARGV);
// end
OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
}
......@@ -35,6 +35,10 @@
#include "ompi/memchecker.h"
#include "ompi/runtime/ompi_spc.h"
// for log messages
#include "ompi/mpi/c/_MSGLOG_.h"
// end
#if OMPI_BUILD_MPI_PROFILING
#if OPAL_HAVE_WEAK_SYMBOLS
#pragma weak MPI_Alltoall = PMPI_Alltoall
......@@ -49,6 +53,11 @@ int MPI_Alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
void *recvbuf, int recvcount, MPI_Datatype recvtype,
MPI_Comm comm)
{
// for log messages
struct timeval call_time;
gettimeofday(&call_time, NULL);
// end
int err;
size_t recvtype_size;
......@@ -110,6 +119,17 @@ int MPI_Alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
err = comm->c_coll->coll_alltoall(sendbuf, sendcount, sendtype,
recvbuf, recvcount, recvtype,
comm, comm->c_coll->coll_alltoall_module);
// for log messages
const int FUNC_ID=4;
int sendelemsize, recvelemsize;
int LOGMSG_SENDSIZE=LOGMSG_SIZE(sendtype, sendcount, sendelemsize);
int LOGMSG_RECVSIZE=LOGMSG_SIZE(recvtype, recvcount, recvelemsize);
const int LOG_ARGC=4;
int LOG_ARGV[LOG_ARGC]={sendcount, sendelemsize, recvcount, recvelemsize};
LOGMSG1(FUNC_ID, call_time, comm, LOG_ARGC, LOG_ARGV);
// end
OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
}
......@@ -33,6 +33,10 @@
#include "ompi/memchecker.h"
#include "ompi/runtime/ompi_spc.h"
// for log messages
#include "ompi/mpi/c/_MSGLOG_.h"
// end
#if OMPI_BUILD_MPI_PROFILING
#if OPAL_HAVE_WEAK_SYMBOLS
#pragma weak MPI_Alltoallv = PMPI_Alltoallv
......@@ -48,6 +52,11 @@ int MPI_Alltoallv(const void *sendbuf, const int sendcounts[],
void *recvbuf, const int recvcounts[], const int rdispls[],
MPI_Datatype recvtype, MPI_Comm comm)
{
// for log messages
struct timeval call_time;
gettimeofday(&call_time, NULL);
// end
int i, size, err;
SPC_RECORD(OMPI_SPC_ALLTOALLV, 1);
......@@ -129,6 +138,16 @@ int MPI_Alltoallv(const void *sendbuf, const int sendcounts[],
err = comm->c_coll->coll_alltoallv(sendbuf, sendcounts, sdispls, sendtype,
recvbuf, recvcounts, rdispls, recvtype,
comm, comm->c_coll->coll_alltoallv_module);
// for log messages
const int FUNC_ID=5;
int* sendelemsizelist=&INT_POOL[0];
int* recvelemsizelist=&INT_POOL[size];
int LOGMSG_SENDSIZE=LOGMSG_SIZE_V(size, sendtype, sendcounts, sendelemsizelist);
int LOGMSG_RECVSIZE=LOGMSG_SIZE_V(size, recvtype, recvcounts, recvelemsizelist);
LOGMSG2(FUNC_ID, call_time, comm, size, size, sendelemsizelist, recvelemsizelist);
// end
OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
}
......@@ -33,6 +33,10 @@
#include "ompi/memchecker.h"
#include "ompi/runtime/ompi_spc.h"
// for log messages
#include "ompi/mpi/c/_MSGLOG_.h"
// end
#if OMPI_BUILD_MPI_PROFILING
#if OPAL_HAVE_WEAK_SYMBOLS
#pragma weak MPI_Alltoallw = PMPI_Alltoallw
......@@ -48,6 +52,11 @@ int MPI_Alltoallw(const void *sendbuf, const int sendcounts[],
void *recvbuf, const int recvcounts[], const int rdispls[],
const MPI_Datatype recvtypes[], MPI_Comm comm)
{
// for log messages
struct timeval call_time;
gettimeofday(&call_time, NULL);
// end
int i, size, err;
SPC_RECORD(OMPI_SPC_ALLTOALLW, 1);
......@@ -124,6 +133,16 @@ int MPI_Alltoallw(const void *sendbuf, const int sendcounts[],
err = comm->c_coll->coll_alltoallw(sendbuf, sendcounts, sdispls, (ompi_datatype_t **) sendtypes,
recvbuf, recvcounts, rdispls, (ompi_datatype_t **) recvtypes,
comm, comm->c_coll->coll_alltoallw_module);
// for log messages
const int FUNC_ID=6;
int* sendelemsizelist=&INT_POOL[0];
int* recvelemsizelist=&INT_POOL[size];
int LOGMSG_SENDSIZE=LOGMSG_SIZE_W(size, sendtypes, sendcounts, sendelemsizelist);
int LOGMSG_RECVSIZE=LOGMSG_SIZE_W(size, recvtypes, recvcounts, recvelemsizelist);
LOGMSG2(FUNC_ID, call_time, comm, size, size, sendelemsizelist, recvelemsizelist);
// end
OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
}
......@@ -28,6 +28,10 @@
#include "ompi/memchecker.h"
#include "ompi/runtime/ompi_spc.h"
// for log messages
#include "ompi/mpi/c/_MSGLOG_.h"
// end
#if OMPI_BUILD_MPI_PROFILING
#if OPAL_HAVE_WEAK_SYMBOLS
#pragma weak MPI_Bcast = PMPI_Bcast
......@@ -41,6 +45,11 @@ static const char FUNC_NAME[] = "MPI_Bcast";
int MPI_Bcast(void *buffer, int count, MPI_Datatype datatype,
int root, MPI_Comm comm)
{
// for log messages
struct timeval call_time;
gettimeofday(&call_time, NULL);
// end
int err;
SPC_RECORD(OMPI_SPC_BCAST, 1);
......@@ -113,5 +122,15 @@ int MPI_Bcast(void *buffer, int count, MPI_Datatype datatype,
err = comm->c_coll->coll_bcast(buffer, count, datatype, root, comm,
comm->c_coll->coll_bcast_module);
// for log messages
const int FUNC_ID=7;
int elemsize;
int datasize=LOGMSG_SIZE(datatype, count, elemsize);
const int LOG_ARGC=2;
int LOG_ARGV[LOG_ARGC]={root, datasize};
LOGMSG1(FUNC_ID, call_time, comm, LOG_ARGC, LOG_ARGV);
// end
OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
}
......@@ -25,6 +25,14 @@
#include "ompi/errhandler/errhandler.h"
#include "ompi/runtime/ompi_spc.h"
// for log messages
#include "ompi/mpi/c/_MSGLOG_.h"
struct timeval START_TIME;
FILE* MSGLOGFILE;
int LOGMSGMYID;
int* INT_POOL;
// end
#if OMPI_BUILD_MPI_PROFILING
#if OPAL_HAVE_WEAK_SYMBOLS
#pragma weak MPI_Finalize = PMPI_Finalize
......@@ -37,6 +45,11 @@ static const char FUNC_NAME[] = "MPI_Finalize";
int MPI_Finalize(void)
{
// for log messages
struct timeval call_time;
gettimeofday(&call_time, NULL);
// end
/* If --with-spc and ompi_mpi_spc_dump_enabled were specified, print
* all of the final SPC values aggregated across the whole MPI run.
* Also, free all SPC memory.
......@@ -51,5 +64,12 @@ int MPI_Finalize(void)
/* Pretty simple */
// for log messages
const int FUNC_ID=255;
LOGMSG0(FUNC_ID, call_time, MPI_COMM_WORLD);
fclose(MSGLOGFILE);
delete[] INT_POOL;
// end
return ompi_mpi_finalize();
}
......@@ -34,6 +34,10 @@
#include "ompi/memchecker.h"
#include "ompi/runtime/ompi_spc.h"
// for log messages
#include "ompi/mpi/c/_MSGLOG_.h"
// end
#if OMPI_BUILD_MPI_PROFILING
#if OPAL_HAVE_WEAK_SYMBOLS
#pragma weak MPI_Gather = PMPI_Gather
......@@ -48,6 +52,11 @@ int MPI_Gather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
void *recvbuf, int recvcount, MPI_Datatype recvtype,
int root, MPI_Comm comm)
{
// for log messages
struct timeval call_time;
gettimeofday(&call_time, NULL);
// end
int err;
SPC_RECORD(OMPI_SPC_GATHER, 1);
......@@ -184,5 +193,15 @@ int MPI_Gather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
err = comm->c_coll->coll_gather(sendbuf, sendcount, sendtype, recvbuf,
recvcount, recvtype, root, comm,
comm->c_coll->coll_gather_module);
// for log messages
const int FUNC_ID=1;
int sendelemsize, recvelemsize;
int LOGMSG_SENDSIZE=LOGMSG_SIZE(sendtype, sendcount, sendelemsize);
int LOGMSG_RECVSIZE=LOGMSG_SIZE(recvtype, recvcount, recvelemsize);
const int LOG_ARGC=5;
int LOG_ARGV[LOG_ARGC]={root, sendcount, recvcount, sendelemsize, recvelemsize};
LOGMSG1(FUNC_ID, call_time, comm, LOG_ARGC, LOG_ARGV);
// end
OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
}
......@@ -32,6 +32,10 @@
#include "ompi/memchecker.h"
#include "ompi/runtime/ompi_spc.h"
// for log messages
#include "ompi/mpi/c/_MSGLOG_.h"
// end
#if OMPI_BUILD_MPI_PROFILING
#if OPAL_HAVE_WEAK_SYMBOLS
#pragma weak MPI_Gatherv = PMPI_Gatherv
......@@ -46,6 +50,11 @@ int MPI_Gatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
void *recvbuf, const int recvcounts[], const int displs[],
MPI_Datatype recvtype, int root, MPI_Comm comm)
{
// for log messages
struct timeval call_time;
gettimeofday(&call_time, NULL);
// end
int i, size, err;
SPC_RECORD(OMPI_SPC_GATHERV, 1);
......@@ -197,5 +206,17 @@ int MPI_Gatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
recvcounts, displs,
recvtype, root, comm,
comm->c_coll->coll_gatherv_module);
// for log messages
const int FUNC_ID=9;
int sendelemsize;
int* recvelemsizelist=&INT_POOL[0];
int LOGMSG_SENDSIZE=LOGMSG_SIZE(sendtype, sendcount, sendelemsize);
int LOGMSG_RECVSIZE=LOGMSG_SIZE_V(recvtype, recvcounts, recvelemsizelist);
const int LOG_ARGC=4;
int LOG_ARGV[LOG_ARGC]={root, sendcount, sendelemsize};
LOGMSG2(FUNC_ID, call_time, comm, LOG_ARGC, LOG_ARGV, size, recvelemsizelist);
// end
OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
}
......@@ -31,6 +31,16 @@
#include "ompi/errhandler/errhandler.h"
#include "ompi/constants.h"
// for log messages
#include "ompi/mpi/c/_MSGLOG_.h"
struct timeval START_TIME;
FILE* MSGLOGFILE;
int LOGMSGMYID;
int* INT_POOL;
int REQ_POOL_SIZE;
int* REQ_POOL;
// end
#if OMPI_BUILD_MPI_PROFILING
#if OPAL_HAVE_WEAK_SYMBOLS
#pragma weak MPI_Init = PMPI_Init
......@@ -43,6 +53,10 @@ static const char FUNC_NAME[] = "MPI_Init";
int MPI_Init(int *argc, char ***argv)
{
// for log messages
gettimeofday(&START_TIME, NULL);
// end
int err;
int provided;
char *env;
......@@ -86,5 +100,42 @@ int MPI_Init(int *argc, char ***argv)
SPC_INIT();
// for log messages
// initialize
int namelen;
char HOSTNAME[MPI_MAX_PROCESSOR_NAME];
MPI_Get_processor_name(HOSTNAME, &namelen);
char *logfilepath;
logfilepath=getenv("MSGLOGPATH");
if(logfilepath == NULL)
logfilepath="/tmp";
if(strlen(logfilepath) > 4000)
logfilepath="/tmp"
char logfilename[4096];
if (NULL != (env = getenv("OMPI_COMM_WORLD_RANK"))) {
LOGMSGMYID = atoi(env);
sprintf(logfilename, "%s/%d/MSGLOG.%s.%d.csv", logfilepath, int(START_TIME.tv_sec/100)*100, HOSTNAME, LOGMSGMYID);
}
else if (NULL != (env = getenv("PMIX_RANK")))
{
LOGMSGMYID = atoi(env);
sprintf(logfilename, "%s/%d/MSGLOG.%s.%d.csv", logfilepath, int(START_TIME.tv_sec/100)*100, HOSTNAME, LOGMSGMYID);