Go to the source code of this file.
Code for spawning threads on various platforms. Code donated by John Stone, john.stone@gmail.com This code was originally written for the Tachyon Parallel/Multiprocessor Ray Tracer. Improvements have been donated by Mr. Stone on an ongoing basis. This code is provided under the three clause BSD Open Source License.
NOTE: The latest version of this source file can be re-generated by running the sequence of 'sed' commands shown at the top of the "threads.c" file within the Tachyon source distribution.
Definition in file WKFThreads.h.
|
Definition at line 117 of file WKFThreads.h. Referenced by VMDApp::VMDinit, and wkf_cpu_capability_flags. |
|
Definition at line 119 of file WKFThreads.h. Referenced by orbitalthread, VMDApp::VMDinit, and wkf_cpu_capability_flags. |
|
Definition at line 120 of file WKFThreads.h. Referenced by VMDApp::VMDinit, and wkf_cpu_capability_flags. |
|
Definition at line 123 of file WKFThreads.h. Referenced by VMDApp::VMDinit, and wkf_cpu_capability_flags. |
|
Definition at line 121 of file WKFThreads.h. Referenced by VMDApp::VMDinit, and wkf_cpu_capability_flags. |
|
Definition at line 122 of file WKFThreads.h. Referenced by VMDApp::VMDinit, and wkf_cpu_capability_flags. |
|
Definition at line 118 of file WKFThreads.h. |
|
Definition at line 113 of file WKFThreads.h. |
|
Definition at line 114 of file WKFThreads.h. Referenced by VMDApp::VMDinit, and wkf_cpu_capability_flags. |
|
Definition at line 115 of file WKFThreads.h. Referenced by VMDApp::VMDinit, and wkf_cpu_capability_flags. |
|
Definition at line 116 of file WKFThreads.h. |
|
Definition at line 126 of file WKFThreads.h. Referenced by VMDApp::VMDinit, and wkf_cpu_capability_flags. |
|
Definition at line 127 of file WKFThreads.h. Referenced by VMDApp::VMDinit, and wkf_cpu_capability_flags. |
|
Definition at line 128 of file WKFThreads.h. Referenced by VMDApp::VMDinit, and wkf_cpu_capability_flags. |
|
Definition at line 125 of file WKFThreads.h. Referenced by VMDApp::VMDinit, and wkf_cpu_capability_flags. |
|
Definition at line 124 of file WKFThreads.h. Referenced by orbitalthread, VMDApp::VMDinit, and wkf_cpu_capability_flags. |
|
Definition at line 103 of file WKFThreads.h. Referenced by analyze_selection_aligned_dispatch, VMDApp::VMDinit, and wkf_cpu_capability_flags. |
|
Definition at line 104 of file WKFThreads.h. Referenced by analyze_selection_aligned_dispatch, Orbital::calculate_mo, orbitalthread, vmd_gaussdensity_opt, VMDApp::VMDinit, and wkf_cpu_capability_flags. |
|
Definition at line 106 of file WKFThreads.h. Referenced by VMDApp::VMDinit, and wkf_cpu_capability_flags. |
|
Definition at line 107 of file WKFThreads.h. Referenced by Orbital::calculate_mo, orbitalthread, VMDApp::VMDinit, and wkf_cpu_capability_flags. |
|
Definition at line 105 of file WKFThreads.h. Referenced by Orbital::calculate_mo, orbitalthread, VMDApp::VMDinit, and wkf_cpu_capability_flags. |
|
Definition at line 108 of file WKFThreads.h. Referenced by VMDApp::VMDinit, and wkf_cpu_capability_flags. |
|
Definition at line 101 of file WKFThreads.h. Referenced by VMDApp::VMDinit, and wkf_cpu_capability_flags. |
|
Definition at line 102 of file WKFThreads.h. Referenced by vmd_gaussdensity_opt, VMDApp::VMDinit, and wkf_cpu_capability_flags. |
|
Definition at line 97 of file WKFThreads.h. Referenced by VMDApp::VMDinit, and wkf_cpu_capability_flags. |
|
Definition at line 98 of file WKFThreads.h. Referenced by VMDApp::VMDinit, and wkf_cpu_capability_flags. |
|
Value: (CPU_AVX512F | CPU_AVX512CD | \ CPU_AVX512ER | CPU_AVX512PF) Definition at line 109 of file WKFThreads.h. Referenced by VMDApp::VMDinit. |
|
Definition at line 93 of file WKFThreads.h. Referenced by wkf_cpu_capability_flags, and wkf_cpu_smt_depth. |
|
Definition at line 99 of file WKFThreads.h. Referenced by VMDApp::VMDinit, and wkf_cpu_capability_flags. |
|
Definition at line 100 of file WKFThreads.h. Referenced by FileRenderList::FileRenderList, VMDApp::VMDinit, and wkf_cpu_capability_flags. |
|
Definition at line 94 of file WKFThreads.h. Referenced by wkf_cpu_capability_flags. |
|
Definition at line 470 of file WKFThreads.h. Referenced by wkf_shared_iterator_next_tile, and wkf_threadpool_next_tile. |
|
Shared iterators intended for trivial CPU/GPU load balancing with no exception handling capability (all work units must complete with no errors, or else the whole thing is canceled). Definition at line 469 of file WKFThreads.h. Referenced by correlationthread, cudaenergythread, cudaorbitalthread, densitythread, energythread, measure_rmsdmat_qcp_thread, measure_sasa_thread, openclenergythread, openclorbitalthread, orbitalthread, rdf_thread, reductionthread, text_cmd_parallel, vmddevpoolcudatilelatencythread, vmddevpooltilelatencythread, volinthread, volinthread_prob, wkf_shared_iterator_next_tile, and wkf_threadpool_next_tile. |
|
symbolic constant macro to test if we have a GPU or not Definition at line 513 of file WKFThreads.h. |
|
shortcut macro to tell the create routine we only want CPU cores Definition at line 510 of file WKFThreads.h. Referenced by VMDApp::VMDinit. |
|
Definition at line 64 of file WKFThreads.h. |
|
Definition at line 429 of file WKFThreads.h. Referenced by wkf_threadpool_next_tile, and wkf_tilestack_pop. |
|
|
|
|
|
Definition at line 208 of file WKFThreads.h. Referenced by wkf_cond_broadcast, wkf_cond_destroy, wkf_cond_init, wkf_cond_signal, wkf_cond_wait, wkf_cpu_capability_flags, and wkf_thread_numprocessors. |
|
|
|
Definition at line 207 of file WKFThreads.h. Referenced by AtomSelThr::AtomSelThr, bondsearchthread, find_next_cluster, vmd_bondsearch_thr, wkf_cond_wait, wkf_cpu_capability_flags, wkf_mutex_destroy, wkf_mutex_init, wkf_mutex_lock, wkf_mutex_spin_lock, wkf_mutex_trylock, and wkf_mutex_unlock. |
|
|
|
Definition at line 209 of file WKFThreads.h. Referenced by wkf_cpu_capability_flags, wkf_rwlock_init, wkf_rwlock_readlock, wkf_rwlock_unlock, and wkf_rwlock_writelock. |
|
iterator used for dynamic load balancing |
|
Task tile struct for stack, iterator, and scheduler routines; 'start' is inclusive, 'end' is exclusive. This yields a half-open interval that corresponds to a typical 'for' loop. |
|
Definition at line 206 of file WKFThreads.h. Referenced by find_next_cluster, find_within, measure_gofr, VMDCollab::startserver, text_cmd_parallel, vmd_bondsearch_thr, vmd_cuda_bus_bw, vmd_cuda_globmem_bw, vmd_cuda_madd_gflops, wkf_thread_create, wkf_thread_join, wkf_threadlaunch, and wkf_threadpool_create. |
|
Routines to generate a pool of threads which then grind through a dynamically load balanced work queue implemented as a shared iterator. No exception handling is possible, just a simple all-or-nothing attept. Useful for simple calculations that take very little time. An array of threads is generated, launched, and joined all with one call. |
|
|
|
thread-specific handle data for workers |
|
fetch an atomic int and add inc to it, returning new value Definition at line 1190 of file WKFThreads.C. |
|
destroy an atomic int variable Definition at line 1076 of file WKFThreads.C. |
|
fetch an atomic int and add inc to it, returning original value Definition at line 1162 of file WKFThreads.C. |
|
get an atomic int variable Definition at line 1133 of file WKFThreads.C. |
|
initialize an atomic int variable Definition at line 1053 of file WKFThreads.C. |
|
set an atomic int variable Definition at line 1097 of file WKFThreads.C. |
|
signal a condition variable, waking all threads Definition at line 1013 of file WKFThreads.C. Referenced by wkf_thread_barrier, and wkf_thread_run_barrier. |
|
destroy a condition variable Definition at line 898 of file WKFThreads.C. Referenced by wkf_thread_barrier_destroy, and wkf_thread_run_barrier_destroy. |
|
initialize a condition variable Definition at line 862 of file WKFThreads.C. Referenced by wkf_rwlock_init, wkf_thread_barrier_init, and wkf_thread_run_barrier_init. |
|
signal a condition variable, waking at least one thread Definition at line 981 of file WKFThreads.C. Referenced by wkf_rwlock_unlock. |
|
wait on a condition variable Definition at line 922 of file WKFThreads.C. Referenced by wkf_rwlock_readlock, wkf_rwlock_writelock, wkf_thread_barrier, and wkf_thread_run_barrier. |
|
query CPU affinity of the calling process (if allowed by host system) Definition at line 493 of file WKFThreads.C. Referenced by affinitize_threads, and vmdinfo_tcl. |
|
CPU optional instruction set capability flags Definition at line 292 of file WKFThreads.C. References wkf_cond_t, wkf_mutex_t, and wkf_rwlock_t. Referenced by FileRenderList::FileRenderList, VMDApp::VMDinit, and wkf_cpu_smt_depth. |
|
destroy a mutex Definition at line 838 of file WKFThreads.C. Referenced by cc_threaded, find_next_cluster, vmd_bondsearch_thr, volin_threaded, volin_threaded_prob, wkf_atomic_int_destroy, wkf_shared_iterator_destroy, wkf_thread_barrier_destroy, wkf_thread_run_barrier_destroy, and wkf_tilestack_destroy. |
|
initialize a mutex Definition at line 731 of file WKFThreads.C. Referenced by cc_threaded, find_next_cluster, IMDSimThread::IMDSimThread, vmd_bondsearch_thr, volin_threaded, volin_threaded_prob, wkf_atomic_int_init, wkf_rwlock_init, wkf_shared_iterator_init, wkf_thread_barrier_init, wkf_thread_run_barrier_init, and wkf_tilestack_init. |
|
|
lock a mutex by spinning only Definition at line 794 of file WKFThreads.C. Referenced by wkf_shared_iterator_next_tile, and wkf_shared_iterator_setfatalerror. |
|
try to lock a mutex Definition at line 773 of file WKFThreads.C. |
|
|
initialize a reader/writer lock Definition at line 1222 of file WKFThreads.C. |
|
set reader lock Definition at line 1251 of file WKFThreads.C. |
|
unlock reader/writer lock Definition at line 1315 of file WKFThreads.C. |
|
set writer lock Definition at line 1280 of file WKFThreads.C. |
|
destroy a shared iterator Definition at line 1720 of file WKFThreads.C. Referenced by text_cmd_parallel, wkf_threadlaunch, and wkf_threadpool_destroy. |
|
master thread calls this to query for fatal errors Definition at line 1795 of file WKFThreads.C. Referenced by wkf_threadlaunch, and wkf_threadpool_getfatalerror. |
|
initialize a shared iterator Definition at line 1710 of file WKFThreads.C. Referenced by text_cmd_parallel, wkf_threadlaunch, and wkf_threadpool_create. |
|
iterate the shared iterator, over a requested half-open interval Definition at line 1746 of file WKFThreads.C. Referenced by text_cmd_parallel, wkf_threadlaunch_next_tile, and wkf_threadpool_next_tile. |
|
set shared iterator parameters Definition at line 1729 of file WKFThreads.C. Referenced by text_cmd_parallel, wkf_threadlaunch, and wkf_threadpool_sched_dynamic. |
|
worker thread calls this to indicate a fatal error Definition at line 1782 of file WKFThreads.C. Referenced by wkf_threadlaunch_setfatalerror, and wkf_threadpool_setfatalerror. |
|
synchronize on counting barrier primitive Definition at line 1435 of file WKFThreads.C. Referenced by FreeVRScene::draw, and CaveScene::draw. |
|
destroy counting barrier primitive Definition at line 1426 of file WKFThreads.C. |
|
initialize counting barrier primitive Definition at line 1365 of file WKFThreads.C. |
|
When rendering in the CAVE we use a special synchronization mode so that shared memory mutexes and condition variables will work correctly when accessed from multiple processes. Inter-process synchronization involves the kernel to a greater degree, so these barriers are substantially more costly to use than the ones designed for use within a single-process. Definition at line 1389 of file WKFThreads.C. Referenced by CaveScene::CaveScene, and FreeVRScene::FreeVRScene. |
|
create a new child thread Definition at line 655 of file WKFThreads.C. Referenced by find_next_cluster, find_within, IMDSimThread::IMDSimThread, measure_gofr, VMDCollab::startserver, text_cmd_parallel, vmd_bondsearch_thr, vmd_cuda_bus_bw, vmd_cuda_globmem_bw, vmd_cuda_madd_gflops, wkf_threadlaunch, and wkf_threadpool_create. |
|
join (wait for completion of, and merge with) a thread Definition at line 698 of file WKFThreads.C. Referenced by find_next_cluster, find_within, measure_gofr, text_cmd_parallel, vmd_bondsearch_thr, vmd_cuda_bus_bw, vmd_cuda_globmem_bw, vmd_cuda_madd_gflops, wkf_threadlaunch, wkf_threadpool_destroy, and IMDSimThread::~IMDSimThread. |
|
If compiling on Linux, enable the GNU CPU affinity functions in both libc and the libpthreads Definition at line 120 of file WKFThreads.C. |
|
number of processors available, subject to user override Definition at line 208 of file WKFThreads.C. References wkf_cond_t. |
|
destroy thread pool barrier Definition at line 1488 of file WKFThreads.C. Referenced by wkf_threadpool_destroy. |
|
initialize thread pool barrier Definition at line 1472 of file WKFThreads.C. Referenced by wkf_threadpool_create. |
|
non-blocking poll to see if peers are already at the barrier Definition at line 1546 of file WKFThreads.C. Referenced by wkf_threadpool_poll. |
|
set the CPU affinity of the current thread (if allowed by host system) Definition at line 582 of file WKFThreads.C. Referenced by affinitize_threads, and vmd_cuda_affinitize_threads. |
|
set the concurrency level and scheduling scope for threads Definition at line 628 of file WKFThreads.C. |
|
launch up to numprocs threads using shared iterator as a load balancer Definition at line 2095 of file WKFThreads.C. Referenced by cc_threaded, evaluate_grid_fast, measure_rmsdmat_qcp, measure_rmsdmat_qcp_ooc, measure_sasalist, vmd_cuda_vol_cpotential, vmd_gaussdensity_threaded, vmd_opencl_evaluate_orbital_grid, vmd_opencl_vol_cpotential, vol_cpotential_cpu, volin_threaded, and volin_threaded_prob. |
|
worker thread can call this to get its client data pointer Definition at line 2185 of file WKFThreads.C. Referenced by correlationthread, cudaenergythread, densitythread, energythread, measure_rmsdmat_qcp_thread, measure_sasa_thread, openclenergythread, openclorbitalthread, orbitalthread, reductionthread, volinthread, and volinthread_prob. |
|
worker thread can call this to get its ID and number of peers Definition at line 2172 of file WKFThreads.C. Referenced by cudaenergythread, densitythread, energythread, measure_rmsdmat_qcp_thread, measure_sasa_thread, openclenergythread, openclorbitalthread, and reductionthread. |
|
iterate the shared iterator over the requested half-open interval Definition at line 2195 of file WKFThreads.C. Referenced by correlationthread, cudaenergythread, densitythread, energythread, measure_rmsdmat_qcp_thread, measure_sasa_thread, openclenergythread, openclorbitalthread, orbitalthread, reductionthread, volinthread, and volinthread_prob. |
|
worker thread calls this to indicate that an unrecoverable error occured Definition at line 2203 of file WKFThreads.C. |
|
create a thread pool with a specified number of worker threads Definition at line 1832 of file WKFThreads.C. Referenced by gpu_ooc_bench, qcp_soa_gpu_ooc, and VMDApp::VMDinit. |
|
join all worker threads and free resources Definition at line 1927 of file WKFThreads.C. Referenced by gpu_ooc_bench, qcp_soa_gpu_ooc, and VMDApp::~VMDApp. |
|
return the number of worker threads currently in the pool Definition at line 1961 of file WKFThreads.C. Referenced by rdf_gpu, and vmd_cuda_measure_latencies. |
|
master thread calls this to query for fatal errors Definition at line 2087 of file WKFThreads.C. |
|
launch threads onto a new function, with associated parms Definition at line 1892 of file WKFThreads.C. Referenced by CUDAAccel::devpool_launch, evaluate_grid_fast, gpu_ooc_bench, measure_rmsdmat_qcp, measure_rmsdmat_qcp_ooc, qcp_soa_gpu, qcp_soa_gpu_ooc, rdf_gpu, vmd_cuda_devpool_latency, vmd_cuda_evaluate_orbital_grid, vmd_cuda_measure_latencies, vmd_opencl_evaluate_orbital_grid, and VMDApp::VMDinit. |
|
iterate the shared iterator over the requested half-open interval Definition at line 2052 of file WKFThreads.C. Referenced by cudaorbitalthread, measure_rmsdmat_qcp_thread, openclorbitalthread, orbitalthread, rdf_thread, vmddevpoolcudatilelatencythread, and vmddevpooltilelatencythread. |
|
Set shared iterator state to half-open interval defined by tile Definition at line 2044 of file WKFThreads.C. Referenced by evaluate_grid_fast, gpu_ooc_bench, measure_rmsdmat_qcp, measure_rmsdmat_qcp_ooc, qcp_soa_gpu, qcp_soa_gpu_ooc, rdf_gpu, vmd_cuda_devpool_latency, vmd_cuda_evaluate_orbital_grid, and vmd_opencl_evaluate_orbital_grid. |
|
worker thread calls this to indicate that an unrecoverable error occured Definition at line 2079 of file WKFThreads.C. |
|
worker thread calls this when a failure occurs on a tile it has already taken from the scheduler Definition at line 2072 of file WKFThreads.C. |
|
wait for all worker threads to complete their work Definition at line 1910 of file WKFThreads.C. Referenced by CUDAAccel::devpool_wait, and vmd_cuda_devpool_latency. |
|
worker thread calls this to scale max tile size by worker speed as determined by the SM/core count and clock rate Definition at line 2018 of file WKFThreads.C. Referenced by cudaorbitalthread, openclorbitalthread, and vmddevpoolcudatilelatencythread. |
|
worker thread can call this to get its client data pointer Definition at line 2034 of file WKFThreads.C. Referenced by cudaorbitalthread, measure_rmsdmat_qcp_thread, openclorbitalthread, orbitalthread, rdf_thread, vmd_cuda_devpool_setdevice, vmd_cuda_devpool_setdeviceonly, vmddevpoolcudalatencythread, vmddevpoolcudatilelatencythread, and vmddevpooltilelatencythread. |
|
worker thread can call this to get its CPU/GPU device ID Definition at line 1980 of file WKFThreads.C. Referenced by vmd_cuda_affinitize_threads, vmd_cuda_devpool_clear_device_mem, vmd_cuda_devpool_enable_P2P, vmd_cuda_devpool_setdevice, and vmd_cuda_devpool_setdeviceonly. |
|
worker thread calls this to get relative speed of this device as determined by the SM/core count and clock rate Definition at line 2006 of file WKFThreads.C. |
|
worker thread can call this to get its ID and number of peers Definition at line 1967 of file WKFThreads.C. Referenced by affinitize_threads, cudaorbitalthread, measure_rmsdmat_qcp_thread, openclorbitalthread, rdf_thread, vmd_cuda_affinitize_threads, vmd_cuda_devpool_clear_device_mem, vmd_cuda_devpool_enable_P2P, vmd_cuda_devpool_setdevice, vmd_cuda_devpool_setdeviceonly, vmddevpoolcudalatencythread, vmddevpoolcudatilelatencythread, and vmddevpooltilelatencythread. |
|
worker thread calls this to set relative speed of this device as determined by the SM/core count and clock rate Note: this should only be called once, during the worker's device initialization process Definition at line 1995 of file WKFThreads.C. Referenced by vmd_cuda_devpool_setdevice. |
|
shrink memory buffers associated with task tile stack if possible Definition at line 1594 of file WKFThreads.C. |
|
destroy task tile stack Definition at line 1585 of file WKFThreads.C. Referenced by wkf_threadpool_destroy. |
|
query if the task tile stack is empty or not Definition at line 1685 of file WKFThreads.C. |
|
initialize task tile stack (to empty) Definition at line 1562 of file WKFThreads.C. Referenced by wkf_threadpool_create. |
|
pop a task tile off of the stack Definition at line 1647 of file WKFThreads.C. Referenced by wkf_threadpool_next_tile. |
|
pop all of the task tiles off of the stack Definition at line 1670 of file WKFThreads.C. |
|
push a task tile onto the stack Definition at line 1618 of file WKFThreads.C. Referenced by wkf_threadpool_tile_failed. |
|
sleeping barrier synchronization for thread pool Definition at line 406 of file WKFThreads.h. |