nerscadmin / IPM

Integrated Performance Monitoring for High Performance Computing
http://ipm-hpc.org
GNU Lesser General Public License v2.1
84 stars 36 forks source link

revamp C and Fortran wrappers : #8

Closed ggouaillardet closed 9 years ago

ggouaillardet commented 9 years ago

here is an example with MPI_Send:

void IPM_MPI_Send(MPI3CONST void *sbuf, int scount, MPI_Datatype stype, int dest, int tag, MPI_Comm comm_in, double tstart, double tstop) { // do IPM related stuff }

int MPI_Send(MPI3CONST void *sbuf, int scount, MPI_Datatype stype, int dest, int tag, MPI_Comm comm_in) { int rv; double tstart, tstop;

IPM_TIMESTAMP(tstart); rv = PMPI_Send(sbuf,scount,stype,dest,tag,comm_in); IPM_TIMESTAMP(tstop);

if( ipm_state!=STATE_ACTIVE ) { return rv; }

IPM_MPI_Send(sbuf,scount,stype,dest,tag,comm_in, tstart, tstop);

return rv; }

void mpisend(void sbuf, MPI_Fint scount, MPI_Fint stype, MPI_Fint dest, MPI_Fint tag, MPI_Fint comm_in, MPI_Fint *info) { double tstart, tstop;

// f2c conversions IPM_TIMESTAMP(tstart); pmpisend(sbuf,scount,stype,dest,tag,comm_in,info); IPM_TIMESTAMP(tstop);

if( ipm_state!=STATE_ACTIVE ) { return; }

// f2c conversions IPM_MPI_Send(sbuf,_scount,MPI_Type_f2c(_stype),_dest,_tag,MPI_Comm_f2c(*comm_in), tstart, tstop);

}

ggouaillardet commented 9 years ago

This is an alternative to nerscadmin/IPM#6

IPM is still C only. Fortran wrappers now call PMPI_* Fortran subroutines so there is no more need to worry about MPI_IN_PLACE and friends. i am unsure of how/whether this works with Fortran 2008

swfrench commented 9 years ago

Hi Gilles - Many thanks for the PR and apologies for the delay in one of us getting back to you. This seems like a pretty elegant solution. As long as there is no introspection into sbuf that would encounter a language-specific "special value" a la MPI_IN_PLACE (which is clearly not something IPM does at present), then this should be fine. Let me run some tests tomorrow and hopefully we can get this merged in.