Go to the documentation of this file.
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
integer, parameter, public log_error
Only log ERROR messages.
type(threaded_procedure_container_type), dimension(:), allocatable, volatile thread_entry_containers
Conversion between common inbuilt FORTRAN data types.
integer, volatile next_suggested_idle_thread
integer function forthread_cond_destroy(cond_id)
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.
integer function forthread_mutex_lock(mutex_id)
integer, parameter, public log_warn
Log WARNING and ERROR messages.
Wraps the thread procedure with the call itself and the data to pass to it.
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_mutex_init(mutex_id, attr_id)
integer function forthread_join(thread_id, val)
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...
integer function forthread_mutex_destroy(mutex_id)
integer function forthread_cond_broadcast(cond_id)
integer, dimension(:), allocatable, volatile activate_thread_mutex
logical, dimension(:), allocatable, volatile thread_busy
integer, volatile active_scalar_mutex
The thread call procedure interface.
subroutine, public threadpool_start_thread(proc, arguments, data_buffer)
Starts an idle thread from the pool to execute a specific procedure with some data....
integer, dimension(:), allocatable, volatile thread_ids
integer, dimension(:), allocatable, volatile thread_pass_data
This is a thread pool and the single management "main" thread will spawn out free threads in the pool...
integer, parameter default_thread_pool_size
Number of threads in the pool.
subroutine, public check_thread_status(ierr)
Checks the error status of any thread operation and reports an error if it failed.
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 find_idle_thread()
Finds an idle thread, if one is not available then will block until one becomes free.
integer, volatile netcdfmutex
Mutex used for controling NetCDF access.
Converts data types to strings.
integer function forthread_cond_signal(cond_id)
integer, volatile total_number_of_threads
Overall IO configuration.
integer function forthread_cond_wait(cond_id, mutex_id)
integer function forthread_create(thread_id, attr_id, run, arg)
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...
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, volatile active_threads
subroutine, public threadpool_finalise()
Finalises the thread pool.
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_unlock(mutex_id)
integer function forthread_destroy()
integer function forthread_kill(thread_id, sig)
logical, dimension(:), allocatable, volatile thread_start
integer, dimension(:), allocatable, volatile activate_thread_condition_variables
logical, volatile threadpool_active
integer function forthread_init()
Parses the XML configuration file to produce the io configuration description which contains the data...
integer function forthread_cond_init(cond_id, attr_id)
subroutine, public threadpool_init(io_configuration)
Initialises the thread pool and marks each thread as idle.