Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"The way of the world is to praise dead saints and prosecute live ones." -- Nathaniel Howe


devel / comp.unix.shell / Re: Run multiple make in parallel with appropriate cores settings for each of them.

SubjectAuthor
* Run multiple make in parallel with appropriate cores settings forhongy...@gmail.com
`* Re: Run multiple make in parallel with appropriate cores settings forRichard Harnden
 `- Re: Run multiple make in parallel with appropriate cores settings for each of thKees Nuyt

1
Run multiple make in parallel with appropriate cores settings for each of them.

<af1f6c6e-4586-4f20-99fe-2c072139a747n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5273&group=comp.unix.shell#5273

  copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:a05:6214:c64:b0:449:7011:569d with SMTP id t4-20020a0562140c6400b004497011569dmr14398347qvj.90.1650941408839;
Mon, 25 Apr 2022 19:50:08 -0700 (PDT)
X-Received: by 2002:a05:6214:3006:b0:443:cf1e:58d7 with SMTP id
ke6-20020a056214300600b00443cf1e58d7mr15139715qvb.53.1650941408699; Mon, 25
Apr 2022 19:50:08 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!feeder.erje.net!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Mon, 25 Apr 2022 19:50:08 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=203.175.13.156; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 203.175.13.156
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <af1f6c6e-4586-4f20-99fe-2c072139a747n@googlegroups.com>
Subject: Run multiple make in parallel with appropriate cores settings for
each of them.
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Tue, 26 Apr 2022 02:50:08 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 96
 by: hongy...@gmail.com - Tue, 26 Apr 2022 02:50 UTC

I noticed the BuildPackages.sh [1] script is used by GAP to build the packages supported by it. Because there are so many packages, there is another option in the script to support parallel make. The following code snippet is the relevant logic corresponding to this option implemented in this script:

```
PARALLEL=no
[...]
while [[ "$#" -ge 1 ]]; do
option="$1" ; shift
case "$option" in
[...]
--parallel) PARALLEL=yes; ;;
[...]
esac
done
[...]

if [ "x$PARALLEL" = "xyes" ] && [ "x$STRICT" = "xyes" ]; then
error "The options --strict and --parallel cannot be used simultaneously"
fi

if [ "x$PARALLEL" = "xyes" ]; then
export MAKEFLAGS="${MAKEFLAGS:--j3}"
fi;

[...]

BUILD_PID=$!
if [ "x$PARALLEL" = "xyes" ]; then
# If more than 4 background jobs are running, wait for one to finish (if
# <wait -n> is available) or for all to finish (if only <wait> is available)
if [[ $(jobs -r -p | wc -l) -gt 4 ]]; then
wait -n 2>&1 >/dev/null || wait
fi
else
# wait for this package to finish building
if ! wait $BUILD_PID && [[ $STRICT = yes ]]
then
exit 1
fi
fi;
```
As you can see, by default, the parallel make is disabled, and when the `--parallel` option is used, 3 cores will be assigned to each make process.

I want to enhance this logic and tried the following simple and crude modification [2]:

Add the following line:

NCORE=$(sudo dmidecode -t 4 | grep 'Core Enabled:' | awk '{a+=$NF}END{print a}')

And change the following two lines respectively:

Change
export MAKEFLAGS="${MAKEFLAGS:--j3}"

to

export MAKEFLAGS="${MAKEFLAGS:--j$NCORE}"


Change

if [[ $(jobs -r -p | wc -l) -gt 4 ]]; then
to

if [[ $(jobs -r -p | wc -l) -gt $((NCORE +1)) ]]; then

But the above method has the drawbacks and possibly more feasible alternatives, as commented here [3]:

```
Note that by telling both make and jobs to use that many cores, you are in fact instructing the system to use ~NCORE^2 cores.

One could possibly rearrange things so that a single make job server is shared across all jobs, then it's be "only" 2*NCORE jobs.
```

But I don't know how to implement this or other more powerful and feasible solutions to solve the problems discussed here. Any hints will be highly appreciated.

[1] https://github.com/gap-system/gap/blob/master/bin/BuildPackages.sh
[2] https://github.com/gap-system/gap/pull/4879/commits/f0375b2be81900687e678e2c61a28f6643dffb97
[3] https://github.com/gap-system/gap/pull/4879#discussion_r857318524

Regards,
HZ

Re: Run multiple make in parallel with appropriate cores settings for each of them.

<t48k56$3lg$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5274&group=comp.unix.shell#5274

  copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: richard....@gmail.com (Richard Harnden)
Newsgroups: comp.unix.shell
Subject: Re: Run multiple make in parallel with appropriate cores settings for
each of them.
Date: Tue, 26 Apr 2022 12:13:41 +0100
Organization: A noiseless patient Spider
Lines: 100
Message-ID: <t48k56$3lg$1@dont-email.me>
References: <af1f6c6e-4586-4f20-99fe-2c072139a747n@googlegroups.com>
Reply-To: nospam.harnden@gmail.com
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 26 Apr 2022 11:13:42 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="6575338ee9284d5ba0f400c1680079fe";
logging-data="3760"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/p6eIXODeVthxsFkuKYDIJriAIPNIkp7U="
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0)
Gecko/20100101 Thunderbird/91.8.1
Cancel-Lock: sha1:EmCTWfUOdY17VJrmI4Qi/uA/+oo=
In-Reply-To: <af1f6c6e-4586-4f20-99fe-2c072139a747n@googlegroups.com>
 by: Richard Harnden - Tue, 26 Apr 2022 11:13 UTC

