Просмотр исходного кода

Compute ncpus if not specified

Vecna 3 недель назад
Родитель
Сommit
5a0141b3d9
2 измененных файлов с 6 добавлено и 8 удалено
  1. 1 7
      run.sh
  2. 5 1
      scripts/generate-lox-results.sh

+ 1 - 7
run.sh

@@ -20,13 +20,6 @@ while [ -n "$1" ]; do
     shift
 done
 
-if [ -z "$ncpus" ]; then
-    ncpus=$(nproc)
-fi
-if [ -z "$cpurange" ]; then
-    cpurange="0-$((ncpus - 1))"
-fi
-
 abort() {
     echo "Step $1 failed."
     echo "To restart from this step, try running:"
@@ -64,6 +57,7 @@ if [[ ! -d parsing-results/lox-old || ! -d parsing-results/lox-new || ! -d parsi
     # Clean up any remnants of previous attempts and try again
     rm -rf parsing-results/{lox-{old,new},troll-patrol}
 
+    # Arguments here may be empty; the generate-lox-results.sh script handles this case
     ./scripts/generate-lox-results.sh -N "$cpurange" -n "$ncpus" || abort "lox-gen"
 fi
 

+ 5 - 1
scripts/generate-lox-results.sh

@@ -15,7 +15,11 @@ while [ -n "$1" ]; do
 done
 
 if [ -z "$ncpus" ]; then
-    ncpus=$(nproc)
+    if [ -z "$cpurange" ]; then
+        ncpus=$(docker run --rm troll-patrol numactl -C $cpurange nproc)
+    else
+        ncpus=$(nproc)
+    fi
 fi
 if [ -z "$cpurange" ]; then
     cpurange="0-$((ncpus - 1))"