Exemple #1
0
    def prepare_MPI_filtering(cls, filter_file: str) -> None:
        # Find which MPI functions to filter
        # Get all MPI functions (our filter_file is a WHITELIST)
        default_provider = D.BackendDefaults()
        mpi_funcs_dump = os.path.join(default_provider.instance.get_pira_dir(),
                                      'mpi_funcs.dump')
        U.shell('wrap.py -d > ' + mpi_funcs_dump)
        all_MPI_functions_decls = U.read_file(mpi_funcs_dump).split('\n')
        all_MPI_functions = []
        for fd in all_MPI_functions_decls:
            name = fd[fd.find(' '):fd.find('(')]
            all_MPI_functions.append(name.strip())

        MPI_functions_to_filter = []
        file_content = U.read_file(filter_file).split('\n')
        # We always want to measure MPI_Init and MPI_Finalize
        file_content.append('MPI_Init')
        file_content.append('MPI_Finalize')
        for l in file_content:
            if l.find('MPI_') > -1:
                L.get_logger().log(
                    'ScorepSystemHelper::prepare_MPI_filtering: Remove ' + l)
                # prevent double removal
                if l in all_MPI_functions: all_MPI_functions.remove(l)

        # Generate the .c file using the mpi wrap.py script
        L.get_logger().log(
            'ScorepSystemHelper::prepare_MPI_filtering: About to filter ' +
            str(len(all_MPI_functions)) + ' MPI functions')
        wrap_script = '{{fn PIRA_Filter'
        for mpi_func in all_MPI_functions:
            wrap_script += ' ' + mpi_func

        wrap_script += '}}\n{{callfn}}\n{{endfn}}'
        default_provider = D.BackendDefaults()
        wrap_file = default_provider.get_wrap_w_file()
        if U.check_file(wrap_file):
            U.remove_file(wrap_file)
        U.write_file(wrap_file, wrap_script)

        wrap_c_path = default_provider.get_wrap_c_file()
        wrap_command = 'wrap.py -o ' + wrap_c_path + ' ' + wrap_file
        U.shell(wrap_command)
        # Compile it to .so file
        compile_mpi_wrapper_command = 'mpicc -shared -fPIC -o ' + default_provider.get_wrap_so_file(
        ) + ' ' + wrap_c_path
        U.shell(compile_mpi_wrapper_command)
Exemple #2
0
 def test_checker_v2_functors_missing(self):
   for file in functor_files:
     U.remove_file(tempdir + file)
     with self.assertRaises(PiraConfigurationErrorException): C.Checker.check_configfile_v2(self.config_v2)
     self.create_tempfiles()