Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multi-threaded H5VL operations #7

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
444a986
Support API tests with autotools
mattjala Nov 12, 2024
054bf12
Support parallel execution of API tests
mattjala Nov 12, 2024
1fabd29
Integrate API tests with framework
mattjala Nov 12, 2024
417737c
Add testmthdf with MT VL tests
mattjala Nov 12, 2024
9a69086
Disable free list check when multithread enabled
mattjala Oct 22, 2024
618e3eb
Implement MT Native Wrapper VOL
mattjala Nov 12, 2024
1d1854e
Implement MT passthru wrapper VOL
mattjala Nov 12, 2024
e80d8be
Make registration of optional VOL ops locally threadsafe
mattjala Nov 12, 2024
04336f9
Make H5VL object ref counts atomic
mattjala Nov 12, 2024
4e1ec36
Add additional const qualifiers for connector info
mattjala Nov 12, 2024
ae7de28
Treat global VOL IDs in multi-threadsafe manner
mattjala Nov 12, 2024
8fd993c
Implement threadsafe search for existing connector
mattjala Nov 12, 2024
43ad06e
File open threadsafety
mattjala Nov 12, 2024
caab99e
Properly initialize atomic variables
mattjala Nov 12, 2024
88c6e79
Acquire global lock duirng dyn ops/H5T routines
mattjala Nov 12, 2024
c2875c0
Fix app ref count error
mattjala Nov 12, 2024
af02315
Acquire global lock on entry to non threadsafe VOL
mattjala Nov 12, 2024
5a78e84
Refcount VOL wrap context atomically
mattjala Sep 25, 2024
29adc33
Initialize properly when H5VL_NATIVE used early
mattjala Sep 26, 2024
3b445ea
Fix API context lib state copy
mattjala Nov 12, 2024
fa26e60
Check arguments in get_wrap_ctx()
mattjala Sep 30, 2024
fb97a90
Free vol obj memory if creation fails
mattjala Nov 12, 2024
373e5fc
Check VOL obj rc during free in threadsafe manner
mattjala Nov 12, 2024
75373bc
Remove global mutex from VOL API calls
mattjala Nov 12, 2024
5a38874
Remove global mutex from H5VL.c
mattjala Nov 12, 2024
5cb8f35
Adding missing locks around ID releases
mattjala Nov 12, 2024
42e2722
Guard ID iteration in connector search
mattjala Nov 12, 2024
bc8e136
Remove global lock from passthrough VOL callbacks
mattjala Nov 13, 2024
5d63e09
Fix deadlock due to bad exit macro
mattjala Nov 13, 2024
2837e61
Skip file open fail test for non-native VOLs
mattjala Nov 13, 2024
c488fe2
Add test workflow
mattjala Nov 13, 2024
fcb7c2a
Modify README to allow version parsing
mattjala Nov 13, 2024
1a58367
Test single/multi thread in CI
mattjala Nov 14, 2024
73b6a36
Remove unnecessary includes from MT wrapper VOLs
mattjala Nov 14, 2024
1bab9a0
Remove unnecessary test use of dyn op registration VOL
mattjala Nov 14, 2024
83f7cb4
Clarify autotools helper macro
mattjala Nov 18, 2024
3f05a46
Move atomic type specification into macros
mattjala Nov 18, 2024
c599c85
Add Makefile.am to thread test subdirs
mattjala Nov 18, 2024
5748722
Add TestFrameworkFlags param to AddTest
mattjala Nov 18, 2024
2d124c5
Rework testframe to use framework flags
mattjala Nov 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 103 additions & 0 deletions .github/workflows/multithread_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Build and Test Multithreaded HDF5 Library

on:
push:
branches:
- '*'

env:
HDF5TestExpress: 1

jobs:
build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
api_tests: ["--enable-api-tests", "--disable-api-tests"]
multi_thread: ["--enable-multithread --disable-hl", "--disable-multithread --enable-threadsafe --disable-hl", "--disable-multithread --disable-threadsafe"]
build_mode: ["production", "debug"]
fail-fast: false

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up autotools
run: |
sudo apt install automake autoconf libtool libtool-bin
sudo apt install libaec0 libaec-dev valgrind

- name: Configure HDF5
working-directory: ${{github.workspace}}
run: |
sh ./autogen.sh
./configure --enable-shared --enable-tests ${{ matrix.multi_thread }} ${{ matrix.api_tests }} --enable-build-mode=${{ matrix.build_mode }}

- name: Build HDF5
working-directory: ${{github.workspace}}
run: |
make -j

- name: API Tests - Native (Single thread)
if: matrix.api_tests == '--enable-api-tests'
working-directory: ${{github.workspace}}
run: |
valgrind ./test/API/api_tests -maxthreads 1

- name: API Tests (Multi thread)
if: matrix.api_tests == '--enable-api-tests' && matrix.multi_thread == '--enable-multithread --disable-hl'
working-directory: ${{github.workspace}}
run: |
valgrind ./test/API/api_tests -maxthreads 16

- name: API Tests - MT Native Wrapper (Single thread)
if: matrix.api_tests == '--enable-api-tests' && matrix.multi_thread == '--enable-multithread --disable-hl'
working-directory: ${{github.workspace}}
env:
HDF5_PLUGIN_PATH: ${{github.workspace}}/test/.libs
HDF5_VOL_CONNECTOR: "mt_native_wrapper_vol_connector"
run: |
valgrind ./test/API/api_tests -maxthreads 1

- name: API Tests - MT Native Wrapper (Multi thread)
if: matrix.api_tests == '--enable-api-tests' && matrix.multi_thread == '--enable-multithread --disable-hl'
working-directory: ${{github.workspace}}
env:
HDF5_PLUGIN_PATH: ${{github.workspace}}/test/.libs
HDF5_VOL_CONNECTOR: "mt_native_wrapper_vol_connector"
run: |
valgrind ./test/API/api_tests -maxthreads 16

- name: API Tests - MT Passthru Wrapper (Single thread)
if: matrix.api_tests == '--enable-api-tests' && matrix.multi_thread == '--enable-multithread --disable-hl'
working-directory: ${{github.workspace}}
env:
HDF5_PLUGIN_PATH: ${{github.workspace}}/test/.libs
HDF5_VOL_CONNECTOR: "mt_passthru_wrapper_vol_connector under_vol=0\\;under_info={}"
run: |
valgrind ./test/API/api_tests -maxthreads 1

- name: API Tests - MT Passthru Wrapper (Multi thread)
if: matrix.api_tests == '--enable-api-tests' && matrix.multi_thread == '--enable-multithread --disable-hl'
working-directory: ${{github.workspace}}
env:
HDF5_PLUGIN_PATH: ${{github.workspace}}/test/.libs
HDF5_VOL_CONNECTOR: "mt_passthru_wrapper_vol_connector under_vol=0\\;under_info={}"
run: |
valgrind ./test/API/api_tests -maxthreads 16

- name: MT VL Tests (Single thread)
working-directory: ${{github.workspace}}/test/
run: |
valgrind ./threads/testmthdf5 -maxthreads 1

- name: MT VL Tests (Multi thread)
if: matrix.multi_thread == '--enable-multithread --disable-hl'
working-directory: ${{github.workspace}}/test/
run: |
valgrind ./threads/testmthdf5 -maxthreads 16

- name: Other HDF5 Tests
working-directory: ${{github.workspace}}
run: |
make check
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
HDF5 version 1.14.2 released on 2023-08-11
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already below past the dashed-line separator

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of the h5repack tests parses the current version of HDF5 from the third word in the README file and breaks if this is moved.


# Experimental

This branch contains modified source code of HDF5 r1.14.2. The code will be used to
Expand Down
68 changes: 67 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,14 @@ AC_ARG_ENABLE([warnings-as-errors],
])],
[WARNINGS_AS_ERRORS=$enableval])

## ----------------------------------------------------------------------
## Check if we should build the HDF5 API tests
AC_ARG_ENABLE([api-tests],
AS_HELP_STRING([--enable-api-tests], [Enable building of API tests]),
[enable_api_tests=$enableval], [enable_api_tests=no])



