Skip to content

Commit 4ca376c

Browse files
Update test to use HDF5 async APIs (#54)
* Fix return value * Committing clang-format changes * Update makefile * Change test codes to use explicit async API * Committing clang-format changes --------- Co-authored-by: github-actions <github-actions[bot]@users.noreply.github.com>
1 parent 7453e70 commit 4ca376c

4 files changed

Lines changed: 291 additions & 184 deletions

File tree

test/async_test_multifile.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include <sys/time.h>
44
#include <unistd.h>
55
#include "hdf5.h"
6-
#include "h5_async_lib.h"
76

87
/* #define DIMLEN 10 */
98
#define DIMLEN 1024
@@ -13,7 +12,7 @@ int print_dbg_msg = 1;
1312
int
1413
main(int argc, char *argv[])
1514
{
16-
hid_t file_id, grp_id, dset1_id, dset0_id, dspace_id, async_dxpl, attr_space, attr0, attr1;
15+
hid_t file_id, grp_id, dset1_id, dset0_id, dspace_id, dxpl, attr_space, attr0, attr1;
1716
struct timeval t0;
1817
struct timeval t1;
1918
struct timeval t2;
@@ -27,7 +26,7 @@ main(int argc, char *argv[])
2726
int * write_data, attr_data0, attr_data1;
2827
int i, ret = 0;
2928
herr_t status;
30-
hid_t async_fapl;
29+
hid_t fapl;
3130
hbool_t op_failed;
3231
size_t num_in_progress;
3332
hid_t es_id = H5EScreate();
@@ -48,9 +47,8 @@ main(int argc, char *argv[])
4847
dspace_id = H5Screate_simple(2, ds_size, NULL);
4948
attr_space = H5Screate_simple(1, &attr_size, NULL);
5049

51-
async_fapl = H5Pcreate(H5P_FILE_ACCESS);
52-
async_dxpl = H5Pcreate(H5P_DATASET_XFER);
53-
/* H5Pset_vol_async(async_fapl); */
50+
fapl = H5Pcreate(H5P_FILE_ACCESS);
51+
dxpl = H5Pcreate(H5P_DATASET_XFER);
5452

5553
gettimeofday(&ts, 0);
5654
for (ifile = 0; ifile < nfile; ifile++) {
@@ -74,7 +72,7 @@ main(int argc, char *argv[])
7472

7573
gettimeofday(&t0, 0);
7674
snprintf(file_name, sizeof(file_name), "%s/test_%d.h5", fpath, ifile);
77-
file_id = H5Fcreate_async(file_name, H5F_ACC_TRUNC, H5P_DEFAULT, async_fapl, es_id);
75+
file_id = H5Fcreate_async(file_name, H5F_ACC_TRUNC, H5P_DEFAULT, fapl, es_id);
7876
if (file_id < 0) {
7977
fprintf(stderr, "Error with file create\n");
8078
ret = -1;
@@ -131,7 +129,7 @@ main(int argc, char *argv[])
131129

132130
gettimeofday(&t3, 0);
133131

134-
status = H5Dwrite_async(dset0_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, async_dxpl, write_data, es_id);
132+
status = H5Dwrite_async(dset0_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, write_data, es_id);
135133
if (status < 0) {
136134
fprintf(stderr, "Error with dset 0 write\n");
137135
ret = -1;
@@ -145,7 +143,7 @@ main(int argc, char *argv[])
145143
/* for(i = 0; i < DIMLEN*DIMLEN; ++i) */
146144
/* write_data[i] *= -1; */
147145

148-
status = H5Dwrite_async(dset1_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, async_dxpl, write_data, es_id);
146+
status = H5Dwrite_async(dset1_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, write_data, es_id);
149147
if (status < 0) {
150148
fprintf(stderr, "Error with dset 0 write\n");
151149
ret = -1;
@@ -176,8 +174,8 @@ main(int argc, char *argv[])
176174

177175
H5Sclose(dspace_id);
178176
H5Sclose(attr_space);
179-
H5Pclose(async_fapl);
180-
H5Pclose(async_dxpl);
177+
H5Pclose(fapl);
178+
H5Pclose(dxpl);
181179

182180
if (print_dbg_msg)
183181
printf("H5ESwait start\n");

0 commit comments

Comments
 (0)