12 use mpi
, only : mpi_thread_multiple, mpi_thread_serialized
22 integer,
dimension(:),
intent(in) :: arguments
23 character,
dimension(:),
allocatable,
intent(inout),
optional :: data_buffer
30 integer,
dimension(:),
allocatable :: arguments
31 character,
dimension(:),
allocatable :: data_buffer
57 if (io_configuration%number_of_threads .ge. 1)
then 60 if (io_configuration%my_io_rank==0)
then 61 call log_log(
log_warn,
"No setting for IO server thread pool size which must be 1 or more so using default size")
85 #ifdef ENFORCE_THREAD_SAFETY 92 #ifdef ENFORCE_THREAD_SAFETY 103 integer,
dimension(:),
intent(in) :: arguments
104 character,
dimension(:),
allocatable,
intent(in),
optional :: data_buffer
106 integer :: idle_thread_id
111 if (idle_thread_id .ne. -1)
then 175 integer,
pointer :: retval
229 integer,
intent(in) :: ierr
231 if (ierr .ne. 0)
then
type(threaded_procedure_container_type), dimension(:), allocatable, volatile thread_entry_containers
The thread call procedure interface.
integer function forthread_mutex_unlock(mutex_id)
integer function forthread_cond_signal(cond_id)
Overall IO configuration.
Wraps the thread procedure with the call itself and the data to pass to it.
integer function find_idle_thread()
Finds an idle thread, if one is not available then will block until one becomes free.
integer, volatile next_suggested_idle_thread
integer, dimension(:), allocatable, volatile activate_thread_mutex
integer, parameter, public log_error
Only log ERROR messages.
integer, volatile total_number_of_threads
subroutine, public threadpool_init(io_configuration)
Initialises the thread pool and marks each thread as idle.
integer function forthread_mutex_destroy(mutex_id)
integer function forthread_kill(thread_id, sig)
integer function get_index_of_idle_thread()
Specifically gets the index of the next idle thread or -1 if they are all busy. This starts from a ne...
integer function forthread_join(thread_id, val)
logical function, public threadpool_is_idle()
Determines whether the thread pool is idle or not (i.e. all threads are idle and waiting for work) ...
integer function forthread_init()
integer, dimension(:), allocatable, volatile thread_ids
subroutine, public threadpool_deactivate()
This waits for all busy threads to complete and then shuts all the pthreads down. The deactivation an...
integer function forthread_mutex_init(mutex_id, attr_id)
Conversion between common inbuilt FORTRAN data types.
integer function forthread_cond_init(cond_id, attr_id)
Converts data types to strings.
logical, dimension(:), allocatable, volatile thread_busy
subroutine, public threadpool_lock_netcdf_access()
Aquires the NetCDF thread lock, NetCDF is not thread safe so we need to manage thread calls to it...
integer function forthread_create(thread_id, attr_id, run, arg)
subroutine, public log_log(level, message, str)
Logs a message at the specified level. If the level is above the current level then the message is ig...
logical, dimension(:), allocatable, volatile thread_start
This is a thread pool and the single management "main" thread will spawn out free threads in the pool...
subroutine, public threadpool_finalise()
Finalises the thread pool.
subroutine, public check_thread_status(ierr)
Checks the error status of any thread operation and reports an error if it failed.
integer function forthread_mutex_lock(mutex_id)
integer, dimension(:), allocatable, volatile thread_pass_data
integer, volatile active_scalar_mutex
integer, parameter default_thread_pool_size
Number of threads in the pool.
subroutine threadpool_thread_entry_procedure(thread_id)
Entry point called by each thread creation in the pool, this calls out to the actual procedure to exe...
integer, parameter, public log_warn
Log WARNING and ERROR messages.
integer function forthread_destroy()
integer, dimension(:), allocatable, volatile activate_thread_condition_variables
integer function forthread_cond_broadcast(cond_id)
integer function forthread_cond_destroy(cond_id)
integer function forthread_cond_wait(cond_id, mutex_id)
subroutine, public threadpool_start_thread(proc, arguments, data_buffer)
Starts an idle thread from the pool to execute a specific procedure with some data. If there is no thread available then this will block until one becomes idle.
subroutine, public threadpool_unlock_netcdf_access()
Releases the NetCDF thread lock, NetCDF is not thread safe so we need to manage thread calls to it...
logical, volatile threadpool_active
integer, volatile active_threads
Parses the XML configuration file to produce the io configuration description which contains the data...
integer, volatile netcdfmutex
Mutex used for controling NetCDF access.