habanero-rice / hclib

A C/C++ task-based programming model for shared memory and distributed parallel computing.
http://habanero-rice.github.io/hclib/
BSD 3-Clause "New" or "Revised" License
71 stars 35 forks source link

Restore fixed worker pool strategy #58

Closed DaoWen closed 5 years ago

DaoWen commented 7 years ago

This patch re-enables the option of using the original worker strategy with a fixed pool of thread contexts (no fibers). This option can be useful for debugging, performance profiling, and as a way to avoid overheads introduced by fibers when an application uses a compatible subset of the API.

Note that the different strategies now use C conditionals rather than preprocessor conditionals to select the strategy. This allows us to support either run-time selection (for debugging) or compile-time selection (for production) of different thread strategies. I think removing most of the preprocessor #ifs has also made the code more readable and maintainable. When the strategy is selected statically, the compiler should remove all of the dead branches for the unused strategies, with a result very similar to the version using preprocessor conditionals.

A simple python script is included to make it easier to select a desired set of worker context options when building the runtime (if set statically for production mode) or when launching a program (if set dynamically for debug mode). There are a few placeholders for the HCLIB_WORKER_STRATEGY_THREADS strategy, which will be added in a follow-on patch. Another follow-on patch will update our Travis configuration to run our regression tests against a matrix of worker-context configurations.

vivkumar commented 7 years ago

Good to see that this option is not ripped out. I think this will be very useful while taking performance numbers where we want to limit HClib overheads to the minimal.

On May 25, 2017, at 8:01 PM, Nick Vrvilo notifications@github.com wrote:

This patch re-enables the option of using the original worker strategy with a fixed pool of thread contexts (no fibers). This option can be useful for debugging, performance profiling, and as a way to avoid overheads introduced by fibers when an application uses a compatible subset of the API.

Note that the different strategies now use C conditionals rather than preprocessor conditionals to select the strategy. This allows us to support either run-time selection (for debugging) or compile-time selection (for production) of different thread strategies. I think removing most of the preprocessor #ifs has also made the code more readable and maintainable. When the strategy is selected statically, the compiler should remove all of the dead branches for the unused strategies, with a result very similar to the version using preprocessor conditionals.

A simple python script is included to make it easier to select a desired set of worker context options when building the runtime (if set statically for production mode) or at run-time (if set dynamically for debug mode). There are a few placeholders for the HCLIB_WORKER_STRATEGY_THREADS, which will be added in a follow-on patch. Another follow-on patch will update our Travis configuration to run our regression tests against a matrix of worker-context configurations.

You can view, comment on, or merge this pull request online at:

https://github.com/habanero-rice/hclib/pull/58 https://github.com/habanero-rice/hclib/pull/58 Commit Summary

Restore fixed worker pool strategy File Changes

M Makefile.am https://github.com/habanero-rice/hclib/pull/58/files#diff-0 (2) M inc/hclib-rt.h https://github.com/habanero-rice/hclib/pull/58/files#diff-1 (6) A inc/hclib-worker-config.h https://github.com/habanero-rice/hclib/pull/58/files#diff-2 (108) M inc/hclib_common.h https://github.com/habanero-rice/hclib/pull/58/files#diff-3 (4) M install.sh https://github.com/habanero-rice/hclib/pull/58/files#diff-4 (2) A scripts/hclib-options https://github.com/habanero-rice/hclib/pull/58/files#diff-5 (129) M src/hclib-runtime.c https://github.com/habanero-rice/hclib/pull/58/files#diff-6 (304) M src/inc/hclib-finish.h https://github.com/habanero-rice/hclib/pull/58/files#diff-7 (2) M src/inc/hclib-internal.h https://github.com/habanero-rice/hclib/pull/58/files#diff-8 (1) Patch Links:

https://github.com/habanero-rice/hclib/pull/58.patch https://github.com/habanero-rice/hclib/pull/58.patch https://github.com/habanero-rice/hclib/pull/58.diff https://github.com/habanero-rice/hclib/pull/58.diff — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/habanero-rice/hclib/pull/58, or mute the thread https://github.com/notifications/unsubscribe-auth/AM-6ZmDRft_sFCNrP7-xElDWULHC6Q0vks5r9ZDHgaJpZM4NmdCV.

agrippa commented 7 years ago

If you can tell me how to build this branch with the config you expect to perform the best, i can compare it against master with the micro-benchmarking suite.