diff --git a/packages/taucmdr/cf/software/tau_installation.py b/packages/taucmdr/cf/software/tau_installation.py index ab98ce1c8..01bb5b857 100644 --- a/packages/taucmdr/cf/software/tau_installation.py +++ b/packages/taucmdr/cf/software/tau_installation.py @@ -1015,6 +1015,7 @@ def install(self, force_reinstall=False): LOGGER.info(f'Installing {self.title} to:\n {self.install_prefix}') try: shutil.move(self._prepare_src(), self.install_prefix) + self.tau_version = self.get_version(os.path.join(self.install_prefix, 'include/TAU.h.default')) except Exception as err: LOGGER.debug("Exception thrown by shutil.move, attempting to continue.") # On some docker fuse mounted file systems shutil.move was failing with symlinks @@ -1932,3 +1933,15 @@ def get_python_version(self, python_path): pattern = re.compile(r'\d+\.\d+\.\d+') match = pattern.search(out) return match.group() + + def get_version(self): + header_path = os.path.join(self.install_prefix, 'include/TAU.h.default') + with open(header_path) as f: + for line in f: + if line.startswith("#define TAU_VERSION"): + verline = line + break + verstr = re.findall('"([^"]*)"', verline)[0] + if verstr.endswith('-git'): + ver = verstr[:-len('-git')] + return ver diff --git a/packages/taucmdr/model/experiment.py b/packages/taucmdr/model/experiment.py index 1c31f6bb0..e4dbe9c78 100644 --- a/packages/taucmdr/model/experiment.py +++ b/packages/taucmdr/model/experiment.py @@ -93,6 +93,10 @@ def attributes(): 'type': 'string', 'description': 'TAU Makefile used during this experiment, if any.' }, + 'tau_version': { + 'type': 'string', + 'description': 'TAU version used during this experiment' + }, 'record_output': { 'type': 'boolean', 'default': False, @@ -233,6 +237,49 @@ def verify(self): for rhs in [targ, app, meas]: lhs.check_compatibility(rhs) + # Check for deprecated attributes + if 'tau_version' in self.controller(self.storage).search(self.eid)[0]: + tau_version_str = self.controller(self.storage).search(self.eid)[0]['tau_version'] + tau_version = [int(i) for i in tau_version_str.split('.')] + tau_version.extend([0]*(3-len(tau_version))) + else: + return + for comp in [targ, app, meas]: + for attr, props in comp.attributes.iteritems(): + if 'deprecated' in props: + if comp.controller(self.storage).search(self.eid)[0][attr] in props['deprecated']: + deprecated_option = comp.controller(self.storage).search(self.eid)[0][attr] + dep = props['deprecated'][targ[attr]] + if isinstance(dep, list): + if len(dep) == 2 and dep[1] != '': + rem_str = dep[1] + rem = [int(i) for i in rem_str.split('.')] + rem.extend([0]*(3-len(rem))) + is_removed = tau_version >= rem + else: + is_removed = False + + if is_removed: + is_deprecated = False + else: + depr_str = dep[0] + depr = [int(i) for i in depr_str.split('.')] + depr.extend([0]*(3-len(depr))) + is_deprecated = tau_version >= depr + else: + depr_str = dep + depr = [int(i) for i in depr_str.split('.')] + depr.extend([0]*(3-len(depr))) + is_deprecated = tau_version >= depr + is_removed = False + + if is_deprecated: + LOGGER.warning( + "The \"--%s %s\" option has been deprecated in TAU version %s and will be removed in a future release." %(attr, deprecated_option, depr_str) + ) + elif is_removed: + raise ConfigurationError(f'The \"--{attr} {deprecated_option}\" option was removed in TAU version {rem_str}.') + def on_create(self): self.verify() try: @@ -348,6 +395,8 @@ def configure(self): tau.install() if not baseline: self.controller(self.storage).update({'tau_makefile': os.path.basename(tau.get_makefile())}, self.eid) + self.controller(self.storage).update({'tau_version': tau.get_version()}, self.eid) + self.verify() return tau def managed_build(self, compiler_cmd, compiler_args): diff --git a/packages/taucmdr/model/target.py b/packages/taucmdr/model/target.py index 516b9d834..5299a0e33 100644 --- a/packages/taucmdr/model/target.py +++ b/packages/taucmdr/model/target.py @@ -503,6 +503,7 @@ def attributes(): 'group': 'software package', 'metavar': '(||download|download-tr4|download-tr6|None)', 'action': ParsePackagePathAction}, + 'deprecated': {'download-tr4' : ['2.29.1',''], 'download-tr6' : ['2.29.1','']}, 'rebuild_required': True }, 'libotf2_source': { @@ -744,6 +745,9 @@ def papi_metrics(self, event_type="PRESET", include_modifiers=False): def tau_metrics(self): return self.get_installation('tau').tau_metrics() + def tau_version(self): + return self.get_installation('tau').tau_version() + def cupti_metrics(self): if not self.get('cuda'): return []