[Openmp-dev] [EXTERNAL] Behavior of OMP_PROC_BIND=true

Churbanov, Andrey via Openmp-dev openmp-dev at lists.llvm.org
Wed Jul 8 01:22:34 PDT 2020


The specification requires omp_get_proc_bind() to return the thread affinity policy to be used for parallel regions.
Though TRUE is among allowed return values, it is actually not a policy but rather enabling of some policy the runtime applies to threads binding.
So returning SPREAD looks more reasonable to me in this case.  If we would return TRUE users will never know what policy the runtime is actually using. 

Returning TRUE means for me:
- implementation wants to apply some thread affinity policy, other than standard MASTER, SPREAD or CLOSE;
- implementation does not want to bother with inventing a name for the policy;
- and/or implementation does not want to show any details of the policy to users.

I don't think that hiding details from user is a good behavior.
Though it may be possible that gcc has documentation with detailed description of the runtime behavior for OMP_PROC_BIND=true, I haven't checked.
Once we return SPREAD - the standard policy, we don't need to add any extra documentation.

-- Andrey

-----Original Message-----
From: Openmp-dev <openmp-dev-bounces at lists.llvm.org> On Behalf Of Doerfert, Johannes via Openmp-dev
Sent: Wednesday, July 8, 2020 2:09 AM
To: Lewis, Cannada <canlewi at sandia.gov>
Cc: openmp-dev at lists.llvm.org
Subject: Re: [Openmp-dev] [EXTERNAL] Behavior of OMP_PROC_BIND=true

On 7/7/20 5:54 PM, Lewis, Cannada wrote:
> I found where my confusion was coming from, but I would like clarification that omp_get_proc_bind is doing the right thing:
>
> At line 5473 in kmp_settings.cpp
>
>      } else if (__kmp_nested_proc_bind.bind_types[0] == proc_bind_true) {
>        // OMP_PROC_BIND=true maps to OMP_PROC_BIND=spread.
>        __kmp_nested_proc_bind.bind_types[0] = proc_bind_spread;
>      }
>
> Even if libomp uses spread internally for the case of OMP_PROC_BIND=true shouldn’t omp_get_proc_bind still report that the value true was provided instead of the value for spread?

I can see that we might want to do that but is it really more helpful?


~ Johannes


>
> -Drew
>
> On Jul 6, 2020, at 2:13 PM, Lewis, Cannada via Openmp-dev <openmp-dev at lists.llvm.org<mailto:openmp-dev at lists.llvm.org>> wrote:
>
> I am writing to figure out what is the expected result from get_omp_proc_bind when the environmental variable OMP_PROC_BIND is true.  Based on https://www.openmp.org/spec-html/5.0/openmpse52.html I was expecting the result to be 1, which is what I get when using g++ version 9.2, but for clang++ I get 4, which is the same as spread.  Any help would be appreciated since I am trying to match up results from an app compiled with clang and a performance model that currently returns 1 for get_omp_proc_bind when OMP_PROC_BIND=true.
>
> -Drew
> _______________________________________________
> Openmp-dev mailing list
> Openmp-dev at lists.llvm.org<mailto:Openmp-dev at lists.llvm.org>
> https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev
>

_______________________________________________
Openmp-dev mailing list
Openmp-dev at lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev

--------------------------------------------------------------------
Joint Stock Company Intel A/O
Registered legal address: Krylatsky Hills Business Park,
17 Krylatskaya Str., Bldg 4, Moscow 121614,
Russian Federation

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


More information about the Openmp-dev mailing list