~nickpapior/siesta/tddft-work

« back to all changes in this revision

Viewing changes to Tests/test-list.mk

  • Committer: Rafi Ullah
  • Date: 2017-08-30 14:09:10 UTC
  • mfrom: (611.1.19 trunk)
  • Revision ID: rraffiu@gmail.com-20170830140910-bhu0osuh4d59wn8e
Merged with trunk-630

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# test makefile template
 
3
# for creating different tests with different
 
4
# list elements
 
5
#
 
6
# This makefile implements a simplistic way of
 
7
# running a list of elements.
 
8
#
 
9
# The list of elements must be provided in the
 
10
# variable:
 
11
#   LIST
 
12
# while the fdf-flag to be runned should be named
 
13
#   FDF_LIST
 
14
 
 
15
 
 
16
MPI=mpirun -np 2
 
17
SIESTA=../../../siesta
 
18
 
 
19
# Example for BSC runs
 
20
#
 
21
#MPI=mpirun -np 2
 
22
#SIESTA= ../../../siesta
 
23
 
 
24
# Make compatibility layer for old test-runs
 
25
ifeq ($(strip $(firstword $(SIESTA))),mpirun)
 
26
MPI=
 
27
endif
 
28
ifeq ($(strip $(firstword $(SIESTA))),mpiexec)
 
29
MPI=
 
30
endif
 
31
 
 
32
#----------------------------------------------------------------------------
 
33
REFERENCE_DIR?=../../../Tests/Reference
 
34
REFERENCE_CHECKER?=../cmp_digest.sh
 
35
 
 
36
label=work
 
37
 
 
38
 
 
39
.PHONY: completed
 
40
 
 
41
# Create list of jobs
 
42
_JOBS = $(addprefix completed_$(label)_,$(LIST))
 
43
 
 
44
# Create completed jobs target
 
45
completed: $(_JOBS)
 
46
 
 
47
.PHONY: $(_JOBS)
 
48
 
 
49
$(_JOBS): completed_$(label)_%:
 
50
        @echo ">>>> Running $(name)_$* test..."
 
51
        @if [ -d $(label)_$* ] ; then rm -rf $(label)_$* ; fi; mkdir $(label)_$*
 
52
        @if [ -n "$(EXTRAFILES)" ] ; then cp -f $(EXTRAFILES) $(label)_$* ; fi
 
53
        @for i in `cat $(name).pseudos` ; do \
 
54
          echo "    ==> Copying pseudopotential file for $$i..." ;\
 
55
          ln ../Pseudos/$$i.psf $(label)_$*/$$i.psf ;\
 
56
         done
 
57
        @echo "    ==> Running SIESTA as $(MPI) $(SIESTA) -L $(name)_$* -fdf XML.Write -fdf $(FDF_LIST):$* ../$(name).fdf"
 
58
        @(cd $(label)_$* ; $(MPI) $(SIESTA) -L $(name)_$* -fdf XML.Write -fdf $(FDF_LIST):$* ../$(name).fdf 2>&1 > $(name)_$*.out ) \
 
59
          && touch completed_$(label)_$*
 
60
        @if [ -f completed_$(label)_$* ] ; then cp $(label)_$*/$(name)_$*.out $(label)_$*/$(name)_$*.xml .;\
 
61
           echo "    ===> SIESTA finished successfully";\
 
62
         else \
 
63
           echo " **** Test $(name)_$* did not complete successfully";\
 
64
         fi
 
65
 
 
66
check: completed check-only
 
67
 
 
68
# Create list of jobs
 
69
_CHECK_JOBS = $(addprefix check-only-,$(LIST))
 
70
 
 
71
check-only: $(_CHECK_JOBS)
 
72
$(_CHECK_JOBS): check-only-%:
 
73
        @echo "    ==> Running check for system $(name)_$*"
 
74
        @REFERENCE_DIR=$(REFERENCE_DIR) sh $(REFERENCE_CHECKER) $(name)_$*.out
 
75
 
 
76
_CLEAN_JOBS = $(addprefix clean-,$(LIST))
 
77
 
 
78
clean: $(_CLEAN_JOBS)
 
79
$(_CLEAN_JOBS): clean-%:
 
80
        @echo ">>>> Cleaning $(name)_$* test..."
 
81
        rm -rf $(label)_$* completed_$(label)_$* $(name)_$*.out $(name)_$*.xml
 
82