コード例 #1
0
def get_config_schema():
    from aksetup_helper import ConfigSchema, Option, \
            IncludeDir, LibraryDir, Libraries, BoostLibraries, \
            Switch, StringListOption, make_boost_base_options

    nvcc_path = search_on_path(["nvcc", "nvcc.exe"])
    if nvcc_path is None:
        print(
            "***************************************************************")
        print("*** WARNING: nvcc not in path.")
        print("*** May need to set CUDA_INC_DIR for installation to succeed.")
        print(
            "***************************************************************")
        cuda_root_default = None
    else:
        cuda_root_default = normpath(join(dirname(nvcc_path), ".."))

    default_lib_dirs = [
        "${CUDA_ROOT}/lib",
        "${CUDA_ROOT}/lib64",
        # https://github.com/inducer/pycuda/issues/98
        "${CUDA_ROOT}/lib/stubs",
        "${CUDA_ROOT}/lib64/stubs",
    ]

    return ConfigSchema(make_boost_base_options() + [
        Switch("USE_SHIPPED_BOOST", True, "Use included Boost library"),
        BoostLibraries("python"),
        BoostLibraries("thread"),
        Switch("CUDA_TRACE", False, "Enable CUDA API tracing"),
        Option("CUDA_ROOT",
               default=cuda_root_default,
               help="Path to the CUDA toolkit"),
        Option("CUDA_PRETEND_VERSION",
               help="Assumed CUDA version, in the form 3010 for 3.1."),
        IncludeDir("CUDA", None),
        Switch("CUDA_ENABLE_GL", False, "Enable CUDA GL interoperability"),
        Switch("CUDA_ENABLE_CURAND", True, "Enable CURAND library"),
        LibraryDir("CUDADRV", default_lib_dirs),
        Libraries("CUDADRV", ["cuda"]),
        LibraryDir("CUDART", default_lib_dirs),
        Libraries("CUDART", ["cudart"]),
        LibraryDir("CURAND", default_lib_dirs),
        Libraries("CURAND", ["curand"]),
        StringListOption("CXXFLAGS", [],
                         help="Any extra C++ compiler options to include"),
        StringListOption("LDFLAGS", [],
                         help="Any extra linker options to include"),
    ])
コード例 #2
0
ファイル: setup.py プロジェクト: tboser/pyopencl
def get_config_schema():
    from aksetup_helper import ConfigSchema, Option, \
            IncludeDir, LibraryDir, Libraries, \
            Switch, StringListOption

    default_cxxflags = ['-std=gnu++11']

    if 'darwin' in sys.platform:
        import platform
        osx_ver, _, _ = platform.mac_ver()
        osx_ver = '.'.join(osx_ver.split('.')[:2])

        sysroot_paths = [
                "/Applications/Xcode.app/Contents/Developer/Platforms/"
                "MacOSX.platform/Developer/SDKs/MacOSX%s.sdk" % osx_ver,
                "/Developer/SDKs/MacOSX%s.sdk" % osx_ver
                ]

        default_libs = []
        default_cxxflags = default_cxxflags + [
                '-stdlib=libc++', '-mmacosx-version-min=10.7',
                '-arch', 'i386', '-arch', 'x86_64'
                ]

        from os.path import isdir
        for srp in sysroot_paths:
            if isdir(srp):
                default_cxxflags.extend(['-isysroot', srp])
                break

        default_ldflags = default_cxxflags[:] + ["-Wl,-framework,OpenCL"]

    else:
        default_libs = ["alteracl","alterahalmmd","elf","OpenCL"]
        default_libdir = [
            "/opt/intelFPGA/16.1/hld/board/s5_ref/linux64/lib",
            "/opt/intelFPGA/16.1/hld/host/linux64/lib"]
        default_ldflags = ["-Wl,--no-as-needed"]
        default_incdir = []

    return ConfigSchema([
        Switch("CL_TRACE", False, "Enable OpenCL API tracing"),
        Switch("CL_ENABLE_GL", False, "Enable OpenCL<->OpenGL interoperability"),
        Switch(
            "CL_USE_SHIPPED_EXT", True,
            "Use the pyopencl version of CL/cl_ext.h which includes" +
            " a broader range of vendor-specific OpenCL extension attributes" +
            " than the standard Khronos (or vendor specific) CL/cl_ext.h."),
        Option("CL_PRETEND_VERSION", None,
            "Dotted CL version (e.g. 1.2) which you'd like to use."),

        IncludeDir("CL", []),
        LibraryDir("CL", []),
        Libraries("CL", default_libs),

        StringListOption("CXXFLAGS", default_cxxflags,
            help="Any extra C++ compiler options to include"),
        StringListOption("LDFLAGS", default_ldflags,
            help="Any extra linker options to include"),
        ])
