Download
Releases (INSTALL) 1.10 (Sep 2013) Download 1.9 (Feb 2013) Download 1.8.1 (Oct 2012) Download 1.8 (Sept 2012) Download 1.7.1 (Feb 2012) Download 1.7 (Sept 2011) Download 1.6 (Jun 2011) NEWS Download 1.5.1 (Mar 2011) NEWS Download 1.5 (Feb 2011) NEWS Download 1.4 (Jul 2010) NEWS Download 1.3.1 (Feb 2010) NEWS Download 1.3 (Feb 2010) NEWS Download 1.2 (Nov 2009) NEWS Download 1.1 (Jan 2009) NEWS Download 1.0 (Feb 2008) Download
## The Qthread Library
The qthreads API is designed to make using large numbers of threads convenient and easy, and to allow portable access to threading constructs used in massively parallel shared memory environments. The API maps well to both MTA-style threading and PIM-style threading, and is still quite useful in a standard SMP context. The qthreads API provides access to full/empty-bit (FEB) semantics, where every word of memory can be marked either full or empty, and a thread can wait for any word to attain either state. The qthreads library on an SMP (i.e. the POSIX implementation) is essentially a library for spawning and controlling coroutines: threads with small (4k) stacks. The threads are entirely in user-space and use their blocked/unblocked status as part of their scheduling. The library's metaphor is that there are many qthreads and several "shepherds". Shepherds can be thought of as a thread mobility domain; they map to specific processors or memory regions. Qthreads are assigned to specific shepherds and do not migrate unless directed to migrate. The API includes utility functions for making threaded loops, sorting, and similar operations convenient. The Qthread library was developed to explore innovations in highly concurrent systems where the ultimate system either does not exist, or is sufficiently hard to obtain that development of software for the system becomes difficult. Development is currently hosted on GitHub: https://github.com/Qthreads/qthreads. ### Platforms & Requirements #### Architectures POSIX Qthreads supports most POSIX-style machines, including Linux, Solaris, and MacOS X, running on a variety of architectures. It has been tested on:
Architecture | Linux | Solaris | MacOS X | SST
--- | --- | --- | --- | ---
PPC32 | ✓ |  | ✓ | ✓
PPC64 | ✓ |  | ✓ |
IA32 | ✓ |  | ✓ |
IA64 | ✓ |  |  |
AMD64/x86_64 | ✓ |  | ✓ |
SparcV9+ |  | ✓ |  |
Tilera (MIPS) | ✓ |  |  |
#### Compilers Qthreads has been tested with:
GCC 3.x | Works
GCC 4.x | Works
PGI 11.6 | Works
Intel ICC 11.1.x | Works; does not support inline assembly on IA64
Intel ICC 12.x | Works
TileraMDE 2.0.0.77314 | Works; requires `-O0`
SunStudio 12 | Causes internal compiler errors ("Wasted space")
#### Build Requirements To compile and run the POSIX Qthreads you will require: A UNIX-like shell (Qthreads uses the GNU Autotools) GNU Make C Compiler (Prior to 1.5 requires either C++ or the cprops library) To compile and run SST Qthreads you will also require: PPC C Compiler A full complement of static libraries (here) ### Installation Detailed installation directions are included in the INSTALL file in the distribution (see the link on the left). ### Papers & Publications To cite qthreads, please use: Qthreads: An API for Programming with Millions of Lightweight Threads Kyle Wheeler, Richard Murphy, Douglas Thain In the Proceedings of the 22nd IEEE International Parallel & Distributed Processing Symposium (IPDPS '08, in the MTAAP '08 workshop), IEEE Press, 2008. Additional related publications: Implementing a Portable Multi-threaded Graph Library: the MTGL on Qthreads Brian Barrett, Jonathan Berry, Richard Murphy, Kyle Wheeler In the Proceedings of the 23rd IEEE International Parallel & Distributed Processing Symposium (IPDPS '09, in the MTAAP '09 workshop), IEEE Press, 2009. Portable Performance from Workstation to Supercomputer: Distributing Data Structures with Qthreads Kyle Wheeler, Douglas Thain, Richard Murphy In the Proceedings of the First Workshop on Programming Models for Emerging Architectures (PMEA), IEEE Press, 2009. Scheduling Task Parallelism on Multi-Socket Multicore Systems Stephen Olivier, Allan Porterfield, Kyle Wheeler, and Jan Prins In the Proceedings of the 25th International Conference on Supercomputing (ICS'11, in the ROSS'11 workshop), ACM Press, 2011. ### API 1.8 Documentation Basic Threading qthread_init, qthread_initialize qthread_finalize qthread_yield qthread_spawn qthread_fork, and many variants qthread_id qthread_shep qthread_worker, qthread_worker_unique qthread_get_tasklocal, qthread_size_tasklocal qthread_migrate_to qthread_stackleft qthread_retloc Futures future_init future_fork future_join_all future_exit future_yield future_acquire Blocking & Atomic Operations Non-blocking Atomics qthread_incr, qthread_dincr, qthread_fincr qthread_cas, qthread_cas_ptr FEB External state (aligned_t; any aligned word in memory) qthread_empty, qthread_fill qthread_feb_status qthread_readFE qthread_readFF qthread_writeEF, qthread_writeEF_const qthread_writeF, qthread_writeF_const Inline state (syncvar_t) qthread_syncvar_empty, qthread_syncvar_fill qthread_syncvar_status qthread_syncvar_readFE qthread_syncvar_readFF qthread_syncvar_writeEF, qthread_syncvar_writeEF_const qthread_syncvar_writeF, qthread_syncvar_writeF_const qthread_feb_barrier_create, qthread_feb_barrier_enter, qthread_feb_barrier_destroy, qthread_feb_barrier_resize Mutex qthread_lock, qthread_unlock Reductions (Sincs) qt_sinc_init, qt_sinc_create qt_sinc_fini, qt_sinc_destroy qt_sinc_reset qt_sinc_expect qt_sinc_submit qt_sinc_wait Threaded Loops Futurelib mt_loop mt_loop_returns Qloop qt_loop, qt_loop_step, qt_loop_step_future, qt_loop_future qt_loop_balance, qt_loop_balance_future qt_loopaccum_balance, qt_loopaccum_balance_future qt_loop_queue_create, qt_loop_queue_setchunk, qt_loop_queue_run, qt_loop_queue_run_there, qt_loop_queue_addworker Qutil qutil_double_max, qutil_uint_max, qutil_int_max qutil_double_min, qutil_uint_min, qutil_int_min qutil_double_mult, qutil_uint_mult, qutil_int_mult qutil_double_sum, qutil_uint_sum, qutil_int_sum qutil_mergesort, qutil_qsort qt_double_max, qt_uint_max, qt_int_max qt_double_min, qt_uint_min, qt_int_min qt_double_prod, qt_uint_prod, qt_int_prod qt_double_sum, qt_uint_sum, qt_int_sum Timers qtimer_create qtimer_destroy qtimer_start qtimer_stop qtimer_secs qtimer_fastrand Distributed Data Structures Qpool (distributed memory pool) qpool_create, qpool_create_aligned qpool_destroy qpool_alloc qpool_free Qarray (distributed array) qarray_create, qarray_create_tight, qarray_create_configured qarray_destroy qarray_elem, qarray_elem_nomigrate, qarray_elem_migrate qarray_shepof qarray_iter, qarray_iter_loop, qarray_iter_loop_nb, qarray_iter_constloop Qlfqueue (lock-free ordered queue) qlfqueue_create qlfqueue_destroy qlfqueue_enqueue qlfqueue_dequeue qlfqueue_empty Qdqueue (distributed end-to-end ordered queue) qdqueue_create qdqueue_destroy qdqueue_enqueue, qdqueue_enqueue_there qdqueue_dequeue qdqueue_empty Qt_dictionary (concurrent lock-free hash table) qt_dictionary_create qt_dictionary_destroy qt_dictionary_put, qt_dictionary_put_if_absent qt_dictionary_get qt_dictionary_delete qt_dictionary_end qt_dictionary_iterator_create qt_dictionary_iterator_destroy qt_dictionary_iterator_next qt_dictionary_iterator_get qt_dictionary_iterator_equals qt_dictionary_iterator_copy Externally Blocking Operations qt_begin_blocking_action, qt_end_blocking_action qt_accept qt_connect qt_poll qt_pread qt_pwrite qt_read qt_select qt_system qt_wait4 qt_write Runtime Functions qthread_num_shepherds qthread_num_workers qthread_cacheline qthread_sorted_sheps, qthread_sorted_sheps_remote qthread_debuglevel qthread_readstate qthread_distance qthread_enable_shepherd, qthread_disable_shepherd qthread_shep_ok qthread_enable_worker, qthread_disable_worker Computational Templates All Pairs Wavefront Memory Allocation (deprecated) qalloc_makedynmap, qalloc_makestatmap, qalloc_loadmap qalloc_malloc, qalloc_statmalloc, qalloc_dynmalloc qalloc_free, qalloc_statfree, qalloc_dynfree qalloc_cleanup qalloc_checkpoint Top of page | Contacts Dylan Stark (dstark@sandia.gov) (505) 284-6101 Stephen Olivier (slolivi@sandia.gov) (505) 844-7122