Exemplo n.º 1
0
 def main(self, argv):
     args = self._parse_args(argv)
     proj_ctrl = Project.controller()
     proj = proj_ctrl.selected()
     targ = Target.controller(proj_ctrl.storage).one({'name': args.target})
     if targ is None:
         self.parser.error("A target with name %s does not exist." %
                           args.target)
     app = Application.controller(proj_ctrl.storage).one(
         {'name': args.application})
     if app is None:
         self.parser.error("An application with name %s does not exist." %
                           args.application)
     meas = Measurement.controller(proj_ctrl.storage).one(
         {'name': args.measurement})
     if meas is None:
         self.parser.error("A measurement with name %s does not exist." %
                           args.measurement)
     data = {
         'name': args.name,
         'project': proj.eid,
         'target': targ.eid,
         'application': app.eid,
         'measurement': meas.eid
     }
     return self._create_record(PROJECT_STORAGE, data)
Exemplo n.º 2
0
 def main(self, argv):
     args = self._parse_args(argv)
     store = arguments.parse_storage_flag(args)[0]
     data = {attr: getattr(args, attr) for attr in self.model.attributes if hasattr(args, attr)}
     meas_name = args.name
     try:
         force_tau_options = args.force_tau_options
     except AttributeError:
         pass
     else:
         # Unset force_tau_options if it was already set and --force-tau-options=none 
         if data.pop('force_tau_options', False) and [i.lower().strip() for i in force_tau_options] == ['none']:
             meas_ctrl = Measurement.controller(store)
             meas_ctrl.unset(['force_tau_options'], {'name': meas_name})
             self.logger.info("Removed 'force-tau-options' from measurement '%s'.", meas_name)
         else:
             data['force_tau_options'] = force_tau_options
             self.logger.info("Added 'force-tau-options' to measurement '%s'.", meas_name)
     key_attr = self.model.key_attribute
     try:
         data[key_attr] = args.new_key
     except AttributeError:
         pass
     key = getattr(args, key_attr)
     return self._update_record(store, data, key)
Exemplo n.º 3
0
 def _parse_implicit(self, args):
     targets = set()
     applications = set()
     measurements = set()
     experiments = set()
     targ_ctrl = Target.controller(PROJECT_STORAGE)
     app_ctrl = Application.controller(PROJECT_STORAGE)
     meas_ctrl = Measurement.controller(PROJECT_STORAGE)
     expr_ctrl = Experiment.controller(PROJECT_STORAGE)
     for flag in 'impl_experiment', 'impl_project', 'impl_target', 'impl_application', 'impl_measurement':
         for name in getattr(args, flag, []):
             tar = targ_ctrl.one({"name": name})
             app = app_ctrl.one({"name": name})
             mes = meas_ctrl.one({"name": name})
             expr = expr_ctrl.one({"name": name})
             found = set([tar, app, mes, expr]) - set([None])
             if len(found) > 1:
                 self.parser.error("'%s' is ambiguous. "
                                   "Please use a command line flag to specify configuration type." % name)
             elif len(found) == 0:
                 self.parser.error("'%s' is not an experiment, target, application, or measurement." % name)
             elif tar:
                 targets.add(tar)
             elif app:
                 applications.add(app)
             elif mes:
                 measurements.add(mes)
             elif expr:
                 experiments.add(expr)
     return targets, applications, measurements, experiments
