[Openmp-commits] [PATCH] D20697: Offer API for setting number of loop dispatch buffers
Jonathan Peyton via Openmp-commits
openmp-commits at lists.llvm.org
Thu May 26 12:29:33 PDT 2016
jlpeyton created this revision.
jlpeyton added reviewers: AndreyChurbanov, tlwilmar.
jlpeyton added a subscriber: openmp-commits.
jlpeyton set the repository for this revision to rL LLVM.
The problem is the lack of dispatch buffers when thousands of loops with nowait, about 10 iterations each, are executed by hundreds of threads. We only have built-in 7 dispatch buffers, but there is a need in dozens or hundreds of buffers.
The problem can be fixed by setting `KMP_MAX_DISP_BUF` to bigger value. In order to give users same possibility I changed build-time control into run-time one, adding API just in case.
This change adds an environment variable `KMP_DISP_NUM_BUFFERS` and a new API function `kmp_set_disp_num_buffers(int num_buffers)`.
The `KMP_DISP_NUM_BUFFERS` envirable works only before serial initialization, because during the serial initialization we already allocate buffers for the hot team, so it is too late to change the number of buffers later (or we need to reallocate buffers for all teams which sounds too complicated). The `kmp_set_defaults()` routine does not work for this envirable, because it calls serial initialization before reading the parameter string. So a new routine, `kmp_set_disp_num_buffers()`, is created so that it can set our internal global variable before the library initialization. If both the envirable and API used the envirable wins.
Repository:
rL LLVM
http://reviews.llvm.org/D20697
Files:
runtime/src/dllexports
runtime/src/i18n/en_US.txt
runtime/src/include/41/omp.h.var
runtime/src/include/41/omp_lib.f90.var
runtime/src/include/41/omp_lib.h.var
runtime/src/kmp.h
runtime/src/kmp_csupport.c
runtime/src/kmp_dispatch.cpp
runtime/src/kmp_ftn_entry.h
runtime/src/kmp_ftn_os.h
runtime/src/kmp_global.c
runtime/src/kmp_runtime.c
runtime/src/kmp_settings.c
runtime/src/kmp_stub.c
runtime/test/env/kmp_set_dispatch_buf.c
runtime/test/worksharing/for/kmp_set_dispatch_buf.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20697.58664.patch
Type: text/x-patch
Size: 22458 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20160526/de901df1/attachment-0001.bin>
More information about the Openmp-commits
mailing list