blob: fe39f2c976c3899da6fe0ca5b8b9b0a26d8584a2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#include <stdio.h>
#include "hdf5.h"
#include "H5FDsubfile_public.h"
#include "mpi.h"
int
main(int argc, char **argv)
{
int i, mpi_size, mpi_rank;
int loop_count = 20;
int mpi_provides, require = MPI_THREAD_MULTIPLE;
hid_t subfile_id = -1;
MPI_Init_thread(&argc, &argv, require, &mpi_provides);
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
if (argc > 1) {
int check_value = atoi(argv[1]);
if (check_value > 0) {
loop_count = check_value;
}
}
H5open();
if (H5FDsubfiling_init() == SUCCEED) {
subfile_id = get_subfiling_context();
printf("[%d] subfile_id = %lx\n", mpi_rank, subfile_id);
}
else if (mpi_rank == 0) {
puts("Error: Unable to initialize subfiling!");
}
for(i=0; i < loop_count; i++) {
sf_open_subfiles(subfile_id, NULL, O_CREAT|O_TRUNC|O_RDWR);
sf_close_subfiles(subfile_id);
}
H5FDsubfiling_finalize();
MPI_Barrier(MPI_COMM_WORLD);
H5close();
MPI_Finalize();
return 0;
}
|