Exemplo n.º 4
0
 def main(self, argv):
     args = self._parse_args(argv)
     store = arguments.parse_storage_flag(args)[0]
     data = {
         attr: getattr(args, attr)
         for attr in self.model.attributes if hasattr(args, attr)
     }
     meas_name = args.name
     try:
         force_tau_options = args.force_tau_options
     except AttributeError:
         pass
     else:
         # Unset force_tau_options if it was already set and --force-tau-options=none
         if data.pop('force_tau_options', False) and [
                 i.lower().strip() for i in force_tau_options
         ] == ['none']:
             meas_ctrl = Measurement.controller(store)
             meas_ctrl.unset(['force_tau_options'], {'name': meas_name})
             self.logger.info(
                 "Removed 'force-tau-options' from measurement '%s'.",
                 meas_name)
         else:
             data['force_tau_options'] = force_tau_options
             self.logger.info(
                 "Added 'force-tau-options' to measurement '%s'.",
                 meas_name)
     key_attr = self.model.key_attribute
     try:
         data[key_attr] = args.new_key
     except AttributeError:
         pass
     key = getattr(args, key_attr)
     return self._update_record(store, data, key)
Exemplo n.º 5
0
 def _parse_implicit(self, args):
     targets = set()
     applications = set()
     measurements = set()
     experiments = set()
     targ_ctrl = Target.controller(PROJECT_STORAGE)
     app_ctrl = Application.controller(PROJECT_STORAGE)
     meas_ctrl = Measurement.controller(PROJECT_STORAGE)
     expr_ctrl = Experiment.controller(PROJECT_STORAGE)
     for flag in 'impl_experiment', 'impl_project', 'impl_target', 'impl_application', 'impl_measurement':
         for name in getattr(args, flag, []):
             tar = targ_ctrl.one({"name": name})
             app = app_ctrl.one({"name": name})
             mes = meas_ctrl.one({"name": name})
             expr = expr_ctrl.one({"name": name})
             found = {tar, app, mes, expr} - {None}
             if len(found) > 1:
                 self.parser.error(
                     "'%s' is ambiguous. "
                     "Please use a command line flag to specify configuration type."
                     % name)
             elif not found:
                 self.parser.error(
                     "'%s' is not an experiment, target, application, or measurement."
                     % name)
             elif tar:
                 targets.add(tar)
             elif app:
                 applications.add(app)
             elif mes:
                 measurements.add(mes)
             elif expr:
                 experiments.add(expr)
     return targets, applications, measurements, experiments
Exemplo n.º 6
0
 def _parse_implicit(self, args, targets, applications, measurements):
     targ_ctrl = Target.controller(PROJECT_STORAGE)
     app_ctrl = Application.controller(PROJECT_STORAGE)
     meas_ctrl = Measurement.controller(PROJECT_STORAGE)
     for flag in 'impl_targets', 'impl_applications', 'impl_measurements':
         for name in getattr(args, flag, []):
             tar = targ_ctrl.one({"name": name})
             app = app_ctrl.one({"name": name})
             mes = meas_ctrl.one({"name": name})
             tam = set([tar, app, mes]) - set([None])
             if len(tam) > 1:
                 self.parser.error(
                     "'%s' is ambiguous.  Please use --target, --application,"
                     " or --measurement to specify configuration type" %
                     name)
             elif len(tam) == 0:
                 self.parser.error(
                     "'%s' is not a target, application, or measurement" %
                     name)
             elif tar:
                 targets.add(tar)
             elif app:
                 applications.add(app)
             elif mes:
                 measurements.add(mes)
Exemplo n.º 7
0
 def test_set_tau_force_options(self):
     self.reset_project_storage()
     expr = Project.selected().experiment()
     self.assertFalse('force-tau-options' in expr.populate('measurement'))
     tau_options = "-optVerbose -optNoCompInst"
     self.assertCommandReturnValue(0, EDIT_COMMAND, ['profile', '--force-tau-options=%s' % tau_options])
     # Check that 'force-tau-options' is now a list containing the expected options in the project record
     meas = Measurement.controller(PROJECT_STORAGE).one({'name': 'profile'})
     self.assertIsNotNone(meas)
     self.assertListEqual(meas['force_tau_options'], [tau_options])
