Skip to content

Commit

Permalink
Merge pull request #38 from HDFGroup/feature/vfd_swmr
Browse files Browse the repository at this point in the history
Feature/vfd swmr
  • Loading branch information
vchoi-hdfgroup authored Aug 27, 2021
2 parents 0a4ee89 + 0aa6a8d commit d134859
Show file tree
Hide file tree
Showing 8 changed files with 3,027 additions and 41 deletions.
1 change: 1 addition & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -1420,6 +1420,7 @@
./test/vfd_swmr_common.h
./test/vfd_swmr_generator.c
./test/vfd_swmr_group_writer.c
./test/vfd_swmr_gperf_writer.c
./test/vfd_swmr_reader.c
./test/vfd_swmr_remove_reader.c
./test/vfd_swmr_remove_writer.c
Expand Down
3 changes: 3 additions & 0 deletions test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT) \
vfd_swmr_group_reader$(EXEEXT) vfd_swmr_group_writer$(EXEEXT) \
vfd_swmr_vlstr_reader$(EXEEXT) vfd_swmr_vlstr_writer$(EXEEXT) \
vfd_swmr_zoo_reader$(EXEEXT) vfd_swmr_zoo_writer$(EXEEXT) \
vfd_swmr_gperf_reader$(EXEEXT) vfd_swmr_gperf_writer$(EXEEXT) \
vds_env$(EXEEXT) \
vds_swmr_gen$(EXEEXT) vds_swmr_reader$(EXEEXT) vds_swmr_writer$(EXEEXT)
if HAVE_SHARED_CONDITIONAL
Expand Down Expand Up @@ -111,6 +112,7 @@ check_PROGRAMS=$(TEST_PROG) error_test err_compat tcheck_version \
vfd_swmr_vlstr_reader vfd_swmr_vlstr_writer \
vfd_swmr_zoo_reader vfd_swmr_zoo_writer \
vfd_swmr_attrdset_reader vfd_swmr_attrdset_writer \
vfd_swmr_gperf_reader vfd_swmr_gperf_writer \
vfd_swmr_check_compat \
vfd_swmr_dsetchks_reader vfd_swmr_dsetchks_writer \
swmr_check_compat_vfd vds_env vds_swmr_gen vds_swmr_reader vds_swmr_writer \
Expand Down Expand Up @@ -178,6 +180,7 @@ vfd_swmr_zoo_reader_SOURCES=vfd_swmr_zoo_writer.c genall5.c

vfd_swmr_bigset_reader_SOURCES=vfd_swmr_bigset_writer.c
vfd_swmr_group_reader_SOURCES=vfd_swmr_group_writer.c
vfd_swmr_gperf_reader_SOURCES=vfd_swmr_gperf_writer.c
vfd_swmr_dsetops_reader_SOURCES=vfd_swmr_dsetops_writer.c

vfd_swmr_attrdset_writer_SOURCES=vfd_swmr_attrdset_writer.c
Expand Down
28 changes: 14 additions & 14 deletions test/testvfdswmr.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -1021,21 +1021,21 @@ done
#
#
GROUP_seg_n=1000000 # Number of groups when segmentation fault occurs
if [ ${do_os_groups_seg:-no} = no ]; then
continue
fi
echo launch vfd_swmr_group operations with old-style group: $GROUP_seg_n groups ......may take some time......
catch_out_err_and_rc vfd_swmr_group_writer \
../vfd_swmr_group_writer -q -N -G -n $GROUP_seg_n -a $GROUP_seg_n

# Collect exit code of the writer
if [ $(cat vfd_swmr_group_writer.rc) -ne 0 ]; then
echo writer had error
nerrors=$((nerrors + 1))
fi
#
if [ ${do_os_groups_seg:-no} != no ]; then
echo launch vfd_swmr_group operations with old-style group: $GROUP_seg_n groups ......may take some time......
catch_out_err_and_rc vfd_swmr_group_writer \
../vfd_swmr_group_writer -q -N -G -n $GROUP_seg_n -a $GROUP_seg_n

# Collect exit code of the writer
if [ $(cat vfd_swmr_group_writer.rc) -ne 0 ]; then
echo writer had error
nerrors=$((nerrors + 1))
fi

# Clean up output files
rm -f vfd_swmr_group_writer.{out,rc}
# Clean up output files
rm -f vfd_swmr_group_writer.{out,rc}
fi

###############################################################################
#
Expand Down
33 changes: 12 additions & 21 deletions test/vfd_swmr_attrdset_writer.c
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,6 @@ perform_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *c
unsigned step;
bool result;
unsigned dd;
bool ret = true;