On 26/04/2022 03:50, hongy...@gmail.com wrote:
> I noticed the BuildPackages.sh [1] script is used by GAP to build the packages supported by it. Because there are so many packages, there is another option in the script to support parallel make. The following code snippet is the relevant logic corresponding to this option implemented in this script:
>
> ```
> PARALLEL=no
> [...]
> while [[ "$#" -ge 1 ]]; do
> option="$1" ; shift
> case "$option" in
> [...]
> --parallel) PARALLEL=yes; ;;
> [...]
> esac
> done
> [...]
>
> if [ "x$PARALLEL" = "xyes" ] && [ "x$STRICT" = "xyes" ]; then
> error "The options --strict and --parallel cannot be used simultaneously"
> fi
>
> if [ "x$PARALLEL" = "xyes" ]; then
> export MAKEFLAGS="${MAKEFLAGS:--j3}"
> fi;
>
> [...]

This [...] desends into a subdir and starts the build in the background.

>
> BUILD_PID=$!
> if [ "x$PARALLEL" = "xyes" ]; then
> # If more than 4 background jobs are running, wait for one to finish (if
> # <wait -n> is available) or for all to finish (if only <wait> is available)
> if [[ $(jobs -r -p | wc -l) -gt 4 ]]; then
> wait -n 2>&1 >/dev/null || wait
> fi
> else
> # wait for this package to finish building
> if ! wait $BUILD_PID && [[ $STRICT = yes ]]
> then
> exit 1
> fi
> fi;

So: either wait for each background job in finish if PARALLEL != yes, or
let 4 jobs run at once.

> ```
> As you can see, by default, the parallel make is disabled, and when the `--parallel` option is used, 3 cores will be assigned to each make process.
>
> I want to enhance this logic and tried the following simple and crude modification [2]:

You make everything way too complicated.

I would say that if you want to start 4 build jobs at a time, then you
should reduce -j3 ; not try to increace it. If you do anything at all.

I would just leave it alone. You are trying to add complexity for zero
benefit.

>
> Add the following line:
>
> NCORE=$(sudo dmidecode -t 4 | grep 'Core Enabled:' | awk '{a+=$NF}END{print a}')
>
> And change the following two lines respectively:
>
> Change
> export MAKEFLAGS="${MAKEFLAGS:--j3}"
>
> to
>
> export MAKEFLAGS="${MAKEFLAGS:--j$NCORE}"
>
>
> Change
>
> if [[ $(jobs -r -p | wc -l) -gt 4 ]]; then
>
> to
>
> if [[ $(jobs -r -p | wc -l) -gt $((NCORE +1)) ]]; then
>
> But the above method has the drawbacks and possibly more feasible alternatives, as commented here [3]:
>
> ```
> Note that by telling both make and jobs to use that many cores, you are in fact instructing the system to use ~NCORE^2 cores.
>
> One could possibly rearrange things so that a single make job server is shared across all jobs, then it's be "only" 2*NCORE jobs.
> ```
>
> But I don't know how to implement this or other more powerful and feasible solutions to solve the problems discussed here. Any hints will be highly appreciated.
>
> [1] https://github.com/gap-system/gap/blob/master/bin/BuildPackages.sh
> [2] https://github.com/gap-system/gap/pull/4879/commits/f0375b2be81900687e678e2c61a28f6643dffb97
> [3] https://github.com/gap-system/gap/pull/4879#discussion_r857318524
>
> Regards,
> HZ

Re: Run multiple make in parallel with appropriate cores settings for each of them.

<evnf6hhg30dsjm69p97ou4lkulkh1e4ssu@dim53.demon.nl>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5275&group=comp.unix.shell#5275

  copy link   Newsgroups: comp.unix.shell
From: k.n...@nospam.demon.nl (Kees Nuyt)
Newsgroups: comp.unix.shell
Subject: Re: Run multiple make in parallel with appropriate cores settings for each of them.
Date: Tue, 26 Apr 2022 14:05:25 +0200
Reply-To: k.nuyt@nospam.demon.nl
Message-ID: <evnf6hhg30dsjm69p97ou4lkulkh1e4ssu@dim53.demon.nl>
References: <af1f6c6e-4586-4f20-99fe-2c072139a747n@googlegroups.com> <t48k56$3lg$1@dont-email.me>
User-Agent: ForteAgent/7.10.32.1214
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Organization: KPN B.V.
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!feeder1.feed.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr2.eu1.usenetexpress.com!94.232.112.246.MISMATCH!abe006.abavia.com!abp003.abavia.com!news.kpn.nl!not-for-mail
Lines: 15
Injection-Date: Tue, 26 Apr 2022 14:05:25 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
 by: Kees Nuyt - Tue, 26 Apr 2022 12:05 UTC

On Tue, 26 Apr 2022 12:13:41 +0100, Richard Harnden
<richard.nospam@gmail.com> wrote:

> You make everything way too complicated.
>
> I would say that if you want to start 4 build jobs at a time, then you
> should reduce -j3 ; not try to increace it. If you do anything at all.
>
> I would just leave it alone. You are trying to add complexity for zero
> benefit.

+1
--
Kees Nuyt

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor