[AMBER] [PATCH 7/8] AmberTools: Fix parallel tests

From: Reinis Danne <gam4rei.gmail.com>
Date: Tue, 23 Oct 2012 01:15:00 +0300

From: Reinis Danne <rei4dan.gmail.com>

Most of the tests are independent and could be run in parallel if make
is given option -j with number of parallel jobs to use.

This change consists of three parts:
- Treat ./test_at_serial.sh as makefile by marking it with '+' so that
  recursive instances of make would communicate and pass around all
  necessary information for parallel runs.
- Don't clean tests at the beginning of test run. Otherwise some of the
  files will disappear while tests are running and it will lead to
  errors. This also implies that make clean has to be called manually
  before repeated test runs.
- Mark nab tests as .NOTPARALLEL, because not all of them use unique
  executable name for programs they are compiling in the same directory.
  They probably should use the name of the test to make sure they are
  not modifying each others files and then they could be run in
  parallel.

There are other possibilities for test parallelization, e.g., some of
the tests are run as recipes of the same target and thus can't be run
in parallel. They should be split up in different targets.

Note: If OpenMP is enabled one would want to set OMP_NUM_THREADS to a
reasonable value for optimal performance when multiple tests are
executed at once. By default OpenMP starts equal number of threads to
the number of CPUs in the machine, limiting it to a fraction of it when
similar number of tests are running in parallel will result in greater
overall performance. It is best to consider only the number of physical
cores when deciding on number of jobs to use.

On Linux one can use the following command in bash to get the number of
physical cores:
$ ncpus=$(grep "^core id" /proc/cpuinfo | sort -u | wc -l)

And then set number of OMP threads:
$ export OMP_NUM_THREADS=$((1+${ncpus}/2))

With these changes more than a half is cut off the time required to run
serial (and OpenMP) tests.
---
 AmberTools/test/Makefile     | 4 ++--
 AmberTools/test/nab/Makefile | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/AmberTools/test/Makefile b/AmberTools/test/Makefile
index 27afe24..4796250 100644
--- a/AmberTools/test/Makefile
+++ b/AmberTools/test/Makefile
.. -3,14 +3,14 .. include ../src/config.h
 ######    Top-level targets, for general use:    ############################
 
 test:
-	./test_at_serial.sh
+	+./test_at_serial.sh
 
 test.parallel:
 	./test_at_parallel.sh
 
 ######    Intermediate-level targets:    ############################
 
-test.serial: clean is_amberhome_defined \
+test.serial: is_amberhome_defined \
 	test.nab test.ptraj test.cpptraj test.antechamber \
 	test.leap test.resp test.pbsa test.mmpbsa test.parmed \
 	test.ambpdb test.elsize test.chamber test.sqm test.rism1d \
diff --git a/AmberTools/test/nab/Makefile b/AmberTools/test/nab/Makefile
index 1bb2505..7459a15 100644
--- a/AmberTools/test/nab/Makefile
+++ b/AmberTools/test/nab/Makefile
.. -12,6 +12,8 .. testrism:  \
 	rism_ion-noasymp rism_ion_pse1 rism_ion_pse3 rism_mdiis0 rism_mdiis1 \
 	rism_sp rism_sp2
 
+.NOTPARALLEL:
+
 duplex_test::
 	../Run.duplex
 
-- 
1.7.12.4
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Mon Oct 22 2012 - 15:30:10 PDT
Custom Search