Skip to content

Commit 9efede3

Browse files
committed
Add a compression test and minor print info changes
1 parent bceffde commit 9efede3

5 files changed

Lines changed: 90 additions & 14 deletions

File tree

src/h5_async_vol.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,7 @@ func_log(const char *func, const char *name)
10071007
}
10081008

10091009
static inline void
1010-
func_log_str(const char *func, const char *name, char *str)
1010+
func_log_str(const char *func, const char *name, const char *str)
10111011
{
10121012
#ifdef ENABLE_DBG_MSG
10131013
const char *type = "ASYNC VOL";
@@ -2219,9 +2219,10 @@ get_n_running_task_in_queue_nolock(async_task_t *task, const char *call_func)
22192219
}
22202220

22212221
#ifdef ENABLE_DBG_MSG
2222-
if (async_instance_g && (async_instance_g->mpi_rank == ASYNC_DBG_MSG_RANK || -1 == ASYNC_DBG_MSG_RANK))
2223-
fprintf(fout_g, " [ASYNC VOL DBG] %s, pool size %lu, called by [%s]\n", __func__, pool_size,
2224-
call_func);
2222+
if (async_instance_g && (async_instance_g->mpi_rank == ASYNC_DBG_MSG_RANK || -1 == ASYNC_DBG_MSG_RANK)) {
2223+
func_log_int1(__func__, "pool size", (int)pool_size);
2224+
func_log_str(__func__, "called by", call_func);
2225+
}
22252226
#endif
22262227

22272228
return pool_size;
@@ -2285,9 +2286,10 @@ get_n_running_task_in_queue(async_task_t *task, const char *call_func)
22852286
}
22862287

22872288
#ifdef ENABLE_DBG_MSG
2288-
if (async_instance_g && (async_instance_g->mpi_rank == ASYNC_DBG_MSG_RANK || -1 == ASYNC_DBG_MSG_RANK))
2289-
fprintf(fout_g, " [ASYNC VOL DBG] %s, pool size %lu, called by [%s]\n", __func__, pool_size,
2290-
call_func);
2289+
if (async_instance_g && (async_instance_g->mpi_rank == ASYNC_DBG_MSG_RANK || -1 == ASYNC_DBG_MSG_RANK)) {
2290+
func_log_int1(__func__, "pool size", (int)pool_size);
2291+
func_log_str(__func__, "called by", call_func);
2292+
}
22912293
#endif
22922294

22932295
return pool_size;
@@ -2346,7 +2348,8 @@ get_n_running_task_in_queue_obj(H5VL_async_t *async_obj, const char *call_func)
23462348
return -1;
23472349
}
23482350
#ifdef ENABLE_DBG_MSG
2349-
fprintf(fout_g, " [ASYNC VOL DBG] %s, pool size %lu, called by [%s]\n", __func__, pool_size, call_func);
2351+
func_log_int1(__func__, "pool size", (int)pool_size);
2352+
func_log_str(__func__, "called by", call_func);
23502353
#endif
23512354

23522355
return pool_size;
@@ -2381,7 +2384,7 @@ H5VL_async_task_wait(async_task_t *async_task)
23812384

23822385
#ifdef ENABLE_DBG_MSG
23832386
if (async_instance_g && (async_instance_g->mpi_rank == ASYNC_DBG_MSG_RANK || -1 == ASYNC_DBG_MSG_RANK))
2384-
fprintf(fout_g, " [ASYNC VOL DBG] %s, released %u count\n", __func__, mutex_count);
2387+
func_log_int1(__func__, "release mutex count", (int)mutex_count);
23852388
#endif
23862389

23872390
if (async_task->is_done != 1)

test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ set(tests
2929
async_test_serial_event_set
3030
async_test_serial_event_set_error_stack
3131
async_test_serial_mdset
32+
async_test_compression
3233
)
3334

3435
if(MPI_FOUND)

test/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ifndef HDF5_DIR
2-
HDF5_DIR = /global/u1/h/houhun/hdf5/develop_gnu_cmake/install
2+
HDF5_DIR = /global/cfs/cdirs/m2621/perlmutter/hdf5/build.1.14.6.async/install
33
endif
44

55
ifndef ABT_DIR
6-
ABT_DIR = /global/u1/h/houhun/cori/argobots/install_gnu
6+
ABT_DIR = /global/u1/h/houhun/hdf5vol/vol-async/argobots/install
77
endif
88