Exemplo n.º 8
0
 def test_set_tau_extra_options_none(self):
     self.reset_project_storage()
     expr = Project.selected().experiment()
     self.assertFalse('extra-tau-options' in expr.populate('measurement'))
     tau_options = "none"
     self.assertCommandReturnValue(0, EDIT_COMMAND, ['profile', '--extra-tau-options=%s' % tau_options])
     # Check that 'extra-tau-options' is now a list containing the expected options in the project record
     meas = Measurement.controller(PROJECT_STORAGE).one({'name': 'profile'})
     self.assertIsNotNone(meas)
     self.assertNotIn('extra_tau_options', meas)
Exemplo n.º 9
0
 def test_set_tau_force_options(self):
     self.reset_project_storage()
     expr = Project.selected().experiment()
     self.assertFalse('force-tau-options' in expr.populate('measurement'))
     tau_options = "-optVerbose -optNoCompInst"
     self.assertCommandReturnValue(0, EDIT_COMMAND, ['profile', '--force-tau-options=%s' % tau_options])
     # Check that 'force-tau-options' is now a list containing the expected options in the project record
     meas = Measurement.controller(PROJECT_STORAGE).one({'name': 'profile'}) 
     self.assertIsNotNone(meas)
     self.assertListEqual(meas['force_tau_options'], [tau_options])
Exemplo n.º 10
0
 def test_trace_callpath_10(self):
     self.reset_project_storage()
     name = 'test_discourage_callpath'
     stdout, stderr = self.assertCommandReturnValue(
         0, create_cmd, [name, '--trace', '--callpath', '10'])
     self.assertFalse(stderr)
     self.assertIn("Added measurement '%s' to project" % name, stdout)
     self.assertIn("WARNING", stdout)
     meas = Measurement.controller(PROJECT_STORAGE).one({'name': name})
     self.assertIsInstance(meas, Measurement)
     self.assertEqual(meas['callpath'], 10)
Exemplo n.º 11
0
 def test_set_tau_forced_extra_options(self):
     self.reset_project_storage()
     expr = Project.selected().experiment()
     self.assertFalse('extra-tau-options' in expr.populate('measurement'))
     self.assertFalse('forced-tau-options' in expr.populate('measurement'))
     tau_options = "-optKeepFiles"
     self.assertCommandReturnValue(0, EDIT_COMMAND, ['profile', '--extra-tau-options=%s' % tau_options])
     with self.assertRaises(IncompatibleRecordError):
         self.assertNotCommandReturnValue(0, EDIT_COMMAND, ['profile', '--force-tau-options=%s' % tau_options])
     meas = Measurement.controller(PROJECT_STORAGE).one({'name': 'profile'})
     self.assertIsNotNone(meas)
Exemplo n.º 12
0
 def test_trace_edit(self):
     self.reset_project_storage()
     name = 'test_trace_edit'
     create_args = [name, '--profile', 'tau', '--trace', 'none', '--callpath', '10']
     stdout, stderr = self.assertCommandReturnValue(0, CREATE_COMMAND, create_args)
     self.assertFalse(stderr)
     self.assertIn("Added measurement '%s' to project" % name, stdout)
     self.assertNotIn("WARNING", stdout)
     meas = Measurement.controller(PROJECT_STORAGE).one({'name': name}) 
     self.assertIsInstance(meas, Measurement)
     self.assertEqual(meas['callpath'], 10)
     self.assertEqual(meas['profile'], 'tau')
     self.assertEqual(meas['trace'], 'none')
     stdout, stderr = self.assertCommandReturnValue(0, EDIT_COMMAND, [name, '--trace', 'slog2'])
     self.assertFalse(stderr)
     self.assertIn("WARNING", stdout)
     meas = Measurement.controller(PROJECT_STORAGE).one({'name': name}) 
     self.assertIsInstance(meas, Measurement)
     self.assertEqual(meas['callpath'], 10)
     self.assertEqual(meas['profile'], 'tau')
     self.assertEqual(meas['trace'], 'slog2')
