[ET Trac] #1775: Add Boost to ET
Roland Haas
trac-noreply at einsteintoolkit.org
Wed Apr 1 11:51:52 CDT 2026
#1775: Add Boost to ET
Reporter: Erik Schnetter
Status: new
Milestone: ET_2026_05
Version: development version
Type: enhancement
Priority: minor
Component: EinsteinToolkit thorn
Comment (by Roland Haas):
It is possible to interact with make's parallel build system (somewhat): https://www.gnu.org/software/make/manual/html_node/POSIX-Jobserver.html (note that Cactus requires GNU make).
```
#!/bin/bash
# fail on errors, error on unset variable reference
set -u -e
# verobse output?
if [ ${VERBOSE-no} = yes ]; then
set -x
fi
# handle -n option to make (do nothing), since make thinks we are a sub-make
set -- $MAKEFLAGS
if [[ ${#*} -ge 1 ]] && [[ $1 = *n* ]]; then # -n flag passed to make, do nothing
exit 0
fi
# parse remaining make arguments
MAX_JOBS=1
JOBSERVER_AUTH=
for o in "$@"; do
case $o in
( --jobserver-auth=* )
JOBSERVER_AUTH=${o#--jobserver-auth=}
;;
( -j* )
MAX_JOBS=${o#-j*}
;;
( -- )
break
;;
esac
done
# functions to get some job tokens from make
function return_tokens() {
local JOBSERVER_FILE=
if [ -n "$JOBSERVER_AUTH" ] && [ -n "$JOBSERVER_TOKENS" ]; then
case $JOBSERVER_AUTH in
( fifo:* )
JOBSERVER_FILE=${JOBSERVER_AUTH#fifo:}
;;
( *,* )
# /dev/fd/ emulated by bash (if not by the OS)
JOBSERVER_FILE=/dev/fd/${JOBSERVER_AUTH#*,} # read handle of pipe
;;
esac
if [ -n "$JOBSERVER_FILE" ]; then
echo -n $JOBSERVER_TOKENS >$JOBSERVER_FILE
fi
fi
}
function maybe_get_tokens() {
local JOBSERVER_FILE=
if [ -n "$JOBSERVER_AUTH" ]; then
case $JOBSERVER_AUTH in
( fifo:* )
JOBSERVER_FILE=${JOBSERVER_AUTH#fifo:}
;;
( *,* )
# /dev/fd/ emulated by bash (if not by the OS)
JOBSERVER_FILE=/dev/fd/${JOBSERVER_AUTH#%,*} # write handle of pipe
;;
esac
if [ -n "$JOBSERVER_FILE" ]; then
set +e # read sets error code on timeout, which is not an error
read -r -N $MAX_JOBS -t 5 JOBSERVER_TOKENS <$JOBSERVER_FILE
set -e
fi
fi
}
if [ -n "$MAX_JOBS" ]; then
JOBSERVER_TOKENS=
# wait for 5 seconds to get up MAX_JOBS tokens (or 1024 if MAX_JOBS is empty)
trap return_tokens EXIT
maybe_get_tokens
# one job is for "free" since it represents this process
JOBS_OPT=-j$(( ${#JOBSERVER_TOKENS} + 1 ))
else # no maximum
JOBS_OPT=-j
fi
echo $JOBS_OPT tokens: ${JOBSERVER_TOKENS:-}
```
when declaring the script above a sub-make to make using:
```
all:
+ at ./bjam-test.sh
```
which then produces:
```
haengie2: ~/.../Boost/dist$ make -j5 -f GNUMakefile all
-j5 tokens: ++++
haengie2: ~/.../Boost/dist$ make -j1 -f GNUMakefile all
-j1 tokens:
haengie2: ~/.../Boost/dist$ make -j -f GNUMakefile all
-j tokens:
haengie2: ~/.../Boost/dist$ make -f GNUMakefile all
-j1 tokens:
```
ie constructs a `-j` option for bjam reflection (a subset of) the jobs available to make.
As for tar file size, the best I can do right now is to remove Boost examples, docs, tests etc. then re-compress with `gzip`'s `--rsyncable` option for a ~30MB file size which git can hopefully diff:
```
#!/bin/bash
# this script removes "extra" files from Boost distribution archive to try and
# reduce its size. It creates a new zipped archive that may be diff-able for git.
if [ ${#@} -ne 1 ]; then
echo >&2 "usage: $0 <tar-file>"
exit 1
fi
set -e
FN="$1"
TEMPDIR=`mktemp -d`
function cleanup() {
rm -r $TEMPDIR
}
trap cleanup EXIT
tar -xf "$FN" -C $TEMPDIR
find $TEMPDIR -depth '(' -name examples -or -name doc -or -name test ')' -print0 | xargs --null rm -r
# use gzip's --rsyncable option in hopes that this will let git diff versions
# of the tar archive
( cd $TEMPDIR ; tar -c * ) | gzip --rsyncable >${FN%.tar*}-stripped.tar.gz
```
--
Ticket URL: https://bitbucket.org/einsteintoolkit/tickets/issues/1775/add-boost-to-et
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.einsteintoolkit.org/pipermail/trac/attachments/20260401/b03e2a28/attachment.htm>
More information about the Trac
mailing list