## Set default
if test "X-$WARNINGS_AS_ERRORS" = X- ; then
WARNINGS_AS_ERRORS=no
Expand Down Expand Up @@ -1655,6 +1663,60 @@ if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes" -a "x$HAVE_COMPRESS2"
EXTERNAL_FILTERS="${EXTERNAL_FILTERS}deflate(zlib)"
fi

## TODO - Probably this should be reworked or moved somewhere else

# If the provided name corresponds to a non-empty variable,
# create a macro with the given name and value.
# If the provided name does not exist, create a macro with the
# default value if one was provided, otherwise undefine the macro.
m4_define([EXPORT_VARIABLE],
[if test -n "$$1"; then
AC_SUBST([$1], ["#define $1 $$1"])
else
if test -n "$2"; then
AC_SUBST([$1], ["#define $1 $2"])
else
AC_SUBST([$1], ["/*undef $1 */"])
fi
fi]
)

EXPORT_VARIABLE([H5_API_TEST_CONFIG_H], ["1"])

# TODO: These flags are copied from a CMake equivalent H5_api_test_config.h.in
# and I haven't verified that the autotools define them
EXPORT_VARIABLE([H5_API_TEST_HAVE_ASYNC], [])
if test -n "$H5_HAVE_PARALLEL"; then
EXPORT_VARIABLE([MPIEXEC_EXECUTABLE], [])
EXPORT_VARIABLE([MPIEXEC], [])

EXPORT_VARIABLE(MPIEXEC_NUMPROC_FLAG, [])
EXPORT_VARIABLE(MPIEXEC_PREFLAGS, [])
EXPORT_VARIABLE(MPIEXEC_POSTFLAGS, [])

EXPORT_VARIABLE(MPIEXEC_SERVER_PREFLAGS, [])
EXPORT_VARIABLE(MPIEXEC_SERVER_POSTFLAGS, [])
EXPORT_VARIABLE(MPIEXEC_MAX_NUMPROCS, [])
fi

EXPORT_VARIABLE([DART_TESTING_TIMEOUT], ["1500"])


EXPORT_VARIABLE([H5_API_TEST_ENV_VARS], [])
EXPORT_VARIABLE([H5_API_TEST_INIT_COMMAND], [])

EXPORT_VARIABLE([H5_API_TEST_SERVER_START_MSG], [])
EXPORT_VARIABLE([H5_API_TEST_SERVER_EXIT_COMMAND], [])

EXPORT_VARIABLE([H5_API_TEST_CLIENT_HELPER_START_MSG], [])
EXPORT_VARIABLE([H5_API_TEST_CLIENT_HELPER_EXIT_COMMAND], [])

EXPORT_VARIABLE([H5_API_TEST_CLIENT_INIT_TOKEN_REGEX], [])
EXPORT_VARIABLE([H5_API_TEST_CLIENT_INIT_TOKEN_VAR], [])





## ----------------------------------------------------------------------
## Is the szlib present? It has a header file `szlib.h' and a library
Expand Down Expand Up @@ -4159,7 +4221,7 @@ AM_CONDITIONAL([BUILD_TESTS_PARALLEL_CONDITIONAL], [test -n "$TESTPARALLEL"])
AM_CONDITIONAL([BUILD_TOOLS_CONDITIONAL], [test "X$HDF5_TOOLS" = "Xyes"])
AM_CONDITIONAL([BUILD_TOOLS_HL_GIF_CONDITIONAL], [test "X$HDF5_HL_GIF_TOOLS" = "Xyes"])
AM_CONDITIONAL([BUILD_DOXYGEN_CONDITIONAL], [test "X$HDF5_DOXYGEN" = "Xyes"])

AM_CONDITIONAL([BUILD_API_TESTS], [test "x$enable_api_tests" = "xyes"])
## ----------------------------------------------------------------------
## Build the Makefiles.
##
Expand Down Expand Up @@ -4281,6 +4343,10 @@ AC_CONFIG_FILES([Makefile
test/test_use_cases.sh
test/test_vds_env.sh
test/test_vds_swmr.sh
test/threads/Makefile
test/threads/unit/Makefile
test/API/Makefile
test/API/H5_api_test_config.h:test/API/H5_api_test_config_at.h.in
testpar/Makefile
testpar/testpflush.sh
utils/Makefile
Expand Down
Loading