Exemplo n.º 13
0
 def test_trace_edit(self):
     self.reset_project_storage()
     name = 'test_trace_edit'
     create_args = [name, '--profile', 'tau', '--trace', 'none', '--callpath', '10']
     stdout, stderr = self.assertCommandReturnValue(0, CREATE_COMMAND, create_args)
     self.assertFalse(stderr)
     self.assertIn("Added measurement '%s' to project" % name, stdout)
     self.assertNotIn("WARNING", stdout)
     meas = Measurement.controller(PROJECT_STORAGE).one({'name': name})
     self.assertIsInstance(meas, Measurement)
     self.assertEqual(meas['callpath'], 10)
     self.assertEqual(meas['profile'], 'tau')
     self.assertEqual(meas['trace'], 'none')
     stdout, stderr = self.assertCommandReturnValue(0, EDIT_COMMAND, [name, '--trace', 'slog2'])
     self.assertFalse(stderr)
     self.assertIn("WARNING", stdout)
     meas = Measurement.controller(PROJECT_STORAGE).one({'name': name})
     self.assertIsInstance(meas, Measurement)
     self.assertEqual(meas['callpath'], 10)
     self.assertEqual(meas['profile'], 'tau')
     self.assertEqual(meas['trace'], 'slog2')
Exemplo n.º 14
0
 def test_set_tau_forced_extra_options_none(self):
     self.reset_project_storage()
     expr = Project.selected().experiment()
     self.assertFalse('extra-tau-options' in expr.populate('measurement'))
     self.assertFalse('forced-tau-options' in expr.populate('measurement'))
     tau_options = "none"
     self.assertCommandReturnValue(0, EDIT_COMMAND, ['profile', '--extra-tau-options=%s' % tau_options])
     self.assertCommandReturnValue(0, EDIT_COMMAND, ['profile', '--force-tau-options=%s' % tau_options])
     meas = Measurement.controller(PROJECT_STORAGE).one({'name': 'profile'})
     self.assertIsNotNone(meas)
     self.assertNotIn('extra_tau_options', meas)
     self.assertNotIn('force_tau_options', meas)
Exemplo n.º 15
0
    def main(self, argv):
        from taucmdr.cli.commands.project.list import COMMAND as project_list
        args = self._parse_args(argv)
    
        tar_ctrl = Target.controller(PROJECT_STORAGE)
        app_ctrl = Application.controller(PROJECT_STORAGE)
        meas_ctrl = Measurement.controller(PROJECT_STORAGE)
        proj_ctrl = Project.controller()
    
        project_name = args.name
        project = proj_ctrl.one({'name': project_name})
        if not project:
            self.parser.error("'%s' is not a project name. Type `%s` to see valid names." % 
                              (project_name, project_list.command))
    
        updates = dict(project.element)
        updates['name'] = getattr(args, 'new_name', project_name)
        targets = set(project['targets'])
        applications = set(project['applications'])
        measurements = set(project['measurements'])
        
        added = self._parse_add_args(args, tar_ctrl, app_ctrl, meas_ctrl, targets, applications, measurements)
        removed = self._parse_remove_args(args, tar_ctrl, app_ctrl, meas_ctrl, targets, applications, measurements)
    
        updates['targets'] = list(targets)
        updates['applications'] = list(applications)
        updates['measurements'] = list(measurements)
        
        try:
            force_tau_options = args.force_tau_options
        except AttributeError:
            pass
        else:
            # Unset force_tau_options if it was already set and --force-tau-options=none 
            if updates.pop('force_tau_options', False) and [i.lower().strip() for i in force_tau_options] == ['none']:
                proj_ctrl.unset(['force_tau_options'], {'name': project_name})
                self.logger.info("Removed 'force-tau-options' from project configuration '%s'.", project_name)
            else:
                updates['force_tau_options'] = force_tau_options
                self.logger.info("Added 'force-tau-options' to project configuration '%s'.", project_name)

        proj_ctrl.update(updates, {'name': project_name})
        for model in added:
            self.logger.info("Added %s '%s' to project configuration '%s'.", 
                             model.name.lower(), model[model.key_attribute], project_name)
        for model in removed:
            self.logger.info("Removed %s '%s' from project configuration '%s'.", 
                             model.name.lower(), model[model.key_attribute], project_name)
        return EXIT_SUCCESS
