mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-04-24 17:51:25 +08:00
Added infrastructure support for multithreaded concurrency by adding an optional way to switch to using a non-recursive R/W lock for the global API lock. This is enabled with a new 'concurrency' configuration flag for the autotools & CMake builds, which is disabled by default. When the 'concurrency' build option is chosen, the global API lock will use the R/W lock and all API calls currently will acquire a write lock, ensuring exclusive access by one thread. Over time, the API routines that are converted to support multithreaded concurrency will switch to acquiring a read lock instead. Reentering the library from application callbacks is managed by the 'disable locking for this thread' (DLFTT) threadsafety protocol. This is internally handled within the H5_API_LOCK / H5_API_UNLOCK macros in H5private.h (as before), which invoke the 'dlftt' routines in H5TSint.c. To support this change, the threadsafety configuration macros for the library have been updated: - --enable-threadsafe now defines the H5_HAVE_THREADSAFE macro - --enable-concurrency defines the H5_HAVE_CONCURRENCY macro The new H5_HAVE_THREADSAFE_API macro is set if either H5_HAVE_THREADSAFE or H5_HAVE_CONCURRENCY is enabled. New Github actions are added to include the concurrency configuration in the CI for the develop branch. To support the new non-recursive R/W locking for API routines, some other changes are necessary: Added macro wrappers around all callback invocations that could call an application function, and therefore re-enter the library: H5_BEFORE_USER_CB* / H5_AFTER_USER_CB* Added H5_user_cb_prepare / H5_user_cb_restore routines that save the state of the library when callback leaves the library. Includes error stack and threadsafe reentry state currently. There's also some small cleanups to various places in the library: Moved the H5E_mpi_error_str / H5E_mpi_error_str_len globals to be local for pushing MPI errors, so that multiple threads can't interfere with each other. Added H5TS_rwlock_trywrlock() routine to R/W lock interface. Emulate R/W locks on MacOS because its implementation of pthread_rwlock_wrlock() does not conform to the POSIX standard. Don't acquire the global API lock in H5close, since it's acquired in H5_term_library, which is necessary because H5_term_library is invoked via other code paths that don't hold the global API lock. Don't call H5Eget_auto2 API routine within H5_term_library. Switched 'return NULL' in H5allocate_memory to HGOTO_DONE(NULL). Switched H5Pget_file_space_strategy / H5Pset_file_space_strategy to use internal routines instead of API routines. Switched H5Oopen_by_addr & H5Ovisit1 to use internal routines instead of API routines. Fixed a few places in src/H5Odeprec.c where a major error ID was passed as a minor ID.
106 lines
5.3 KiB
Plaintext
106 lines
5.3 KiB
Plaintext
Copyright Notice and License Terms for
|
|
HDF5 (Hierarchical Data Format 5) Software Library and Utilities
|
|
-----------------------------------------------------------------------------
|
|
|
|
HDF5 (Hierarchical Data Format 5) Software Library and Utilities
|
|
Copyright 2006 by The HDF Group.
|
|
|
|
NCSA HDF5 (Hierarchical Data Format 5) Software Library and Utilities
|
|
Copyright 1998-2006 by The Board of Trustees of the University of Illinois.
|
|
|
|
All rights reserved.
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
modification, are permitted for any purpose (including commercial purposes)
|
|
provided that the following conditions are met:
|
|
|
|
1. Redistributions of source code must retain the above copyright notice,
|
|
this list of conditions, and the following disclaimer.
|
|
|
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
this list of conditions, and the following disclaimer in the documentation
|
|
and/or materials provided with the distribution.
|
|
|
|
3. Neither the name of The HDF Group, the name of the University, nor the
|
|
name of any Contributor may be used to endorse or promote products derived
|
|
from this software without specific prior written permission from
|
|
The HDF Group, the University, or the Contributor, respectively.
|
|
|
|
DISCLAIMER:
|
|
THIS SOFTWARE IS PROVIDED BY THE HDF GROUP AND THE CONTRIBUTORS
|
|
"AS IS" WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO
|
|
EVENT SHALL THE HDF GROUP OR THE CONTRIBUTORS BE LIABLE FOR ANY DAMAGES
|
|
SUFFERED BY THE USERS ARISING OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
You are under no obligation whatsoever to provide any bug fixes, patches, or
|
|
upgrades to the features, functionality or performance of the source code
|
|
("Enhancements") to anyone; however, if you choose to make your Enhancements
|
|
available either publicly, or directly to The HDF Group, without imposing a
|
|
separate written license agreement for such Enhancements, then you hereby
|
|
grant the following license: a non-exclusive, royalty-free perpetual license
|
|
to install, use, modify, prepare derivative works, incorporate into other
|
|
computer software, distribute, and sublicense such enhancements or derivative
|
|
works thereof, in binary and source code form.
|
|
|
|
-----------------------------------------------------------------------------
|
|
-----------------------------------------------------------------------------
|
|
|
|
Limited portions of HDF5 1.12.0 were developed by Lawrence Berkeley National
|
|
Laboratory (LBNL). LBNL's Copyright Notice and Licensing Terms can be
|
|
found in the LICENSE_LBNL_HDF5 file in this directory.
|
|
|
|
-----------------------------------------------------------------------------
|
|
-----------------------------------------------------------------------------
|
|
|
|
Contributors: National Center for Supercomputing Applications (NCSA) at
|
|
the University of Illinois, Fortner Software, Unidata Program Center
|
|
(netCDF), The Independent JPEG Group (JPEG), Jean-loup Gailly and Mark Adler
|
|
(gzip), and Digital Equipment Corporation (DEC).
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
Portions of HDF5 were developed with support from the Lawrence Berkeley
|
|
National Laboratory (LBNL) and the United States Department of Energy
|
|
under Prime Contract No. DE-AC02-05CH11231.
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
Portions of HDF5 were developed with support from Lawrence Livermore
|
|
National Laboratory and the United States Department of Energy under
|
|
Prime Contract No. DE-AC52-07NA27344.
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
Portions of HDF5 were developed with support from the University of
|
|
California, Lawrence Livermore National Laboratory (UC LLNL).
|
|
The following statement applies to those portions of the product and must
|
|
be retained in any redistribution of source code, binaries, documentation,
|
|
and/or accompanying materials:
|
|
|
|
This work was partially produced at the University of California,
|
|
Lawrence Livermore National Laboratory (UC LLNL) under contract
|
|
no. W-7405-ENG-48 (Contract 48) between the U.S. Department of Energy
|
|
(DOE) and The Regents of the University of California (University)
|
|
for the operation of UC LLNL.
|
|
|
|
DISCLAIMER:
|
|
THIS WORK WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY OF
|
|
THE UNITED STATES GOVERNMENT. NEITHER THE UNITED STATES GOVERNMENT NOR
|
|
THE UNIVERSITY OF CALIFORNIA NOR ANY OF THEIR EMPLOYEES, MAKES ANY
|
|
WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY OR RESPONSIBILITY
|
|
FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY INFORMATION,
|
|
APPARATUS, PRODUCT, OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE
|
|
WOULD NOT INFRINGE PRIVATELY- OWNED RIGHTS. REFERENCE HEREIN TO ANY
|
|
SPECIFIC COMMERCIAL PRODUCTS, PROCESS, OR SERVICE BY TRADE NAME,
|
|
TRADEMARK, MANUFACTURER, OR OTHERWISE, DOES NOT NECESSARILY CONSTITUTE
|
|
OR IMPLY ITS ENDORSEMENT, RECOMMENDATION, OR FAVORING BY THE UNITED
|
|
STATES GOVERNMENT OR THE UNIVERSITY OF CALIFORNIA. THE VIEWS AND
|
|
OPINIONS OF AUTHORS EXPRESSED HEREIN DO NOT NECESSARILY STATE OR REFLECT
|
|
THOSE OF THE UNITED STATES GOVERNMENT OR THE UNIVERSITY OF CALIFORNIA,
|
|
AND SHALL NOT BE USED FOR ADVERTISING OR PRODUCT ENDORSEMENT PURPOSES.
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|