Skip to content

Commit

Permalink
Fix the parallelism and load issues.
Browse files Browse the repository at this point in the history
This is done by using two new environment variables:
+ CI_PARALLELISM, the number of cores available per CI job.
+ CI_LOAD_LIMIT, the maximum authorized load limit (total number of
  cores on the machine).

Both of these are set in the respective /etc/gitlab-runner/config.toml
for each machine, in the `[[runners]]` section. See:
https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runners-section
  • Loading branch information
tcojean committed May 22, 2020
1 parent 23498cb commit 5e32019
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 4 additions & 4 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ stages:
EXTRA_CMAKE_FLAGS: ""

.before_script_template: &default_before_script
- export NUM_CORES=4
- export NUM_CORES=${CI_PARALLELISM}
- export OMP_NUM_THREADS=${NUM_CORES}
- export CUDA_VISIBLE_DEVICES=0

Expand Down Expand Up @@ -58,7 +58,7 @@ stages:
-DGINKGO_BUILD_OMP=${BUILD_OMP} -DGINKGO_BUILD_CUDA=${BUILD_CUDA}
-DGINKGO_BUILD_HIP=${BUILD_HIP}
-DGINKGO_BUILD_TESTS=ON -DGINKGO_BUILD_EXAMPLES=ON
- ninja -j${NUM_CORES} -l `nproc`
- ninja -j${NUM_CORES} -l${CI_LOAD_LIMIT}
dependencies: []
except:
- schedules
Expand All @@ -83,7 +83,7 @@ stages:
-DGINKGO_BUILD_OMP=${BUILD_OMP} -DGINKGO_BUILD_CUDA=${BUILD_CUDA}
-DGINKGO_BUILD_HIP=${BUILD_HIP}
-DGINKGO_BUILD_TESTS=ON -DGINKGO_BUILD_EXAMPLES=ON
- ninja -j${NUM_CORES} -l `nproc` install
- ninja -j${NUM_CORES} -l${CI_LOAD_LIMIT} install
- |
(( $(ctest -N | tail -1 | sed 's/Total Tests: //') != 0 )) || exit 1
- ctest -V
Expand Down Expand Up @@ -864,7 +864,7 @@ fineci-benchmark-build:
-DGINKGO_BUILD_HIP=${BUILD_HIP} \\
-DGINKGO_BUILD_TESTS=OFF -DGINKGO_BUILD_EXAMPLES=OFF \\
-DGINKGO_BUILD_BENCHMARKS=ON
make -j4
make -j${CI_PARALLELISM}
EOT
dependencies: []
only:
Expand Down
8 changes: 6 additions & 2 deletions cmake/CTestScript.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,12 @@ endif()
include(ProcessorCount)
ProcessorCount(PROC_COUNT)
if(NOT PROC_COUNT EQUAL 0)
if (PROC_COUNT GREATER 10)
set(PROCT_COUNT 10)
if (defined ENV{CI_PARALLELISM})
set(PROC_COUNT "$ENV{CI_PARALLELISM}")
elseif(PROC_COUNT LESS 4)
set(PROC_COUNT 1)
else()
set(PROC_COUNT 4)
endif()
if(NOT WIN32)
set(CTEST_BUILD_FLAGS "-j${PROC_COUNT}")
Expand Down

0 comments on commit 5e32019

Please sign in to comment.