Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F72782142
io3.c
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Jul 17, 01:07
Size
690 B
Mime Type
text/x-c
Expires
Fri, Jul 19, 01:07 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
19102256
Attached To
rPNBODY pNbody
io3.c
View Options
/* example of parallel MPI write into separate files */
#include "mpi.h"
#include <stdio.h>
#define BUFSIZE 100
int
main
(
int
argc
,
char
*
argv
[])
{
int
i
,
myrank
,
buf
[
BUFSIZE
];
char
filename
[
128
];
MPI_File
myfile
;
MPI_Init
(
&
argc
,
&
argv
);
MPI_Comm_rank
(
MPI_COMM_WORLD
,
&
myrank
);
for
(
i
=
0
;
i
<
BUFSIZE
;
i
++
)
buf
[
i
]
=
myrank
*
BUFSIZE
+
i
;
sprintf
(
filename
,
"testfile.%d"
,
myrank
);
MPI_File_open
(
MPI_COMM_SELF
,
filename
,
MPI_MODE_WRONLY
|
MPI_MODE_CREATE
,
MPI_INFO_NULL
,
&
myfile
);
MPI_File_write
(
myfile
,
buf
,
BUFSIZE
,
MPI_INT
,
MPI_STATUS_IGNORE
);
MPI_File_close
(
&
myfile
);
MPI_Finalize
();
return
0
;
}
Event Timeline
Log In to Comment