/[escript]/branches/lapack2681/scons/grouptest.py
ViewVC logotype

Annotation of /branches/lapack2681/scons/grouptest.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2682 - (hide annotations)
Fri Sep 25 01:35:55 2009 UTC (10 years, 1 month ago) by jfenwick
File MIME type: text/x-python
File size: 3846 byte(s)
Experimenting with Lapack

1 jfenwick 2266 ########################################################
2     #
3 jfenwick 2548 # Copyright (c) 2003-2009 by University of Queensland
4 jfenwick 2266 # Earth Systems Science Computational Center (ESSCC)
5     # http://www.uq.edu.au/esscc
6     #
7     # Primary Business: Queensland, Australia
8     # Licensed under the Open Software License version 3.0
9     # http://www.opensource.org/licenses/osl-3.0.php
10     #
11     ########################################################
12    
13 jfenwick 2549 __copyright__="""Copyright (c) 2003-2009 by University of Queensland
14 jfenwick 2266 Earth Systems Science Computational Center (ESSCC)
15     http://www.uq.edu.au/esscc
16     Primary Business: Queensland, Australia"""
17     __license__="""Licensed under the Open Software License version 3.0
18     http://www.opensource.org/licenses/osl-3.0.php"""
19 jfenwick 2344 __url__="https://launchpad.net/escript-finley"
20 jfenwick 2266
21    
22    
23     class GroupTest:
24 gross 2502 def __init__(self, exec_cmd, evars, python_dir, working_dir, test_list, single_processor_only=False):
25 jfenwick 2266 self.python_dir=python_dir
26     self.working_dir=working_dir
27     self.test_list=test_list
28     self.exec_cmd=exec_cmd
29     self.evars=evars
30     self.mkdirs=[]
31 gross 2502 self.single_processor_only=single_processor_only
32 jfenwick 2266
33     def makeDir(self,dirname):
34     self.mkdirs.append(dirname)
35    
36 jfenwick 2276 def makeHeader(build_platform):
37 jfenwick 2266 res="#!/bin/bash\n"
38     res=res+"\n#############################################\n"
39     res=res+"# This file is autogenerated by scons.\n"
40     res=res+"# It will be regenerated each time scons is run\n"
41     res=res+"#############################################\n\n"
42     res=res+"function failed()\n{\n echo ""Execution failed for $@""\n exit 1\n}\n"
43 jfenwick 2508 res=res+"if [ $# -ne 1 ]\nthen\n echo Usage: $0 wrapper_options\necho Runs all unit tests. Options must be a single string.\nexit 2\nfi\n"
44 jfenwick 2504 res=res+'CMDSTR="getopt -uq -o p:n: -- $1"\nSTR=`$CMDSTR`\nNUMPROCS=1\n'
45     res=res+'NUMNODES=1\n#This little complication is required because set --\n'
46     res=res+'#does not seem to like -n as the first positional parameter\n'
47     res=res+'STATE=0\nfor name in $STR\ndo \n'
48     res=res+'case $STATE in\n'
49     res=res+' 0) case $name in\n'
50     res=res+' -n) STATE=1;;\n'
51     res=res+' -p) STATE=2;;\n'
52     res=res+' --) break 2;;\n'
53     res=res+' esac;;\n'
54     res=res+' 1) if [ $name == "--" ];then break; fi; NUMNODES=$name; STATE=0;;\n'
55     res=res+' 2) if [ $name == "--" ];then break; fi; NUMPROCS=$name; STATE=0;;\n'
56     res=res+' esac\n'
57     res=res+'done\n'
58     res=res+'let MPIPROD="$NUMPROCS * $NUMNODES"\n'
59 jfenwick 2276 res=res+"\nexport LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH\n"
60     if build_platform=='darwin':
61     res=res+"export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DYLD_LIBRARY_PATH\n"
62 jfenwick 2374 res=res+"\nexport OLD_PYTHON=`pwd`:$PYTHONPATH\nBINRUNNER=\"`pwd`/bin/escript -b $1\"\nPYTHONRUNNER=\"`pwd`/bin/escript $1\"\nBATCH_ROOT=`pwd`\n"
63 jfenwick 2276 res=res+"BUILD_DIR=$BATCH_ROOT/build/"+build_platform
64     res=res+"\nif [ ! -d $BUILD_DIR ]\nthen\n echo Can not find build directory $BUILD_DIR\n exit 2\nfi\n"
65 jfenwick 2374 #res=res+"if [ $# -lt 2 ]\nthen\n echo Usage: $0 bin_run_cmd python_run_cmd\n exit 2\nfi\n"
66 jfenwick 2266 return res
67     makeHeader=staticmethod(makeHeader)
68    
69     def makeString(self):
70     res=""
71 gross 2502 if self.single_processor_only:
72 jfenwick 2504 res+="if [ $MPIPROD -le 1 ]; then\n"
73 gross 2502 tt="\t"
74     else:
75     tt=""
76 jfenwick 2266 for d in self.mkdirs:
77 gross 2502 res=res+tt+"if [ ! -d "+str(d)+" ]\n"+tt+"then\n"+tt+"\tmkdir "+d+"\n"+tt+"fi\n"
78 jfenwick 2266 for v in self.evars:
79 gross 2502 res=res+tt+"export "+str(v[0])+"="+str(v[1])+"\n"
80     if len(self.python_dir)>0:
81     res=res+tt+"export PYTHONPATH="+self.python_dir+":$OLD_PYTHON"+"\n"+tt+"cd "+self.working_dir+"\n"
82     else:
83     res=res+tt+"export PYTHONPATH=$OLD_PYTHON"+"\n"+tt+"cd "+self.working_dir+"\n"
84 jfenwick 2266 for t in self.test_list:
85 gross 2502 res=res+tt+"echo Starting "+t+"\n"
86     res=res+tt+self.exec_cmd+' '+t+' || failed '+t+'\n'
87     res=res+tt+"echo Completed "+t+"\n"
88     if self.single_processor_only:
89     res+="fi\n"
90 jfenwick 2266 res=res+"\n"
91     return res
92    

  ViewVC Help
Powered by ViewVC 1.1.26