for (step = 0; step < s->asteps; step++) {
dbgf(2, "Adding attribute %d\n", step);
Expand Down Expand Up @@ -1507,11 +1506,11 @@ verify_add_or_modify_attr(unsigned action, hid_t did, char *attr_name, unsigned
unsigned int read_which;
unsigned int tmp_val;
char tmp_vl_val[sizeof("attr-9999999999")];
char * read_vl_which = NULL;
bool is_vl = false;
hid_t aid = H5I_INVALID_HID;
hid_t atid = H5I_INVALID_HID;
bool ret = FALSE;
char * read_vl_which;
bool is_vl = false;
hid_t aid = H5I_INVALID_HID;
hid_t atid = H5I_INVALID_HID;
bool ret = FALSE;

HDassert(did != badhid);
HDassert(action == ADD_ATTR || action == MODIFY_ATTR);
Expand All @@ -1531,11 +1530,6 @@ verify_add_or_modify_attr(unsigned action, hid_t did, char *attr_name, unsigned
HDsprintf(tmp_vl_val, "%u", which);
else
HDsprintf(tmp_vl_val, "%u %c", which, 'M');

if ((read_vl_which = HDmalloc(sizeof("9999999999"))) == NULL) {
HDprintf("HDmalloc failed\n");
TEST_ERROR;
}
}
else {
if (action == MODIFY_ATTR)
Expand All @@ -1544,7 +1538,7 @@ verify_add_or_modify_attr(unsigned action, hid_t did, char *attr_name, unsigned
tmp_val = which;
}

if (H5Aread(aid, atid, is_vl ? (void *)&read_vl_which : (void *)&read_which) < 0) {
if (H5Aread(aid, atid, is_vl ? &read_vl_which : (void *)&read_which) < 0) {
HDprintf("H5Aread failed\n");
TEST_ERROR;
}
Expand All @@ -1569,8 +1563,8 @@ verify_add_or_modify_attr(unsigned action, hid_t did, char *attr_name, unsigned
ret = (read_which == tmp_val);
}

if (read_vl_which)
HDfree(read_vl_which);
if (is_vl)
H5free_memory(read_vl_which);

return ret;

Expand All @@ -1582,8 +1576,8 @@ verify_add_or_modify_attr(unsigned action, hid_t did, char *attr_name, unsigned
}
H5E_END_TRY;

if (read_vl_which)
HDfree(read_vl_which);
if (is_vl)
H5free_memory(read_vl_which);

return false;

Expand Down Expand Up @@ -1960,17 +1954,14 @@ np_reader_no_verification(const state_t *s, np_state_t *np, H5F_vfd_swmr_config_
int
main(int argc, char **argv)
{
hid_t fapl = H5I_INVALID_HID;
hid_t fcpl = H5I_INVALID_HID;
unsigned step;
hid_t fapl = H5I_INVALID_HID;
hid_t fcpl = H5I_INVALID_HID;
bool writer = FALSE;
state_t s;
const char * personality;
H5F_vfd_swmr_config_t config;
np_state_t np;
dsets_state_t ds;
unsigned dd;
bool result;

if (!state_init(&s, argc, argv)) {
HDprintf("state_init() failed\n");
Expand Down
13 changes: 9 additions & 4 deletions test/vfd_swmr_bigset_writer.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,10 @@ newmat(unsigned rows, unsigned cols)
{
mat_t *mat;

mat = malloc(sizeof(*mat) + (rows * cols - 1) * sizeof(mat->elt[0]));
mat = HDmalloc(sizeof(*mat) + (rows * cols - 1) * sizeof(mat->elt[0]));

if (mat == NULL)
err(EXIT_FAILURE, "%s: malloc", __func__);
err(EXIT_FAILURE, "%s: HDmalloc", __func__);

mat->rows = rows;
mat->cols = cols;
Expand Down Expand Up @@ -463,11 +463,11 @@ state_init(state_t *s, int argc, char **argv)
if ((s->one_by_one_sid = H5Screate_simple(1, &dims, &dims)) < 0)
errx(EXIT_FAILURE, "H5Screate_simple failed");

s->dataset = malloc(sizeof(*s->dataset) * s->ndatasets);
s->dataset = HDmalloc(sizeof(*s->dataset) * s->ndatasets);
if (s->dataset == NULL)
err(EXIT_FAILURE, "could not allocate dataset handles");

s->sources = malloc(sizeof(*s->sources) * s->ndatasets);
s->sources = HDmalloc(sizeof(*s->sources) * s->ndatasets);
if (s->sources == NULL)
err(EXIT_FAILURE, "could not allocate quadrant dataset handles");

Expand Down Expand Up @@ -1174,6 +1174,11 @@ main(int argc, char **argv)

free(mat);

if (s.dataset)
HDfree(s.dataset);
if (s.sources)
HDfree(s.sources);

return EXIT_SUCCESS;
}

Expand Down
Loading

0 comments on commit d134859

Please sign in to comment.