コード例 #3
0
ファイル: setup.py プロジェクト: romanstingler/pyopencl
def get_config_schema():
    from aksetup_helper import ConfigSchema, Option, \
            IncludeDir, LibraryDir, Libraries, BoostLibraries, \
            Switch, StringListOption, make_boost_base_options

    import sys
    if 'darwin' in sys.platform:
        import platform
        osx_ver, _, _ = platform.mac_ver()
        osx_ver = '.'.join(osx_ver.split('.')[:2])

        sysroot_paths = [
            "/Applications/Xcode.app/Contents/Developer/Platforms/"
            "MacOSX.platform/Developer/SDKs/MacOSX%s.sdk" % osx_ver,
            "/Developer/SDKs/MacOSX%s.sdk" % osx_ver
        ]

        default_libs = []
        default_cxxflags = ['-arch', 'i386', '-arch', 'x86_64']

        from os.path import isdir
        for srp in sysroot_paths:
            if isdir(srp):
                default_cxxflags.extend(['-isysroot', srp])
                break

        default_ldflags = default_cxxflags[:] + ["-Wl,-framework,OpenCL"]

    else:
        default_libs = ["OpenCL"]
        default_cxxflags = []
        default_ldflags = []

    return ConfigSchema(make_boost_base_options() + [
        BoostLibraries("python"),
        Switch("USE_SHIPPED_BOOST", True, "Use included Boost library"),
        Switch("CL_TRACE", False, "Enable OpenCL API tracing"),
        Switch("CL_ENABLE_GL", False,
               "Enable OpenCL<->OpenGL interoperability"),
        Switch("CL_ENABLE_DEVICE_FISSION", True,
               "Enable device fission extension, if present"),
        Option("CL_PRETEND_VERSION", None,
               "Dotted CL version (e.g. 1.2) which you'd like to use."),
        IncludeDir("CL", []),
        LibraryDir("CL", []),
        Libraries("CL", default_libs),
        StringListOption("CXXFLAGS",
                         default_cxxflags,
                         help="Any extra C++ compiler options to include"),
        StringListOption("LDFLAGS",
                         default_ldflags,
                         help="Any extra linker options to include"),
    ])
コード例 #4
0
ファイル: setup.py プロジェクト: ernwa/pyopencl
def get_config_schema():
    from aksetup_helper import ConfigSchema, Option, \
            IncludeDir, LibraryDir, Libraries, \
            Switch, StringListOption

    default_cxxflags = ['-std=c++0x']

    if 'darwin' in sys.platform:
        import platform
        osx_ver, _, _ = platform.mac_ver()
        osx_ver = '.'.join(osx_ver.split('.')[:2])

        sysroot_paths = [
            "/Applications/Xcode.app/Contents/Developer/Platforms/"
            "MacOSX.platform/Developer/SDKs/MacOSX%s.sdk" % osx_ver,
            "/Developer/SDKs/MacOSX%s.sdk" % osx_ver
        ]

        default_libs = []
        default_cxxflags = default_cxxflags + [
            '-stdlib=libc++', '-mmacosx-version-min=10.7', '-arch', 'i386',
            '-arch', 'x86_64'
        ]

        from os.path import isdir
        for srp in sysroot_paths:
            if isdir(srp):
                default_cxxflags.extend(['-isysroot', srp])
                break

        default_ldflags = default_cxxflags[:] + ["-Wl,-framework,OpenCL"]

    else:
        default_libs = ["OpenCL"]
        default_ldflags = []

    return ConfigSchema([
        Switch("CL_TRACE", False, "Enable OpenCL API tracing"),
        Switch("CL_ENABLE_GL", False,
               "Enable OpenCL<->OpenGL interoperability"),
        Option("CL_PRETEND_VERSION", None,
               "Dotted CL version (e.g. 1.2) which you'd like to use."),
        IncludeDir("CL", []),
        LibraryDir("CL", []),
        Libraries("CL", default_libs),
        StringListOption("CXXFLAGS",
                         default_cxxflags,
                         help="Any extra C++ compiler options to include"),
        StringListOption("LDFLAGS",
                         default_ldflags,
                         help="Any extra linker options to include"),
    ])
