From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11349 invoked by alias); 12 Apr 2007 18:18:16 -0000 Received: (qmail 11341 invoked by uid 22791); 12 Apr 2007 18:18:16 -0000 X-Spam-Check-By: sourceware.org Received: from ik-out-1112.google.com (HELO ik-out-1112.google.com) (66.249.90.181) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 12 Apr 2007 19:18:11 +0100 Received: by ik-out-1112.google.com with SMTP id c28so601092ika for ; Thu, 12 Apr 2007 11:18:08 -0700 (PDT) Received: by 10.78.83.15 with SMTP id g15mr482168hub.1176401888594; Thu, 12 Apr 2007 11:18:08 -0700 (PDT) Received: from e177100129.adsl.alicedsl.de ( [85.177.100.129]) by mx.google.com with ESMTP id j2sm626690mue.2007.04.12.11.18.06; Thu, 12 Apr 2007 11:18:07 -0700 (PDT) From: Daniel Franke To: gcc-patches@gcc.gnu.org Subject: Re: [gomp] GOMP_CPU_AFFINITY support Date: Thu, 12 Apr 2007 18:43:00 -0000 User-Agent: KMail/1.9.6 Cc: Brooks Moses , Jakub Jelinek References: <20070404155436.GJ355@devserv.devel.redhat.com> <200704120000.14277.franke.daniel@gmail.com> <461DBB05.2040704@codesourcery.com> In-Reply-To: <461DBB05.2040704@codesourcery.com> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_FfnHG4OQUQuiEtf" Message-Id: <200704122017.41698.franke.daniel@gmail.com> X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2007-04/txt/msg00713.txt.bz2 --Boundary-00=_FfnHG4OQUQuiEtf Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 726 On Thursday 12 April 2007 06:52:21 Brooks Moses wrote: Brooks, thanks for your helpful comments, I applied them as suggested. > > +list. @code{GOMP_CPU_AFFINITY=0} binds all threads to CPU 0. > > Giving examples like this is definitely a good thing; well done! (I > would put the simple example first, though.) > I do want to point out that I don't think the quantity of virtual red > ink I just applied to this is any reflection on the quality -- it looks > well-written and clear to me! :) Thank you very much, but your praise has to go to Jakub. Most of this was based on his explanation given when he first proposed the patch last year :) Please find an updated version of the patch attached. Regards Daniel --Boundary-00=_FfnHG4OQUQuiEtf Content-Type: text/x-diff; charset="iso-8859-1"; name="libgomp.texi.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="libgomp.texi.diff" Content-length: 1759 Index: libgomp.texi =================================================================== --- libgomp.texi (revision 123524) +++ libgomp.texi (working copy) @@ -895,14 +895,25 @@ @cindex Environment Variable @table @asis @item @emph{Description}: -A patch for this extension has been submitted, but was not yet applied at the -time of writing. +Binds threads to specific CPUs. The variable should contain a space- or +comma-separated list of CPUs. This list may contain different kind of +entries: either single CPU numbers in any order, a range of CPUs (M-N) +or a range with some stride (M-N:S). CPU numbers are zero based. For example, +@code{GOMP_CPU_AFFINITY="0 3 1-2 4-15:2"} will bind the initial thread +to CPU 0, the second to CPU 3, the third to CPU 1, the fourth to +CPU 2, the fifth to CPU 4, the sixth through tenth to CPUs 6, 8, 10, 12, +and 14 respectively and then start assigning back from the beginning of +the list. @code{GOMP_CPU_AFFINITY=0} binds all threads to CPU 0. -@item @emph{Reference}: -@uref{http://gcc.gnu.org/ml/gcc-patches/2006-05/msg00982.html, -GCC Patches Mailinglist} -@uref{http://gcc.gnu.org/ml/gcc-patches/2006-05/msg01133.html, -GCC Patches Mailinglist} +There is no GNU OpenMP library routine to determine whether a CPU affinity +specification is in effect. As a workaround, language-specific library +functions, e.g., @code{getenv} in C or @code{GET_ENVIRONMENT_VARIABLE} in +Fortran, may be used to query the setting of the @code{GOMP_CPU_AFFINITY} +environment variable. A defined CPU affinity on startup cannot be changed +or disabled during the runtime of the application. + +If this environment variable is omitted, the host system will handle the +assignment of threads to CPUs. @end table --Boundary-00=_FfnHG4OQUQuiEtf--