Exemplo n.º 16
0
 def main(self, argv):
     args = self._parse_args(argv)
     proj_ctrl = Project.controller()
     proj = proj_ctrl.selected()
     targ = Target.controller(proj_ctrl.storage).one({'name': args.target})
     if targ is None:
         self.parser.error("A target with name %s does not exist." %args.target)
     app = Application.controller(proj_ctrl.storage).one({'name': args.application})
     if app is None:
         self.parser.error("An application with name %s does not exist." %args.application)
     meas = Measurement.controller(proj_ctrl.storage).one({'name': args.measurement})
     if meas is None:
         self.parser.error("A measurement with name %s does not exist." %args.measurement)
     data = {'name': args.name,
             'project': proj.eid,
             'target': targ.eid,
             'application': app.eid,
             'measurement': meas.eid}
     return self._create_record(PROJECT_STORAGE, data)
Exemplo n.º 17
0
Arquivo: edit.py Projeto: HPCL/taucmdr
    def main(self, argv):
        from taucmdr.cli.commands.project.list import COMMAND as project_list
        args = self._parse_args(argv)

        tar_ctrl = Target.controller(PROJECT_STORAGE)
        app_ctrl = Application.controller(PROJECT_STORAGE)
        meas_ctrl = Measurement.controller(PROJECT_STORAGE)
        proj_ctrl = Project.controller()

        project_name = args.name
        project = proj_ctrl.one({'name': project_name})
        if not project:
            self.parser.error(
                "'%s' is not a project name. Type `%s` to see valid names." %
                (project_name, project_list.command))

        updates = dict(project)
        updates['name'] = getattr(args, 'new_name', project_name)
        targets = set(project['targets'])
        applications = set(project['applications'])
        measurements = set(project['measurements'])

        added = self._parse_add_args(args, tar_ctrl, app_ctrl, meas_ctrl,
                                     targets, applications, measurements)
        removed = self._parse_remove_args(args, tar_ctrl, app_ctrl, meas_ctrl,
                                          targets, applications, measurements)

        updates['targets'] = list(targets)
        updates['applications'] = list(applications)
        updates['measurements'] = list(measurements)

        proj_ctrl.update(updates, {'name': project_name})
        for model in added:
            self.logger.info("Added %s '%s' to project configuration '%s'.",
                             model.name.lower(), model[model.key_attribute],
                             project_name)
        for model in removed:
            self.logger.info(
                "Removed %s '%s' from project configuration '%s'.",
                model.name.lower(), model[model.key_attribute], project_name)
        return EXIT_SUCCESS
Exemplo n.º 18
0
 def _parse_implicit(self, args, targets, applications, measurements):
     targ_ctrl = Target.controller(PROJECT_STORAGE)
     app_ctrl = Application.controller(PROJECT_STORAGE)
     meas_ctrl = Measurement.controller(PROJECT_STORAGE)
     for flag in 'impl_targets', 'impl_applications', 'impl_measurements':
         for name in getattr(args, flag, []):
             tar = targ_ctrl.one({"name": name})
             app = app_ctrl.one({"name": name})
             mes = meas_ctrl.one({"name": name})
             tam = set([tar, app, mes]) - set([None])
             if len(tam) > 1:
                 self.parser.error("'%s' is ambiguous.  Please use --target, --application,"
                                   " or --measurement to specify configuration type" % name)
             elif len(tam) == 0:
                 self.parser.error("'%s' is not a target, application, or measurement" % name)
             elif tar:
                 targets.add(tar)
             elif app:
                 applications.add(app)
             elif mes:
                 measurements.add(mes)
