Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Build docker in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
saraedum committed Aug 20, 2019
1 parent 155e3ac commit 7c9ea55
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .ci/build-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ docker_build() {
# Docker's --cache-from does not really work with multi-stage builds: https://github.com/moby/moby/issues/34715
# So we just have to rely on the local cache.
time docker build -f docker/Dockerfile \
--build-arg "WITH_PYTHON=${WITH_PYTHON}" --build-arg "MAKEOPTS=${MAKEOPTS}" --build-arg "SAGE_NUM_THREADS=${SAGE_NUM_THREADS}" --build-arg "MAKEOPTS_DOCBUILD=${MAKEOPTS}" --build-arg "SAGE_NUM_THREADS_DOCBUILD=${SAGE_NUM_THREADS_DOCBUILD}" --build-arg ARTIFACT_BASE=$ARTIFACT_BASE $@
--build-arg "WITH_PYTHON=${WITH_PYTHON}" --build-arg "MAKEFLAGS=${MAKEFLAGS}" --build-arg "SAGE_NUM_THREADS=${SAGE_NUM_THREADS}" --build-arg "MAKEFLAGS_DOCBUILD=${MAKEFLAGS}" --build-arg "SAGE_NUM_THREADS_DOCBUILD=${SAGE_NUM_THREADS_DOCBUILD}" --build-arg ARTIFACT_BASE=$ARTIFACT_BASE $@
}

# We use a multi-stage build /docker/Dockerfile. For the caching to be
Expand Down
8 changes: 4 additions & 4 deletions .ci/setup-make-parallelity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# Source this to set CPUTHREADS (the number of apparent cores) and RAMTHREADS
# (free RAM divided by the maximum amount needed per thread typically)
# From this this script infers reasonable defaults for SAGE_NUM_THREADS and
# MAKEOPTS.
# MAKEFLAGS.

# We do exactly the same for CPUTHREADS_DOCBUILD, RAMTHREADS_DOCBUILD,
# SAGE_NUM_THREADS_DOCBUILD, MAKEOPTS_DOCBUILD. As the docbuild needs
# SAGE_NUM_THREADS_DOCBUILD, MAKEFLAGS_DOCBUILD. As the docbuild needs
# substantially more RAM as of May 2018.

# ****************************************************************************
Expand Down Expand Up @@ -61,5 +61,5 @@ else
export SAGE_NUM_THREADS_DOCBUILD=$RAMTHREADS_DOCBUILD
fi
# Set -j and -l for make (though -l is probably ignored by Sage)
export MAKEOPTS="-j $SAGE_NUM_THREADS -l $((CPUTHREADS - 1)).8"
export MAKEOPTS_DOCBUILD="-j $SAGE_NUM_THREADS_DOCBUILD -l $((CPUTHREADS_DOCBUILD - 1)).8"
export MAKEFLAGS="-j $SAGE_NUM_THREADS -l $((CPUTHREADS - 1)).8"
export MAKEFLAGS_DOCBUILD="-j $SAGE_NUM_THREADS_DOCBUILD -l $((CPUTHREADS_DOCBUILD - 1)).8"
2 changes: 1 addition & 1 deletion .ci/test-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ IMAGE="$1"
# Runs $IMAGE with args and check that it terminates with a zero exit code in at most limit seconds.
timed_run() {
START=`date +%s`
docker run -e MAKEOPTS="$MAKEOPTS_DOCBUILD" -e SAGE_NUM_THREADS="$SAGE_NUM_THREADS_DOCBUILD" "$IMAGE" "$2"
docker run -e MAKEFLAGS="$MAKEFLAGS_DOCBUILD" -e SAGE_NUM_THREADS="$SAGE_NUM_THREADS_DOCBUILD" "$IMAGE" "$2"
END=`date +%s`
TOTAL=$((END-START))
echo "Checking whether running \"$2\" was fast…"
Expand Down
2 changes: 1 addition & 1 deletion .circleci/before-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
. .ci/protect-secrets.sh
# Collect debug infos about the system we are running on
.ci/describe-system.sh
# Set MAKEOPTS and SAGE_NUM_THREADS
# Set MAKEFLAGS and SAGE_NUM_THREADS
. .ci/setup-make-parallelity.sh

# Set DOCKER_TAG according to the current branch/tag
Expand Down
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ before_script:
- .ci/describe-system.sh
# Set DOCKER_TAG according to the current branch/tag
- . .ci/update-env.sh
# Set MAKEOPTS and SAGE_NUM_THREADS according to the machine we are running on
# Set MAKEFLAGS and SAGE_NUM_THREADS according to the machine we are running on
- . .ci/setup-make-parallelity.sh

# We use docker-in-docker to build our docker images, i.e., we run a
Expand Down

0 comments on commit 7c9ea55

Please sign in to comment.