Commit 0292fbd0 authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

add no-debug option for launcher

parent c5435b26
Pipeline #37284 failed with stage
...@@ -530,6 +530,10 @@ class DNS(_code): ...@@ -530,6 +530,10 @@ class DNS(_code):
metavar = 'NTHREADS_PER_PROCESS', metavar = 'NTHREADS_PER_PROCESS',
help = 'number of threads to use per MPI process', help = 'number of threads to use per MPI process',
default = 1) default = 1)
parser.add_argument(
'--no-debug',
action = 'store_true',
dest = 'no_debug')
parser.add_argument( parser.add_argument(
'--no-submit', '--no-submit',
action = 'store_true', action = 'store_true',
...@@ -1051,6 +1055,7 @@ class DNS(_code): ...@@ -1051,6 +1055,7 @@ class DNS(_code):
njobs = opt.njobs, njobs = opt.njobs,
hours = opt.minutes // 60, hours = opt.minutes // 60,
minutes = opt.minutes % 60, minutes = opt.minutes % 60,
no_submit = opt.no_submit) no_submit = opt.no_submit,
no_debug = opt.no_debug)
return None return None
...@@ -194,7 +194,9 @@ class _code(_base): ...@@ -194,7 +194,9 @@ class _code(_base):
outfile.write(self.main) outfile.write(self.main)
outfile.write(self.main_end) outfile.write(self.main_end)
return None return None
def compile_code(self): def compile_code(
self,
no_debug = False):
# compile code # compile code
if not os.path.isfile(os.path.join(bfps.header_dir, 'base.hpp')): if not os.path.isfile(os.path.join(bfps.header_dir, 'base.hpp')):
raise IOError('header not there:\n' + raise IOError('header not there:\n' +
...@@ -206,6 +208,8 @@ class _code(_base): ...@@ -206,6 +208,8 @@ class _code(_base):
command_strings = [bfps.install_info['compiler']] command_strings = [bfps.install_info['compiler']]
command_strings += [self.name + '.cpp', '-o', self.name] command_strings += [self.name + '.cpp', '-o', self.name]
command_strings += bfps.install_info['extra_compile_args'] command_strings += bfps.install_info['extra_compile_args']
if no_debug:
command_strings += ['-DNDEBUG']
command_strings += ['-I' + idir for idir in bfps.install_info['include_dirs']] command_strings += ['-I' + idir for idir in bfps.install_info['include_dirs']]
command_strings.append('-I' + bfps.header_dir) command_strings.append('-I' + bfps.header_dir)
command_strings += ['-L' + ldir for ldir in bfps.install_info['library_dirs']] command_strings += ['-L' + ldir for ldir in bfps.install_info['library_dirs']]
...@@ -237,7 +241,8 @@ class _code(_base): ...@@ -237,7 +241,8 @@ class _code(_base):
hours = 0, hours = 0,
minutes = 10, minutes = 10,
njobs = 1, njobs = 1,
no_submit = False): no_submit = False,
no_debug = False):
self.read_parameters() self.read_parameters()
with h5py.File(os.path.join(self.work_dir, self.simname + '.h5'), 'r') as data_file: with h5py.File(os.path.join(self.work_dir, self.simname + '.h5'), 'r') as data_file:
iter0 = data_file['iteration'].value iter0 = data_file['iteration'].value
...@@ -249,7 +254,7 @@ class _code(_base): ...@@ -249,7 +254,7 @@ class _code(_base):
need_to_compile = (datetime.fromtimestamp(os.path.getctime(os.path.join(self.work_dir, self.name))) < need_to_compile = (datetime.fromtimestamp(os.path.getctime(os.path.join(self.work_dir, self.name))) <
bfps.install_info['install_date']) bfps.install_info['install_date'])
if need_to_compile: if need_to_compile:
assert self.compile_code() == 0 assert self.compile_code(no_debug = no_debug) == 0
if self.work_dir != os.path.realpath(os.getcwd()): if self.work_dir != os.path.realpath(os.getcwd()):
shutil.copy(self.name, self.work_dir) shutil.copy(self.name, self.work_dir)
if 'niter_todo' not in self.parameters.keys(): if 'niter_todo' not in self.parameters.keys():
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment