Commit b694013a authored by Deike Kleberg's avatar Deike Kleberg
Browse files

Test program collectData.c runs in serial mode.

parent eafdd31f
......@@ -2,6 +2,8 @@ noinst_PROGRAMS=myModel
if USE_MPI
noinst_PROGRAMS+=pio_write myModel2003 compareResourcesArray collectData
else
noinst_PROGRAMS+=collectData
endif
AM_CFLAGS=-I$(top_srcdir)/src
......
......@@ -34,8 +34,9 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
noinst_PROGRAMS = myModel$(EXEEXT) $(am__EXEEXT_1)
noinst_PROGRAMS = myModel$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2)
@USE_MPI_TRUE@am__append_1 = pio_write myModel2003 compareResourcesArray collectData
@USE_MPI_FALSE@am__append_2 = collectData
subdir = pioExamples
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
......@@ -54,6 +55,7 @@ CONFIG_CLEAN_VPATH_FILES =
@USE_MPI_TRUE@am__EXEEXT_1 = pio_write$(EXEEXT) myModel2003$(EXEEXT) \
@USE_MPI_TRUE@ compareResourcesArray$(EXEEXT) \
@USE_MPI_TRUE@ collectData$(EXEEXT)
@USE_MPI_FALSE@am__EXEEXT_2 = collectData$(EXEEXT)
PROGRAMS = $(noinst_PROGRAMS)
am_collectData_OBJECTS = collectData.$(OBJEXT)
collectData_OBJECTS = $(am_collectData_OBJECTS)
......
......@@ -4,10 +4,10 @@
#ifdef USE_MPI
#include <mpi.h>
#include "pio_c_temp.h"
#endif
#include "cdi.h"
#include "pio_c_temp.h"
#include "pio_util.h"
#include <assert.h>
......@@ -76,6 +76,9 @@ void modelRun ()
pioEndDef ();
// for debugging
reshArrayPrint ( "reshArrayModel" );
for ( tsID = 0; tsID < ntsteps; tsID++ )
{
......@@ -101,11 +104,6 @@ void modelRun ()
}
#ifdef USE_MPI
if ( rank == 0 ) reshArrayPrint ( "reshArrayModel" );
#endif
streamClose ( streamID );
vlistDestroy ( vlistID );
taxisDestroy ( taxisID );
......
......@@ -69,16 +69,18 @@ namespaceTuple_t namespaceResHDecode ( int resH )
void pioNamespaceInit ( int nspn, int * argHasLocalFile )
{
#ifdef USE_MPI
int i;
assert(nspn <= NUM_NAMESPACES && nspn >= 1 );
nNamespaces = nspn;
if ( nspn >= 1 )
{
hasLocalFile = xmalloc ( nspn * sizeof ( int ));
hasLocalFile = xmalloc ( nspn * sizeof ( hasLocalFile[0] ));
for ( i = 0; i < nspn; i++ )
hasLocalFile[i] = argHasLocalFile[i];
}
#endif
}
......
......@@ -2,24 +2,21 @@
#include "config.h"
#endif
#ifdef USE_MPI
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <assert.h>
#include "pio.h"
#include "cdi.h"
#include "pio_util.h"
#ifdef USE_MPI
#include "pio_comm.h"
#include "pio_impl.h"
#endif
#ifdef USE_MPI
#include "pio_util.h"
char * command2charP[6] = {"IO_Open_file", "IO_Close_file",
"IO_Get_fp","IO_Set_fp",
......@@ -187,7 +184,6 @@ int pioFileOpenW ( const char *filename )
return iret;
}
#endif
/***************************************************************/
......@@ -195,7 +191,6 @@ void backendInit ( void )
{
int IOMode = commInqIOMode ();
#ifdef USE_MPI
commDefCommNode ();
if ( IOMode == PIO_NONE && commInqSizeNode () != 1 )
......@@ -236,14 +231,12 @@ void backendInit ( void )
initPOSIXNONB ();
break;
}
#endif
}
/***************************************************************/
void backendFinalize ( void )
{
#ifdef USE_MPI
/*
switch ( pioinfo->type )
{
......@@ -256,8 +249,8 @@ void backendFinalize ( void )
commDestroy ();
MPI_Finalize ();
exit ( 0 );
#endif
}
#endif
/*
* Local Variables:
* c-file-style: "Java"
......
......@@ -7,9 +7,11 @@
#ifdef USE_MPI
#include "mpi.h"
#else
typedef int MPI_Comm;
#endif
MPI_Comm pioInit_c ( MPI_Comm, int, int );
#endif
#endif
/*
......
......@@ -243,6 +243,15 @@ MPI_Comm commInqCommModel ( void )
}
int commInqRankPio ( void )
{
assert ( info != NULL &&
info->rankPio != CDI_UNDEFID &&
info->isProcIO == 1 );
return info->rankPio;
}
int commInqRankModel ( void )
{
assert ( info != NULL &&
......
......@@ -72,14 +72,15 @@ int commInqRankGlob ( void );
void commDefNProcsIO ( int );
int commInqNProcsIO ( void );
int commInqNProcsModel ( void );
int commInqIsProcIO ( void );
void commDefIOMode ( int, int, int );
int commInqIOMode ( void );
void commDefCommPio ( void );
MPI_Comm commInqCommPio ( void );
MPI_Comm commInqCommModel ( void );
int commInqRankPio ( void );
int commInqRankModel ( void );
int commInqIsProcIO ( void );
void commDefCommNode ( void );
MPI_Comm commInqCommNode ( void );
......
......@@ -26,73 +26,10 @@ MPI_Win * win = NULL;
int * winPostSet = NULL;
MPI_Group * groupsIO = NULL;
MPI_Group * groupsIONetto = NULL;
#endif
/*****************************************************************************/
int pioInit ( int comm, int nIOP, int mode )
{
#ifdef USE_MPI
#endif
return 0;
}
/*****************************************************************************/
/**
@brief initializes the MPI_Communicators needed for the
communication between the calculator PEs and the I/O PEs and within the
group of I/O PEs.
commGlob: all PEs
commPIO: I/O PEs, PEs with highest ranks in commGlob
commModel: calculating PEs, no I/O PEs
commsIO[i]:
Collective call
@param comm MPI_Communicator of all calling PEs
@param nIOP number of I/O PEs
@return int indicating wether the calling PE is a calcutator (1) or not (0)
*/
#ifdef USE_MPI
MPI_Comm pioInit_c ( MPI_Comm commGlob, int nIOP, int IOMode )
{
if ( IOMode < PIO_NONE || IOMode > PIO_MAXIOMODUS )
xabort ( "PIOTYPE is no valid modus" );
#ifdef _SX
if ( IOMode == PIO_POSIX_ASYNCH )
xabort ( "PIO_POSIX_ASYNCH does not work on SX" );
#endif
commInit ();
commDefCommGlob ( commGlob );
commDefNProcsIO ( nIOP );
commDefIOMode ( IOMode, PIO_MAXIOMODUS, PIO_MINIOMODUSWITHSPECIALPROCS );
commDefCommPio ();
if ( commInqIsProcIO ())
{
IOServer ();
commDestroy ();
MPI_Finalize ();
exit ( 0 );
}
else
{
commEvalPhysNodes ();
commDefCommsIO ();
}
return commInqCommModel ();
}
#endif
/************************************************************************/
int cmp ( const void * va, const void * vb )
......@@ -182,8 +119,7 @@ in order of vSizes
@return
*/
#ifdef USE_MPI
void varMapGen ( int * vSizes, int * sSizes, int * varMapping,
int nStreams, int * nodeSizes, int nNodes )
{
......@@ -274,11 +210,9 @@ void varMapGen ( int * vSizes, int * sSizes, int * varMapping,
xprintArray ( "buckets", buckets, nProcsColl, DATATYPE_INT );
}
}
#endif
/************************************************************************/
#ifdef USE_MPI
void defVarDeco ( int vlistID, int varID )
{
int varSize, cRank, lChunk, rem, lOffset;
......@@ -307,7 +241,6 @@ void defVarDeco ( int vlistID, int varID )
vlistDefVarDeco ( vlistID, varID, nProcsModel, &deco[0] );
}
#endif
/************************************************************************/
......@@ -318,8 +251,6 @@ void varsMapNDeco ( int nNodes, int * nodeSizes )
int nStreams, nVars, * resHs, * streamSizes, * varSizes, * varMapping;
int i, j, k = 0;
#ifdef USE_MPI
nStreams = streamSize ();
resHs = xmalloc ( nStreams * sizeof ( int ));
......@@ -358,8 +289,6 @@ void varsMapNDeco ( int nNodes, int * nodeSizes )
if ( varSizes ) free ( varSizes );
if ( streamSizes ) free ( streamSizes );
if ( resHs ) free ( resHs );
#endif
}
/************************************************************************/
......@@ -367,7 +296,6 @@ void varsMapNDeco ( int nNodes, int * nodeSizes )
static
void modelWinCleanup ( void )
{
#ifdef USE_MPI
int collID;
for ( collID = 0; collID < commInqNProcsColl (); collID ++ )
......@@ -387,7 +315,6 @@ void modelWinCleanup ( void )
if ( winBufferSize ) free ( winBufferSize );
xdebug ( "cleaned up mpi_win's" );
#endif
}
/************************************************************************/
......@@ -395,8 +322,6 @@ void modelWinCleanup ( void )
static
void getWinBufferSizes ( void )
{
#ifdef USE_MPI
int collID, nstreams, * streamIndexArray, streamNo, vlistID, nvars, varID;
int collIDchunk = 0;
int nProcsColl = commInqNProcsColl ();
......@@ -427,9 +352,6 @@ static
assert ( winBufferSize[collID] < winBufferSizeMax );
}
xprintArray ( "winBufferSize", winBufferSize, nProcsColl, DATATYPE_INT );
return;
#endif
}
/************************************************************************/
......@@ -438,8 +360,6 @@ static
static
void modelWinCreate ( void )
{
#ifdef USE_MPI
int collID, ranks[1];
int nProcsColl = commInqNProcsColl ();
......@@ -472,8 +392,6 @@ void modelWinCreate ( void )
&groupsIONetto[collID] ));
}
xdebug ( "created mpi_win's" );
#endif
}
/************************************************************************/
......@@ -514,6 +432,72 @@ void pioBuffer ( int streamID, int varID, const double *data, int nmiss )
winBufferHead[collID]++;
}
#endif
/*****************************************************************************/
int pioInit ( int comm, int nIOP, int mode )
{
#ifdef USE_MPI
#endif
return 0;
}
/*****************************************************************************/
/**
@brief initializes the MPI_Communicators needed for the
communication between the calculator PEs and the I/O PEs and within the
group of I/O PEs.
commGlob: all PEs
commPIO: I/O PEs, PEs with highest ranks in commGlob
commModel: calculating PEs, no I/O PEs
commsIO[i]:
Collective call
@param comm MPI_Communicator of all calling PEs
@param nIOP number of I/O PEs
@return int indicating wether the calling PE is a calcutator (1) or not (0)
*/
#ifdef USE_MPI
MPI_Comm pioInit_c ( MPI_Comm commGlob, int nIOP, int IOMode )
{
if ( IOMode < PIO_NONE || IOMode > PIO_MAXIOMODUS )
xabort ( "PIOTYPE is no valid modus" );
#ifdef _SX
if ( IOMode == PIO_POSIX_ASYNCH )
xabort ( "PIO_POSIX_ASYNCH does not work on SX" );
#endif
commInit ();
commDefCommGlob ( commGlob );
commDefNProcsIO ( nIOP );
commDefIOMode ( IOMode, PIO_MAXIOMODUS, PIO_MINIOMODUSWITHSPECIALPROCS );
commDefCommPio ();
if ( commInqIsProcIO ())
{
IOServer ();
commDestroy ();
MPI_Finalize ();
exit ( 0 );
}
else
{
commEvalPhysNodes ();
commDefCommsIO ();
}
return commInqCommModel ();
}
#endif
/************************************************************************/
void pioEndDef ( void )
......
......@@ -7,6 +7,7 @@
#include <assert.h>
#include "resource_handle.h"
#include "pio_comm.h"
#include "pio_util.h"
#include "namespace.h"
#include "cdi.h"
......@@ -630,6 +631,18 @@ void reshArrayPrint ( char * filename )
if ( ! arrayInit ) return;
#ifdef USE_MPI
{
int root = 0;
if ( commInqIsProcIO () == 0 )
{
if ( commInqRankModel () != root ) return;
}
else if ( commInqRankPio () != root ) return;
}
#endif
if ( filename )
{
fp = fopen ( filename, "w" );
......
......@@ -575,7 +575,7 @@ int grbWriteVarSliceDP(int streamID, int varID, int levelID, const double *data,
/* begin deike */
#ifndef NOMPI
#ifdef USE_MPI
if ( commInqIOMode () != PIO_NONE )
nwrite = pioFileWrite ( fileID, tsID, gribbuffer, nbytes );
else
......
......@@ -1801,7 +1801,7 @@ int vlistInqVarDecoOff ( int vlistID, int varID )
if ( deco[i].rank == rankModel ) iret = deco[i].offset;
}
#else
iret = vlistInqVarSize ( vlistID, varID );
iret = 0;
#endif
assert ( iret != CDI_UNDEFID );
......
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