Exemplo n.º 19
0
 def main(self, argv):
     from taucmdr.cli.commands.project.list import COMMAND as project_list
     args = self._parse_args(argv)
 
     tar_ctrl = Target.controller(PROJECT_STORAGE)
     app_ctrl = Application.controller(PROJECT_STORAGE)
     meas_ctrl = Measurement.controller(PROJECT_STORAGE)
     proj_ctrl = Project.controller()
 
     project_name = args.name
     project = proj_ctrl.one({'name': project_name})
     if not project:
         self.parser.error("'%s' is not a project name. Type `%s` to see valid names." % 
                           (project_name, project_list.command))
 
     updates = dict(project)
     updates['name'] = getattr(args, 'new_name', project_name)
     targets = set(project['targets'])
     applications = set(project['applications'])
     measurements = set(project['measurements'])
     
     added = self._parse_add_args(args, tar_ctrl, app_ctrl, meas_ctrl, targets, applications, measurements)
     removed = self._parse_remove_args(args, tar_ctrl, app_ctrl, meas_ctrl, targets, applications, measurements)
 
     updates['targets'] = list(targets)
     updates['applications'] = list(applications)
     updates['measurements'] = list(measurements)
     
     proj_ctrl.update(updates, {'name': project_name})
     for model in added:
         self.logger.info("Added %s '%s' to project configuration '%s'.", 
                          model.name.lower(), model[model.key_attribute], project_name)
     for model in removed:
         self.logger.info("Removed %s '%s' from project configuration '%s'.", 
                          model.name.lower(), model[model.key_attribute], project_name)
     return EXIT_SUCCESS
Exemplo n.º 20
0
def attributes():
    from taucmdr.model.project import Project
    from taucmdr.model.target import Target
    from taucmdr.model.measurement import Measurement
    from taucmdr.cf.platforms import DARWIN, HOST_OS, CRAY_CNL

    def _encourage_except_baseline(lhs, lhs_attr, lhs_value, rhs):
        if isinstance(rhs, Measurement):
            if not rhs['baseline']:
                lhs_name = lhs.name.lower()
                rhs_name = rhs.name.lower()
                LOGGER.warning("%s = %s in %s recommends True in %s", lhs_attr,
                               lhs_value, lhs_name, rhs_name)

    return {
        'projects': {
            'collection': Project,
            'via': 'applications',
            'description': 'projects using this application'
        },
        'name': {
            'primary_key': True,
            'type': 'string',
            'description': 'application configuration name',
            'unique': True
        },
        'openmp': {
            'type': 'boolean',
            'description': 'application uses OpenMP',
            'default': False,
            'argparse': {
                'flags': ('--openmp', )
            },
            'rebuild_required': True
        },
        'pthreads': {
            'type': 'boolean',
            'description': 'application uses pthreads',
            'default': False,
            'argparse': {
                'flags': ('--pthreads', )
            },
            'rebuild_required': True
        },
        'python': {
            'type': 'boolean',
            'description': 'application uses Python',
            'default': False,
            'argparse': {
                'flags': ('--python', )
            },
            'rebuild_required': True
        },
        'tbb': {
            'type': 'boolean',
            'description': 'application uses Thread Building Blocks (TBB)',
            'default': False,
            'argparse': {
                'flags': ('--tbb', )
            },
            'rebuild_required': True
        },
        'mpi': {
            'type': 'boolean',
            'default': False,
            'description': 'application uses MPI',
            'argparse': {
                'flags': ('--mpi', )
            },
            'compat': {
                True: _encourage_except_baseline
            },
            'rebuild_required': True
        },
        'caf': {
            'type': 'boolean',
            'default': False,
            'description': 'application uses Coarray Fortran',
            'argparse': {
                'flags': ('--caf', )
            },
            'compat': {
                True: (_encourage_except_baseline,
                       Measurement.require('source_inst', 'never'))
            },
            'rebuild_required': True
        },
        'cuda': {
            'type': 'boolean',
            'default': False,
            'description': 'application uses NVIDIA CUDA',
            'argparse': {
                'flags': ('--cuda', )
            },
            'compat': {
                True: Target.require('cuda_toolkit')
            },
            'rebuild_required': True
        },
        'opencl': {
            'type': 'boolean',
            'default': False,
            'description': 'application uses OpenCL',
            'argparse': {
                'flags': ('--opencl', )
            },
            'compat': {
                True:
                (Target.require('cuda_toolkit'), _encourage_except_baseline)
            },
            'rebuild_required': True
        },
        'shmem': {
            'type': 'boolean',
            'default': False,
            'description': 'application uses SHMEM',
            'argparse': {
                'flags': ('--shmem', )
            },
            'rebuild_required': True
        },
        'mpc': {
            'type': 'boolean',
            'default': False,
            'description': 'application uses MPC',
            'argparse': {
                'flags': ('--mpc', )
            },
            'rebuild_required': True
        },
        'max_threads': {
            'type': 'integer',
            'description': 'maximum number of threads',
            'argparse': {
                'flags': ('--max-threads', ),
                'metavar': 'threads',
                'nargs': '?',
                'const': 25
            },
            'rebuild_required': True
        },
        'linkage': {
            'type': 'string',
            'default': 'static' if HOST_OS is CRAY_CNL else 'dynamic',
            'description': "application linkage",
            'argparse': {
                'flags': ('--linkage', ),
                'metavar': '<linkage>',
                'choices': ('static', 'dynamic')
            },
            'compat': {
                'static': Target.exclude('host_os', DARWIN)
            },
            'rebuild_required': True
        },
    }
