Commit 7b6278c1 authored by Deike Kleberg's avatar Deike Kleberg
Browse files

IO mode PIO_NONE running.

parent c97c2e22
......@@ -13,7 +13,7 @@
extern void reshArrayPrint ( char * );
#define nProcsIO 3
#define nProcsIO 1
static int hasLocalFile[] = { 0 };
......@@ -25,10 +25,11 @@ static int nlev[nVars] = {1,1,5,5,2};
#define maxlev 5
#define ntsteps 3
//int IOModus = PIO_POSIX_FPGUARD_SENDRECV;
//int IOModus = PIO_MPI_NONB;
//int IOModus = PIO_POSIX_NONB;
int IOModus = PIO_POSIX_ASYNCH;
int IOMode = PIO_NONE;
//int IOMode = PIO_MPI_NONB;
//int IOMode = PIO_POSIX_FPGUARD_SENDRECV;
//int IOMode = PIO_POSIX_ASYNCH;
//int IOMode = PIO_POSIX_NONB;
void modelRun ()
{
......@@ -131,22 +132,20 @@ void modelRun ()
int main (int argc, char *argv[])
{
int sizeGlob, rankGlob;
#ifdef USE_MPI
MPI_Comm commGlob, commModel;
int sizeGlob;
xmpi ( MPI_Init ( &argc, &argv));
xmpi ( MPI_Comm_dup ( MPI_COMM_WORLD, &commGlob ));
xmpi ( MPI_Comm_set_errhandler ( commGlob, MPI_ERRORS_RETURN ));
xmpi ( MPI_Comm_size ( commGlob, &sizeGlob ));
xmpi ( MPI_Comm_rank ( commGlob, &rankGlob ));
xmpi ( MPI_Comm_size ( commGlob, &sizeGlob ));
if ( nProcsIO <=0 || nProcsIO >= sizeGlob )
if ( nProcsIO <= 0 || nProcsIO >= sizeGlob )
xabort ( "bad distribution of tasks on PEs" );
commModel = pioInit_c ( commGlob, nProcsIO, IOModus );
commModel = pioInit_c ( commGlob, nProcsIO, IOMode );
#endif
modelRun ();
......
......@@ -203,7 +203,8 @@ extern "C" {
#define PIO_POSIX_FPGUARD_THREAD_REFUSE 5
#define PIO_POSIX_FPGUARD_THREAD 6
#define PIO_MAX_IOMODUS PIO_POSIX_FPGUARD_SENDRECV
#define PIO_MAXIOMODUS PIO_POSIX_FPGUARD_SENDRECV
#define PIO_MINIOMODUSWITHSPECIALPROCS PIO_POSIX_NONB
//#define TEST_LOCAL 0
// set to 1 if running compareResourceArray with one PE
......
......@@ -1073,7 +1073,7 @@ int fileOpen(const char *filename, const char *mode)
/* begin deike */
#ifdef USE_MPI
if ( memcmp ( mode, "w", 1 ) == 0 && commInqIOModus () != PIO_NONE )
if ( memcmp ( mode, "w", 1 ) == 0 && commInqIOMode () != PIO_NONE )
return pioFileOpenW ( filename );
#endif
/* end deike */
......@@ -1169,7 +1169,7 @@ int fileClose(int fileID)
/* begin deike */
#ifdef USE_MPI
if ( commInqIOModus () != PIO_NONE )
if ( commInqIOMode () != PIO_NONE )
return pioFileClose ( fileID );
#endif
......
......@@ -80,7 +80,7 @@ size_t pioFileWrite ( int fileID, int tsID, const void *buffer, size_t len )
{
size_t iret = CDI_UNDEFID;
switch ( commInqIOModus ())
switch ( commInqIOMode ())
{
case PIO_MPI_NONB:
iret = fwMPINONB ( fileID, tsID, buffer, len );
......@@ -118,7 +118,7 @@ size_t pioFileWrite ( int fileID, int tsID, const void *buffer, size_t len )
int pioFileClose ( int id )
{
int iret = CDI_UNDEFID;
switch ( commInqIOModus ())
switch ( commInqIOMode ())
{
case PIO_MPI_NONB:
iret = fcMPINONB ( id );
......@@ -156,7 +156,7 @@ int pioFileOpenW ( const char *filename )
{
int iret = CDI_UNDEFID;
switch ( commInqIOModus ())
switch ( commInqIOMode ())
{
case PIO_MPI_NONB:
iret = fowMPINONB ( filename );
......@@ -193,19 +193,22 @@ int pioFileOpenW ( const char *filename )
void backendInit ( void )
{
int IOModus = commInqIOModus ();
int IOMode = commInqIOMode ();
#ifdef USE_MPI
commDefCommNode ();
if (( IOModus == PIO_NONE ) && ( commInqSizeNode () != 1 ))
if ( IOMode == PIO_NONE && commInqSizeNode () != 1 )
xabort ( "PIOTYPE, NNODES: not a valid combination" );
switch ( IOModus )
switch ( IOMode )
{
case PIO_NONE:
commDefCommColl ( 1 );
commSendNodeInfo ();
commRecvNodeMap ();
commDefCommsIO ();
break;
case PIO_MPI_NONB:
initMPINONB ();
......
This diff is collapsed.
......@@ -18,7 +18,9 @@ typedef struct {
} nodeInfo_t;
typedef struct {
int IOModus;
int IOMode;
int maxIOMode;
int minIOModeWithSpecialProcs;
int nProcsIO;
int nProcsModel;
int isProcIO;
......@@ -44,8 +46,6 @@ typedef struct {
int rankColl;
MPI_Comm commCalc;
int sizeCalc;
int rankCalc;
MPI_Comm * commsIO;
int nProcsColl;
......@@ -55,8 +55,7 @@ typedef struct {
enum { MAXNPROCSIO = 256,
MAXCOMMIONAME = 12,
MAXIOMODUS = PIO_POSIX_FPGUARD_SENDRECV};
MAXCOMMIONAME = 12 };
enum { sizeNodeInfo = 3,
NODEINFO = 1111,
......@@ -73,8 +72,8 @@ int commInqRankGlob ( void );
void commDefNProcsIO ( int );
int commInqNProcsIO ( void );
int commInqNProcsModel ( void );
void commDefIOModus ( int );
int commInqIOModus ( void );
void commDefIOMode ( int, int, int );
int commInqIOMode ( void );
void commDefCommPio ( void );
MPI_Comm commInqCommPio ( void );
......
......@@ -25,7 +25,6 @@ double ** winBuffer = NULL;
double ** winBufferHead = NULL;
MPI_Win * win = NULL;
int * winPostSet = NULL;
int * winFirstWrite = NULL;
MPI_Group * groupsIO = NULL;
MPI_Group * groupsIONetto = NULL;
......@@ -40,7 +39,6 @@ int pioInit ( int comm, int nIOP, int mode )
}
/*****************************************************************************/
/**
@brief initializes the MPI_Communicators needed for the
communication between the calculator PEs and the I/O PEs and within the
......@@ -62,24 +60,24 @@ int pioInit ( int comm, int nIOP, int mode )
*/
#ifdef USE_MPI
MPI_Comm pioInit_c ( MPI_Comm commGlob, int nIOP, int IOModus )
MPI_Comm pioInit_c ( MPI_Comm commGlob, int nIOP, int IOMode )
{
if ( IOModus < PIO_NONE || IOModus > PIO_MAX_IOMODUS )
if ( IOMode < PIO_NONE || IOMode > PIO_MAXIOMODUS )
xabort ( "PIOTYPE is no valid modus" );
#ifdef _SX
if ( IOModus == PIO_POSIX_ASYNCH )
if ( IOMode == PIO_POSIX_ASYNCH )
xabort ( "PIO_POSIX_ASYNCH does not work on SX" );
#endif
commInit ();
commDefCommGlob ( commGlob );
commDefNProcsIO ( nIOP );
commDefIOModus ( IOModus );
commDefCommPio ();
commDefIOMode ( IOMode, PIO_MAXIOMODUS, PIO_MINIOMODUSWITHSPECIALPROCS );
commDefCommPio ();
if ( commInqIsProcIO ())
{
{
IOServer ();
commDestroy ();
MPI_Finalize ();
......@@ -382,7 +380,6 @@ void modelWinCleanup ( void )
}
if ( groupsIONetto ) free ( groupsIONetto );
if ( winFirstWrite ) free ( winFirstWrite );
if ( winPostSet ) free ( winPostSet );
if ( win ) free ( win );
if ( winBufferHead ) free ( winBufferHead );
......@@ -452,7 +449,6 @@ void modelWinCreate ( void )
winBufferHead = xmalloc ( nProcsColl * sizeof ( winBufferHead[0] ));
win = xmalloc ( nProcsColl * sizeof ( win[0] ));
winPostSet = xmalloc ( nProcsColl * sizeof ( winPostSet[0] ));
winFirstWrite = xmalloc ( nProcsColl * sizeof ( winFirstWrite[0] ));
groupsIONetto = xmalloc ( nProcsColl * sizeof ( groupsIONetto[0] ));
getWinBufferSizes ();
......@@ -467,7 +463,6 @@ void modelWinCreate ( void )
MPI_INFO_NULL, &winBuffer[collID] ));
assert ( winBuffer[collID] != NULL );
winBufferHead[collID] = winBuffer[collID];
winFirstWrite[collID] = 1;
xmpi ( MPI_Win_create ( winBuffer[collID],
( MPI_Aint ) winBufferSize[collID] *
sizeof ( double ), sizeof ( double ),
......@@ -539,7 +534,7 @@ void pioEndDef ( void )
xmpi ( MPI_Send ( buffer, bufferSize, MPI_PACKED, commInqNProcsModel (),
RESOURCES, commInqCommsIO ( rankGlob )));
xdebug ( "sent message metadata" );
xdebug ( "sent message RESOURCES" );
reshPackBufferDestroy ( &buffer );
}
......@@ -596,6 +591,13 @@ void pioWriteTimestep ( int ts, int vdate, int vtime )
buffer[0] = ts;
buffer[1] = vdate;
buffer[2] = vtime;
if ( rankGlob < nProcsColl )
{
xmpi ( MPI_Send ( &buffer[0], timestepSize, MPI_INTEGER, nProcsModel,
WRITETS, commInqCommsIO ( rankGlob )));
xdebug ( "sent message WRITETS" );
}
for ( collID = 0; collID < nProcsColl; collID++ )
{
......@@ -604,14 +606,6 @@ void pioWriteTimestep ( int ts, int vdate, int vtime )
xmpi ( MPI_Win_post ( groupsIONetto[collID], iAssert, win[collID] ));
winPostSet[collID] = 1;
winBufferHead[collID] = winBuffer[collID];
winFirstWrite[collID] = 1;
}
if ( rankGlob < nProcsColl )
{
xmpi ( MPI_Send ( &buffer[0], timestepSize, MPI_INTEGER, nProcsModel,
WRITETS, commInqCommsIO ( rankGlob )));
xdebug ( "sent message WRITETS" );
}
#endif
}
......
......@@ -108,6 +108,8 @@ static
MPI_Group groupCalc;
int nProcsModel = commInqNProcsModel ();
int sizeModelGroup;
xmpi ( MPI_Win_create ( MPI_BOTTOM, 0, sizeof ( double ), MPI_INFO_NULL,
commCalc, &win ));
......@@ -116,6 +118,8 @@ static
xmpi ( MPI_Comm_group ( commCalc, &groupCalc ));
xmpi ( MPI_Group_excl ( groupCalc, 1, ranks, &groupModel ));
xmpi ( MPI_Group_size ( groupModel, &sizeModelGroup ));
/* first shot with fixed getBuffers */
getBufferSize = xmalloc ( nProcsModel * sizeof ( getBufferSize[0] ));
getGetBufferSize ();
......@@ -212,11 +216,10 @@ void getData ( int tsID, int vdate, int vtime )
vdate >= 0 &&
vtime >= 0 );
xmpi ( MPI_Win_start ( groupModel, iAssert, win ));
xmpi ( MPI_Win_start ( groupModel, iAssert, win ));
for ( i = 0; i < nProcsModel; i++ )
xmpi ( MPI_Get ( &getBuffer[i][0], getBufferSize[i], MPI_DOUBLE,
i, 0, getBufferSize[i], MPI_DOUBLE, win ));
xmpi ( MPI_Win_complete ( win ));
if ( ddebug > 2 )
......@@ -302,9 +305,9 @@ void IOServer ()
iBuffer = xmalloc ( size * sizeof ( int ));
xmpi ( MPI_Recv ( iBuffer, size, MPI_INTEGER, source,
tag, commCalc, &status ));
xdebug ("command WRITETS, recved: tsID=%d, vdate=%d, vtime=%d",
iBuffer[0], iBuffer[1], iBuffer[2] );
getData ( iBuffer[0], iBuffer[1], iBuffer[2] );
xdebug ("command WRITETS, recved: tsID=%d, vdate=%d, vtime=%d, source=%d",
iBuffer[0], iBuffer[1], iBuffer[2], source );
getData ( iBuffer[0], iBuffer[1], iBuffer[2] );
free ( iBuffer );
break;
......
......@@ -1584,8 +1584,7 @@ void streamWriteVar(int streamID, int varID, const double *data, int nmiss)
#ifdef USE_MPI
if ( ! namespaceHasLocalFile ( namespaceGetActive ()))
{
if ( commInqIOModus () != PIO_NONE )
pioBuffer ( streamID, varID, data, nmiss );
pioBuffer ( streamID, varID, data, nmiss );
return;
}
#endif
......
......@@ -576,7 +576,7 @@ int grbWriteVarSliceDP(int streamID, int varID, int levelID, const double *data,
/* begin deike */
#ifndef NOMPI
if ( commInqIOModus () != PIO_NONE )
if ( commInqIOMode () != PIO_NONE )
nwrite = pioFileWrite ( fileID, tsID, gribbuffer, nbytes );
else
nwrite = fileWrite(fileID, gribbuffer, nbytes);
......
Supports Markdown
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