Skip to content

Commit

Permalink
Merge pull request #9 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 Apr 30, 2021
2 parents 49600e5 + 4042f4c commit 67c7503
Show file tree
Hide file tree
Showing 3 changed files with 2,947 additions and 237 deletions.
155 changes: 151 additions & 4 deletions test/testvfdswmr.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,20 @@ fi
BIGSET_n=25 # -n option: # of iterations
BIGSET_few_s=20 # -s option: # of datasets (for few_big test)
BIGSET_many_s=500 # -s option: # of datasets (for many_small test)
GROUP_n=100 # -n option: # of groups (for vfd_swmr_group_writer.c)
GROUP_n=40 # -n option: # of groups (for group test)
GROUP_attr_n=1 # -n option: # of groups (for group attribute test)

if [[ "$HDF5TestExpress" -eq 0 ]] ; then # Setting for exhaustive run
BIGSET_n=50
BIGSET_few_s=40
BIGSET_many_s=1000
GROUP_n=400
GROUP_attr_n=4
elif [[ "$HDF5TestExpress" -gt 1 ]]; then # Setting for quick run
BIGSET_n=10
BIGSET_few_s=10
BIGSET_many_s=100
GROUP_n=40
GROUP_n=20
fi

###############################################################################
Expand Down Expand Up @@ -153,7 +156,7 @@ if [ $rc -ne 0 ] ; then
fi

all_tests="generator expand shrink expand_shrink sparse vlstr_null vlstr_oob zoo groups attrdset"
all_tests="${all_tests} few_big many_small"
all_tests="${all_tests} groups_attrs os_groups_attrs few_big many_small"
tests=${all_tests}

if [ $# -gt 0 ]; then
Expand Down Expand Up @@ -668,7 +671,7 @@ for options in "-p -g -a 10 -v -m -d 10 -c 3 -u 5" "-k -a 20 -v -m -d 5"; do
done

#
# Make sure that we can create GROUP_n groups (40, 100, or 400 depending on the HDF5TestExpress level)
# Make sure that we can create GROUP_n groups (20, 40, or 400 depending on the HDF5TestExpress level)
# while a reader waits for each to appear.
#
if [ ${do_groups:-no} = yes ]; then
Expand Down Expand Up @@ -705,6 +708,150 @@ if [ ${do_groups:-no} = yes ]; then
rm -f vfd_swmr_group_reader.*.{out,rc}
fi

# The group attribute test takes longer.
# So for standard run and quick run, we
# shorten the number of tests. The standard
# run covers all the features we need to
# test. The quick run doesn't cover the
# attribute storage change between dense and
# compact.
# The exhaustive run tries to test a feature
# per test from scratch.
#
grp_attr_list=(
"compact"
"dense"
"compact-del"
"dense-del"
"compact-add-to-dense"
"dense-del-to-compact"
"modify"
"add-vstr"
"remove-vstr"
"modify-vstr"
)
grp_sub_attr_list=(
"dense-del-to-compact"
"modify"
"remove-vstr"
"modify-vstr"
)

grp_short_sub_attr_list=(
"dense"
"modify"
"remove-vstr"
"modify-vstr"
)

if [[ "$HDF5TestExpress" -eq 1 ]] ; then #Setting for standard run
grp_attr_list=("${grp_sub_attr_list[@]}")
elif [[ "$HDF5TestExpress" -gt 1 ]] ; then #Setting for quick run
grp_attr_list=("${grp_short_sub_attr_list[@]}")
fi

for options in ${grp_attr_list[*]}; do
if [ ${do_groups_attrs:-no} = no ]; then
continue
fi
echo launch vfd_swmr_group attribute: $options
catch_out_err_and_rc vfd_swmr_group_writer \
../vfd_swmr_group_writer -q -c 1 -n $GROUP_attr_n -a 1 -A $options &
pid_writer=$!

catch_out_err_and_rc vfd_swmr_group_reader \
../vfd_swmr_group_reader -q -c 1 -n $GROUP_attr_n -a 1 -A $options &
pid_reader=$!

# Wait for the reader to finish before signalling the
# writer to quit: the writer holds the file open so that the
# reader will find the shadow file when it opens
# the .h5 file.
wait $pid_reader
wait $pid_writer

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

# 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}
rm -f vfd_swmr_group_reader.*.{out,rc}
done

# The following tests are for add/del/modify attributes for
# groups created with the old-style.
# Check https://portal.hdfgroup.org/display/HDF5/Groups for
# the detailed group implementation note.
# The 'compact' and 'compact-del' are the attribute addition
# and deletion tests. Other test names have the same meaning
# as those of the new-style group tests.
#
os_grp_attr_list=(
"compact"
"compact-del"
"modify"
"add-vstr"
"remove-vstr"
"modify-vstr"
)
os_grp_sub_attr_list=(
"modify"
"remove-vstr"
"modify-vstr"
)
if [[ "$HDF5TestExpress" -gt 0 ]] ; then #Setting for standard run
os_grp_attr_list=("${os_grp_sub_attr_list[@]}")
fi

for options in ${os_grp_attr_list[*]}; do
if [ ${do_os_groups_attrs:-no} = no ]; then
continue
fi
echo launch vfd_swmr_group attribute with old-style group: $options
catch_out_err_and_rc vfd_swmr_group_writer \
../vfd_swmr_group_writer -q -G -c 1 -n $GROUP_attr_n -a 1 -A $options &
pid_writer=$!

catch_out_err_and_rc vfd_swmr_group_reader \
../vfd_swmr_group_reader -q -G -c 1 -n $GROUP_attr_n -a 1 -A $options &
pid_reader=$!

# Wait for the reader to finish before signalling the
# writer to quit: the writer holds the file open so that the
# reader will find the shadow file when it opens
# the .h5 file.
wait $pid_reader
wait $pid_writer

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

# 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}
rm -f vfd_swmr_group_reader.*.{out,rc}
done




for options in "-d 1" "-d 1 -F" "-d 2" "-d 2 -F" "-d 1 -V" "-d 1 -M" "-d 1 -V -F" "-d 1 -M -F"; do
if [ ${do_many_small:-no} = no ]; then
continue
Expand Down
4 changes: 4 additions & 0 deletions test/vfd_swmr_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,10 @@ vfd_swmr_create_fapl(bool use_latest_format, bool use_vfd_swmr, bool only_meta_p
if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
return H5I_INVALID_HID;
}
else {/* Currently this is used only for old-styled group implementation tests.*/
if (H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0)
return H5I_INVALID_HID;
}

/* Enable page buffering */
if (H5Pset_page_buffer_size(fapl, 4096, only_meta_pages ? 100 : 0, 0) < 0)
Expand Down
Loading

0 comments on commit 67c7503

Please sign in to comment.