Added an option to bind initial thread at the start of application

via setting envirable KMP_INITIAL_THREAD_BIND=1.

Differential Revision: https://reviews.llvm.org/D29665

llvm-svn: 295339
This commit is contained in:
Andrey Churbanov 2017-02-16 17:08:40 +00:00
parent 85d758299e
commit ad3f63986d
1 changed files with 8 additions and 3 deletions

View File

@ -46,10 +46,15 @@
void
__kmpc_begin(ident_t *loc, kmp_int32 flags)
{
// By default __kmp_ignore_mppbeg() returns TRUE.
if (__kmp_ignore_mppbeg() == FALSE) {
// By default __kmpc_begin() is no-op.
char *env;
if ((env = getenv( "KMP_INITIAL_THREAD_BIND" )) != NULL &&
__kmp_str_match_true( env )) {
__kmp_middle_initialize();
KC_TRACE(10, ("__kmpc_begin: middle initialization called\n" ));
} else if (__kmp_ignore_mppbeg() == FALSE) {
// By default __kmp_ignore_mppbeg() returns TRUE.
__kmp_internal_begin();
KC_TRACE( 10, ("__kmpc_begin: called\n" ) );
}
}