Exemplo n.º 21
0
def attributes():
    from taucmdr.model.project import Project
    from taucmdr.model.target import Target
    from taucmdr.model.measurement import Measurement
    from taucmdr.cf.platforms import DARWIN, HOST_OS, CRAY_CNL
    return {
        'projects': {
            'collection': Project,
            'via': 'applications',
            'description': 'projects using this application'
        },
        'name': {
            'primary_key': True,
            'type': 'string',
            'description': 'application configuration name',
            'unique': True
        },
        'openmp': {
            'type': 'boolean',
            'description': 'application uses OpenMP',
            'default': False,
            'argparse': {'flags': ('--openmp',)},
            'rebuild_required': True
        },
        'pthreads': {
            'type': 'boolean',
            'description': 'application uses pthreads',
            'default': False,
            'argparse': {'flags': ('--pthreads',)},
            'rebuild_required': True
        },
        'tbb': {
            'type': 'boolean',
            'description': 'application uses Thread Building Blocks (TBB)',
            'default': False,
            'argparse': {'flags': ('--tbb',)},
            'rebuild_required': True
        },
        'mpi': {
            'type': 'boolean',
            'default': False,
            'description': 'application uses MPI',
            'argparse': {'flags': ('--mpi',)},
            'compat': {True: Measurement.require('mpi', True)},
            'rebuild_required': True
        },
        'cuda': {
            'type': 'boolean',
            'default': False,
            'description': 'application uses NVIDIA CUDA',
            'argparse': {'flags': ('--cuda',)},
            'compat': {True: Target.require('cuda_toolkit')},
            'rebuild_required': True
        },
        'opencl': {
            'type': 'boolean',
            'default': False,
            'description': 'application uses OpenCL',
            'argparse': {'flags': ('--opencl',)},
            'compat': {True: (Target.require('cuda_toolkit'),
                              Measurement.encourage('opencl', True))},
            'rebuild_required': True
        },
        'shmem': {
            'type': 'boolean',
            'default': False,
            'description': 'application uses SHMEM',
            'argparse': {'flags': ('--shmem',)},
            'rebuild_required': True
        },
        'mpc': {
            'type': 'boolean',
            'default': False,
            'description': 'application uses MPC',
            'argparse': {'flags': ('--mpc',)},
            'rebuild_required': True
        },
        'select_file': {
            'type': 'string',
            'description': 'specify selective instrumentation file',
            'argparse': {'flags': ('--select-file',),
                         'metavar': 'path'},
            'compat': {True: Measurement.exclude('source_inst', 'never')},
            'rebuild_required': True
        },
        'linkage': {
            'type': 'string',
            'default': 'static' if HOST_OS is CRAY_CNL else 'dynamic',
            'description': "application linkage",
            'argparse': {'flags': ('--linkage',),
                         'metavar': '<linkage>',
                         'choices': ('static', 'dynamic')},
            'compat': {'static': Target.exclude('host_os', DARWIN)},
            'rebuild_required': True
        },
    }
