From 0292fbd03c38fbe455588176cf30554c632e8234 Mon Sep 17 00:00:00 2001 From: Cristian C Lalescu <Cristian.Lalescu@ds.mpg.de> Date: Thu, 27 Sep 2018 14:41:36 +0200 Subject: [PATCH] add no-debug option for launcher --- bfps/DNS.py | 7 ++++++- bfps/_code.py | 11 ++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/bfps/DNS.py b/bfps/DNS.py index 8e72593e..94081850 100644 --- a/bfps/DNS.py +++ b/bfps/DNS.py @@ -530,6 +530,10 @@ class DNS(_code): metavar = 'NTHREADS_PER_PROCESS', help = 'number of threads to use per MPI process', default = 1) + parser.add_argument( + '--no-debug', + action = 'store_true', + dest = 'no_debug') parser.add_argument( '--no-submit', action = 'store_true', @@ -1051,6 +1055,7 @@ class DNS(_code): njobs = opt.njobs, hours = opt.minutes // 60, minutes = opt.minutes % 60, - no_submit = opt.no_submit) + no_submit = opt.no_submit, + no_debug = opt.no_debug) return None diff --git a/bfps/_code.py b/bfps/_code.py index c29dda63..b3aa9ff9 100644 --- a/bfps/_code.py +++ b/bfps/_code.py @@ -194,7 +194,9 @@ class _code(_base): outfile.write(self.main) outfile.write(self.main_end) return None - def compile_code(self): + def compile_code( + self, + no_debug = False): # compile code if not os.path.isfile(os.path.join(bfps.header_dir, 'base.hpp')): raise IOError('header not there:\n' + @@ -206,6 +208,8 @@ class _code(_base): command_strings = [bfps.install_info['compiler']] command_strings += [self.name + '.cpp', '-o', self.name] 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.append('-I' + bfps.header_dir) command_strings += ['-L' + ldir for ldir in bfps.install_info['library_dirs']] @@ -237,7 +241,8 @@ class _code(_base): hours = 0, minutes = 10, njobs = 1, - no_submit = False): + no_submit = False, + no_debug = False): self.read_parameters() with h5py.File(os.path.join(self.work_dir, self.simname + '.h5'), 'r') as data_file: iter0 = data_file['iteration'].value @@ -249,7 +254,7 @@ class _code(_base): need_to_compile = (datetime.fromtimestamp(os.path.getctime(os.path.join(self.work_dir, self.name))) < bfps.install_info['install_date']) 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()): shutil.copy(self.name, self.work_dir) if 'niter_todo' not in self.parameters.keys(): -- GitLab