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
4573f9ce
Commit
4573f9ce
authored
Jun 13, 2013
by
Thomas Jahns
🤸
Browse files
Refactor reshListPrint.
parent
92a1f01d
Changes
6
Hide whitespace changes
Inline
Side-by-side
examples/pio/compareResourcesArray.c
View file @
4573f9ce
...
...
@@ -171,7 +171,18 @@ defineModel(int instID)
modelDef
(
instID
,
0
,
"myModel"
);
}
void
modelRun
(
MPI_Comm
comm
)
static
void
printResources
()
{
FILE
*
fp
=
fopen
(
"reshArrayModel.txt"
,
"w"
);
if
(
!
fp
)
xabort
(
"%s"
,
"could not open file"
);
reshListPrint
(
fp
);
fclose
(
fp
);
}
static
void
modelRun
(
MPI_Comm
comm
)
{
int
gridID
,
zaxisID
,
taxisID
,
instID
,
vlistID
,
streamID
;
...
...
@@ -204,7 +215,7 @@ void modelRun ( MPI_Comm comm )
differ
=
reshListCompare
(
0
,
1
);
printf
(
"The resource arrays %s.
\n
"
,
differ
?
"differ"
:
"are equal"
);
reshListPrint
(
"reshArrayModel"
);
printResources
(
);
pioNamespaceSetActive
(
0
);
streamClose
(
streamID
);
...
...
src/pio_interface.c
View file @
4573f9ce
...
...
@@ -860,8 +860,6 @@ void pioEndDef ( void )
varsMapNDeco
(
commInqNNodes
(),
commInqNodeSizes
());
reshListPrint
(
"reshListModel"
);
if
(
rankGlob
<
commInqNProcsColl
())
{
MPI_Comm
comm
=
commInqCommsIO
(
rankGlob
);
...
...
src/pio_server.c
View file @
4573f9ce
...
...
@@ -928,9 +928,23 @@ void IOServer ()
reshUnpackResources
(
buffer
,
size
,
&
commCalc
);
xdebug
(
"%s"
,
""
);
free
(
buffer
);
if
(
ddebug
>
0
&&
commInqRankGlob
()
==
nProcsModel
)
reshListPrint
(
"reshListIOServer"
);
serverWinCreate
();
{
int
rankGlob
=
commInqRankGlob
();
if
(
ddebug
>
0
&&
rankGlob
==
nProcsModel
)
{
static
const
char
baseName
[]
=
"reshListIOServer."
,
suffix
[]
=
".txt"
;
/* 9 digits for rank at most */
char
buf
[
sizeof
(
baseName
)
+
9
+
sizeof
(
suffix
)
+
1
];
snprintf
(
buf
,
sizeof
(
buf
),
"%s%d%s"
,
baseName
,
rankGlob
,
suffix
);
FILE
*
fp
=
fopen
(
buf
,
"w"
);
xassert
(
fp
);
reshListPrint
(
fp
);
fclose
(
fp
);
}
}
serverWinCreate
();
break
;
case
WRITETS
:
...
...
src/pio_util.h
View file @
4573f9ce
...
...
@@ -154,9 +154,6 @@ void printArray ( const char *, char *, const void *, int, int, const char *, co
if ( ddebug == MAXDEBUG ) \
printArray ( debugString, ps, array, n, datatype, __func__, __FILE__, __LINE__ )
void
reshListPrint
(
char
*
);
#endif
/*
* Local Variables:
...
...
src/resource_handle.c
View file @
4573f9ce
...
...
@@ -588,36 +588,13 @@ int reshListCompare ( int nsp0, int nsp1 )
/**************************************************************/
void
reshListPrint
(
char
*
filename
)
void
reshListPrint
(
FILE
*
fp
)
{
int
i
,
j
,
temp
;
listElem_t
*
curr
;
FILE
*
fp
;
LIST_INIT
();
#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"
);
if
(
!
fp
)
{
xdebug
(
"%s"
,
"could not open file"
);
fp
=
stdout
;
}
}
else
fp
=
stdout
;
temp
=
namespaceGetActive
();
...
...
@@ -650,7 +627,6 @@ void reshListPrint ( char * filename )
fprintf
(
fp
,
"#
\n
# end global resource list"
\
"
\n
#
\n
##########################################
\n\n
"
);
fclose
(
fp
);;
pioNamespaceSetActive
(
temp
);
}
...
...
src/resource_handle.h
View file @
4573f9ce
...
...
@@ -56,6 +56,7 @@ int reshGetStatus ( cdiResH, resOps * );
void
reshLock
(
void
);
void
reshUnlock
(
void
);
int
reshListCompare
(
int
nsp0
,
int
nsp1
);
void
reshListPrint
(
FILE
*
fp
);
#endif
/*
...
...
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