Threading

VLFeat supports for threaded computations can be used to take advantage of multi-core architectures. Threading support includes:

Using VLFeat from multiple threads

VLFeat can be used from multiple threads simultaneously if proper rules are followed.

Parallel computations

VLFeat uses OpenMP to implement parallel computations. Generally, this means that multiple cores are uses appropriately and transparently, provided that other multi-threaded parts of the application use OpenMP and that VLFeat and the application link to the same OpenMP library. If finer control is required, read on.

VLFeat functions avoids affecting OpenMP global state, including the desired number of computational threads, in order to minimize side effects to the linked application (e.g. MATLAB). Instead, VLFeat duplicates a few OpenMP control parameters when needed (this approach is similar to the method used by other libraries such as Intel MKL).

The maximum number of threads available to the application can be obtained by vl_get_thread_limit (for OpenMP version 3.0 and greater). This limit is controlled by the OpenMP library (the function is a wrapper around omp_get_thread_limit), which in turn may determined that based on the number of computational cores or the value of the OMP_THREAD_LIMIT variable when the program is launched. This value is an upper bound on the number of computation threads that can be used at any time.

The maximum number of computational thread that VLFeat should use is set by vl_set_num_threads() and retrieved by vl_get_max_threads(). This number is a target value as well as an upper bound to the number of threads used by VLFeat. This value is stored in the VLFeat private state and is not necessarily equal to the corresponding OpenMP state variable retrieved by calling omp_get_max_threads(). vl_set_num_threads(1) disables the use of multiple threads and vl_set_num_threads(0) uses the value returned by the OpenMP call omp_get_max_threads(). The latter value is controlled, for example, by calling omp_set_num_threads() in the application. Note that:

See also:
http://software.intel.com/sites/products/documentation/doclib/mkl_sa/11/mkl_userguide_win/GUID-C2295BC8-DD22-466B-94C9-5FAA79D4F56D.htm http://software.intel.com/sites/products/documentation/doclib/mkl_sa/11/mkl_userguide_win/index.htm#GUID-DEEF0363-2B34-4BAB-87FA-A75DBE842040.htm http://software.intel.com/sites/products/documentation/hpc/mkl/lin/MKL_UG_managing_performance/Using_Additional_Threading_Control.htm


libvlfeat
Author(s): Andrea Vedaldi
autogenerated on Thu Jun 6 2019 20:25:52