From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by sourceware.org (Postfix) with ESMTPS id C0C613858D1E for ; Thu, 13 Jul 2023 16:13:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C0C613858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-3fbc54cab6fso8364225e9.0 for ; Thu, 13 Jul 2023 09:13:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689264820; x=1691856820; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=H8Kwq4efKhjYfoVsTEveklM7sb+JHT4ySPOxe5J0Gz0=; b=ejmlOdNVJPXNDFS9PsMYfchIyS/XeAr9Zu+TGNKPW5foQdeJLgTavcxJrEpZawS7yu s30ntRbse9DGrW2Fipfy3nTUAvs9jgGw07O0wil5MIH1j8Nlvqy2OVUyZ+JndlNTurLp YW2yPJ7MNLQtlw17Z8/9aE6iIBR8kexwlYK7g3+fkU0eaKG+soN0Ar1vm6fReCkZr036 dpOTZSr1PPp8n35NmoQuiUJ9EFLXpl3S68UrxnkZDPjdbOgw6UV9U0ol4WooiZmbKWPh PK8JWUINo40Lclq4wC2K6hvjrqzLitx3BkLI3SHredsAbw0xiRnJ5mb4rmjOD7hCR3hH uKHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689264820; x=1691856820; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=H8Kwq4efKhjYfoVsTEveklM7sb+JHT4ySPOxe5J0Gz0=; b=Ommo1e1wNYNNtA59BrqVTvcuOdp1vi4Agww5w0b2s/lpjYU4zeWF7EXvKUpwIPe60b kxQqALp5zSN+6UlFmlO6ExuiBBlHN2ScsYrjrhL5geetBRgQHKDiqT0xTNA0O91yyvy2 jLpAKGQfK71FvfkWyoR7lWQOCu+C5Bjv0UfT4wk3sYP1DRs3P1pZAFkxB13mD23shRgL 4rl9JfhImsIg2gQZPaSMR/E4qmx97tc2gtW2R8pP1Rfmr025yd23nRs+SfOoZN3u/Hmh kR4TtUEkOLZR8BCH+LPOI8DloamHcqI0A6vTS/ZxjDNiPts4xEboDJEREB4YMIl9Cc+j S6Dw== X-Gm-Message-State: ABy/qLbBFJCg/ErsLN/YG/iKhgLs/H8idxSagCSvQ9mlEsTQYI0GoWrl F8uzo1GJXiNPiYJRdX/dzaOwg0vh09mN/vFMHJSQzA== X-Google-Smtp-Source: APBJJlH3ohFZ3yilMXp9EbTWND5I06XAwD9D5xJ6IL5SpnLacHcw05CbrK9ndCqobMdU7QMJ/Df7f1rWj3vBG0j2ltA= X-Received: by 2002:a5d:63c9:0:b0:314:c9c:bc96 with SMTP id c9-20020a5d63c9000000b003140c9cbc96mr1715082wrw.7.1689264820358; Thu, 13 Jul 2023 09:13:40 -0700 (PDT) MIME-Version: 1.0 References: <34fce57b-69a0-a9fd-f8ff-671ee7f94227@codesourcery.com> <5b66591e-6af2-7219-acfc-640aeffad0b0@codesourcery.com> In-Reply-To: <5b66591e-6af2-7219-acfc-640aeffad0b0@codesourcery.com> From: Prathamesh Kulkarni Date: Thu, 13 Jul 2023 21:43:04 +0530 Message-ID: Subject: Re: [Patch] libgomp: Use libnuma for OpenMP's partition=nearest allocation trait To: Tobias Burnus Cc: gcc-patches , Jakub Jelinek Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, 12 Jul 2023 at 17:35, Tobias Burnus wrote= : > > Now committed as r14-2462-g450b05ce54d3f0. Hi Tobias, The newly added tests in above commit -- alloc-11.c and alloc-12.c seem to fail during execution on armv8l-unknown-linux-gnueabihf: Running libgomp:libgomp.c++/c++.exp ... FAIL: libgomp.c++/../libgomp.c-c++-common/alloc-11.c execution test FAIL: libgomp.c++/../libgomp.c-c++-common/alloc-12.c execution test Running libgomp:libgomp.c/c.exp ... FAIL: libgomp.c/../libgomp.c-c++-common/alloc-11.c execution test FAIL: libgomp.c/../libgomp.c-c++-common/alloc-12.c execution test Could you please investigate ? Thanks, Prathamesh > > Changes to the patch in previous email: > * I fixed some issues found on the way, > * The wording in the .texi has been improved/expanded, and > * I included two testcases to exercise the two libraries (or > the default allocator when it is not available at runtime). > > Given that the default allocation already works fine (nearest) > and the normal "malloc" is more economic in terms of memory > handling (not multiples of page size or requesting a fixed > pool size), I was wondering whether this patch is really needed. > > But at the end: default can be changed (cf. below) and given > the user the choice makes sense. The manual states what GCC does > which should help to make a conscious choice. > > * * * > > I did experiment with the testcase attached to previous email > plus using dlopen to obtain the functions from libnuma if available. > > It was also using: > /* { dg-do run { target { dlopen } } } */ > /* { dg-additional-options "-ldl" } */ > > However, the Linux kernel too often placed the allocated memory > on the "wrong" node to be usable as a testcase. I did get be > 0 to 15 misplaced allocations, depending on the run. > > Hence, there is no such testcase. Using numactrl --preferred=3D1 I > could force the normal allocation to (mostly) use node 1 for > allocations such that the difference between partiton =3D default/environ= ment > vs. partition =3D nearest was clearly visible. Hence it does work. > > Otherwise, the same applies as I wrote the yesterday: > > On 11.07.23 12:35, Tobias Burnus wrote: > > > While by default 'malloc' allocates memory on the same node as the > > calling > > process/thread ('numactl --show' shows 'preferred node: current', > > Linux kernel memory policy MPOL_DEFAULT), this can be changed. > > For instance, when running the program as follows, 'malloc' now > > prefers to allocate on the second node: > > numactl --preferred=3D1 ./myproc > > > > Thus, it seems to be sensible to provide a means to ensure the 'nearest= ' > > allocation. The MPOL_LOCAL policy does so, as provided by > > libnuma's numa_alloc_local. (Which is just wrapper around the syscalls > > mmap and mbind.) As with (lib)memkind, there is a run-time dlopen check > > for (lib)numa - and no numa*.h is required when bulding GCC. > ----------------- > Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstra=C3=9Fe 2= 01, 80634 M=C3=BCnchen; Gesellschaft mit beschr=C3=A4nkter Haftung; Gesch= =C3=A4ftsf=C3=BChrer: Thomas Heurung, Frank Th=C3=BCrauf; Sitz der Gesellsc= haft: M=C3=BCnchen; Registergericht M=C3=BCnchen, HRB 106955