def run_nek(self, rea_file=None, step_limit=None): from lib.nekBinRun import run_nek cls = self.__class__ run_nek(cwd=os.path.join(self.examples_root, cls.example_subdir), rea_file=cls.case_name if not rea_file else rea_file, ifmpi=self.ifmpi, log_suffix=self.log_suffix, n_procs=self.mpi_procs, step_limit=step_limit, verbose=self.verbose)
def run_nek(self, rea_file=None, step_limit=None): from lib.nekBinRun import run_nek cls = self.__class__ run_nek( cwd = os.path.join(self.examples_root, cls.example_subdir), rea_file = cls.case_name if not rea_file else rea_file, ifmpi = self.ifmpi, log_suffix = self.log_suffix, n_procs = self.mpi_procs, step_limit = step_limit, verbose = self.verbose )
def compare_runs(self): cls = self.__class__ # First get the output w/o acc build_nek(source_root=self.source_root, usr_file=cls.case_name, cwd=os.path.join(self.examples_root, cls.example_subdir), f77=self.f77.replace('-acc', ''), cc=self.cc.replace('-acc', ''), ifmpi=self.ifmpi, verbose=self.verbose) run_nek(cwd=os.path.join(self.examples_root, cls.example_subdir), rea_file=cls.case_name, ifmpi=self.ifmpi, log_suffix=self.log_suffix + '.noacc', n_procs=self.mpi_procs, step_limit=cls.step_limit, verbose=self.verbose) # Then get the output with ACC build_nek(source_root=self.source_root, usr_file=cls.case_name, cwd=os.path.join(self.examples_root, cls.example_subdir), f77=self.f77.replace('-acc', '') + ' -acc -Minfo=accel', cc=self.cc.replace('-acc', '') + ' -acc -Minfo=accel', ifmpi=self.ifmpi, verbose=self.verbose) run_nek(cwd=os.path.join(self.examples_root, cls.example_subdir), rea_file=cls.case_name, ifmpi=self.ifmpi, log_suffix=self.log_suffix + '.acc', n_procs=self.mpi_procs, step_limit=cls.step_limit, verbose=self.verbose) # Now compare output logfile_noacc = os.path.join( self.examples_root, cls.example_subdir, '{0}.log.{1}{2}.noacc'.format(cls.case_name, self.mpi_procs, self.log_suffix)) logfile_acc = os.path.join( self.examples_root, cls.example_subdir, '{0}.log.{1}{2}.acc'.format(cls.case_name, self.mpi_procs, self.log_suffix)) loglines_noacc = self.get_lines_from_log(cls.log_label, logfile_noacc) loglines_acc = self.get_lines_from_log(cls.log_label, logfile_acc) self.assertNotEqual( len(logfile_noacc), 0, 'Could not find the label {0} in the logfile {1}'.format( cls.log_label, logfile_noacc)) self.assertNotEqual( len(loglines_acc), 0, 'Could not find the label {0} in the logfile {1}'.format( cls.log_label, logfile_acc)) for (noacc, acc) in zip(loglines_noacc, loglines_acc): err_msg = 'The lines with/without ACC did not match after this point\n' + \ '\n---- Without ACC -----------------------------------------------------\n' + \ noacc + \ '\n---- With ACC --------------------------------------------------------\n' + \ acc self.assertEqual(noacc, acc, err_msg)
def compare_runs(self): cls = self.__class__ # First get the output w/o acc build_nek( source_root = self.source_root, usr_file = cls.case_name, cwd = os.path.join(self.examples_root, cls.example_subdir), f77 = self.f77.replace('-acc',''), cc = self.cc.replace('-acc',''), ifmpi = self.ifmpi, verbose = self.verbose ) run_nek( cwd = os.path.join(self.examples_root, cls.example_subdir), rea_file = cls.case_name, ifmpi = self.ifmpi, log_suffix = self.log_suffix + '.noacc', n_procs = self.mpi_procs, step_limit = cls.step_limit, verbose = self.verbose ) # Then get the output with ACC build_nek( source_root = self.source_root, usr_file = cls.case_name, cwd = os.path.join(self.examples_root, cls.example_subdir), f77 = self.f77.replace('-acc','') + ' -acc -Minfo=accel', cc = self.cc.replace('-acc','') + ' -acc -Minfo=accel', ifmpi = self.ifmpi, verbose = self.verbose ) run_nek( cwd = os.path.join(self.examples_root, cls.example_subdir), rea_file = cls.case_name, ifmpi = self.ifmpi, log_suffix = self.log_suffix + '.acc', n_procs = self.mpi_procs, step_limit = cls.step_limit, verbose = self.verbose ) # Now compare output logfile_noacc = os.path.join( self.examples_root, cls.example_subdir, '{0}.log.{1}{2}.noacc'.format(cls.case_name, self.mpi_procs, self.log_suffix) ) logfile_acc = os.path.join( self.examples_root, cls.example_subdir, '{0}.log.{1}{2}.acc'.format(cls.case_name, self.mpi_procs, self.log_suffix) ) loglines_noacc = self.get_lines_from_log(cls.log_label, logfile_noacc) loglines_acc = self.get_lines_from_log(cls.log_label, logfile_acc) self.assertNotEqual( len(logfile_noacc), 0, 'Could not find the label {0} in the logfile {1}'.format(cls.log_label, logfile_noacc) ) self.assertNotEqual( len(loglines_acc), 0, 'Could not find the label {0} in the logfile {1}'.format(cls.log_label, logfile_acc) ) for (noacc, acc) in zip(loglines_noacc, loglines_acc): err_msg = 'The lines with/without ACC did not match after this point\n' + \ '\n---- Without ACC -----------------------------------------------------\n' + \ noacc + \ '\n---- With ACC --------------------------------------------------------\n' + \ acc self.assertEqual(noacc, acc, err_msg)