From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26848 invoked by alias); 11 Oct 2013 20:03:56 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 26782 invoked by uid 48); 11 Oct 2013 20:03:51 -0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libgomp/58691] New: OpenMP 4: Surprising results with OMP_PLACES= Date: Fri, 11 Oct 2013 20:03:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libgomp X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-10/txt/msg00641.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58691 Bug ID: 58691 Summary: OpenMP 4: Surprising results with OMP_PLACES= Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libgomp Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org CC: jakub at gcc dot gnu.org I played around with OMP_PLACES and noticed the following oddness: First, create some OpenMP program: $ echo "end" > test.f90; gfortran -fopenmp test.f90 Using "threads", "cores" or "sockets", one gets a places result: $ OMP_PLACES='threads' OMP_DISPLAY_ENV=verbose ./a.out 2>&1 |grep OMP_PLACES OMP_PLACES = '{0},{1},{2},{3}' However, if one specifies a numerical value, one doesn't: $ OMP_PLACES='{0:2}' OMP_DISPLAY_ENV=verbose ./a.out 2>&1 |grep OMP_PLACES OMP_PLACES = '' The reason - as it turns out - is that one has in libgomp/env.c the following code: parse_places_var (const char *name) { ... if (strncasecmp (env, "threads", 7) == 0) { env += 7; level = 1; } ... if (level) { ... return gomp_affinity_init_level (level, count, false); } ... if (gomp_global_icv.bind_var == omp_proc_bind_false) return false; gomp_places_list_len = 0; gomp_places_list = gomp_affinity_alloc (count, false); Namely: If OMP_PROC_BIND is FALSE, which is the default, the affinity does not get set. * * * I think in terms of the OpenMP spec, everything is implementation defined. Nonetheless, the following should match common expectations: * Both ways of setting OMP_PLACES should act identically. * If the user has set OMP_PLACES, the default of OMP_PROC_BIND should change to TRUE. * If the user has explicitly set OMP_PROC_BIND=FALSE, OMP_PLACES should be ignored. * Probably, a few words in libgomp.text's OMP_PROC_BIND or OMP_PLACES to the interaction of the two wouldn't harm either.