def _configure_knc(self, flags, env):
     # pylint: disable=no-self-use
     k1om_ar = util.which('x86_64-k1om-linux-ar')
     if not k1om_ar:
         for path in glob.glob('/usr/linux-k1om-*'):
             k1om_ar = util.which(os.path.join(path, 'bin', 'x86_64-k1om-linux-ar'))
             if k1om_ar:
                 break
     env['PATH'] = os.pathsep.join([os.path.dirname(k1om_ar), env.get('PATH', os.environ['PATH'])])
     flags.extend(['CFLAGS=-fPIC', 'CXXFLAGS=-fPIC',
                   '--host=x86_64-k1om-linux',
                   '--disable-nls', '--disable-werror'])
 def configure(self, flags, env):
     # Handle special target architecture flags
     arch_flags = {INTEL_KNC_ARCH: ['--host=x86_64-k1om-linux'], 
                   None: []}
     flags.extend(arch_flags.get(self.target_arch, arch_flags[None]))
                
     # Add KNC GNU compilers to PATH if building for KNC
     if self.target_arch is INTEL_KNC_ARCH:
         k1om_ar = util.which('x86_64-k1om-linux-ar')
         if not k1om_ar:
             for path in glob.glob('/usr/linux-k1om-*'):
                 k1om_ar = util.which(os.path.join(path, 'bin', 'x86_64-k1om-linux-ar'))
                 if k1om_ar:
                     break
         env['PATH'] = os.pathsep.join([os.path.dirname(k1om_ar), env.get('PATH', os.environ['PATH'])])
     return super(LibunwindInstallation, self).configure(flags, env)
Esempio n. 3
0
 def is_compatible(cmd):
     """Check if this subcommand can work with the given command.
     
     Args:
         cmd (str): A command from the command line, e.g. sys.argv[1].
         
     Returns:
         bool: True if this subcommand is compatible with `cmd`.
     """
     return bool(util.which(cmd))
Esempio n. 4
0
 def __call__(cls,  *args, **kwargs):
     try:
         command = kwargs['command']
     except KeyError:
         command = args[0]
     assert isinstance(command, basestring)
     if os.path.isabs(command):
         try:
             return cls.__instances__[command]
         except KeyError:
             pass
     absolute_path = util.which(command)
     if not absolute_path:
         raise ConfigurationError("'%s' missing or not executable." % command,
                                  "Check spelling, loaded modules, PATH environment variable, and file permissions")
     return KeyedRecordCreator.__call__(cls, absolute_path)
Esempio n. 5
0
 def _detect_launcher(self, application_cmd):
     cmd = application_cmd[0]
     launcher_cmd = [] 
     if cmd in LAUNCHERS:
         try:
             idx = application_cmd.index('--')
         except ValueError:
             exes = [item for item in enumerate(application_cmd[1:], 1) if util.which(item[1])]
             self.logger.debug("Executables on command line: %s", exes)
             if len(exes) == 1:
                 idx = exes[0][0]
                 launcher_cmd = application_cmd[:idx]
                 application_cmd = application_cmd[idx:]
             else:
                 raise ConfigurationError("TAU is having trouble parsing the command line arguments",
                                          ("Use '--' to seperate %s and its arguments from the application command "
                                           "and its arguments, e.g. `mpirun -np 4 -- ./a.out -g hello`" % cmd))
         else:
             launcher_cmd = application_cmd[:idx]
             application_cmd = application_cmd[idx+1:]
     return launcher_cmd, application_cmd
Esempio n. 6
0
    def managed_run(self, launcher_cmd, application_cmd):
        """Uses this experiment to run an application command.
        
        Performs all relevent system preparation tasks to run the user's application
        under the specified experimental configuration.
        
        Args:
            launcher_cmd (list): Application launcher with command line arguments.
            application_cmd (list): Application executable with command line arguments.

        Raises:
            ConfigurationError: The experiment is not configured to perform the desired run.
            
        Returns:
            int: Application subprocess return code.
        """
        command = util.which(application_cmd[0])
        if not command:
            raise ConfigurationError("Cannot find executable: %s" % application_cmd[0])
        tau = self.configure()
        cmd, env = tau.get_application_command(launcher_cmd, application_cmd)
        return Trial.controller(self.storage).perform(self, cmd, os.getcwd(), env)