コード例 #5
0
def get_config_schema():
    from aksetup_helper import ConfigSchema, Option, \
            IncludeDir, LibraryDir, Libraries, BoostLibraries, \
            Switch, StringListOption, make_boost_base_options

    return ConfigSchema(make_boost_base_options() + [
        Switch("USE_SHIPPED_BOOST", True, "Use included Boost library"),
        BoostLibraries("python"),
        BoostLibraries("thread"),
        Switch("CUDA_TRACE", False, "Enable CUDA API tracing"),
        Option("CUDA_ROOT", help="Path to the CUDA toolkit"),
        Option("CUDA_PRETEND_VERSION",
               help="Assumed CUDA version, in the form 3010 for 3.1."),
        IncludeDir("CUDA", None),
        Switch("CUDA_ENABLE_GL", False, "Enable CUDA GL interoperability"),
        LibraryDir("CUDADRV", []),
        Libraries("CUDADRV", ["cuda"]),
        StringListOption("CXXFLAGS", [],
                         help="Any extra C++ compiler options to include"),
        StringListOption("LDFLAGS", [],
                         help="Any extra linker options to include"),
    ])
コード例 #6
0
ファイル: setup.py プロジェクト: andrewcron/pycuda
def get_config_schema():
    from aksetup_helper import ConfigSchema, Option, \
            IncludeDir, LibraryDir, Libraries, BoostLibraries, \
            Switch, StringListOption, make_boost_base_options

    nvcc_path = search_on_path(["nvcc", "nvcc.exe"])
    if nvcc_path is None:
        print("*** nvcc not in path. Giving up.")
        import sys
        sys.exit(1)

    cuda_root_default = normpath(join(dirname(nvcc_path), ".."))

    return ConfigSchema(make_boost_base_options() + [
        Switch("USE_SHIPPED_BOOST", True, "Use included Boost library"),
        BoostLibraries("python"),
        BoostLibraries("thread"),
        Switch("CUDA_TRACE", False, "Enable CUDA API tracing"),
        Option("CUDA_ROOT",
               default=cuda_root_default,
               help="Path to the CUDA toolkit"),
        Option("CUDA_PRETEND_VERSION",
               help="Assumed CUDA version, in the form 3010 for 3.1."),
        IncludeDir("CUDA", None),
        Switch("CUDA_ENABLE_GL", False, "Enable CUDA GL interoperability"),
        Switch("CUDA_ENABLE_CURAND", True, "Enable CURAND library"),
        LibraryDir("CUDADRV", ["${CUDA_ROOT}/lib", "${CUDA_ROOT}/lib64"]),
        Libraries("CUDADRV", ["cuda"]),
        LibraryDir("CUDART", ["${CUDA_ROOT}/lib", "${CUDA_ROOT}/lib64"]),
        Libraries("CUDART", ["cudart"]),
        LibraryDir("CURAND", ["${CUDA_ROOT}/lib", "${CUDA_ROOT}/lib64"]),
        Libraries("CURAND", ["curand"]),
        StringListOption("CXXFLAGS", [],
                         help="Any extra C++ compiler options to include"),
        StringListOption("LDFLAGS", [],
                         help="Any extra linker options to include"),
    ])
コード例 #7
0
def get_config_schema():
    from aksetup_helper import ConfigSchema, BoostLibraries, \
            Option, StringListOption, make_boost_base_options
    import sys

    if 'darwin' in sys.platform:
        default_libs = []
        default_cxxflags = [
            '-arch', 'i386', '-arch', 'x86_64', '-isysroot',
            '/Developer/SDKs/MacOSX10.6.sdk'
        ]
        default_ldflags = default_cxxflags[:]
    else:
        default_cxxflags = []
        default_ldflags = []

    return ConfigSchema(make_boost_base_options() + [
        BoostLibraries("python"),
        Option("SEQAN_DIR"),
        StringListOption("CXXFLAGS", ["-Wno-sign-compare"],
                         help="Any extra C++ compiler options to include"),
        StringListOption("LDFLAGS", [],
                         help="Any extra linker options to include"),
    ])
