Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-18 09:16:02

0001 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
0002  * Copyright by The HDF Group.                                               *
0003  * All rights reserved.                                                      *
0004  *                                                                           *
0005  * This file is part of HDF5.  The full HDF5 copyright notice, including     *
0006  * terms governing use, modification, and redistribution, is contained in    *
0007  * the COPYING file, which can be found at the root of the source code       *
0008  * distribution tree, or in https://www.hdfgroup.org/licenses.               *
0009  * If you do not have access to either file, you may request a copy from     *
0010  * help@hdfgroup.org.                                                        *
0011  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
0012 
0013 /*
0014  * Purpose: The public header file for the "I/O concentrator" driver.
0015  * This provides a similar functionality to that of the subfiling driver
0016  * but introduces the necessary file access functionality via a multi-
0017  * threading MPI service
0018  */
0019 
0020 #ifndef H5FDioc_H
0021 #define H5FDioc_H
0022 
0023 #include "H5FDsubfiling.h"
0024 
0025 #ifdef H5_HAVE_IOC_VFD
0026 /**
0027  * \def H5FD_IOC
0028  * Macro that returns the identifier for the #H5FD_IOC driver. \hid_t{file driver}
0029  */
0030 #define H5FD_IOC (H5FDperform_init(H5FD_ioc_init))
0031 #else
0032 #define H5FD_IOC (H5I_INVALID_HID)
0033 #endif
0034 
0035 /**
0036  * \def H5FD_IOC_NAME
0037  * The canonical name for the #H5FD_IOC driver
0038  */
0039 #define H5FD_IOC_NAME "ioc"
0040 
0041 #ifdef H5_HAVE_IOC_VFD
0042 
0043 #ifndef H5FD_IOC_FAPL_MAGIC
0044 /**
0045  * \def H5FD_IOC_CURR_FAPL_VERSION
0046  * The version number of the H5FD_ioc_config_t configuration
0047  * structure for the #H5FD_IOC driver
0048  */
0049 #define H5FD_IOC_CURR_FAPL_VERSION 1
0050 /**
0051  * \def H5FD_IOC_FAPL_MAGIC
0052  * Unique number used to distinguish the #H5FD_IOC driver from other HDF5 file drivers
0053  */
0054 #define H5FD_IOC_FAPL_MAGIC 0xFED21331
0055 #endif
0056 
0057 /**
0058  * \def H5FD_IOC_DEFAULT_THREAD_POOL_SIZE
0059  * The default number of I/O concentrator worker threads
0060  */
0061 #define H5FD_IOC_DEFAULT_THREAD_POOL_SIZE 4
0062 
0063 /*
0064  * Environment variables interpreted by the IOC VFD
0065  */
0066 
0067 /**
0068  * \def H5FD_IOC_THREAD_POOL_SIZE
0069  * Macro for name of the environment variable that controls/overrides
0070  * the number of I/O concentrator worker threads
0071  *
0072  * The value set for this environment variable is interpreted as an
0073  * int value and must be > 0.
0074  */
0075 #define H5FD_IOC_THREAD_POOL_SIZE "H5FD_IOC_THREAD_POOL_SIZE"
0076 
0077 //! <!-- [H5FD_ioc_config_t_snip] -->
0078 /**
0079  * \struct H5FD_ioc_config_t
0080  * \brief Configuration structure for H5Pset_fapl_ioc() / H5Pget_fapl_ioc()
0081  *
0082  * \details H5FD_ioc_config_t is a public structure that is used to pass
0083  *          configuration data to the #H5FD_IOC driver via a File Access
0084  *          Property List. A pointer to an instance of this structure is
0085  *          a parameter to H5Pset_fapl_ioc() and H5Pget_fapl_ioc().
0086  *
0087  * \var uint32_t H5FD_ioc_config_t::magic
0088  *      A somewhat unique number which distinguishes the #H5FD_IOC driver
0089  *      from other drivers. Used in combination with a version number, it
0090  *      can help to validate a user-generated File Access Property List.
0091  *      This field should be set to #H5FD_IOC_FAPL_MAGIC.
0092  *
0093  * \var uint32_t H5FD_ioc_config_t::version
0094  *      Version number of the H5FD_ioc_config_t structure. Any instance passed
0095  *      to H5Pset_fapl_ioc() / H5Pget_fapl_ioc() must have a recognized version
0096  *      number or an error will be raised. Currently, this field should be set
0097  *      to #H5FD_IOC_CURR_FAPL_VERSION.
0098  *
0099  * \var int32_t H5FD_ioc_config_t::thread_pool_size
0100  *      The number of I/O concentrator worker threads to use.
0101  *
0102  *      This value can also be set or adjusted with the #H5FD_IOC_THREAD_POOL_SIZE
0103  *      environment variable.
0104  *
0105  */
0106 typedef struct H5FD_ioc_config_t {
0107     uint32_t magic;            /* Must be set to H5FD_IOC_FAPL_MAGIC */
0108     uint32_t version;          /* Must be set to H5FD_IOC_CURR_FAPL_VERSION */
0109     int32_t  thread_pool_size; /* Number of I/O concentrator worker threads to use */
0110 } H5FD_ioc_config_t;
0111 //! <!-- [H5FD_ioc_config_t_snip] -->
0112 
0113 #ifdef __cplusplus
0114 extern "C" {
0115 #endif
0116 
0117 /**
0118  * \brief Internal routine to initialize #H5FD_IOC driver. Not meant to be
0119  *        called directly by an HDF5 application
0120  */
0121 H5_DLL hid_t H5FD_ioc_init(void);
0122 /**
0123  * \ingroup FAPL
0124  *
0125  * \brief Modifies the specified File Access Property List to use the #H5FD_IOC driver
0126  *
0127  * \fapl_id
0128  * \param[in] vfd_config Pointer to #H5FD_IOC driver configuration structure. May be NULL.
0129  * \returns \herr_t
0130  *
0131  * \details H5Pset_fapl_ioc() modifies the File Access Property List to use the
0132  *          #H5FD_IOC driver.
0133  *
0134  *          The #H5FD_IOC driver is a reference implementation of an "I/O concentrator"
0135  *          file driver that works in conjunction with the #H5FD_SUBFILING driver and
0136  *          provides the I/O backend for servicing I/O requests to subfiles.
0137  *
0138  *          Typically, an HDF5 application won't need to call this routine directly.
0139  *          The #H5FD_IOC driver is usually set up as a side effect of an HDF5 application
0140  *          using the #H5FD_SUBFILING driver, but this routine is provided in case the
0141  *          application wishes to manually configure the #H5FD_IOC driver.
0142  *
0143  * \note The \p vfd_config parameter may be NULL. In this case, the driver will
0144  *       be setup with default settings. Note that in this case, it is assumed
0145  *       the parent #H5FD_SUBFILING driver was also setup with default settings.
0146  *       If the two drivers differ in configuration settings, application behavior
0147  *       may not be as expected.
0148  *
0149  * \since 1.14.0
0150  *
0151  */
0152 H5_DLL herr_t H5Pset_fapl_ioc(hid_t fapl_id, H5FD_ioc_config_t *vfd_config);
0153 /**
0154  * \ingroup FAPL
0155  *
0156  * \brief Queries a File Access Property List for #H5FD_IOC file driver properties
0157  *
0158  * \fapl_id
0159  * \param[out] config_out Pointer to H5FD_ioc_config_t structure through which the
0160  *                        #H5FD_IOC file driver properties will be returned.
0161  *
0162  * \returns \herr_t
0163  *
0164  * \details H5Pget_fapl_ioc() queries the specified File Access Property List for
0165  *          #H5FD_IOC driver properties as set by H5Pset_fapl_ioc(). If the #H5FD_IOC
0166  *          driver has not been set on the File Access Property List, a default
0167  *          configuration is returned. An HDF5 application may use this functionality
0168  *          to manually configure the #H5FD_IOC driver by calling H5Pget_fapl_ioc()
0169  *          on a newly-created File Access Property List, adjusting the default
0170  *          values and then calling H5Pset_fapl_ioc() with the configured
0171  *          H5FD_ioc_config_t structure.
0172  *
0173  * \since 1.14.0
0174  *
0175  */
0176 H5_DLL herr_t H5Pget_fapl_ioc(hid_t fapl_id, H5FD_ioc_config_t *config_out);
0177 /**
0178  * \brief Internal routine for managing exclusive access to critical sections
0179  *        by the #H5FD_IOC driver's worker threads. Not meant to be called
0180  *        directly by an HDF5 application
0181  */
0182 H5_DLL void H5FD_ioc_begin_thread_exclusive(void);
0183 /**
0184  * \brief Internal routine for managing exclusive access to critical sections
0185  *        by the #H5FD_IOC driver's worker threads. Not meant to be called
0186  *        directly by an HDF5 application
0187  */
0188 H5_DLL void H5FD_ioc_end_thread_exclusive(void);
0189 
0190 #ifdef __cplusplus
0191 }
0192 #endif
0193 
0194 #endif /* H5_HAVE_IOC_VFD */
0195 
0196 #endif