40 |
res=res+"# It will be regenerated each time scons is run\n" |
res=res+"# It will be regenerated each time scons is run\n" |
41 |
res=res+"#############################################\n\n" |
res=res+"#############################################\n\n" |
42 |
res=res+"function failed()\n{\n echo ""Execution failed for $@""\n exit 1\n}\n" |
res=res+"function failed()\n{\n echo ""Execution failed for $@""\n exit 1\n}\n" |
43 |
|
res=res+'CMDSTR="getopt -uq -o p:n: -- $1"\nSTR=`$CMDSTR`\nNUMPROCS=1\n' |
44 |
|
res=res+'NUMNODES=1\n#This little complication is required because set --\n' |
45 |
|
res=res+'#does not seem to like -n as the first positional parameter\n' |
46 |
|
res=res+'STATE=0\nfor name in $STR\ndo \n' |
47 |
|
res=res+'case $STATE in\n' |
48 |
|
res=res+' 0) case $name in\n' |
49 |
|
res=res+' -n) STATE=1;;\n' |
50 |
|
res=res+' -p) STATE=2;;\n' |
51 |
|
res=res+' --) break 2;;\n' |
52 |
|
res=res+' esac;;\n' |
53 |
|
res=res+' 1) if [ $name == "--" ];then break; fi; NUMNODES=$name; STATE=0;;\n' |
54 |
|
res=res+' 2) if [ $name == "--" ];then break; fi; NUMPROCS=$name; STATE=0;;\n' |
55 |
|
res=res+' esac\n' |
56 |
|
res=res+'done\n' |
57 |
|
res=res+'let MPIPROD="$NUMPROCS * $NUMNODES"\n' |
58 |
res=res+"\nexport LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH\n" |
res=res+"\nexport LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH\n" |
59 |
if build_platform=='darwin': |
if build_platform=='darwin': |
60 |
res=res+"export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DYLD_LIBRARY_PATH\n" |
res=res+"export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DYLD_LIBRARY_PATH\n" |
69 |
def makeString(self): |
def makeString(self): |
70 |
res="" |
res="" |
71 |
if self.single_processor_only: |
if self.single_processor_only: |
72 |
res+="if [ ( $ESCRIPT_NUM_NODES * $ESCRIPT_NUM_PROCS ) -le 1 ]; then\n" |
res+="if [ $MPIPROD -le 1 ]; then\n" |
73 |
tt="\t" |
tt="\t" |
74 |
else: |
else: |
75 |
tt="" |
tt="" |