Ejemplo n.º 1
0
def get_config_schema():
    from aksetup_helper import (ConfigSchema, 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"
    ]

    return ConfigSchema([
        Switch("USE_SHIPPED_ISL", True, "Use included copy of isl"),
        Switch("USE_SHIPPED_IMATH", True, "Use included copy of imath in isl"),
        Switch("USE_GMP", True, "Use gmp in external isl"),
        Switch("USE_BARVINOK", False, "Include wrapper for Barvinok"),
        Switch("USE_IMATH_SIO", True, "When using imath, use small-integer "
               "optimization"),
        IncludeDir("GMP", []),
        LibraryDir("GMP", []),
        Libraries("GMP", ["gmp"]),
        IncludeDir("ISL", []),
        LibraryDir("ISL", []),
        Libraries("ISL", ["isl"]),
        IncludeDir("BARVINOK", []),
        LibraryDir("BARVINOK", []),
        Libraries("BARVINOK", ["barvinok", "polylibgmp"]),
        StringListOption("CXXFLAGS",
                         default_cxxflags,
                         help="Any extra C++ compiler options to include"),
        StringListOption("LDFLAGS", [],
                         help="Any extra linker options to include"),
    ])
Ejemplo n.º 2
0
def get_config_schema():
    from aksetup_helper import (ConfigSchema, IncludeDir, LibraryDir,
                                Libraries, Switch, StringListOption)

    return ConfigSchema([
        Switch("USE_SHIPPED_ISL", True, "Use included copy of isl"),
        Switch("USE_SHIPPED_IMATH", True, "Use included copy of imath in isl"),
        Switch("USE_GMP", True, "Use gmp in external isl"),
        Switch("USE_BARVINOK", False, "Include wrapper for Barvinok"),
        Switch("USE_IMATH_SIO", False, "When using imath, use small-integer "
               "optimization"),
        IncludeDir("GMP", []),
        LibraryDir("GMP", []),
        Libraries("GMP", ["gmp"]),
        IncludeDir("ISL", []),
        LibraryDir("ISL", []),
        Libraries("ISL", ["isl"]),
        IncludeDir("BARVINOK", []),
        LibraryDir("BARVINOK", []),
        Libraries("BARVINOK", ["barvinok", "polylibgmp"]),
        StringListOption("CXXFLAGS", [],
                         help="Any extra C++ compiler options to include"),
        StringListOption("LDFLAGS", [],
                         help="Any extra linker options to include"),
    ])
Ejemplo n.º 3
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"),
    ])
Ejemplo n.º 4
0
def get_config_schema():
    from aksetup_helper import ConfigSchema, \
            IncludeDir, LibraryDir, Libraries, BoostLibraries, \
            StringListOption, make_boost_base_options

    return ConfigSchema(make_boost_base_options() + [
        BoostLibraries("python"),
        IncludeDir("BOOST_BINDINGS", []),
        LibraryDir("BLAS", []),
        Libraries("BLAS", ["blas"]),
        LibraryDir("LAPACK", []),
        Libraries("LAPACK", ["lapack"]),
        StringListOption("CXXFLAGS", [],
                         help="Any extra C++ compiler options to include"),
    ])
Ejemplo n.º 5
0
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:
        default_libs = []
        default_cxxflags = ['-arch', 'i386', '-arch', 'x86_64',
                '-isysroot', '/Developer/SDKs/MacOSX10.6.sdk']
        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"),

        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"),
        ])
Ejemplo n.º 6
0
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"),
        ])
Ejemplo n.º 7
0
def get_config_schema():
    from aksetup_helper import ConfigSchema, \
            IncludeDir, LibraryDir, Libraries, BoostLibraries, \
            Switch, StringListOption, make_boost_base_options

    if sys.platform.startswith('darwin'):
        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 = []

    try:
        import os
        conf_file = os.environ["SITECONF"]
    except:
        conf_file = "siteconf.py"

    return ConfigSchema(make_boost_base_options() + [
        BoostLibraries("python"),
        Switch("USE_SHIPPED_BOOST", True, "Use included Boost library"),
        Switch("USE_SHIPPED_VIENNACL", True, "Use included ViennaCL library"),
        Switch("USE_OPENCL", True, "Use OpenCL"),
        IncludeDir("CL", []),
        LibraryDir("CL", []),
        Libraries("CL", default_libs),
        IncludeDir("VIENNACL", []),
        StringListOption("CXXFLAGS",
                         default_cxxflags,
                         help="Any extra C++ compiler options to include"),
        StringListOption("LDFLAGS",
                         default_ldflags,
                         help="Any extra linker options to include"),
    ],
                        conf_file=conf_file)
Ejemplo n.º 8
0
def get_config_schema():
    from aksetup_helper import (ConfigSchema, StringListOption, Switch,
                                IncludeDir, LibraryDir, Libraries)

    return ConfigSchema([
        Switch("USE_SHIPPED_METIS", True, "Use included copy of metis"),
        StringListOption("CXXFLAGS", [],
                         help="Any extra C++ compiler options to include"),
        IncludeDir("METIS", []),
        LibraryDir("METIS", []),
        Libraries("METIS", ["metis"]),
    ])
Ejemplo n.º 9
0
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"),
    ])
Ejemplo n.º 10
0
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"),
    ])
Ejemplo n.º 11
0
def get_config_schema():
    from aksetup_helper import (ConfigSchema, IncludeDir, LibraryDir,
                                Libraries, Switch, StringListOption,
                                make_boost_base_options)

    return ConfigSchema(make_boost_base_options() + [
        Switch("USE_SILO", False, "Compile libsilo interface"),
        IncludeDir("SILO", []),
        LibraryDir("SILO", []),
        Libraries("SILO", ["siloh5"]),
        StringListOption("CXXFLAGS", [],
                         help="Any extra C++ compiler options to include"),
    ])
Ejemplo n.º 12
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() + [
        BoostLibraries("python"),
        IncludeDir("TAGLIB", []),
        LibraryDir("TAGLIB", []),
        Libraries("TAGLIB", ["tag"]),
        StringListOption("CXXFLAGS", [],
                         help="Any extra C++ compiler options to include"),
    ])
Ejemplo n.º 13
0
def get_config_schema():
    from aksetup_helper import ConfigSchema, \
            IncludeDir, LibraryDir, Libraries, BoostLibraries, \
            Switch, StringListOption, make_boost_base_options

    return ConfigSchema(make_boost_base_options() + [
        BoostLibraries("python"),

        IncludeDir("BOOST_BINDINGS", ["../boost-numeric-bindings"]),

        Switch("HAVE_BLAS", False, "Whether to build with support for BLAS"),
        LibraryDir("BLAS", []),
        Libraries("BLAS", ["blas"]),

        Switch("HAVE_LAPACK", False, "Whether to build with support for LAPACK"),
        LibraryDir("LAPACK", []),
        Libraries("LAPACK", ["blas"]),

        Switch("COMPILE_DASKR", True, "Whether to build (with) DASKR"),
        Switch("COMPILE_XERBLA", False,
            "Whether to compile and add our own XERBLA routine."
            "ATLAS LAPACK does not have one."),

        Switch("HAVE_ARPACK", False, "Whether to build with support for BLAS"),
        LibraryDir("ARPACK", []),
        Libraries("ARPACK", ["arpack"]),

        Switch("HAVE_UMFPACK", False, "Whether to build with support for UMFPACK"),
        IncludeDir("UMFPACK", ["/usr/include/suitesparse"]),
        LibraryDir("UMFPACK", []),
        Libraries("UMFPACK", ["umfpack", "amd"]),

        StringListOption("CXXFLAGS", [],
            help="Any extra C++ compiler options to include"),
        StringListOption("LDFLAGS", [],
            help="Any extra linker options to include"),
        ])
Ejemplo n.º 14
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("*** 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"),
    ])
Ejemplo n.º 15
0
def get_config_schema():
    from aksetup_helper import ConfigSchema, \
            IncludeDir, LibraryDir, Libraries, BoostLibraries, \
            Switch, StringListOption, make_boost_base_options

    return ConfigSchema(make_boost_base_options() + [
        BoostLibraries("python"),
        IncludeDir("BOOST_BINDINGS", ["../boost-numeric-bindings"]),
        Switch("HAVE_BLAS", False, "Whether to build with support for BLAS"),
        LibraryDir("BLAS", []),
        Libraries("BLAS", ["blas"]),
        StringListOption("CXXFLAGS", [],
                         help="Any extra C++ compiler options to include"),
        StringListOption("LDFLAGS", [],
                         help="Any extra linker options to include"),
    ])
Ejemplo n.º 16
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"),
        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"),
    ])
Ejemplo n.º 17
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"),
        ])
Ejemplo n.º 18
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"),
        ])
Ejemplo n.º 19
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"),
        ])