00001 """
00002 define a dict of Option objects for the option parser to use
00003 """
00004
00005 __copyright__ = """
00006 Copyright 2008 Sean Ross-Ross
00007 """
00008 __license__ = """
00009 This file is part of SLIMpy .
00010
00011 SLIMpy is free software: you can redistribute it and/or modify
00012 it under the terms of the GNU Lesser General Public License as published by
00013 the Free Software Foundation, either version 3 of the License, or
00014 (at your option) any later version.
00015
00016 SLIMpy is distributed in the hope that it will be useful,
00017 but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00019 GNU Lesser General Public License for more details.
00020
00021 You should have received a copy of the GNU Lesser General Public License
00022 along with SLIMpy . If not, see <http://www.gnu.org/licenses/>.
00023 """
00024
00025
00026 from optparse import Option
00027
00028 from slimpy_base.setup.option_callbacks import builder_callback
00029 from slimpy_base.setup.option_callbacks import runner_callback
00030 from slimpy_base.setup.option_callbacks import optest
00031 from slimpy_base.setup.option_callbacks import opts_callback
00032
00033
00034
00035 options = dict(
00036
00037
00038 verbose=Option( "-v", "--verbose",
00039 metavar="VERB",
00040 dest="verbose",
00041
00042 help="print various outputs to "
00043 "stderr 0 to 10 [default=1]" ),
00044
00045 memsize=Option( "-m", "--memsize",
00046 metavar="MEM",
00047 dest="memsize",
00048
00049 help="memory size to pass to out-of-core"
00050 " functions in MB [default 500]" ),
00051
00052 quiet=Option( "-q", "--quiet",
00053 action="store_false",
00054 dest="verbose",
00055 metavar="VERB",
00056 help="print no output to stderr" ),
00057
00058 check_paths=Option( "-c", "--check-paths",
00059 action="store_true",
00060 dest="check_path",
00061
00062 help="check executable paths before running programs" ),
00063
00064 strict_check=Option( "--strict-check",
00065 metavar="SC",
00066 type="int",
00067
00068 dest="strict_check",
00069 help="check spaces for correctness "
00070 "can be 0,1 or 2. "
00071 "SC=0 no spaces are checked and error are caught only by executables, "
00072 "SC=1 spaces are checked for correctness, "
00073 "SC=2 spaces are checked for correctness and no voidSpaces are accepted "
00074 ),
00075
00076 no_check_paths=Option( "--no-check-paths",
00077 action="store_false",
00078 dest="check_path",
00079 help="do not check executable paths "
00080 "before running programs [default] " ),
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093 globaltmpdir=Option( "-t", "--tmpdir","--globaltmpdir",
00094
00095 metavar="GTD",
00096 dest='globaltmpdir',
00097 help="Global temporary directory. Directory to store temporary data"
00098 "In parallel computation it is used to share data." ),
00099
00100 localtmpdir=Option( "--localtmpdir",
00101
00102 metavar="LTD",
00103 dest='localtmpdir',
00104 help="Local SLIMpy temporary data directory."
00105 "In parallel computation it is used to work locally." ),
00106
00107 eps=Option( "--eps",
00108
00109 help="Parallel only. Domain decomposition overlap"
00110 " parameter. Common across all dimensions." ),
00111
00112 nwin=Option( "--nwin",
00113
00114 help="Parallel only. Defines domain decomposition across "
00115 "all dimensions. 2-digit values for each"
00116 "dimension are given together, i.e. --nwin=020407 "
00117 "gives 2 windows along the 1st dimension, 4 along"
00118 " the 2nd, 7 along the 3rd" ),
00119
00120 scons=Option( "--scons",
00121 action='callback',
00122 callback=runner_callback,
00123 help="""output a scons file to stdout\n NOT MAINTAINED""" ),
00124
00125 dot=Option( '-d', "--dot",
00126 action='callback',
00127 callback=runner_callback,
00128 help="""output a dot file to stdout""" ),
00129
00130 dottest=Option( "--dottest",
00131 action='callback',
00132 callback=runner_callback,
00133 help="dryrun the script and run dotests on all"
00134 "linear operators that were defined" ),
00135
00136 multicore=Option( '-j',"--jobs",
00137 action='callback', metavar='N',
00138 type=int,
00139 nargs=1,
00140 callback=runner_callback,
00141 help="Allow N jobs at once" ),
00142
00143 no_pipe=Option( "--no-pipe",
00144 action='callback',
00145 callback=builder_callback,
00146 help="do not chain commands into pipe" ),
00147
00148 dryrun=Option( "-n", "--dryrun",
00149 action='store_const',
00150 const="dryrun",
00151 dest='runtype',
00152 help="print output only do not run commands" ),
00153
00154 no_del=Option( "--no-del",
00155 action="store_true",
00156 dest="no_del",
00157
00158 help="Does not perform cleaning during, cleans tmp variables at end." ),
00159
00160 log=Option( "-l", "--log",
00161 dest='logfile',
00162
00163 metavar="FILE",
00164 help="log file to write all output to, view with SLIMpy's record_viewer" ),
00165
00166 debug=Option( "-o","--debug",
00167 dest='debug',
00168 action='append',
00169
00170 help="print output only relative to "
00171 "crertain debug types:\n"
00172 "cleaner\ndisplay\nsolver" ),
00173
00174 mpi=Option( "--mpi","--enable-mpi" ,
00175 dest='mpi',
00176
00177 action="store_true",
00178 help="enable mpi" ),
00179
00180 dist=Option( "--dist","--distributed" ,
00181 dest='dist',
00182 type=str,
00183 nargs=1,
00184 action='callback',
00185 callback=runner_callback,
00186 help="enable distributed slimpy" ),
00187
00188 walltime=Option( "--walltime" ,
00189 dest='walltime',
00190
00191 type=int,
00192 help="time-out in seconds for each command" ),
00193
00194
00195 no_mpi=Option( "--no-mpi","--disable-mpi" ,
00196 dest='mpi',
00197 action="store_false",
00198 help="enable mpi" ),
00199
00200
00201 mpi_run=Option( "--mpi-run",
00202 dest='MPIRUN',
00203
00204 help="mpi executable" ),
00205
00206 mpi_flags=Option( "--mpi-flags",
00207 dest='MPIFLAGS',
00208
00209 help="mpi flags" ),
00210
00211 test=Option( "--test",
00212 action='callback',
00213 callback=optest,
00214 help="run a test suit to test "
00215 "the slimpy framework and exit" ),
00216
00217
00218
00219
00220
00221
00222 opts=Option( "--options",
00223 action='callback',
00224 callback=opts_callback,
00225 help="Iternal use for shell script completion" ),
00226 )
00227