def __make_options(self, params): '''Return generic Litmus options.''' # Guess defaults using the properties of this computer if 'cpus' in params: cpus = min(map(int, params['cpus'])) else: cpus = num_cpus() if 'clusters' in params: clusters = min(map(int, params['clusters'])) else: # default to partitioned clusters = num_cpus() try: rm_config = get_config_option("RELEASE_MASTER") and True except: rm_config = False release_master = list(set([False, bool(rm_config)])) return [GenOption('tasks', int, range(cpus, 5*cpus, cpus), 'Number of tasks per experiment.'), GenOption('cpus', int, [cpus], 'Number of processors on target system.'), GenOption('clusters', int, [clusters], 'Number of clusters on target system.'), GenOption('release_master', [True,False], release_master, 'Redirect release interrupts to a single CPU.'), GenOption('duration', float, [30], 'Experiment duration.')]
def verify_environment(kernel, copts): if kernel and not com.uname_matches(kernel): raise InvalidKernel(kernel) if copts: results = [] for param, wanted in copts.iteritems(): try: actual = com.get_config_option(param) except IOError: actual = None if not str(wanted) == str(actual): results += [ConfigResult(param, wanted, actual)] if results: raise InvalidKernel(results)
def verify_environment(exp_params): '''Raise an exception if the current system doesn't match that required by @exp_params.''' if exp_params.kernel and not re.match(exp_params.kernel, com.kernel()): raise InvalidKernel(exp_params.kernel) if exp_params.config_options: results = [] for param, wanted in exp_params.config_options.iteritems(): try: actual = com.get_config_option(param) except IOError: actual = None if not str(wanted) == str(actual): results += [ConfigResult(param, wanted, actual)] if results: raise InvalidConfig(results)
def __make_options(self, params): '''Return generic Litmus options.''' # Guess defaults using the properties of this computer if 'cpus' in params: cpus = min(map(int, params['cpus'])) else: cpus = num_cpus() try: rm_config = get_config_option("RELEASE_MASTER") and True except: rm_config = False release_master = list(set([False, bool(rm_config)])) return [ GenOption('tasks', int, range(cpus, 5 * cpus, cpus), 'Number of tasks per experiment.'), GenOption('cpus', int, [cpus], 'Number of processors on target system.'), GenOption('release_master', [True, False], release_master, 'Redirect release interrupts to a single CPU.'), GenOption('duration', float, [30], 'Experiment duration.') ]