コード例 #8
0
def get_config_schema():
    from aksetup_helper import ConfigSchema, Option, \
            IncludeDir, LibraryDir, Libraries, BoostLibraries, \
            Switch, StringListOption, make_boost_base_options

    nvcc_path = search_on_path(["nvcc", "nvcc.exe"])
    if nvcc_path is None:
        print("***************************************************************")
        print("*** WARNING: nvcc not in path.")
        print("*** May need to set CUDA_INC_DIR for installation to succeed.")
        print("***************************************************************")
        cuda_root_default = None
    else:
        cuda_root_default = normpath(join(dirname(nvcc_path), ".."))

    cxxflags_default = []
    ldflags_default = []

    lib64 = "lib64"
    import sys
    if sys.platform.startswith("win"):
        # https://github.com/inducer/pycuda/issues/113
        lib64 = "lib/x64"

        cxxflags_default.extend(['/EHsc'])
        ldflags_default.extend(['/FORCE'])
    elif 'darwin' in sys.platform:
        import glob
        root_candidates = glob.glob('/Developer/NVIDIA/CUDA-*')
        if root_candidates:
            cuda_root_default = root_candidates[-1]
            lib64 = "lib"

    default_lib_dirs = [
        "${CUDA_ROOT}/lib",
        "${CUDA_ROOT}/"+lib64,
        # https://github.com/inducer/pycuda/issues/98
        "${CUDA_ROOT}/lib/stubs",
        "${CUDA_ROOT}/%s/stubs" % lib64,
        ]

    if 'darwin' in sys.platform:
        default_lib_dirs.append(
            "/usr/local/cuda/lib")

    return ConfigSchema(make_boost_base_options() + [
        Switch("USE_SHIPPED_BOOST", True, "Use included Boost library"),

        BoostLibraries("python"),
        BoostLibraries("thread"),

        Switch("CUDA_TRACE", False, "Enable CUDA API tracing"),
        Option("CUDA_ROOT", default=cuda_root_default,
            help="Path to the CUDA toolkit"),
        Option("CUDA_PRETEND_VERSION",
            help="Assumed CUDA version, in the form 3010 for 3.1."),
        IncludeDir("CUDA", None),

        Switch("CUDA_ENABLE_GL", False, "Enable CUDA GL interoperability"),
        Switch("CUDA_ENABLE_CURAND", True, "Enable CURAND library"),

        LibraryDir("CUDADRV", default_lib_dirs),
        Libraries("CUDADRV", ["cuda"]),

        LibraryDir("CUDART", default_lib_dirs),
        Libraries("CUDART", ["cudart"]),

        LibraryDir("CURAND", default_lib_dirs),
        Libraries("CURAND", ["curand"]),

        StringListOption("CXXFLAGS", cxxflags_default,
            help="Any extra C++ compiler options to include"),
        StringListOption("LDFLAGS", ldflags_default,
            help="Any extra linker options to include"),
        ])
コード例 #9
0
def get_config_schema():
    from aksetup_helper import ConfigSchema, Option, \
            IncludeDir, LibraryDir, Libraries, \
            Switch, StringListOption

    default_cxxflags = [
            # Required for pybind11:
            # https://pybind11.readthedocs.io/en/stable/faq.html#someclass-declared-with-greater-visibility-than-the-type-of-its-field-someclass-member-wattributes
            "-fvisibility=hidden"
            ]

    if 'darwin' in sys.platform:
        import platform
        osx_ver, _, _ = platform.mac_ver()
        osx_ver = '.'.join(osx_ver.split('.')[:2])

        sysroot_paths = [
                "/Applications/Xcode.app/Contents/Developer/Platforms/"
                "MacOSX.platform/Developer/SDKs/MacOSX%s.sdk" % osx_ver,
                "/Developer/SDKs/MacOSX%s.sdk" % osx_ver
                ]

        default_libs = []
        default_cxxflags = default_cxxflags + [
                '-stdlib=libc++', '-mmacosx-version-min=10.7',
                '-arch', 'i386', '-arch', 'x86_64'
                ]

        from os.path import isdir
        for srp in sysroot_paths:
            if isdir(srp):
                default_cxxflags.extend(['-isysroot', srp])
                break

        default_ldflags = default_cxxflags[:] + ["-Wl,-framework,OpenCL"]

    else:
        default_libs = ["OpenCL"]
        if "linux" in sys.platform:
            # Requested in
            # https://github.com/inducer/pyopencl/issues/132#issuecomment-314713573
            # to make life with Altera FPGAs less painful by default.
            default_ldflags = ["-Wl,--no-as-needed"]
        else:
            default_ldflags = []

    return ConfigSchema([
        Switch("CL_TRACE", False, "Enable OpenCL API tracing"),
        Switch("CL_ENABLE_GL", False, "Enable OpenCL<->OpenGL interoperability"),
        Switch(
            "CL_USE_SHIPPED_EXT", False,
            "Use the pyopencl version of CL/cl_ext.h which includes"
            + " a broader range of vendor-specific OpenCL extension attributes"
            + " than the standard Khronos (or vendor specific) CL/cl_ext.h."),
        Option("CL_PRETEND_VERSION", None,
            "Dotted CL version (e.g. 1.2) which you'd like to use."),

        IncludeDir("CL", []),
        LibraryDir("CL", []),
        Libraries("CL", default_libs),

        StringListOption("CXXFLAGS", default_cxxflags,
            help="Any extra C++ compiler options to include"),
        StringListOption("LDFLAGS", default_ldflags,
            help="Any extra linker options to include"),
        ])
コード例 #10
0
def get_config_schema():
    from aksetup_helper import (ConfigSchema, Option,
            IncludeDir, LibraryDir, Libraries,
            Switch, StringListOption)

    default_cxxflags = [
            # Required for pybind11:
            # https://pybind11.readthedocs.io/en/stable/faq.html#someclass-declared-with-greater-visibility-than-the-type-of-its-field-someclass-member-wattributes
            "-fvisibility=hidden"
            ]

    if "darwin" in sys.platform:
        import platform
        osx_ver, _, _ = platform.mac_ver()
        osx_ver = ".".join(osx_ver.split(".")[:2])

        sysroot_paths = [
                "/Applications/Xcode.app/Contents/Developer/Platforms/"
                "MacOSX.platform/Developer/SDKs/MacOSX%s.sdk" % osx_ver,
                "/Developer/SDKs/MacOSX%s.sdk" % osx_ver
                ]

        default_libs = []
        default_cxxflags = default_cxxflags + [
                "-stdlib=libc++", "-mmacosx-version-min=10.7"]

        from os.path import isdir
        for srp in sysroot_paths:
            if isdir(srp):
                default_cxxflags.extend(["-isysroot", srp])
                break

        default_ldflags = default_cxxflags[:] + ["-Wl,-framework,OpenCL"]

    else:
        default_libs = ["OpenCL"]
        if "linux" in sys.platform:
            # Requested in
            # https://github.com/inducer/pyopencl/issues/132#issuecomment-314713573
            # to make life with Altera FPGAs less painful by default.
            default_ldflags = ["-Wl,--no-as-needed"]
        else:
            default_ldflags = []

    return ConfigSchema([
        Switch("CL_TRACE", False, "Enable OpenCL API tracing"),
        Switch("CL_ENABLE_GL", False, "Enable OpenCL<->OpenGL interoperability"),
        Switch(
            "CL_USE_SHIPPED_EXT", False,
            "Use the pyopencl version of CL/cl_ext.h which includes"
            + " a broader range of vendor-specific OpenCL extension attributes"
            + " than the standard Khronos (or vendor specific) CL/cl_ext.h."),

        # This is here because the ocl-icd wheel declares but doesn't define
        # clSetProgramSpecializationConstant as of 2021-05-22, and providing
        # configuration options for this to pip install isn't easy. Being
        # able to specify this means being able to build a PyOpenCL via pip install
        # that'll work with an outdated ICD loader.
        #
        # (https://stackoverflow.com/q/677577)
        # x-ref: https://github.com/inducer/meshmode/pull/194/checks?check_run_id=2647133257#step:5:27  # noqa: E501
        # x-ref: https://github.com/isuruf/ocl-wheels/
        Option("CL_PRETEND_VERSION",
            os.environ.get("PYOPENCL_CL_PRETEND_VERSION", None),
            "Dotted CL version (e.g. 1.2) which you'd like to use."),

        IncludeDir("CL", []),
        LibraryDir("CL", []),
        Libraries("CL", default_libs),

        StringListOption("CXXFLAGS", default_cxxflags,
            help="Any extra C++ compiler options to include"),
        StringListOption("LDFLAGS", default_ldflags,
            help="Any extra linker options to include"),
        ])