99
ifndef ASYNC_DIR
10-
ASYNC_DIR = /global/homes/h/houhun/hdf5vol/vol-async/src
10+
ASYNC_DIR = ../src
1111
endif
1212

1313
STATLIB = libasynchdf5.a
@@ -35,7 +35,7 @@ LDFLAGS = $(DEBUG) -L$(ASYNC_DIR) -L$(ABT_DIR)/$(ABT_LIBDIR) -L$(HDF5_DIR)/$(HDF
3535
SRC = async_test_serial.c async_test_serial2.c async_test_multifile.c async_test_multifile_env.c async_test_serial_mdset.c \
3636
async_test_serial_event_set.c async_test_serial_event_set_error_stack.c \
3737
async_test_parallel.c async_test_parallel2.c async_test_parallel3.c async_test_parallel4.c async_test_parallel5.c \
38-
async_test_parallel_merge.c
38+
async_test_parallel_merge.c async_test_compression.c
3939

4040
OBJ = $(SRC:.c=.o)
4141
EXE = $(SRC:.c=.exe)

test/async_test_compression.c

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#include <hdf5.h>
2+
#include <stdio.h>
3+
4+
#define DIM0 10
5+
#define DIM1 10
6+
7+
int main() {
8+
hid_t fid, dspace, dset, dcpl, es_id;
9+
hsize_t dims[2];
10+
int ret, data[DIM0][DIM1];
11+
herr_t status;
12+
hbool_t op_failed;
13+
size_t num_in_progress;
14+
15+
for (int i = 0; i < DIM0; i++)
16+
for (int j = 0; j < DIM1; j++)
17+
data[i][j] = i * j;
18+
19+
es_id = H5EScreate();
20+
21+
fid = H5Fcreate_async("async_compressed_dset.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT, es_id);
22+
if (fid < 0) {
23+
fprintf(stderr, "Error with file create\n");
24+
ret = -1;
25+
goto done;
26+
}
27+
28+
dims[0] = DIM0;
29+
dims[1] = DIM1;
30+
dspace = H5Screate_simple(2, dims, NULL);
31+
32+
dcpl = H5Pcreate(H5P_DATASET_CREATE);
33+
H5Pset_chunk(dcpl, 2, dims);
34+
H5Pset_deflate(dcpl, 9);
35+
36+
dset = H5Dcreate_async(fid, "compress_dset", H5T_NATIVE_INT, dspace, H5P_DEFAULT, dcpl, H5P_DEFAULT, es_id);
37+
if (dset < 0) {
38+
fprintf(stderr, "Error with dset create\n");
39+
ret = -1;
40+
goto done;
41+
}
42+
43+
status = H5Dwrite_async(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data, es_id);
44+
if (status < 0) {
45+
fprintf(stderr, "Error with dset write\n");
46+
ret = -1;
47+
goto done;
48+
}
49+
50+
H5Pclose(dcpl);
51+
H5Sclose(dspace);
52+
H5Dclose_async(dset, es_id);
53+
H5Fclose_async(fid, es_id);
54+
55+
printf("Wait for async\n");
56+
fflush(stdout);
57+
58+
status = H5ESwait(es_id, H5ES_WAIT_FOREVER, &num_in_progress, &op_failed);
59+
if (status < 0) {
60+
fprintf(stderr, "Error with H5ESwait\n");
61+
ret = -1;
62+
goto done;
63+
}
64+
65+
printf("Wait done\n");
66+
fflush(stdout);
67+
68+
H5ESclose(es_id);
69+
70+
done:
71+
return ret;
72+
}

test/pytest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def main_test(mpi_tasks=0, cpu_allocation="", run_parallel=False, verbose=False)
5454
num_pass=0
5555
num_fail=0
5656

57-
serial_cases = ['async_test_serial.exe', 'async_test_serial2.exe', 'async_test_multifile.exe', 'async_test_serial_event_set.exe', 'async_test_serial_event_set_error_stack.exe', 'async_test_serial_mdset.exe']
57+
serial_cases = ['async_test_serial.exe', 'async_test_serial2.exe', 'async_test_multifile.exe', 'async_test_serial_event_set.exe', 'async_test_serial_event_set_error_stack.exe', 'async_test_serial_mdset.exe', 'async_test_compression.exe']
5858
parallel_cases = ['async_test_parallel.exe', 'async_test_parallel2.exe', 'async_test_parallel3.exe', 'async_test_parallel4.exe', 'async_test_parallel5.exe', 'async_test_parallel_merge.exe']
5959

6060
print("Running serial tests")

0 commit comments

Comments
 (0)