diff --git a/bfps/DNS.py b/bfps/DNS.py index 8e72593e5c2dedeeccc60077918838c511490972..940818508fbb320855ea6a584269873693ab4d18 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 c29dda63895a3a0907b7d98593c3af79945b8639..b3aa9ff9c7ede48cebc33680ac0e7c328126a593 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():