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
2f346079
Commit
2f346079
authored
Dec 02, 2014
by
Thomas Jahns
🤸
Browse files
Refactor elicitation of accumulation buffer size.
parent
fd06280e
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/pio.c
View file @
2f346079
...
...
@@ -28,12 +28,6 @@ const char *const cdiPioCmdStrTab[] = {
"IO_Finalize"
};
long
initial_buffersize
=
16
*
1024
*
1024
;
/* 4 KB <= x < 256 MB */
/* 16 * 1024 * 1024; */
/* 16 * 1024; */
/* 4 * 1024; */
char
*
token
=
"%"
;
/***************************************************************/
...
...
src/pio_impl.h
View file @
2f346079
...
...
@@ -23,6 +23,20 @@ enum IO_Server_command
extern
const
char
*
const
cdiPioCmdStrTab
[];
static
inline
size_t
findWriteAccumBufsize
()
{
unsigned
long
initial_buffersize
=
16UL
*
1024UL
*
1024UL
;
const
char
*
p
=
getenv
(
"BUFSIZE"
);
long
temp
=
p
?
atol
(
p
)
:
-
1
;
unsigned
long
buffersize
=
(
temp
>
0
&&
(
unsigned
long
)
temp
>
initial_buffersize
)
?
(
unsigned
long
)
temp
:
initial_buffersize
;
return
buffersize
;
}
struct
dBuffer
{
size_t
wr_pointer
;
...
...
src/pio_mpinonb.c
View file @
2f346079
...
...
@@ -15,8 +15,6 @@
#include
"pio_impl.h"
#include
"pio_util.h"
extern
long
initial_buffersize
;
typedef
struct
{
size_t
size
;
...
...
@@ -217,8 +215,6 @@ size_t fwMPINONB ( int fileID, int tsID, const void *buffer, size_t len )
int
fcMPINONB
(
int
fileID
)
{
aFiledataM
*
of
;
int
iret
;
MPI_Comm
commNode
=
commInqCommNode
();
int
rankNode
=
commInqRankNode
();
xdebug
(
"IOPE%d: write buffer, close file and cleanup, in %d"
,
...
...
@@ -249,27 +245,21 @@ elemCheck(void *q, void *nm)
int
fowMPINONB
(
const
char
*
filename
)
{
static
aFiledataM
*
of
;
static
long
buffersize
=
0
;
int
id
,
bcastRank
=
0
;
static
unsigned
long
buffersize
=
0
;
int
id
;
enum
{
bcastRoot
=
0
};
MPI_Comm
commNode
=
commInqCommNode
();
int
rankNode
=
commInqRankNode
();
/* broadcast buffersize to collectors ( just once, for all files )*/
if
(
!
buffersize
)
if
(
!
buffersize
)
{
xdebug
(
"IOPE%d: Broadcast buffersize to collectors ..."
,
rankNode
);
if
(
rankNode
==
bcastRank
)
{
if
(
getenv
(
"BUFSIZE"
)
!=
NULL
)
buffersize
=
atol
(
getenv
(
"BUFSIZE"
));
if
(
buffersize
<
initial_buffersize
)
buffersize
=
initial_buffersize
;
}
xmpi
(
MPI_Bcast
(
&
buffersize
,
1
,
MPI_LONG
,
bcastRank
,
commNode
));
if
(
rankNode
==
bcastRoot
)
buffersize
=
findWriteAccumBufsize
();
xmpi
(
MPI_Bcast
(
&
buffersize
,
1
,
MPI_UNSIGNED_LONG
,
bcastRoot
,
commNode
));
}
xdebug
(
"buffersize=%ld"
,
buffersize
);
...
...
src/pio_posixfpguardsendrecv.c
View file @
2f346079
...
...
@@ -21,8 +21,6 @@
#include
"pio_util.h"
#include
"dmemory.h"
extern
long
initial_buffersize
;
typedef
struct
{
struct
dBuffer
*
db1
;
...
...
@@ -454,23 +452,20 @@ elemCheck(void *q, void *nm)
int
fowPOSIXFPGUARDSENDRECV
(
const
char
*
filename
)
{
int
root
=
0
,
id
;
int
id
;
enum
{
bcastRoot
=
0
};
aFiledataPF
*
afd
;
static
long
buffersize
=
0
;
static
unsigned
long
buffersize
=
0
;
/* broadcast buffersize to collectors */
if
(
!
buffersize
)
{
if
(
commInqRankColl
()
==
root
)
{
xdebug
(
"name=%s, broadcast buffersize to collectors ..."
,
filename
);
if
(
getenv
(
"BUFSIZE"
)
!=
NULL
)
buffersize
=
atol
(
getenv
(
"BUFSIZE"
));
if
(
buffersize
<
initial_buffersize
)
buffersize
=
initial_buffersize
;
}
xmpi
(
MPI_Bcast
(
&
buffersize
,
1
,
MPI_LONG
,
root
,
commInqCommColl
()));
if
(
commInqRankColl
()
==
bcastRoot
)
buffersize
=
findWriteAccumBufsize
();
xmpi
(
MPI_Bcast
(
&
buffersize
,
1
,
MPI_UNSIGNED_LONG
,
bcastRoot
,
commInqCommColl
()));
}
/* init and add file element */
...
...
src/pio_record_send.c
View file @
2f346079
...
...
@@ -12,7 +12,6 @@
#include
"dmemory.h"
extern
char
*
token
;
extern
long
initial_buffersize
;
typedef
struct
{
...
...
@@ -221,9 +220,10 @@ int
pioSendOpen
(
const
char
*
filename
)
{
remoteFileBuf
*
afd
;
static
long
buffersize
=
0
;
int
root
=
0
,
id
,
iret
;
static
unsigned
long
buffersize
=
0
;
int
id
,
iret
;
enum
{
bcastRoot
=
0
,
messageLength
=
32
,
};
char
message
[
messageLength
];
...
...
@@ -232,16 +232,10 @@ pioSendOpen(const char *filename)
/* broadcast buffersize to collectors */
if
(
!
buffersize
)
{
if
(
commInqRankColl
()
==
root
)
{
if
(
getenv
(
"BUFSIZE"
)
!=
NULL
)
buffersize
=
atol
(
getenv
(
"BUFSIZE"
));
if
(
buffersize
<
initial_buffersize
)
buffersize
=
initial_buffersize
;
xdebug
(
"filename=%s, broadcast buffersize=%ld to collectors ..."
,
filename
,
buffersize
);
}
xmpi
(
MPI_Bcast
(
&
buffersize
,
1
,
MPI_LONG
,
root
,
commCollectors
));
if
(
commInqRankColl
()
==
bcastRoot
)
buffersize
=
findWriteAccumBufsize
();
xmpi
(
MPI_Bcast
(
&
buffersize
,
1
,
MPI_UNSIGNED_LONG
,
bcastRoot
,
commCollectors
));
}
/* init and add remoteFileBuf */
...
...
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