예제 #1
0
def get_compile_args(libfabric=get()):
    flags = []
    if libfabric == 'bundled':
        flags = third_party_utils.default_get_compile_args('libfabric',
                                                           ucp=get_uniq_cfg_path())
    elif libfabric == 'system':
        # Allow overriding pkg-config via LIBFABRIC_DIR, for platforms
        # without pkg-config.
        libfab_dir_val = overrides.get('LIBFABRIC_DIR')
        if libfab_dir_val:
            flags.append('-I' + libfab_dir_val + '/include')
        else:
            # Try using pkg-config to get the compile-time flags.
            pcflags = third_party_utils.pkgconfig_get_compile_args('libfabric',
                                                                   system=True)
            for pcl in pcflags:
                flags.append(pcl)

    launcher_val = chpl_launcher.get()
    ofi_oob_val = overrides.get_environ('CHPL_RT_COMM_OFI_OOB')
    if 'mpi' in launcher_val or ( ofi_oob_val and 'mpi' in ofi_oob_val ):
        mpi_dir_val = overrides.get_environ('MPI_DIR')
        if mpi_dir_val:
            flags.append('-I' + mpi_dir_val + '/include')

    return flags
예제 #2
0
def get_compile_args():
    args = ([], [])
    libfabric_val = get()
    if libfabric_val == 'bundled':
        ucp_val = get_uniq_cfg_path()
        args = third_party_utils.get_bundled_compile_args('libfabric',
                                                          ucp=ucp_val)
    elif libfabric_val == 'system':
        flags = []

        # Allow overriding pkg-config via LIBFABRIC_DIR, for platforms
        # without pkg-config.
        libfab_dir_val = overrides.get('LIBFABRIC_DIR')
        if libfab_dir_val:
            args[1].append('-I' + libfab_dir_val + '/include')
        else:
            # Try using pkg-config to get the compile-time flags.
            x = third_party_utils.pkgconfig_get_system_compile_args(
                'libfabric')
            args = x

    if libfabric_val == 'system' or libfabric_val == 'bundled':
        flags = []
        launcher_val = chpl_launcher.get()
        ofi_oob_val = overrides.get_environ('CHPL_COMM_OFI_OOB')
        if 'mpi' in launcher_val or (ofi_oob_val and 'mpi' in ofi_oob_val):
            mpi_dir_val = overrides.get_environ('MPI_DIR')
            if mpi_dir_val:
                flags.append('-I' + mpi_dir_val + '/include')

        args[1].extend(flags)

    return args
def get_compile_args(libfabric):
    flags = []
    if libfabric == 'system':
      # Try using pkg-config to get the compile-time flags.
      pcflags = third_party_utils.pkgconfig_get_compile_args(
                       'libfabric', system=True)
      for pcl in pcflags:
        flags.append(pcl)
    elif libfabric == 'libfabric':
      error("CHPL_LIBFABRIC=libfabric is not yet supported", ValueError)

    launcher_val = chpl_launcher.get()
    ofi_oob_val = overrides.get_environ('CHPL_RT_COMM_OFI_OOB')
    if 'mpi' in launcher_val or ( ofi_oob_val and 'mpi' in ofi_oob_val ):
        mpi_dir_val = overrides.get_environ('MPI_DIR')
        if mpi_dir_val:
            flags.append('-I' + mpi_dir_val + '/include')

    return flags
예제 #4
0
def get_link_args():
    args = ([], [])
    libfabric_val = get()
    if libfabric_val == 'bundled':
        args = third_party_utils.pkgconfig_get_bundled_link_args(
            'libfabric', ucp=get_uniq_cfg_path())
    elif libfabric_val == 'system':
        libs = []
        # Allow overriding pkg-config via LIBFABRIC_DIR, for platforms
        # without pkg-config.
        libfab_dir_val = overrides.get('LIBFABRIC_DIR')
        if libfab_dir_val:
            libs.extend([
                '-L' + libfab_dir_val + '/lib',
                '-Wl,-rpath,' + libfab_dir_val + '/lib', '-lfabric'
            ])
        else:
            # Try using pkg-config to get the libraries to link
            # libfabric with.
            tup = third_party_utils.pkgconfig_get_system_link_args('libfabric')
            # put the two lists together (but expect tup[0] to be empty)
            pclibs = tup[0] + tup[1]

            # add -Wl,-rpath for the -L options
            # this was a workaround and is probably not needed anymore
            for pcl in pclibs:
                libs.append(pcl)
                if pcl.startswith('-L'):
                    libs.append(pcl.replace('-L', '-Wl,-rpath,', 1))

        args[1].extend(libs)

    if libfabric_val == 'system' or libfabric_val == 'bundled':
        libs = []
        launcher_val = chpl_launcher.get()
        ofi_oob_val = overrides.get_environ('CHPL_COMM_OFI_OOB')
        if 'mpi' in launcher_val or (ofi_oob_val and 'mpi' in ofi_oob_val):
            mpi_dir_val = overrides.get_environ('MPI_DIR')
            if mpi_dir_val:
                mpi_lib_dir = os.path.join(mpi_dir_val, 'lib64')
                if not os.path.exists(mpi_lib_dir):
                    mpi_lib_dir = os.path.join(mpi_dir_val, 'lib')
                    if not os.path.exists(mpi_lib_dir):
                        mpi_lib_dir = None

                if mpi_lib_dir:
                    libs.append('-L' + mpi_lib_dir)
                    libs.append('-Wl,-rpath,' + mpi_lib_dir)
                    mpi_lib_name = 'mpi'
                    if glob.glob(mpi_lib_dir + '/libmpich.*'):
                        mpi_lib_name = 'mpich'
                    libs.append('-l' + mpi_lib_name)

        # If we're using the PMI2 out-of-band support we have to reference
        # libpmi2 explicitly, except on Cray XC systems.
        platform_val = chpl_platform.get('target')
        if platform_val == 'hpe-cray-ex' or ofi_oob_val == 'pmi2':
            libs.append('-lpmi2')

        args[1].extend(libs)

    return args