Exemplo n.º 22
0
def attributes():
    from taucmdr.model.project import Project
    from taucmdr.model.target import Target
    from taucmdr.model.measurement import Measurement
    from taucmdr.cf.platforms import DARWIN, HOST_OS, CRAY_CNL
    return {
        'projects': {
            'collection': Project,
            'via': 'applications',
            'description': 'projects using this application'
        },
        'name': {
            'primary_key': True,
            'type': 'string',
            'description': 'application configuration name',
            'unique': True
        },
        'openmp': {
            'type': 'boolean',
            'description': 'application uses OpenMP',
            'default': False,
            'argparse': {
                'flags': ('--openmp', )
            },
            'rebuild_required': True
        },
        'pthreads': {
            'type': 'boolean',
            'description': 'application uses pthreads',
            'default': False,
            'argparse': {
                'flags': ('--pthreads', )
            },
            'rebuild_required': True
        },
        'tbb': {
            'type': 'boolean',
            'description': 'application uses Thread Building Blocks (TBB)',
            'default': False,
            'argparse': {
                'flags': ('--tbb', )
            },
            'rebuild_required': True
        },
        'mpi': {
            'type': 'boolean',
            'default': False,
            'description': 'application uses MPI',
            'argparse': {
                'flags': ('--mpi', )
            },
            'compat': {
                True: Measurement.encourage('mpi', True)
            },
            'rebuild_required': True
        },
        'cuda': {
            'type': 'boolean',
            'default': False,
            'description': 'application uses NVIDIA CUDA',
            'argparse': {
                'flags': ('--cuda', )
            },
            'compat': {
                True: Target.require('cuda_toolkit')
            },
            'rebuild_required': True
        },
        'opencl': {
            'type': 'boolean',
            'default': False,
            'description': 'application uses OpenCL',
            'argparse': {
                'flags': ('--opencl', )
            },
            'compat': {
                True: (Target.require('cuda_toolkit'),
                       Measurement.encourage('opencl', True))
            },
            'rebuild_required': True
        },
        'shmem': {
            'type': 'boolean',
            'default': False,
            'description': 'application uses SHMEM',
            'argparse': {
                'flags': ('--shmem', )
            },
            'rebuild_required': True
        },
        'mpc': {
            'type': 'boolean',
            'default': False,
            'description': 'application uses MPC',
            'argparse': {
                'flags': ('--mpc', )
            },
            'rebuild_required': True
        },
        'select_file': {
            'type': 'string',
            'description': 'specify selective instrumentation file',
            'argparse': {
                'flags': ('--select-file', ),
                'metavar': 'path'
            },
            'compat': {
                bool: (Measurement.exclude('source_inst', 'never'),
                       Application.discourage('linkage', 'static'))
            },
            'rebuild_required': True
        },
        'linkage': {
            'type': 'string',
            'default': 'static' if HOST_OS is CRAY_CNL else 'dynamic',
            'description': "application linkage",
            'argparse': {
                'flags': ('--linkage', ),
                'metavar': '<linkage>',
                'choices': ('static', 'dynamic')
            },
            'compat': {
                'static': Target.exclude('host_os', DARWIN)
            },
            'rebuild_required': True
        },
    }