Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
b331cdeb
Commit
b331cdeb
authored
Oct 21, 2011
by
Deike Kleberg
Browse files
Narrow interface.
parent
1226401a
Changes
13
Hide whitespace changes
Inline
Side-by-side
pioExamples/collectData.c
View file @
b331cdeb
...
...
@@ -11,21 +11,22 @@
#include
"pio_util.h"
enum
{
nProcsIO
=
1
,
IOMode
=
PIO_NONE
,
//IOMode = PIO_MPI_NONB,
//IOMode = PIO_POSIX_FPGUARD_SENDRECV,
//IOMode = PIO_POSIX_ASYNCH,
//IOMode = PIO_POSIX_NONB,
filetype
=
FILETYPE_GRB
,
ntfiles
=
2
,
ntsteps
=
3
,
nVars
=
5
,
nlon
=
12
,
nlat
=
6
,
maxlev
=
5
};
static
int
hasLocalFile
[]
=
{
0
};
nProcsIO
=
3
,
//IOMode = PIO_NONE,
//IOMode = PIO_MPI_NONB,
//IOMode = PIO_POSIX_FPGUARD_SENDRECV,
//IOMode = PIO_POSIX_ASYNCH,
IOMode
=
PIO_POSIX_NONB
,
nNamespaces
=
1
,
filetype
=
FILETYPE_GRB
,
ntfiles
=
2
,
ntsteps
=
3
,
nVars
=
5
,
nlon
=
12
,
nlat
=
6
,
maxlev
=
5
};
static
int
hasLocalFile
[
nNamespaces
]
=
{
0
};
static
int
nlev
[
nVars
]
=
{
1
,
1
,
5
,
5
,
2
};
static
char
*
name
=
"example"
;
...
...
@@ -43,8 +44,6 @@ void modelRun ()
int
start
=
CDI_UNDEFID
,
chunk
=
CDI_UNDEFID
,
stop
=
CDI_UNDEFID
;
char
filename
[
1024
];
pioNamespaceInit
(
1
,
hasLocalFile
);
gridID
=
gridCreate
(
GRID_LONLAT
,
nlon
*
nlat
);
gridDefXsize
(
gridID
,
nlon
);
gridDefYsize
(
gridID
,
nlat
);
...
...
@@ -105,9 +104,7 @@ void modelRun ()
taxisDestroy
(
taxisID
);
for
(
i
=
0
;
i
<
nVars
;
i
++
)
zaxisDestroy
(
zaxisID
[
i
]
);
gridDestroy
(
gridID
);
pioNamespaceCleanup
();
gridDestroy
(
gridID
);
}
...
...
@@ -118,14 +115,12 @@ int main (int argc, char *argv[])
int
sizeGlob
;
int
rankDebug
;
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
,
&
rankDebug
));
commModel
=
pioInit_c
(
commGlob
,
nProcsIO
,
IOMode
);
commModel
=
pioInit_c
(
commGlob
,
nProcsIO
,
IOMode
,
nNamespaces
,
hasLocalFile
);
#endif
modelRun
();
...
...
pioExamples/compareResourcesArray.c
View file @
b331cdeb
...
...
@@ -17,13 +17,14 @@ extern void arrayDestroy ( void );
enum
{
IOMode
=
PIO_NONE
,
nProcsIO
=
1
,
nNamespaces
=
2
,
DOUBLE_PRECISION
=
8
,
nlon
=
12
,
nlat
=
6
,
nlev
=
5
,
ntsteps
=
3
};
static
int
hasLocalFile
[]
=
{
0
,
0
};
static
int
hasLocalFile
[
nNamespaces
]
=
{
0
,
0
};
double
lons
[
nlon
]
=
{
0
,
30
,
60
,
90
,
120
,
150
,
180
,
210
,
240
,
270
,
300
,
330
};
double
lats
[
nlat
]
=
{
-
75
,
-
45
,
-
15
,
15
,
45
,
75
};
...
...
@@ -182,8 +183,6 @@ void modelRun ( MPI_Comm comm )
int
bufferSize
,
differ
;
MPI_Status
status
;
pioNamespaceInit
(
2
,
hasLocalFile
);
pioNamespaceSetActive
(
0
);
gridID
=
defineGrid
();
...
...
@@ -213,7 +212,6 @@ void modelRun ( MPI_Comm comm )
pioNamespaceSetActive
(
0
);
streamClose
(
streamID
);
pioNamespaceCleanup
();
return
;
}
...
...
@@ -236,7 +234,7 @@ int main (int argc, char *argv[])
if
(
nProcsIO
!=
1
)
xabort
(
"bad distribution of tasks on PEs"
);
commModel
=
pioInit_c
(
commGlob
,
nProcsIO
,
IOMode
);
commModel
=
pioInit_c
(
commGlob
,
nProcsIO
,
IOMode
,
nNamespaces
,
hasLocalFile
);
modelRun
(
commModel
);
...
...
pioExamples/myModel.c
View file @
b331cdeb
...
...
@@ -77,7 +77,6 @@ void modelRun ()
int
rank
;
#ifdef USE_MPI
pioNamespaceInit
(
2
,
hlf
);
pioNamespaceSetActive
(
0
);
#endif
...
...
@@ -220,8 +219,6 @@ void modelRun ()
zaxisDestroy
(
zaxisID1
);
zaxisDestroy
(
zaxisID2
);
gridDestroy
(
gridID
);
pioNamespaceCleanup
();
}
...
...
@@ -241,7 +238,7 @@ int main (int argc, char *argv[])
if
(
nProcsIO
<=
0
||
nProcsIO
>=
sizeGlob
)
xabort
(
"bad distribution of tasks on PEs"
);
commModel
=
pioInit_c
(
commGlob
,
nProcsIO
,
0
);
commModel
=
pioInit_c
(
commGlob
,
nProcsIO
,
0
,
2
,
hlf
);
#endif
modelRun
();
...
...
src/cdi.h
View file @
b331cdeb
...
...
@@ -206,15 +206,12 @@ extern "C" {
#define PIO_MINIOMODUSWITHSPECIALPROCS PIO_POSIX_NONB
int
pioInit
(
int
,
int
,
int
);
void
pioFinalize
(
void
);
void
pioEndDef
(
void
);
void
pioWriteTimestep
(
int
,
int
,
int
);
int
pioInqVarDecoChunk
(
int
,
int
);
int
pioInqVarDecoOff
(
int
,
int
);
void
pioNamespaceInit
(
int
,
int
*
);
void
pioNamespaceCleanup
(
void
);
int
pioInit
(
int
,
int
,
int
);
void
pioFinalize
(
void
);
void
pioEndDef
(
void
);
void
pioWriteTimestep
(
int
,
int
,
int
);
int
pioInqVarDecoChunk
(
int
,
int
);
int
pioInqVarDecoOff
(
int
,
int
);
void
pioNamespaceSetActive
(
int
);
void
gridGetIndexArray
(
int
,
int
*
);
...
...
src/cdi.inc
View file @
b331cdeb
...
...
@@ -358,14 +358,6 @@
!
INTEGER
)
EXTERNAL
pioInqVarDecoOff
!
pioNamespaceInit
!
(
INTEGER
,
!
INTEGER
)
EXTERNAL
pioNamespaceInit
!
pioNamespaceCleanup
EXTERNAL
pioNamespaceCleanup
!
pioNamespaceSetActive
!
(
INTEGER
)
EXTERNAL
pioNamespaceSetActive
...
...
src/cdiFortran.c
View file @
b331cdeb
...
...
@@ -62,8 +62,6 @@ FCALLSCSUB0 (pioEndDef, PIOENDDEF, pioenddef)
FCALLSCSUB3
(
pioWriteTimestep
,
PIOWRITETIMESTEP
,
piowritetimestep
,
INT
,
INT
,
INT
)
FCALLSCFUN2
(
INT
,
pioInqVarDecoChunk
,
PIOINQVARDECOCHUNK
,
pioinqvardecochunk
,
INT
,
INT
)
FCALLSCFUN2
(
INT
,
pioInqVarDecoOff
,
PIOINQVARDECOOFF
,
pioinqvardecooff
,
INT
,
INT
)
FCALLSCSUB2
(
pioNamespaceInit
,
PIONAMESPACEINIT
,
pionamespaceinit
,
INT
,
PINT
)
FCALLSCSUB0
(
pioNamespaceCleanup
,
PIONAMESPACECLEANUP
,
pionamespacecleanup
)
FCALLSCSUB1
(
pioNamespaceSetActive
,
PIONAMESPACESETACTIVE
,
pionamespacesetactive
,
INT
)
FCALLSCSUB2
(
gridGetIndexArray
,
GRIDGETINDEXARRAY
,
gridgetindexarray
,
INT
,
PINT
)
FCALLSCSUB2
(
streamGetIndexArray
,
STREAMGETINDEXARRAY
,
streamgetindexarray
,
INT
,
PINT
)
...
...
src/grid.h
View file @
b331cdeb
...
...
@@ -81,6 +81,8 @@ const double *gridInqAreaPtr(int gridID);
int
gridCompare
(
int
gridID
,
grid_t
grid
);
int
gridGenerate
(
grid_t
grid
);
void
gridGetIndexArray
(
int
,
int
*
);
#endif
/*
* Local Variables:
...
...
src/namespace.c
View file @
b331cdeb
...
...
@@ -68,25 +68,24 @@ namespaceTuple_t namespaceResHDecode ( int resH )
}
void
pioN
amespaceInit
(
int
nspn
,
int
*
argHasLocalFile
)
void
n
amespaceInit
(
int
nspn
,
int
*
argHasLocalFile
)
{
#ifdef USE_MPI
int
i
;
int
nspID
;
xassert
(
nspn
<=
NUM_NAMESPACES
&&
nspn
>=
1
);
nNamespaces
=
nspn
;
if
(
nspn
>=
1
)
{
hasLocalFile
=
xmalloc
(
nspn
*
sizeof
(
hasLocalFile
[
0
]
));
for
(
i
=
0
;
i
<
nspn
;
i
++
)
hasLocalFile
[
i
]
=
argHasLocalFile
[
i
];
for
(
nspID
=
0
;
nspID
<
nspn
;
nspID
++
)
hasLocalFile
[
nspID
]
=
argHasLocalFile
[
nspID
];
resASent
=
xmalloc
(
nspn
*
sizeof
(
resASent
[
0
]
));
}
#endif
}
void
pioN
amespaceCleanup
(
void
)
void
n
amespaceCleanup
(
void
)
{
if
(
nNamespaces
>
1
)
{
...
...
src/namespace.h
View file @
b331cdeb
...
...
@@ -7,7 +7,8 @@ typedef struct {
int
resASent
;
}
namespaceTuple_t
;
void
namespaceCleanup
(
void
);
void
namespaceInit
(
int
,
int
*
);
void
namespaceShowbits
(
int
,
char
*
);
int
namespaceGetNumber
(
void
);
int
namespaceGetActive
(
void
);
...
...
src/pio_c_temp.h
View file @
b331cdeb
...
...
@@ -11,7 +11,7 @@
typedef
int
MPI_Comm
;
#endif
MPI_Comm
pioInit_c
(
MPI_Comm
,
int
,
int
);
MPI_Comm
pioInit_c
(
MPI_Comm
,
int
,
int
,
int
,
int
*
);
#endif
/*
...
...
src/pio_interface.c
View file @
b331cdeb
...
...
@@ -733,7 +733,8 @@ int pioInit ( int comm, int nIOP, int mode )
*/
#ifdef USE_MPI
MPI_Comm
pioInit_c
(
MPI_Comm
commGlob
,
int
nProcsIO
,
int
IOMode
)
MPI_Comm
pioInit_c
(
MPI_Comm
commGlob
,
int
nProcsIO
,
int
IOMode
,
int
nNamespaces
,
int
*
hasLocalFile
)
{
int
sizeGlob
;
...
...
@@ -756,9 +757,13 @@ MPI_Comm pioInit_c ( MPI_Comm commGlob, int nProcsIO, int IOMode )
commDefIOMode
(
IOMode
,
PIO_MAXIOMODUS
,
PIO_MINIOMODUSWITHSPECIALPROCS
);
commDefCommPio
();
// JUST FOR TEST CASE
COMPARERESOURCEARRAY
// JUST FOR TEST CASE
S WITH ONLY ONE MPI TASK
if
(
commInqRankGlob
()
==
0
&&
commInqSizeGlob
()
==
1
)
return
commInqCommGlob
();
{
xdebug
();
namespaceInit
(
nNamespaces
,
hasLocalFile
);
return
commInqCommGlob
();
}
xassert
(
commInqNProcsModel
()
>
0
);
...
...
@@ -772,7 +777,10 @@ MPI_Comm pioInit_c ( MPI_Comm commGlob, int nProcsIO, int IOMode )
else
{
commEvalPhysNodes
();
commDefCommsIO
();
commDefCommsIO
();
xdebug
(
"nNamespaces=%d, hasLocalFile= %d, %d"
,
nNamespaces
,
hasLocalFile
[
0
],
hasLocalFile
[
1
]
);
namespaceInit
(
nNamespaces
,
hasLocalFile
);
}
return
commInqCommModel
();
...
...
@@ -789,7 +797,6 @@ void pioEndDef ( void )
int
rankGlob
=
commInqRankGlob
();
varsMapNDeco
(
commInqNNodes
(),
commInqNodeSizes
());
xdebug
();
if
(
rankGlob
<
commInqNProcsColl
())
{
...
...
@@ -826,16 +833,16 @@ void pioFinalize ()
{
#ifdef USE_MPI
int
collID
,
ibuffer
=
1111
;
namespaceCleanup
();
for
(
collID
=
0
;
collID
<
commInqNProcsColl
();
collID
++
)
{
xmpi
(
MPI_Send
(
&
ibuffer
,
1
,
MPI_INT
,
commInqNProcsModel
(),
FINALIZE
,
commInqCommsIO
(
collID
)));
xdebug
(
"SENT MESSAGE WITH TAG
\"
FINALIZE
\"
"
);
}
modelWinCleanup
();
commDestroy
();
commDestroy
();
#endif
}
...
...
src/pio_util.c
View file @
b331cdeb
...
...
@@ -23,7 +23,7 @@ void pcdiAssert ( bool assumption, const char * filename,
int
rank
;
MPI_Comm_rank
(
MPI_COMM_WORLD
,
&
rank
);
fprintf
(
stderr
,
"ERROR ASSUMPTION FALSE
, pe
%d in %s, %s, line %d
\n
"
,
fprintf
(
stderr
,
"ERROR
,
ASSUMPTION FALSE
: PE
%d in %s, %s, line %d
\n
"
,
rank
,
functionname
,
filename
,
line
);
MPI_Abort
(
MPI_COMM_WORLD
,
1
);
#else
...
...
src/varscan.c
View file @
b331cdeb
...
...
@@ -10,6 +10,7 @@
#include
"dmemory.h"
#include
"varscan.h"
#include
"vlist.h"
#include
"grid.h"
#include
"pio_util.h"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment