def main(): import sys from aksetup_helper import (hack_distutils, get_config, setup, NumpyExtension, set_up_shipped_boost_if_requested, check_git_submodules) check_git_submodules() hack_distutils() conf = get_config(get_config_schema()) EXTRA_SOURCES, EXTRA_DEFINES = set_up_shipped_boost_if_requested( "pycuda", conf) EXTRA_DEFINES["PYGPU_PACKAGE"] = "pycuda" EXTRA_DEFINES["PYGPU_PYCUDA"] = "1" LIBRARY_DIRS = conf["BOOST_LIB_DIR"] + conf["CUDADRV_LIB_DIR"] LIBRARIES = (conf["BOOST_PYTHON_LIBNAME"] + conf["BOOST_THREAD_LIBNAME"] + conf["CUDADRV_LIBNAME"]) if not conf["CUDA_INC_DIR"] and conf["CUDA_ROOT"]: conf["CUDA_INC_DIR"] = [join(conf["CUDA_ROOT"], "include")] if conf["CUDA_TRACE"]: EXTRA_DEFINES["CUDAPP_TRACE_CUDA"] = 1 if conf["CUDA_PRETEND_VERSION"]: EXTRA_DEFINES["CUDAPP_PRETEND_CUDA_VERSION"] = conf[ "CUDA_PRETEND_VERSION"] INCLUDE_DIRS = ['src/cpp'] + conf["BOOST_INC_DIR"] if conf["CUDA_INC_DIR"]: INCLUDE_DIRS += conf["CUDA_INC_DIR"] conf["USE_CUDA"] = True if 'darwin' in sys.platform and sys.maxsize == 2147483647: # The Python interpreter is running in 32 bit mode on OS X if "-arch" not in conf["CXXFLAGS"]: conf["CXXFLAGS"].extend(['-arch', 'i386', '-m32']) if "-arch" not in conf["LDFLAGS"]: conf["LDFLAGS"].extend(['-arch', 'i386', '-m32']) if 'darwin' in sys.platform: # set path to Cuda dynamic libraries, # as a safe substitute for DYLD_LIBRARY_PATH for lib_dir in conf["CUDADRV_LIB_DIR"]: conf["LDFLAGS"].extend(["-Xlinker", "-rpath", "-Xlinker", lib_dir]) if conf["CUDA_ENABLE_GL"]: EXTRA_SOURCES.append("src/wrapper/wrap_cudagl.cpp") EXTRA_DEFINES["HAVE_GL"] = 1 if conf["CUDA_ENABLE_CURAND"]: EXTRA_DEFINES["HAVE_CURAND"] = 1 EXTRA_SOURCES.extend(["src/wrapper/wrap_curand.cpp"]) LIBRARIES.extend(conf["CURAND_LIBNAME"]) LIBRARY_DIRS.extend(conf["CURAND_LIB_DIR"]) ver_dic = {} exec( compile( open("pycuda/__init__.py").read(), "pycuda/__init__.py", 'exec'), ver_dic) try: from distutils.command.build_py import build_py_2to3 as build_py except ImportError: # 2.x from distutils.command.build_py import build_py import sys if sys.version_info >= (3, ): pvt_struct_source = "src/wrapper/_pvt_struct_v3.cpp" else: pvt_struct_source = "src/wrapper/_pvt_struct_v2.cpp" setup( name="pycuda", # metadata version=ver_dic["VERSION_TEXT"], description="Python wrapper for Nvidia CUDA", long_description=open("README.rst", "rt").read(), author="Andreas Kloeckner", author_email="*****@*****.**", license="MIT", url="http://mathema.tician.de/software/pycuda", classifiers=[ 'Environment :: Console', 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'Intended Audience :: Other Audience', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: MIT License', 'Natural Language :: English', 'Programming Language :: C++', 'Programming Language :: Python', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Topic :: Scientific/Engineering', 'Topic :: Scientific/Engineering :: Mathematics', 'Topic :: Scientific/Engineering :: Physics', 'Topic :: Scientific/Engineering :: Visualization', ], # build info packages=["pycuda", "pycuda.gl", "pycuda.sparse", "pycuda.compyte"], install_requires=[ "pytools>=2011.2", "pytest>=2", "decorator>=3.2.0", "appdirs>=1.4.0" ], ext_package="pycuda", ext_modules=[ NumpyExtension( "_driver", [ "src/cpp/cuda.cpp", "src/cpp/bitlog.cpp", "src/wrapper/wrap_cudadrv.cpp", "src/wrapper/mempool.cpp", ] + EXTRA_SOURCES, include_dirs=INCLUDE_DIRS, library_dirs=LIBRARY_DIRS, libraries=LIBRARIES, define_macros=list(EXTRA_DEFINES.items()), extra_compile_args=conf["CXXFLAGS"], extra_link_args=conf["LDFLAGS"], ), NumpyExtension( "_pvt_struct", [pvt_struct_source], extra_compile_args=conf["CXXFLAGS"], extra_link_args=conf["LDFLAGS"], ), ], include_package_data=True, package_data={"pycuda": [ "cuda/*.hpp", ]}, zip_safe=False, # 2to3 invocation cmdclass={'build_py': build_py})
def main(): from aksetup_helper import ( hack_distutils, get_config, setup, NumpyExtension, set_up_shipped_boost_if_requested, check_git_submodules, ) check_git_submodules() hack_distutils() conf = get_config(get_config_schema(), warn_about_no_config=False) EXTRA_OBJECTS, EXTRA_DEFINES = set_up_shipped_boost_if_requested("pyopencl", conf) LIBRARY_DIRS = conf["BOOST_LIB_DIR"] LIBRARIES = conf["BOOST_PYTHON_LIBNAME"] EXTRA_INCLUDE_DIRS = [] EXTRA_DEFINES["PYGPU_PACKAGE"] = "pyopencl" EXTRA_DEFINES["PYGPU_PYOPENCL"] = "1" if conf["CL_TRACE"]: EXTRA_DEFINES["PYOPENCL_TRACE"] = 1 INCLUDE_DIRS = conf["BOOST_INC_DIR"] + conf["CL_INC_DIR"] if conf["CL_ENABLE_GL"]: EXTRA_DEFINES["HAVE_GL"] = 1 if conf["CL_ENABLE_DEVICE_FISSION"]: EXTRA_DEFINES["PYOPENCL_USE_DEVICE_FISSION"] = 1 if conf["CL_PRETEND_VERSION"]: try: major, minor = [int(x) for x in conf["CL_PRETEND_VERSION"].split(".")] EXTRA_DEFINES["PYOPENCL_PRETEND_CL_VERSION"] = 0x1000 * major + 0x10 * minor except: print("CL_PRETEND_VERSION must be of the form M.N, " "with two integers M and N") raise ver_dic = {} version_file = open("pyopencl/version.py") try: version_file_contents = version_file.read() finally: version_file.close() exec(compile(version_file_contents, "pyopencl/version.py", "exec"), ver_dic) SEPARATOR = "-" * 75 try: from distutils.command.build_py import build_py_2to3 as build_py except ImportError: # 2.x from distutils.command.build_py import build_py try: import mako # noqa except ImportError: print(SEPARATOR) print("Mako is not installed.") print(SEPARATOR) print("That is not a problem, as most of PyOpenCL will be just fine ") print("without it.Some higher-level parts of pyopencl (such as ") print("pyopencl.reduction) will not function without the templating engine ") print("Mako [1] being installed. If you would like this functionality to ") print("work, you might want to install Mako after you finish ") print("installing PyOpenCL.") print("") print("[1] http://www.makotemplates.org/") print(SEPARATOR) print("Hit Ctrl-C now if you'd like to think about the situation.") print(SEPARATOR) from aksetup_helper import count_down_delay count_down_delay(delay=5) might_be_cuda = False for inc_dir in conf["CL_INC_DIR"]: inc_dir = inc_dir.lower() if "nv" in inc_dir or "cuda" in inc_dir: might_be_cuda = True if might_be_cuda and conf["CL_ENABLE_DEVICE_FISSION"]: print(SEPARATOR) print("You might be compiling against Nvidia CUDA with device " "fission enabled.") print(SEPARATOR) print("That is not a problem on CUDA 4.0 and newer. If you are " "using CUDA 3.2,") print("your build will break, because Nvidia shipped a broken CL header in") print("in your version. The fix is to set CL_ENABLE_DEVICE_FISSION to False") print("in your PyOpenCL configuration.") print(SEPARATOR) print("Hit Ctrl-C now if you'd like to think about the situation.") print(SEPARATOR) from aksetup_helper import count_down_delay count_down_delay(delay=5) import sys if sys.version_info >= (3,): pvt_struct_source = "src/wrapper/_pvt_struct_v3.cpp" else: pvt_struct_source = "src/wrapper/_pvt_struct_v2.cpp" setup( name="pyopencl", # metadata version=ver_dic["VERSION_TEXT"], description="Python wrapper for OpenCL", long_description=open("README.rst", "rt").read(), author="Andreas Kloeckner", author_email="*****@*****.**", license="MIT", url="http://mathema.tician.de/software/pyopencl", classifiers=[ "Environment :: Console", "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Intended Audience :: Other Audience", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: C++", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.4", "Programming Language :: Python :: 2.5", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Topic :: Scientific/Engineering", "Topic :: Scientific/Engineering :: Mathematics", "Topic :: Scientific/Engineering :: Physics", ], # build info packages=["pyopencl", "pyopencl.characterize", "pyopencl.compyte"], setup_requires=["numpy"], install_requires=[ "pytools>=2014.2", "pytest>=2", "decorator>=3.2.0", # "Mako>=0.3.6", ], ext_package="pyopencl", ext_modules=[ NumpyExtension( "_cl", [ "src/wrapper/wrap_cl.cpp", "src/wrapper/wrap_cl_part_1.cpp", "src/wrapper/wrap_cl_part_2.cpp", "src/wrapper/wrap_constants.cpp", "src/wrapper/wrap_mempool.cpp", "src/wrapper/bitlog.cpp", ] + EXTRA_OBJECTS, include_dirs=INCLUDE_DIRS + EXTRA_INCLUDE_DIRS, library_dirs=LIBRARY_DIRS + conf["CL_LIB_DIR"], libraries=LIBRARIES + conf["CL_LIBNAME"], define_macros=list(EXTRA_DEFINES.items()), extra_compile_args=conf["CXXFLAGS"], extra_link_args=conf["LDFLAGS"], ), NumpyExtension( "_pvt_struct", [pvt_struct_source], extra_compile_args=conf["CXXFLAGS"], extra_link_args=conf["LDFLAGS"] ), ], include_package_data=True, package_data={"pyopencl": ["cl/*.cl", "cl/*.h"]}, # 2to3 invocation cmdclass={"build_py": build_py}, zip_safe=False, )
def main(): import os from aksetup_helper import (hack_distutils, get_config, setup, NumpyExtension, set_up_shipped_boost_if_requested, check_git_submodules) #check_git_submodules() hack_distutils() conf = get_config(get_config_schema(), warn_about_no_config=False) EXTRA_OBJECTS, EXTRA_DEFINES = \ set_up_shipped_boost_if_requested( "pyviennacl", conf, source_path="external/boost-python-ublas-subset/boost_subset", boost_chrono="header_only") INCLUDE_DIRS = conf["BOOST_INC_DIR"] + [ "external/boost_numpy/" ] if conf["USE_SHIPPED_VIENNACL"]: INCLUDE_DIRS += ["external/viennacl-dev/"] LIBRARY_DIRS = conf["BOOST_LIB_DIR"] LIBRARIES = conf["BOOST_PYTHON_LIBNAME"] # {{{ get version number ver_dic = {} version_file = open("pyviennacl/version.py") try: version_file_contents = version_file.read() finally: version_file.close() exec(compile(version_file_contents, "pyviennacl/version.py", 'exec'), ver_dic) # }}} platform_cflags["msvc"] = ["/EHsc"] platform_cflags["mingw32"] = ["-Wno-unused-function"] platform_cflags["unix"] = ["-Wno-unused-function"] if conf["USE_OPENCL"]: EXTRA_DEFINES["VIENNACL_WITH_OPENCL"] = None if conf["USE_OPENMP"]: EXTRA_DEFINES["VIENNACL_WITH_OPENMP"] = None platform_cflags["unix"] += ["-fopenmp"] EXTRA_DEFINES["VIENNACL_WITH_UBLAS"] = None UNDEF_MACROS = [] if conf["DEBUG"]: UNDEF_MACROS += ['NDEBUG'] #EXTRA_DEFINES["VIENNACL_DEBUG_ALL"] = None EXTRA_DEFINES["VIENNACL_BUILD_INFO"] = None platform_cflags["unix"] += ["-O0","-ggdb"] if not sys.platform.startswith("darwin"): platform_libs['unix'] = ['rt'] if EXTRA_OBJECTS: platform_cflags['mingw32'] += ["-Wno-unused-local-typedefs"] if not sys.platform.startswith("darwin"): platform_cflags['unix'] += ["-Wno-unused-local-typedefs"] source_files = [ "core", "scalars", "vector_float", "vector_double", "vector_int", "vector_long", "vector_uint", "vector_ulong", "dense_matrix_float", "dense_matrix_double", "dense_matrix_int", "dense_matrix_long", "dense_matrix_uint", "dense_matrix_ulong", "structured_matrices", "cpu_compressed_matrix", "compressed_matrix", "compressed_compressed_matrix", "coordinate_matrix", "ell_matrix", "hyb_matrix", "preconditioners","direct_solvers", "iterative_solvers", "extra_functions", "eig", #"bandwidth_reduction", "scheduler", "platform_support", "opencl_support"] from glob import glob try: long_description = open("README.rst", "rt", encoding='utf8').read() except: long_description = open("README.rst", "rt").read() setup( name="pyviennacl", version=ver_dic["VERSION_TEXT"], description="Sparse/dense linear algebra on GPUs and CPUs using OpenCL", long_description=long_description, author='Toby St Clere Smithe', author_email='*****@*****.**', url="http://viennacl.sourceforge.net/pyviennacl.html", classifiers=[ 'Environment :: Console', 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'Intended Audience :: Other Audience', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: MIT License', 'Natural Language :: English', 'Programming Language :: C++', 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Topic :: Scientific/Engineering', 'Topic :: Scientific/Engineering :: Mathematics', 'Topic :: Scientific/Engineering :: Physics', ], setup_requires=['numpy>=1.7'], install_requires=['numpy>=1.7'], packages=["pyviennacl"], ext_package="pyviennacl", ext_modules=[NumpyExtension( "_viennacl", [os.path.join("src", "_viennacl", sf + ".cpp") for sf in source_files] + glob("external/boost_numpy/libs/numpy/src/*.cpp") + EXTRA_OBJECTS, depends=[os.path.join("src", "_viennacl", "viennacl.h")], extra_compile_args=conf["CXXFLAGS"], extra_link_args=conf["LDFLAGS"], define_macros=list(EXTRA_DEFINES.items()), undef_macros=UNDEF_MACROS, include_dirs=INCLUDE_DIRS, library_dirs=LIBRARY_DIRS + conf["CL_LIB_DIR"] + conf["OpenMP_LIB_DIR"], libraries=LIBRARIES + conf["CL_LIBNAME"] + conf["OpenMP_LIBNAME"], )], cmdclass={'build_ext': build_ext_subclass} )
def main(): import glob from aksetup_helper import (hack_distutils, get_config, setup, Extension, set_up_shipped_boost_if_requested) hack_distutils() conf = get_config(get_config_schema(), warn_about_no_config=False) EXTRA_OBJECTS, EXTRA_DEFINES = \ set_up_shipped_boost_if_requested("pymetis", conf) INCLUDE_DIRS = conf["BOOST_INC_DIR"] # noqa LIBRARY_DIRS = conf["BOOST_LIB_DIR"] # noqa LIBRARIES = conf["BOOST_PYTHON_LIBNAME"] # noqa EXTRA_DEFINES["HAVE_MREMAP"] = 0 # mremap() buggy on amd64? ver_filename = "pymetis/version.py" version_file = open(ver_filename) ver_dic = {} try: version_file_contents = version_file.read() finally: version_file.close() exec(compile(version_file_contents, ver_filename, 'exec'), ver_dic) setup( name="PyMetis", version=ver_dic["version"], description="A Graph Partitioning Package", long_description=open("README.rst", "rt").read(), author="Andreas Kloeckner", author_email="*****@*****.**", license="wrapper: MIT/METIS: Apache 2", url="http://mathema.tician.de/software/pymetis", classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'Intended Audience :: Other Audience', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: MIT License', 'License :: Free for non-commercial use', 'Natural Language :: English', 'Programming Language :: C', 'Programming Language :: C++', 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Topic :: Multimedia :: Graphics :: 3D Modeling', 'Topic :: Scientific/Engineering', 'Topic :: Scientific/Engineering :: Mathematics', 'Topic :: Scientific/Engineering :: Visualization', 'Topic :: Software Development :: Libraries', ], packages=["pymetis"], install_requires=["six"], ext_modules=[ Extension( "pymetis._internal", glob.glob("src/metis/GKlib/*.c") + glob.glob("src/metis/*.c") + glob.glob("src/metis/libmetis/*.c") + ["src/wrapper/wrapper.cpp"] + EXTRA_OBJECTS, define_macros=list(EXTRA_DEFINES.items()), include_dirs=["src/metis/GKlib"] + ["src/metis/include"] + ["src/metis/libmetis"] + INCLUDE_DIRS, library_dirs=LIBRARY_DIRS, libraries=LIBRARIES, extra_compile_args=conf["CXXFLAGS"], ), ])
def main(): import sys from aksetup_helper import (hack_distutils, get_config, setup, NumpyExtension, set_up_shipped_boost_if_requested, check_git_submodules) check_git_submodules() hack_distutils() conf = get_config(get_config_schema()) EXTRA_SOURCES, EXTRA_DEFINES = set_up_shipped_boost_if_requested("pycuda", conf) EXTRA_DEFINES["PYGPU_PACKAGE"] = "pycuda" EXTRA_DEFINES["PYGPU_PYCUDA"] = "1" LIBRARY_DIRS = conf["BOOST_LIB_DIR"] + conf["CUDADRV_LIB_DIR"] LIBRARIES = (conf["BOOST_PYTHON_LIBNAME"] + conf["BOOST_THREAD_LIBNAME"] + conf["CUDADRV_LIBNAME"]) if not conf["CUDA_INC_DIR"] and conf["CUDA_ROOT"]: conf["CUDA_INC_DIR"] = [join(conf["CUDA_ROOT"], "include")] if conf["CUDA_TRACE"]: EXTRA_DEFINES["CUDAPP_TRACE_CUDA"] = 1 if conf["CUDA_PRETEND_VERSION"]: EXTRA_DEFINES["CUDAPP_PRETEND_CUDA_VERSION"] = conf["CUDA_PRETEND_VERSION"] INCLUDE_DIRS = ['src/cpp'] + conf["BOOST_INC_DIR"] if conf["CUDA_INC_DIR"]: INCLUDE_DIRS += conf["CUDA_INC_DIR"] conf["USE_CUDA"] = True if 'darwin' in sys.platform and sys.maxsize == 2147483647: # The Python interpreter is running in 32 bit mode on OS X if "-arch" not in conf["CXXFLAGS"]: conf["CXXFLAGS"].extend(['-arch', 'i386', '-m32']) if "-arch" not in conf["LDFLAGS"]: conf["LDFLAGS"].extend(['-arch', 'i386', '-m32']) if 'darwin' in sys.platform: # set path to Cuda dynamic libraries, # as a safe substitute for DYLD_LIBRARY_PATH for lib_dir in conf["CUDADRV_LIB_DIR"]: conf["LDFLAGS"].extend(["-Xlinker", "-rpath", "-Xlinker", lib_dir]) if conf["CUDA_ENABLE_GL"]: EXTRA_SOURCES.append("src/wrapper/wrap_cudagl.cpp") EXTRA_DEFINES["HAVE_GL"] = 1 if conf["CUDA_ENABLE_CURAND"]: EXTRA_DEFINES["HAVE_CURAND"] = 1 EXTRA_SOURCES.extend([ "src/wrapper/wrap_curand.cpp" ]) LIBRARIES.extend(conf["CURAND_LIBNAME"]) LIBRARY_DIRS.extend(conf["CURAND_LIB_DIR"]) ver_dic = {} exec(compile(open("pycuda/__init__.py").read(), "pycuda/__init__.py", 'exec'), ver_dic) import sys if sys.version_info >= (3,): pvt_struct_source = "src/wrapper/_pvt_struct_v3.cpp" else: pvt_struct_source = "src/wrapper/_pvt_struct_v2.cpp" setup(name="pycuda", # metadata version=ver_dic["VERSION_TEXT"], description="Python wrapper for Nvidia CUDA", long_description=open("README.rst", "rt").read(), author="Andreas Kloeckner", author_email="*****@*****.**", license="MIT", url="http://mathema.tician.de/software/pycuda", classifiers=[ 'Environment :: Console', 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'Intended Audience :: Other Audience', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: MIT License', 'Natural Language :: English', 'Programming Language :: C++', 'Programming Language :: Python', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Topic :: Scientific/Engineering', 'Topic :: Scientific/Engineering :: Mathematics', 'Topic :: Scientific/Engineering :: Physics', 'Topic :: Scientific/Engineering :: Visualization', ], # build info packages=["pycuda", "pycuda.gl", "pycuda.sparse", "pycuda.compyte"], setup_requires=[ "numpy>=1.6", ], install_requires=[ "pytools>=2011.2", "pytest>=2", "decorator>=3.2.0", "appdirs>=1.4.0", "mako", ], ext_package="pycuda", ext_modules=[ NumpyExtension("_driver", [ "src/cpp/cuda.cpp", "src/cpp/bitlog.cpp", "src/wrapper/wrap_cudadrv.cpp", "src/wrapper/mempool.cpp", ]+EXTRA_SOURCES, include_dirs=INCLUDE_DIRS, library_dirs=LIBRARY_DIRS, libraries=LIBRARIES, define_macros=list(EXTRA_DEFINES.items()), extra_compile_args=conf["CXXFLAGS"], extra_link_args=conf["LDFLAGS"], ), NumpyExtension("_pvt_struct", [pvt_struct_source], extra_compile_args=conf["CXXFLAGS"], extra_link_args=conf["LDFLAGS"], ), ], include_package_data=True, package_data={ "pycuda": [ "cuda/*.hpp", ] }, zip_safe=False)
def main(): import glob from aksetup_helper import (hack_distutils, get_config, setup, NumpyExtension, set_up_shipped_boost_if_requested, check_git_submodules) check_git_submodules() hack_distutils() conf = get_config(get_config_schema(), warn_about_no_config=False) EXTRA_OBJECTS, EXTRA_DEFINES = set_up_shipped_boost_if_requested( "pyopencl", conf) LIBRARY_DIRS = conf["BOOST_LIB_DIR"] LIBRARIES = conf["BOOST_PYTHON_LIBNAME"] EXTRA_INCLUDE_DIRS = [] EXTRA_DEFINES["PYGPU_PACKAGE"] = "pyopencl" EXTRA_DEFINES["PYGPU_PYOPENCL"] = "1" if conf["CL_TRACE"]: EXTRA_DEFINES["PYOPENCL_TRACE"] = 1 INCLUDE_DIRS = conf["BOOST_INC_DIR"] + conf["CL_INC_DIR"] if conf["CL_ENABLE_GL"]: EXTRA_DEFINES["HAVE_GL"] = 1 if conf["CL_ENABLE_DEVICE_FISSION"]: EXTRA_DEFINES["PYOPENCL_USE_DEVICE_FISSION"] = 1 if conf["CL_PRETEND_VERSION"]: try: major, minor = [ int(x) for x in conf["CL_PRETEND_VERSION"].split(".") ] EXTRA_DEFINES[ "PYOPENCL_PRETEND_CL_VERSION"] = 0x1000 * major + 0x10 * minor except: print( "CL_PRETEND_VERSION must be of the form M.N, with two integers M and N" ) raise ver_dic = {} version_file = open("pyopencl/version.py") try: version_file_contents = version_file.read() finally: version_file.close() exec(compile(version_file_contents, "pyopencl/version.py", 'exec'), ver_dic) try: from distutils.command.build_py import build_py_2to3 as build_py except ImportError: # 2.x from distutils.command.build_py import build_py try: import mako except ImportError: print( "-------------------------------------------------------------------------" ) print("Mako is not installed.") print( "-------------------------------------------------------------------------" ) print( "That is not a problem, as most of PyOpenCL will be just fine without it." ) print( "Some higher-level parts of pyopencl (such as pyopencl.reduction)") print( "will not function without the templating engine Mako [1] being installed." ) print( "If you would like this functionality to work, you might want to install" ) print("Mako after you finish installing PyOpenCL.") print("") print("[1] http://www.makotemplates.org/") print( "-------------------------------------------------------------------------" ) print("Hit Ctrl-C now if you'd like to think about the situation.") print( "-------------------------------------------------------------------------" ) from aksetup_helper import count_down_delay count_down_delay(delay=5) might_be_cuda = False for inc_dir in conf["CL_INC_DIR"]: inc_dir = inc_dir.lower() if "nv" in inc_dir or "cuda" in inc_dir: might_be_cuda = True if might_be_cuda and conf["CL_ENABLE_DEVICE_FISSION"]: print( "-------------------------------------------------------------------------" ) print( "You might be compiling against Nvidia CUDA with device fission enabled." ) print( "-------------------------------------------------------------------------" ) print( "That is not a problem on CUDA 4.0 and newer. If you are using CUDA 3.2," ) print( "your build will break, because Nvidia shipped a broken CL header in" ) print( "in your version. The fix is to set CL_ENABLE_DEVICE_FISSION to False" ) print("in your PyOpenCL configuration.") print( "-------------------------------------------------------------------------" ) print("Hit Ctrl-C now if you'd like to think about the situation.") print( "-------------------------------------------------------------------------" ) from aksetup_helper import count_down_delay count_down_delay(delay=5) import sys if sys.version_info >= (3, ): pvt_struct_source = "src/wrapper/_pvt_struct_v3.cpp" else: pvt_struct_source = "src/wrapper/_pvt_struct_v2.cpp" setup( name="pyopencl", # metadata version=ver_dic["VERSION_TEXT"], description="Python wrapper for OpenCL", long_description=""" PyOpenCL lets you access GPUs and other massively parallel compute devices from Python. It tries to offer computing goodness in the spirit of its sister project `PyCUDA <http://mathema.tician.de/software/pycuda>`_: * Object cleanup tied to lifetime of objects. This idiom, often called `RAII <http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization>`_ in C++, makes it much easier to write correct, leak- and crash-free code. * Completeness. PyOpenCL puts the full power of OpenCL's API at your disposal, if you wish. Every obscure `get_info()` query and all CL calls are accessible. * Automatic Error Checking. All CL errors are automatically translated into Python exceptions. * Speed. PyOpenCL's base layer is written in C++, so all the niceties above are virtually free. * Helpful and complete `Documentation <http://documen.tician.de/pyopencl>`_ as well as a `Wiki <http://wiki.tiker.net/PyOpenCL>`_. * Liberal license. PyOpenCL is open-source under the `MIT license <http://en.wikipedia.org/wiki/MIT_License>`_ and free for commercial, academic, and private use. * Broad support. PyOpenCL was tested and works with Apple's, AMD's, and Nvidia's CL implementations. Like PyOpenCL? (And perhaps use it for `bitcoin <http://bitcoin.org>`_ mining?) Leave a (bitcoin) tip: 1HGPQitv27CdENBcH1bstu5B3zeqXRDwtY """, author="Andreas Kloeckner", author_email="*****@*****.**", license="MIT", url="http://mathema.tician.de/software/pyopencl", classifiers=[ 'Environment :: Console', 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'Intended Audience :: Other Audience', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: MIT License', 'Natural Language :: English', 'Programming Language :: C++', 'Programming Language :: Python', 'Programming Language :: Python :: 3', 'Topic :: Scientific/Engineering', 'Topic :: Scientific/Engineering :: Mathematics', 'Topic :: Scientific/Engineering :: Physics', ], # build info packages=["pyopencl", "pyopencl.characterize", "pyopencl.compyte"], install_requires=[ "pytools>=2011.2", "pytest>=2", "decorator>=3.2.0", # "Mako>=0.3.6", ], ext_package="pyopencl", ext_modules=[ NumpyExtension( "_cl", [ "src/wrapper/wrap_cl.cpp", "src/wrapper/wrap_cl_part_1.cpp", "src/wrapper/wrap_cl_part_2.cpp", "src/wrapper/wrap_constants.cpp", "src/wrapper/wrap_mempool.cpp", "src/wrapper/bitlog.cpp", ] + EXTRA_OBJECTS, include_dirs=INCLUDE_DIRS + EXTRA_INCLUDE_DIRS, library_dirs=LIBRARY_DIRS + conf["CL_LIB_DIR"], libraries=LIBRARIES + conf["CL_LIBNAME"], define_macros=list(EXTRA_DEFINES.items()), extra_compile_args=conf["CXXFLAGS"], extra_link_args=conf["LDFLAGS"], ), NumpyExtension( "_pvt_struct", [pvt_struct_source], extra_compile_args=conf["CXXFLAGS"], extra_link_args=conf["LDFLAGS"], ), ], data_files=[("include/pyopencl", glob.glob("src/cl/*.cl") + glob.glob("src/cl/*.h"))], # 2to3 invocation cmdclass={'build_py': build_py})
def main(): from aksetup_helper import (hack_distutils, get_config, setup, NumpyExtension, set_up_shipped_boost_if_requested, check_git_submodules) check_git_submodules() hack_distutils() conf = get_config(get_config_schema(), warn_about_no_config=False) EXTRA_OBJECTS, EXTRA_DEFINES = \ set_up_shipped_boost_if_requested("pyopencl", conf) LIBRARY_DIRS = conf["BOOST_LIB_DIR"] LIBRARIES = conf["BOOST_PYTHON_LIBNAME"] EXTRA_INCLUDE_DIRS = [] EXTRA_DEFINES["PYGPU_PACKAGE"] = "pyopencl" EXTRA_DEFINES["PYGPU_PYOPENCL"] = "1" if conf["CL_TRACE"]: EXTRA_DEFINES["PYOPENCL_TRACE"] = 1 INCLUDE_DIRS = conf["BOOST_INC_DIR"] + conf["CL_INC_DIR"] if conf["CL_ENABLE_GL"]: EXTRA_DEFINES["HAVE_GL"] = 1 if conf["CL_ENABLE_DEVICE_FISSION"]: EXTRA_DEFINES["PYOPENCL_USE_DEVICE_FISSION"] = 1 if conf["CL_PRETEND_VERSION"]: try: major, minor = [ int(x) for x in conf["CL_PRETEND_VERSION"].split(".") ] EXTRA_DEFINES["PYOPENCL_PRETEND_CL_VERSION"] = \ 0x1000*major + 0x10 * minor except: print("CL_PRETEND_VERSION must be of the form M.N, " "with two integers M and N") raise ver_dic = {} version_file = open("pyopencl/version.py") try: version_file_contents = version_file.read() finally: version_file.close() exec(compile(version_file_contents, "pyopencl/version.py", 'exec'), ver_dic) SEPARATOR = "-" * 75 try: from distutils.command.build_py import build_py_2to3 as build_py except ImportError: # 2.x from distutils.command.build_py import build_py try: import mako # noqa except ImportError: print(SEPARATOR) print("Mako is not installed.") print(SEPARATOR) print("That is not a problem, as most of PyOpenCL will be just fine ") print("without it.Some higher-level parts of pyopencl (such as ") print( "pyopencl.reduction) will not function without the templating engine " ) print( "Mako [1] being installed. If you would like this functionality to " ) print("work, you might want to install Mako after you finish ") print("installing PyOpenCL.") print("") print("[1] http://www.makotemplates.org/") print(SEPARATOR) print("Hit Ctrl-C now if you'd like to think about the situation.") print(SEPARATOR) from aksetup_helper import count_down_delay count_down_delay(delay=5) might_be_cuda = False for inc_dir in conf["CL_INC_DIR"]: inc_dir = inc_dir.lower() if "nv" in inc_dir or "cuda" in inc_dir: might_be_cuda = True if might_be_cuda and conf["CL_ENABLE_DEVICE_FISSION"]: print(SEPARATOR) print("You might be compiling against Nvidia CUDA with device " "fission enabled.") print(SEPARATOR) print("That is not a problem on CUDA 4.0 and newer. If you are " "using CUDA 3.2,") print( "your build will break, because Nvidia shipped a broken CL header in" ) print( "in your version. The fix is to set CL_ENABLE_DEVICE_FISSION to False" ) print("in your PyOpenCL configuration.") print(SEPARATOR) print("Hit Ctrl-C now if you'd like to think about the situation.") print(SEPARATOR) from aksetup_helper import count_down_delay count_down_delay(delay=5) import sys if sys.version_info >= (3, ): pvt_struct_source = "src/wrapper/_pvt_struct_v3.cpp" else: pvt_struct_source = "src/wrapper/_pvt_struct_v2.cpp" setup( name="pyopencl", # metadata version=ver_dic["VERSION_TEXT"], description="Python wrapper for OpenCL", long_description=open("README.rst", "rt").read(), author="Andreas Kloeckner", author_email="*****@*****.**", license="MIT", url="http://mathema.tician.de/software/pyopencl", classifiers=[ 'Environment :: Console', 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'Intended Audience :: Other Audience', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: MIT License', 'Natural Language :: English', 'Programming Language :: C++', 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.4', 'Programming Language :: Python :: 2.5', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', 'Topic :: Scientific/Engineering', 'Topic :: Scientific/Engineering :: Mathematics', 'Topic :: Scientific/Engineering :: Physics', ], # build info packages=["pyopencl", "pyopencl.characterize", "pyopencl.compyte"], install_requires=[ "pytools>=2013.5.2", "pytest>=2", "decorator>=3.2.0", # "Mako>=0.3.6", ], ext_package="pyopencl", ext_modules=[ NumpyExtension( "_cl", [ "src/wrapper/wrap_cl.cpp", "src/wrapper/wrap_cl_part_1.cpp", "src/wrapper/wrap_cl_part_2.cpp", "src/wrapper/wrap_constants.cpp", "src/wrapper/wrap_mempool.cpp", "src/wrapper/bitlog.cpp", ] + EXTRA_OBJECTS, include_dirs=INCLUDE_DIRS + EXTRA_INCLUDE_DIRS, library_dirs=LIBRARY_DIRS + conf["CL_LIB_DIR"], libraries=LIBRARIES + conf["CL_LIBNAME"], define_macros=list(EXTRA_DEFINES.items()), extra_compile_args=conf["CXXFLAGS"], extra_link_args=conf["LDFLAGS"], ), NumpyExtension( "_pvt_struct", [pvt_struct_source], extra_compile_args=conf["CXXFLAGS"], extra_link_args=conf["LDFLAGS"], ), ], include_package_data=True, package_data={"pyopencl": [ "cl/*.cl", "cl/*.h", ]}, # 2to3 invocation cmdclass={'build_py': build_py}, zip_safe=False)
def main(): import glob from aksetup_helper import (hack_distutils, get_config, setup, NumpyExtension, set_up_shipped_boost_if_requested, check_git_submodules) check_git_submodules() hack_distutils() conf = get_config(get_config_schema(), warn_about_no_config=False) EXTRA_OBJECTS, EXTRA_DEFINES = set_up_shipped_boost_if_requested("pyopencl", conf) LIBRARY_DIRS = conf["BOOST_LIB_DIR"] LIBRARIES = conf["BOOST_PYTHON_LIBNAME"] from os.path import dirname, join, normpath EXTRA_INCLUDE_DIRS = [] EXTRA_LIBRARY_DIRS = [] EXTRA_LIBRARIES = [] EXTRA_DEFINES["PYGPU_PACKAGE"] = "pyopencl" EXTRA_DEFINES["PYGPU_PYOPENCL"] = "1" if conf["CL_TRACE"]: EXTRA_DEFINES["PYOPENCL_TRACE"] = 1 INCLUDE_DIRS = conf["BOOST_INC_DIR"] + conf["CL_INC_DIR"] ext_kwargs = dict() if conf["CL_ENABLE_GL"]: EXTRA_DEFINES["HAVE_GL"] = 1 if conf["CL_ENABLE_DEVICE_FISSION"]: EXTRA_DEFINES["PYOPENCL_USE_DEVICE_FISSION"] = 1 ver_dic = {} version_file = open("pyopencl/version.py") try: version_file_contents = version_file.read() finally: version_file.close() exec(compile(version_file_contents, "pyopencl/version.py", 'exec'), ver_dic) try: from distutils.command.build_py import build_py_2to3 as build_py except ImportError: # 2.x from distutils.command.build_py import build_py try: import mako except ImportError: print("-------------------------------------------------------------------------") print("Mako is not installed.") print("-------------------------------------------------------------------------") print("That is not a problem, as most of PyOpenCL will be just fine without it.") print("Some higher-level parts of pyopencl (pyopencl.reduction, to be precise)") print("will not function without the templating engine Mako [1] being installed.") print("If you would like this functionality to work, you might want to install") print("Mako after you finish installing PyOpenCL.") print("") print("[1] http://www.makotemplates.org/") print("-------------------------------------------------------------------------") print("Hit Ctrl-C now if you'd like to think about the situation.") print("-------------------------------------------------------------------------") from aksetup_helper import count_down_delay count_down_delay(delay=5) might_be_cuda = False for inc_dir in conf["CL_INC_DIR"]: inc_dir = inc_dir.lower() if "nv" in inc_dir or "cuda" in inc_dir: might_be_cuda = True if might_be_cuda and conf["CL_ENABLE_DEVICE_FISSION"]: print("-------------------------------------------------------------------------") print("You might be compiling against Nvidia CUDA with device fission enabled.") print("-------------------------------------------------------------------------") print("That is not a problem on CUDA 4.0 and newer. If you are using CUDA 3.2,") print("your build will break, because Nvidia shipped a broken CL header in") print("in your version. The fix is to set CL_ENABLE_DEVICE_FISSION to False") print("in your PyOpenCL configuration.") print("-------------------------------------------------------------------------") print("Hit Ctrl-C now if you'd like to think about the situation.") print("-------------------------------------------------------------------------") from aksetup_helper import count_down_delay count_down_delay(delay=5) import sys if sys.version_info >= (3,): pvt_struct_source = "src/wrapper/_pvt_struct_v3.cpp" else: pvt_struct_source = "src/wrapper/_pvt_struct_v2.cpp" setup(name="pyopencl", # metadata version=ver_dic["VERSION_TEXT"], description="Python wrapper for OpenCL", long_description=""" PyOpenCL lets you access GPUs and other massively parallel compute devices from Python. It tries to offer computing goodness in the spirit of its sister project `PyCUDA <http://mathema.tician.de/software/pycuda>`_: * Object cleanup tied to lifetime of objects. This idiom, often called `RAII <http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization>`_ in C++, makes it much easier to write correct, leak- and crash-free code. * Completeness. PyOpenCL puts the full power of OpenCL's API at your disposal, if you wish. Every obscure `get_info()` query and all CL calls are accessible. * Automatic Error Checking. All CL errors are automatically translated into Python exceptions. * Speed. PyOpenCL's base layer is written in C++, so all the niceties above are virtually free. * Helpful and complete `Documentation <http://documen.tician.de/pyopencl>`_ as well as a `Wiki <http://wiki.tiker.net/PyOpenCL>`_. * Liberal license. PyOpenCL is open-source under the `MIT license <http://en.wikipedia.org/wiki/MIT_License>`_ and free for commercial, academic, and private use. * Broad support. PyOpenCL was tested and works with Apple's, AMD's, and Nvidia's CL implementations. Like PyOpenCL? (And perhaps use it for `bitcoin <http://bitcoin.org>`_ mining?) Leave a (bitcoin) tip: 1HGPQitv27CdENBcH1bstu5B3zeqXRDwtY """, author="Andreas Kloeckner", author_email="*****@*****.**", license = "MIT", url="http://mathema.tician.de/software/pyopencl", classifiers=[ 'Environment :: Console', 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'Intended Audience :: Other Audience', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: MIT License', 'Natural Language :: English', 'Programming Language :: C++', 'Programming Language :: Python', 'Programming Language :: Python :: 3', 'Topic :: Scientific/Engineering', 'Topic :: Scientific/Engineering :: Mathematics', 'Topic :: Scientific/Engineering :: Physics', ], # build info packages=["pyopencl", "pyopencl.characterize", "pyopencl.compyte"], install_requires=[ "pytools>=2011.2", "pytest>=2", "decorator>=3.2.0", # "Mako>=0.3.6", ], ext_package="pyopencl", ext_modules=[ NumpyExtension("_cl", [ "src/wrapper/wrap_cl.cpp", "src/wrapper/wrap_cl_part_1.cpp", "src/wrapper/wrap_cl_part_2.cpp", "src/wrapper/wrap_constants.cpp", "src/wrapper/wrap_mempool.cpp", "src/wrapper/bitlog.cpp", ]+EXTRA_OBJECTS, include_dirs=INCLUDE_DIRS + EXTRA_INCLUDE_DIRS, library_dirs=LIBRARY_DIRS + conf["CL_LIB_DIR"], libraries=LIBRARIES + conf["CL_LIBNAME"], define_macros=list(EXTRA_DEFINES.items()), extra_compile_args=conf["CXXFLAGS"], extra_link_args=conf["LDFLAGS"], ), NumpyExtension("_pvt_struct", [pvt_struct_source], extra_compile_args=conf["CXXFLAGS"], extra_link_args=conf["LDFLAGS"], ), ], data_files=[ ("include/pyopencl", glob.glob("src/cl/*.cl") + glob.glob("src/cl/*.h")) ], # 2to3 invocation cmdclass={'build_py': build_py})
def main(): import glob from aksetup_helper import (hack_distutils, get_config, setup, NumpyExtension, set_up_shipped_boost_if_requested) hack_distutils() conf = get_config(get_config_schema(), warn_about_no_config=False) EXTRA_OBJECTS, EXTRA_DEFINES = set_up_shipped_boost_if_requested(conf) LIBRARY_DIRS = conf["BOOST_LIB_DIR"] LIBRARIES = conf["BOOST_PYTHON_LIBNAME"] from os.path import dirname, join, normpath EXTRA_INCLUDE_DIRS = [] EXTRA_LIBRARY_DIRS = [] EXTRA_LIBRARIES = [] if conf["CL_TRACE"]: EXTRA_DEFINES["PYOPENCL_TRACE"] = 1 INCLUDE_DIRS = ['src/cpp'] + conf["BOOST_INC_DIR"] + conf["CL_INC_DIR"] ext_kwargs = dict() if conf["CL_ENABLE_GL"]: EXTRA_DEFINES["HAVE_GL"] = 1 ver_dic = {} execfile("pyopencl/version.py", ver_dic) setup(name="pyopencl", # metadata version=ver_dic["VERSION_TEXT"], description="Python wrapper for OpenCL", long_description=""" PyOpenCL lets you access GPUs and other massively parallel compute devices from Python. It tries to offer computing goodness in the spirit of its sister project `PyCUDA <http://mathema.tician.de/software/pycuda>`_: * Object cleanup tied to lifetime of objects. This idiom, often called `RAII <http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization>`_ in C++, makes it much easier to write correct, leak- and crash-free code. * Completeness. PyOpenCL puts the full power of OpenCL's API at your disposal, if you wish. Every obscure `get_info()` query and all CL calls are accessible. * Automatic Error Checking. All CL errors are automatically translated into Python exceptions. * Speed. PyOpenCL's base layer is written in C++, so all the niceties above are virtually free. * Helpful and complete `Documentation <http://documen.tician.de/pyopencl>`_ as well as a `Wiki <http://wiki.tiker.net/PyOpenCL>`_. * Liberal license. PyOpenCL is open-source under the `MIT license <http://en.wikipedia.org/wiki/MIT_License>`_ and free for commercial, academic, and private use. * Broad support. PyOpenCL was tested and works with Apple's, AMD's, and Nvidia's CL implementations. """, author=u"Andreas Kloeckner", author_email="*****@*****.**", license = "MIT", url="http://mathema.tician.de/software/pyopencl", classifiers=[ 'Environment :: Console', 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'Intended Audience :: Other Audience', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: Apache Software License', 'Natural Language :: English', 'Programming Language :: C++', 'Programming Language :: Python', 'Topic :: Scientific/Engineering', 'Topic :: Scientific/Engineering :: Mathematics', 'Topic :: Scientific/Engineering :: Physics', ], # build info packages=["pyopencl"], install_requires=[ "pytools>=7", "py>=1.0.2", "decorator>=3.2.0", ], ext_package="pyopencl", ext_modules=[ NumpyExtension("_cl", [ "src/wrapper/wrap_cl.cpp", "src/wrapper/wrap_cl_part_1.cpp", "src/wrapper/wrap_cl_part_2.cpp", "src/wrapper/wrap_constants.cpp", ]+EXTRA_OBJECTS, include_dirs=INCLUDE_DIRS + EXTRA_INCLUDE_DIRS, library_dirs=LIBRARY_DIRS + conf["CL_LIB_DIR"], libraries=LIBRARIES + conf["CL_LIBNAME"], define_macros=list(EXTRA_DEFINES.iteritems()), extra_compile_args=conf["CXXFLAGS"], extra_link_args=conf["LDFLAGS"], ), ])
def main(): from aksetup_helper import (hack_distutils, get_config, setup, Extension, set_up_shipped_boost_if_requested, check_git_submodules) check_git_submodules() hack_distutils(what_opt=1) conf = get_config(get_config_schema()) TRI_EXTRA_OBJECTS, TRI_EXTRA_DEFINES = \ set_up_shipped_boost_if_requested("meshpy", conf) TET_EXTRA_OBJECTS, TET_EXTRA_DEFINES = TRI_EXTRA_OBJECTS, TRI_EXTRA_DEFINES triangle_macros = [ ("EXTERNAL_TEST", 1), ("ANSI_DECLARATORS", 1), ("TRILIBRARY", 1), ] + list(TRI_EXTRA_DEFINES.items()) tetgen_macros = [ ("TETLIBRARY", 1), ("SELF_CHECK", 1), ] + list(TET_EXTRA_DEFINES.items()) # }}} include_dirs = conf["BOOST_INC_DIR"] + ["src/cpp"] library_dirs = conf["BOOST_LIB_DIR"] libraries = conf["BOOST_PYTHON_LIBNAME"] init_filename = "meshpy/__init__.py" exec(compile(open(init_filename, "r").read(), init_filename, "exec"), conf) import codecs setup(name="MeshPy", version=conf["version"], description="Triangular and Tetrahedral Mesh Generator", long_description=codecs.open("README.rst", "r", "utf-8").read(), author="Andreas Kloeckner", author_email="*****@*****.**", license=("MIT for the wrapper/non-commercial for " "the Triangle/GNU Affero Public License for TetGen"), url="http://mathema.tician.de/software/meshpy", classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'Intended Audience :: Other Audience', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: MIT License', 'License :: Free for non-commercial use', 'Natural Language :: English', 'Programming Language :: C++', 'Programming Language :: Python', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Topic :: Multimedia :: Graphics :: 3D Modeling', 'Topic :: Scientific/Engineering', 'Topic :: Scientific/Engineering :: Mathematics', 'Topic :: Scientific/Engineering :: Physics', 'Topic :: Scientific/Engineering :: Visualization', 'Topic :: Software Development :: Libraries', ], packages=["meshpy"], install_requires=[ "pytools>=2011.2", "pytest>=2", "numpy", "six", ], ext_modules=[ Extension( "meshpy._triangle", ["src/cpp/wrap_triangle.cpp", "src/cpp/triangle.c"] + TRI_EXTRA_OBJECTS, include_dirs=include_dirs, library_dirs=library_dirs, libraries=libraries, define_macros=triangle_macros, extra_compile_args=conf["CXXFLAGS"], extra_link_args=conf["LDFLAGS"], ), Extension( "meshpy._tetgen", [ "src/cpp/tetgen.cpp", "src/cpp/predicates.cpp", "src/cpp/wrap_tetgen.cpp"] + TET_EXTRA_OBJECTS, include_dirs=include_dirs, library_dirs=library_dirs, libraries=libraries, define_macros=tetgen_macros, extra_compile_args=conf["CXXFLAGS"], extra_link_args=conf["LDFLAGS"], ), ])
def main(): import os from aksetup_helper import (hack_distutils, get_config, setup, NumpyExtension, set_up_shipped_boost_if_requested, check_git_submodules) check_git_submodules() hack_distutils() conf = get_config(get_config_schema(), warn_about_no_config=False) EXTRA_OBJECTS, EXTRA_DEFINES = \ set_up_shipped_boost_if_requested( "pyviennacl", conf, source_path="external/boost-python-ublas-subset/boost_subset") INCLUDE_DIRS = conf["BOOST_INC_DIR"] + ["external/boost_numpy/"] if conf["USE_SHIPPED_VIENNACL"]: INCLUDE_DIRS += ["external/viennacl-dev/"] LIBRARY_DIRS = conf["BOOST_LIB_DIR"] LIBRARIES = conf["BOOST_PYTHON_LIBNAME"] # {{{ get version number ver_dic = {} version_file = open("pyviennacl/version.py") try: version_file_contents = version_file.read() finally: version_file.close() exec(compile(version_file_contents, "pyviennacl/version.py", 'exec'), ver_dic) # }}} if conf["USE_OPENCL"]: EXTRA_DEFINES["VIENNACL_WITH_OPENCL"] = None EXTRA_DEFINES["VIENNACL_WITH_UBLAS"] = None platform_cflags["msvc"] = ["/EHsc"] platform_cflags["mingw32"] = ["-Wno-unused-function"] platform_cflags["unix"] = ["-Wno-unused-function"] if EXTRA_OBJECTS: platform_cflags['mingw32'] += ["-Wno-unused-local-typedefs"] if not sys.platform.startswith("darwin"): platform_cflags['unix'] += ["-Wno-unused-local-typedefs"] source_files = [ "core", "vector_float", "vector_double", "vector_int", "vector_long", "vector_uint", "vector_ulong", "dense_matrix_float", "dense_matrix_double", "dense_matrix_int", "dense_matrix_long", "dense_matrix_uint", "dense_matrix_ulong", "compressed_matrix", "coordinate_matrix", "ell_matrix", "hyb_matrix", "direct_solvers", "iterative_solvers", "eig", "extra_functions", "scheduler", "opencl_support" ] from glob import glob setup( name="pyviennacl", version=ver_dic["VERSION_TEXT"], description="Sparse/dense linear algebra on GPUs and CPUs using OpenCL", long_description=open("README.rst", "rt").read(), author='Toby St Clere Smithe', author_email='*****@*****.**', url="http://viennacl.sourceforge.net/pyviennacl.html", classifiers=[ 'Environment :: Console', 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'Intended Audience :: Other Audience', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: MIT License', 'Natural Language :: English', 'Programming Language :: C++', 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Topic :: Scientific/Engineering', 'Topic :: Scientific/Engineering :: Mathematics', 'Topic :: Scientific/Engineering :: Physics', ], packages=["pyviennacl"], ext_package="pyviennacl", ext_modules=[ NumpyExtension( "_viennacl", [ os.path.join("src", "_viennacl", sf + ".cpp") for sf in source_files ] + glob("external/boost_numpy/libs/numpy/src/*.cpp") + EXTRA_OBJECTS, depends=[os.path.join("src", "_viennacl", "viennacl.h")], extra_compile_args=conf["CXXFLAGS"], extra_link_args=conf["LDFLAGS"], define_macros=list(EXTRA_DEFINES.items()), include_dirs=INCLUDE_DIRS, library_dirs=LIBRARY_DIRS + conf["CL_LIB_DIR"], libraries=LIBRARIES + conf["CL_LIBNAME"], ) ], cmdclass={'build_ext': build_ext_subclass})
def main(): import glob import sys from aksetup_helper import (hack_distutils, get_config, setup, \ NumpyExtension, set_up_shipped_boost_if_requested, check_git_submodules) check_git_submodules() hack_distutils() conf = get_config(get_config_schema()) EXTRA_SOURCES, EXTRA_DEFINES = set_up_shipped_boost_if_requested("pycuda", conf) EXTRA_DEFINES["PYGPU_PACKAGE"] = "pycuda" EXTRA_DEFINES["PYGPU_PYCUDA"] = "1" LIBRARY_DIRS = conf["BOOST_LIB_DIR"] + conf["CUDADRV_LIB_DIR"] LIBRARIES = (conf["BOOST_PYTHON_LIBNAME"] + conf["BOOST_THREAD_LIBNAME"] + conf["CUDADRV_LIBNAME"]) if not conf["CUDA_INC_DIR"]: conf["CUDA_INC_DIR"] = [join(conf["CUDA_ROOT"], "include")] if conf["CUDA_TRACE"]: EXTRA_DEFINES["CUDAPP_TRACE_CUDA"] = 1 if conf["CUDA_PRETEND_VERSION"]: EXTRA_DEFINES["CUDAPP_PRETEND_CUDA_VERSION"] = conf["CUDA_PRETEND_VERSION"] INCLUDE_DIRS = ['src/cpp'] + conf["BOOST_INC_DIR"] + conf["CUDA_INC_DIR"] conf["USE_CUDA"] = True if 'darwin' in sys.platform and sys.maxsize == 2147483647: # The Python interpreter is running in 32 bit mode on OS X if "-arch" not in conf["CXXFLAGS"]: conf["CXXFLAGS"].extend(['-arch', 'i386', '-m32']) if "-arch" not in conf["LDFLAGS"]: conf["LDFLAGS"].extend(['-arch', 'i386', '-m32']) if 'darwin' in sys.platform: # set path to Cuda dynamic libraries, # as a safe substitute for DYLD_LIBRARY_PATH for lib_dir in conf["CUDADRV_LIB_DIR"]: conf["LDFLAGS"].extend(["-Xlinker", "-rpath", "-Xlinker", lib_dir]) if conf["CUDA_ENABLE_GL"]: EXTRA_SOURCES.append("src/wrapper/wrap_cudagl.cpp") EXTRA_DEFINES["HAVE_GL"] = 1 if conf["CUDA_ENABLE_CURAND"]: EXTRA_DEFINES["HAVE_CURAND"] = 1 EXTRA_SOURCES.extend([ "src/wrapper/wrap_curand.cpp" ]) LIBRARIES.extend(conf["CURAND_LIBNAME"]) LIBRARY_DIRS.extend(conf["CURAND_LIB_DIR"]) ver_dic = {} exec(compile(open("pycuda/__init__.py").read(), "pycuda/__init__.py", 'exec'), ver_dic) try: from distutils.command.build_py import build_py_2to3 as build_py except ImportError: # 2.x from distutils.command.build_py import build_py import sys if sys.version_info >= (3,): pvt_struct_source = "src/wrapper/_pvt_struct_v3.cpp" else: pvt_struct_source = "src/wrapper/_pvt_struct_v2.cpp" setup(name="pycuda", # metadata version=ver_dic["VERSION_TEXT"], description="Python wrapper for Nvidia CUDA", long_description=""" PyCUDA lets you access `Nvidia <http://nvidia.com>`_'s `CUDA <http://nvidia.com/cuda/>`_ parallel computation API from Python. Several wrappers of the CUDA API already exist-so what's so special about PyCUDA? * Object cleanup tied to lifetime of objects. This idiom, often called `RAII <http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization>`_ in C++, makes it much easier to write correct, leak- and crash-free code. PyCUDA knows about dependencies, too, so (for example) it won't detach from a context before all memory allocated in it is also freed. * Convenience. Abstractions like pycuda.driver.SourceModule and pycuda.gpuarray.GPUArray make CUDA programming even more convenient than with Nvidia's C-based runtime. * Completeness. PyCUDA puts the full power of CUDA's driver API at your disposal, if you wish. It also includes code for interoperability with OpenGL. * Automatic Error Checking. All CUDA errors are automatically translated into Python exceptions. * Speed. PyCUDA's base layer is written in C++, so all the niceties above are virtually free. * Helpful `Documentation <http://documen.tician.de/pycuda>`_ and a `Wiki <http://wiki.tiker.net/PyCuda>`_. Relatedly, like-minded computing goodness for `OpenCL <http://khronos.org>`_ is provided by PyCUDA's sister project `PyOpenCL <http://pypi.python.org/pypi/pyopencl>`_. """, author="Andreas Kloeckner", author_email="*****@*****.**", license = "MIT", url="http://mathema.tician.de/software/pycuda", classifiers=[ 'Environment :: Console', 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'Intended Audience :: Other Audience', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: MIT License', 'Natural Language :: English', 'Programming Language :: C++', 'Programming Language :: Python', 'Topic :: Scientific/Engineering', 'Topic :: Scientific/Engineering :: Mathematics', 'Topic :: Scientific/Engineering :: Physics', 'Topic :: Scientific/Engineering :: Visualization', ], # build info packages=["pycuda", "pycuda.gl", "pycuda.sparse", "pycuda.compyte"], install_requires=[ "pytools>=2011.2", "pytest>=2", "decorator>=3.2.0" ], ext_package="pycuda", ext_modules=[ NumpyExtension("_driver", [ "src/cpp/cuda.cpp", "src/cpp/bitlog.cpp", "src/wrapper/wrap_cudadrv.cpp", "src/wrapper/mempool.cpp", ]+EXTRA_SOURCES, include_dirs=INCLUDE_DIRS, library_dirs=LIBRARY_DIRS, libraries=LIBRARIES, define_macros=list(EXTRA_DEFINES.items()), extra_compile_args=conf["CXXFLAGS"], extra_link_args=conf["LDFLAGS"], ), NumpyExtension("_pvt_struct", [pvt_struct_source], extra_compile_args=conf["CXXFLAGS"], extra_link_args=conf["LDFLAGS"], ), ], data_files=[ ("include/pycuda", glob.glob("src/cuda/*.hpp")) ], # 2to3 invocation cmdclass={'build_py': build_py})
def main(): from aksetup_helper import (hack_distutils, get_config, setup, Extension, set_up_shipped_boost_if_requested, check_git_submodules) check_git_submodules() hack_distutils(what_opt=1) conf = get_config(get_config_schema()) TRI_EXTRA_OBJECTS, TRI_EXTRA_DEFINES = \ set_up_shipped_boost_if_requested("meshpy", conf) TET_EXTRA_OBJECTS, TET_EXTRA_DEFINES = TRI_EXTRA_OBJECTS, TRI_EXTRA_DEFINES triangle_macros = [ ("EXTERNAL_TEST", 1), ("ANSI_DECLARATORS", 1), ("TRILIBRARY", 1), ] + list(TRI_EXTRA_DEFINES.items()) tetgen_macros = [ ("TETLIBRARY", 1), ("SELF_CHECK", 1), ] + list(TET_EXTRA_DEFINES.items()) INCLUDE_DIRS = conf["BOOST_INC_DIR"] + ["src/cpp"] LIBRARY_DIRS = conf["BOOST_LIB_DIR"] LIBRARIES = conf["BOOST_PYTHON_LIBNAME"] init_filename = "meshpy/__init__.py" exec(compile(open(init_filename, "r").read(), init_filename, "exec"), conf) try: from distutils.command.build_py import build_py_2to3 as build_py except ImportError: # 2.x from distutils.command.build_py import build_py import codecs setup(name="MeshPy", version=conf["version"], description="Triangular and Tetrahedral Mesh Generator", long_description=codecs.open("README.rst", "r", "utf-8").read(), author="Andreas Kloeckner", author_email="*****@*****.**", license="MIT for the wrapper/non-commercial MIT for the meshers", url="http://mathema.tician.de/software/meshpy", classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'Intended Audience :: Other Audience', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: MIT License', 'License :: Free for non-commercial use', 'Natural Language :: English', 'Programming Language :: C++', 'Programming Language :: Python', 'Programming Language :: Python :: 3', 'Topic :: Multimedia :: Graphics :: 3D Modeling', 'Topic :: Scientific/Engineering', 'Topic :: Scientific/Engineering :: Mathematics', 'Topic :: Scientific/Engineering :: Physics', 'Topic :: Scientific/Engineering :: Visualization', 'Topic :: Software Development :: Libraries', ], packages=["meshpy"], install_requires=[ "pytools>=2011.2", "pytest>=2", "numpy", ], ext_modules=[ Extension( "meshpy._triangle", ["src/cpp/wrap_triangle.cpp", "src/cpp/triangle.c"] + TRI_EXTRA_OBJECTS, include_dirs=INCLUDE_DIRS, library_dirs=LIBRARY_DIRS, libraries=LIBRARIES, define_macros=triangle_macros, extra_compile_args=conf["CXXFLAGS"], extra_link_args=conf["LDFLAGS"], ), Extension( "meshpy._tetgen", [ "src/cpp/tetgen.cpp", "src/cpp/predicates.cpp", "src/cpp/wrap_tetgen.cpp"] + TET_EXTRA_OBJECTS, include_dirs=INCLUDE_DIRS, library_dirs=LIBRARY_DIRS, libraries=LIBRARIES, define_macros=tetgen_macros, extra_compile_args=conf["CXXFLAGS"], extra_link_args=conf["LDFLAGS"], ), ], # 2to3 invocation cmdclass={'build_py': build_py}, )
def main(): from aksetup_helper import (hack_distutils, get_config, setup, Extension, set_up_shipped_boost_if_requested, check_git_submodules) check_git_submodules() hack_distutils(what_opt=1) conf = get_config(get_config_schema()) TRI_EXTRA_OBJECTS, TRI_EXTRA_DEFINES = \ set_up_shipped_boost_if_requested("meshpy", conf) TET_EXTRA_OBJECTS, TET_EXTRA_DEFINES = TRI_EXTRA_OBJECTS, TRI_EXTRA_DEFINES triangle_macros = [ ("EXTERNAL_TEST", 1), ("ANSI_DECLARATORS", 1), ("TRILIBRARY", 1), ] + list(TRI_EXTRA_DEFINES.items()) tetgen_macros = [ ("TETLIBRARY", 1), ("SELF_CHECK", 1), ] + list(TET_EXTRA_DEFINES.items()) INCLUDE_DIRS = conf["BOOST_INC_DIR"] + ["src/cpp"] LIBRARY_DIRS = conf["BOOST_LIB_DIR"] LIBRARIES = conf["BOOST_PYTHON_LIBNAME"] ######## simple use CMAKE to find get the directories: boost_variables = ["VERSION", "INCLUDE_DIRS", "LIB_DIRS", "LIBRARIES"] boost_dict = {} if sys.version_info.major < 3: output = os.popen("cmake . -Dpy_version=2") else: output = os.popen("cmake .") for line in output: for var in boost_variables: if var in line: line = line.replace('-- ' + var, '').replace(': ', '').replace('\n', '') boost_dict[var] = line if not "VERSION" in boost_dict: print("CMake didn't find any boost library") print("default installation will be used instead.") else: print("use cmake to detect bost") lib_name = os.path.basename(boost_dict["LIBRARIES"]) lib_name = lib_name.replace(".lib", "").replace("lib", "").replace(".so", "") INCLUDE_DIRS = [boost_dict["INCLUDE_DIRS"]] + ["src/cpp"] LIBRARY_DIRS = [boost_dict["LIB_DIRS"]] LIBRARIES = [lib_name] ########## end of CMAKE configuration print("using the following configuration:") print("INCLUDE_DIRS: ", INCLUDE_DIRS) print("LIBRARY_DIRS: ", LIBRARY_DIRS) print("LIBRARIES: ", LIBRARIES) init_filename = "meshpy/__init__.py" exec(compile(open(init_filename, "r").read(), init_filename, "exec"), conf) import codecs setup( name="MeshPy", version=conf["version"], description="Triangular and Tetrahedral Mesh Generator", long_description=codecs.open("README.rst", "r", "utf-8").read(), author="Andreas Kloeckner", author_email="*****@*****.**", license= "MIT for the wrapper/non-commercial for the Triangle/GNU Affero Public License for TetGen", url="http://mathema.tician.de/software/meshpy", classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'Intended Audience :: Other Audience', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: MIT License', 'License :: Free for non-commercial use', 'Natural Language :: English', 'Programming Language :: C++', 'Programming Language :: Python', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Topic :: Multimedia :: Graphics :: 3D Modeling', 'Topic :: Scientific/Engineering', 'Topic :: Scientific/Engineering :: Mathematics', 'Topic :: Scientific/Engineering :: Physics', 'Topic :: Scientific/Engineering :: Visualization', 'Topic :: Software Development :: Libraries', ], packages=["meshpy"], install_requires=[ "pytools>=2011.2", "pytest>=2", "numpy", "six", ], ext_modules=[ Extension( "meshpy._triangle", ["src/cpp/wrap_triangle.cpp", "src/cpp/triangle.c"] + TRI_EXTRA_OBJECTS, include_dirs=INCLUDE_DIRS, library_dirs=LIBRARY_DIRS, libraries=LIBRARIES, define_macros=triangle_macros, extra_compile_args=conf["CXXFLAGS"], extra_link_args=conf["LDFLAGS"], ), Extension( "meshpy._tetgen", [ "src/cpp/tetgen.cpp", "src/cpp/predicates.cpp", "src/cpp/wrap_tetgen.cpp" ] + TET_EXTRA_OBJECTS, include_dirs=INCLUDE_DIRS, library_dirs=LIBRARY_DIRS, libraries=LIBRARIES, define_macros=tetgen_macros, extra_compile_args=conf["CXXFLAGS"], extra_link_args=conf["LDFLAGS"], ), ])
def main(): import glob from aksetup_helper import ( hack_distutils, get_config, setup, Extension, set_up_shipped_boost_if_requested) hack_distutils() conf = get_config(get_config_schema()) INCLUDE_DIRS = conf["BOOST_INC_DIR"] LIBRARY_DIRS = conf["BOOST_LIB_DIR"] LIBRARIES = conf["BOOST_PYTHON_LIBNAME"] EXTRA_OBJECTS, EXTRA_DEFINES = \ set_up_shipped_boost_if_requested("pyopencl", conf) EXTRA_DEFINES["HAVE_MREMAP"] = 0 # mremap() buggy on amd64? version_file = open("pymetis/__init__.py") ver_dic = {} try: version_file_contents = version_file.read() finally: version_file.close() exec(compile(version_file_contents, "pymetis/__init__.py", 'exec'), ver_dic) setup(name="PyMetis", version=ver_dic["version"], description="A Graph Partitioning Package", long_description=open("README.rst", "rt").read(), author="Andreas Kloeckner", author_email="*****@*****.**", license="wrapper: MIT/METIS: Apache 2", url="http://mathema.tician.de/software/pymetis", classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'Intended Audience :: Other Audience', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: MIT License', 'License :: Free for non-commercial use', 'Natural Language :: English', 'Programming Language :: C', 'Programming Language :: C++', 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Topic :: Multimedia :: Graphics :: 3D Modeling', 'Topic :: Scientific/Engineering', 'Topic :: Scientific/Engineering :: Mathematics', 'Topic :: Scientific/Engineering :: Visualization', 'Topic :: Software Development :: Libraries', ], packages=["pymetis"], ext_modules=[ Extension( "pymetis._internal", glob.glob("src/metis/GKlib/*.c") + glob.glob("src/metis/*.c") + glob.glob("src/metis/libmetis/*.c") + ["src/wrapper/wrapper.cpp"], define_macros=list(EXTRA_DEFINES.items()), include_dirs=["src/metis/GKlib"] + ["src/metis/include"] + ["src/metis/libmetis"] + INCLUDE_DIRS, library_dirs=LIBRARY_DIRS, libraries=LIBRARIES, extra_compile_args=conf["CXXFLAGS"], ), ] )
def main(): import glob from aksetup_helper import (hack_distutils, get_config, setup, NumpyExtension, set_up_shipped_boost_if_requested) hack_distutils() conf = get_config(get_config_schema(), warn_about_no_config=False) EXTRA_OBJECTS, EXTRA_DEFINES = set_up_shipped_boost_if_requested(conf) LIBRARY_DIRS = conf["BOOST_LIB_DIR"] LIBRARIES = conf["BOOST_PYTHON_LIBNAME"] from os.path import dirname, join, normpath EXTRA_INCLUDE_DIRS = [] EXTRA_LIBRARY_DIRS = [] EXTRA_LIBRARIES = [] if conf["CL_TRACE"]: EXTRA_DEFINES["PYOPENCL_TRACE"] = 1 INCLUDE_DIRS = ['src/cpp'] + conf["BOOST_INC_DIR"] + conf["CL_INC_DIR"] ext_kwargs = dict() if conf["CL_ENABLE_GL"]: EXTRA_DEFINES["HAVE_GL"] = 1 ver_dic = {} exec(compile(open("pyopencl/version.py").read(), "pyopencl/version.py", 'exec'), ver_dic) try: from distutils.command.build_py import build_py_2to3 as build_py except ImportError: # 2.x from distutils.command.build_py import build_py setup(name="pyopencl", # metadata version=ver_dic["VERSION_TEXT"], description="Python wrapper for OpenCL", long_description=""" PyOpenCL lets you access GPUs and other massively parallel compute devices from Python. It tries to offer computing goodness in the spirit of its sister project `PyCUDA <http://mathema.tician.de/software/pycuda>`_: * Object cleanup tied to lifetime of objects. This idiom, often called `RAII <http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization>`_ in C++, makes it much easier to write correct, leak- and crash-free code. * Completeness. PyOpenCL puts the full power of OpenCL's API at your disposal, if you wish. Every obscure `get_info()` query and all CL calls are accessible. * Automatic Error Checking. All CL errors are automatically translated into Python exceptions. * Speed. PyOpenCL's base layer is written in C++, so all the niceties above are virtually free. * Helpful and complete `Documentation <http://documen.tician.de/pyopencl>`_ as well as a `Wiki <http://wiki.tiker.net/PyOpenCL>`_. * Liberal license. PyOpenCL is open-source under the `MIT license <http://en.wikipedia.org/wiki/MIT_License>`_ and free for commercial, academic, and private use. * Broad support. PyOpenCL was tested and works with Apple's, AMD's, and Nvidia's CL implementations. """, author="Andreas Kloeckner", author_email="*****@*****.**", license = "MIT", url="http://mathema.tician.de/software/pyopencl", classifiers=[ 'Environment :: Console', 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'Intended Audience :: Other Audience', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: Apache Software License', 'Natural Language :: English', 'Programming Language :: C++', 'Programming Language :: Python', 'Programming Language :: Python :: 3', 'Topic :: Scientific/Engineering', 'Topic :: Scientific/Engineering :: Mathematics', 'Topic :: Scientific/Engineering :: Physics', ], # build info packages=["pyopencl"], install_requires=[ "pytools>=7", "py>=1.0.2", "decorator>=3.2.0", ], ext_package="pyopencl", ext_modules=[ NumpyExtension("_cl", [ "src/wrapper/wrap_cl.cpp", "src/wrapper/wrap_cl_part_1.cpp", "src/wrapper/wrap_cl_part_2.cpp", "src/wrapper/wrap_constants.cpp", ]+EXTRA_OBJECTS, include_dirs=INCLUDE_DIRS + EXTRA_INCLUDE_DIRS, library_dirs=LIBRARY_DIRS + conf["CL_LIB_DIR"], libraries=LIBRARIES + conf["CL_LIBNAME"], define_macros=list(EXTRA_DEFINES.items()), extra_compile_args=conf["CXXFLAGS"], extra_link_args=conf["LDFLAGS"], ), ], # 2to3 invocation cmdclass={'build_py': build_py})
def main(): import glob from aksetup_helper import (hack_distutils, get_config, setup, \ NumpyExtension, Extension, set_up_shipped_boost_if_requested) hack_distutils() conf = get_config(get_config_schema()) EXTRA_SOURCES, EXTRA_DEFINES = set_up_shipped_boost_if_requested(conf) EXTRA_DEFINES["PYGPU_PACKAGE"] = "pycuda" EXTRA_DEFINES["PYGPU_PYCUDA"] = "1" LIBRARY_DIRS = conf["BOOST_LIB_DIR"] LIBRARIES = conf["BOOST_PYTHON_LIBNAME"] + conf["BOOST_THREAD_LIBNAME"] from os.path import dirname, join, normpath if conf["CUDA_ROOT"] is None: nvcc_path = search_on_path(["nvcc", "nvcc.exe"]) if nvcc_path is None: print("*** CUDA_ROOT not set, and nvcc not in path. Giving up.") import sys sys.exit(1) conf["CUDA_ROOT"] = normpath(join(dirname(nvcc_path), "..")) if conf["CUDA_INC_DIR"] is None: conf["CUDA_INC_DIR"] = [join(conf["CUDA_ROOT"], "include")] if not conf["CUDADRV_LIB_DIR"]: conf["CUDADRV_LIB_DIR"] = [join(conf["CUDA_ROOT"], "lib")] verify_siteconfig(conf) EXTRA_INCLUDE_DIRS = [] EXTRA_LIBRARY_DIRS = [] EXTRA_LIBRARIES = [] if conf["CUDA_TRACE"]: EXTRA_DEFINES["CUDAPP_TRACE_CUDA"] = 1 if conf["CUDA_PRETEND_VERSION"]: EXTRA_DEFINES["CUDAPP_PRETEND_CUDA_VERSION"] = conf[ "CUDA_PRETEND_VERSION"] INCLUDE_DIRS = ['src/cpp'] + conf["BOOST_INC_DIR"] + conf["CUDA_INC_DIR"] conf["USE_CUDA"] = True import sys if 'darwin' in sys.platform and sys.maxsize == 2147483647: # The Python interpreter is running in 32 bit mode on OS X if "-arch" not in conf["CXXFLAGS"]: conf["CXXFLAGS"].extend(['-arch', 'i386', '-m32']) if "-arch" not in conf["LDFLAGS"]: conf["LDFLAGS"].extend(['-arch', 'i386', '-m32']) ext_kwargs = dict() if conf["CUDA_ENABLE_GL"]: EXTRA_SOURCES.append("src/wrapper/wrap_cudagl.cpp") EXTRA_DEFINES["HAVE_GL"] = 1 ver_dic = {} exec( compile( open("pycuda/__init__.py").read(), "pycuda/__init__.py", 'exec'), ver_dic) try: from distutils.command.build_py import build_py_2to3 as build_py except ImportError: # 2.x from distutils.command.build_py import build_py setup( name="pycuda", # metadata version=ver_dic["VERSION_TEXT"], description="Python wrapper for Nvidia CUDA", long_description=""" PyCUDA lets you access `Nvidia <http://nvidia.com>`_'s `CUDA <http://nvidia.com/cuda/>`_ parallel computation API from Python. Several wrappers of the CUDA API already exist-so what's so special about PyCUDA? * Object cleanup tied to lifetime of objects. This idiom, often called `RAII <http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization>`_ in C++, makes it much easier to write correct, leak- and crash-free code. PyCUDA knows about dependencies, too, so (for example) it won't detach from a context before all memory allocated in it is also freed. * Convenience. Abstractions like pycuda.driver.SourceModule and pycuda.gpuarray.GPUArray make CUDA programming even more convenient than with Nvidia's C-based runtime. * Completeness. PyCUDA puts the full power of CUDA's driver API at your disposal, if you wish. It also includes code for interoperability with OpenGL. * Automatic Error Checking. All CUDA errors are automatically translated into Python exceptions. * Speed. PyCUDA's base layer is written in C++, so all the niceties above are virtually free. * Helpful `Documentation <http://documen.tician.de/pycuda>`_ and a `Wiki <http://wiki.tiker.net/PyCuda>`_. Relatedly, like-minded computing goodness for `OpenCL <http://khronos.org>`_ is provided by PyCUDA's sister project `PyOpenCL <http://pypi.python.org/pypi/pyopencl>`_. """, author="Andreas Kloeckner", author_email="*****@*****.**", license="MIT", url="http://mathema.tician.de/software/pycuda", classifiers=[ 'Environment :: Console', 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'Intended Audience :: Other Audience', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: MIT License', 'Natural Language :: English', 'Programming Language :: C++', 'Programming Language :: Python', 'Topic :: Scientific/Engineering', 'Topic :: Scientific/Engineering :: Mathematics', 'Topic :: Scientific/Engineering :: Physics', 'Topic :: Scientific/Engineering :: Visualization', ], # build info packages=["pycuda", "pycuda.gl", "pycuda.sparse"], install_requires=["pytools>=2011.2", "pytest>=2", "decorator>=3.2.0"], ext_package="pycuda", ext_modules=[ NumpyExtension( "_driver", [ "src/cpp/cuda.cpp", "src/cpp/bitlog.cpp", "src/wrapper/wrap_cudadrv.cpp", "src/wrapper/mempool.cpp", ] + EXTRA_SOURCES, include_dirs=INCLUDE_DIRS + EXTRA_INCLUDE_DIRS, library_dirs=LIBRARY_DIRS + conf["CUDADRV_LIB_DIR"], libraries=LIBRARIES + conf["CUDADRV_LIBNAME"], define_macros=list(EXTRA_DEFINES.items()), extra_compile_args=conf["CXXFLAGS"], extra_link_args=conf["LDFLAGS"], ), Extension( "_pvt_struct", ["src/wrapper/_pycuda_struct.c"], extra_compile_args=conf["CXXFLAGS"], extra_link_args=conf["LDFLAGS"], ) ], data_files=[("include/pycuda", glob.glob("src/cuda/*.hpp"))], # 2to3 invocation cmdclass={'build_py': build_py})
def main(): import glob from aksetup_helper import (hack_distutils, get_config, setup, \ NumpyExtension, Extension, set_up_shipped_boost_if_requested) hack_distutils() conf = get_config(get_config_schema()) EXTRA_SOURCES, EXTRA_DEFINES = set_up_shipped_boost_if_requested(conf) LIBRARY_DIRS = conf["BOOST_LIB_DIR"] LIBRARIES = conf["BOOST_PYTHON_LIBNAME"] + conf["BOOST_THREAD_LIBNAME"] from os.path import dirname, join, normpath if conf["CUDA_ROOT"] is None: nvcc_path = search_on_path(["nvcc", "nvcc.exe"]) if nvcc_path is None: print "*** CUDA_ROOT not set, and nvcc not in path. Giving up." import sys sys.exit(1) conf["CUDA_ROOT"] = normpath(join(dirname(nvcc_path), "..")) if conf["CUDA_INC_DIR"] is None: conf["CUDA_INC_DIR"] = [join(conf["CUDA_ROOT"], "include")] if not conf["CUDADRV_LIB_DIR"]: conf["CUDADRV_LIB_DIR"] = [join(conf["CUDA_ROOT"], "lib")] verify_siteconfig(conf) EXTRA_INCLUDE_DIRS = [] EXTRA_LIBRARY_DIRS = [] EXTRA_LIBRARIES = [] if conf["CUDA_TRACE"]: EXTRA_DEFINES["CUDAPP_TRACE_CUDA"] = 1 INCLUDE_DIRS = ['src/cpp'] + conf["BOOST_INC_DIR"] + conf["CUDA_INC_DIR"] conf["USE_CUDA"] = True import sys if 'darwin' in sys.platform: # prevent from building ppc since cuda on OS X is not compiled for ppc # also, default to 32-bit build, since there doesn't appear to be a # 64-bit CUDA on Mac yet. if "-arch" not in conf["CXXFLAGS"]: conf["CXXFLAGS"].extend(['-arch', 'i386', '-m32']) if "-arch" not in conf["LDFLAGS"]: conf["LDFLAGS"].extend(['-arch', 'i386', '-m32']) ext_kwargs = dict() if conf["CUDA_ENABLE_GL"]: EXTRA_SOURCES.append("src/wrapper/wrap_cudagl.cpp") EXTRA_DEFINES["HAVE_GL"] = 1 ver_dic = {} execfile("pycuda/__init__.py", ver_dic) setup(name="pycuda", # metadata version=ver_dic["VERSION_TEXT"], description="Python wrapper for Nvidia CUDA", long_description=""" PyCUDA lets you access `Nvidia <http://nvidia.com>`_'s `CUDA <http://nvidia.com/cuda/>`_ parallel computation API from Python. Several wrappers of the CUDA API already exist-so what's so special about PyCUDA? * Object cleanup tied to lifetime of objects. This idiom, often called `RAII <http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization>`_ in C++, makes it much easier to write correct, leak- and crash-free code. PyCUDA knows about dependencies, too, so (for example) it won't detach from a context before all memory allocated in it is also freed. * Convenience. Abstractions like pycuda.driver.SourceModule and pycuda.gpuarray.GPUArray make CUDA programming even more convenient than with Nvidia's C-based runtime. * Completeness. PyCUDA puts the full power of CUDA's driver API at your disposal, if you wish. It also includes code for interoperability with OpenGL. * Automatic Error Checking. All CUDA errors are automatically translated into Python exceptions. * Speed. PyCUDA's base layer is written in C++, so all the niceties above are virtually free. * Helpful `Documentation <http://documen.tician.de/pycuda>`_ and a `Wiki <http://wiki.tiker.net/PyCuda>`_. Relatedly, like-minded computing goodness for `OpenCL <http://khronos.org>`_ is provided by PyCUDA's sister project `PyOpenCL <http://pypi.python.org/pypi/pyopencl>`_. """, author=u"Andreas Kloeckner", author_email="*****@*****.**", license = "MIT", url="http://mathema.tician.de/software/pycuda", classifiers=[ 'Environment :: Console', 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'Intended Audience :: Other Audience', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: MIT License', 'Natural Language :: English', 'Programming Language :: C++', 'Programming Language :: Python', 'Topic :: Scientific/Engineering', 'Topic :: Scientific/Engineering :: Mathematics', 'Topic :: Scientific/Engineering :: Physics', 'Topic :: Scientific/Engineering :: Visualization', ], # build info packages=["pycuda", "pycuda.gl", "pycuda.sparse"], install_requires=[ "pytools>=8", "py>=1.0.0b7", "decorator>=3.2.0" ], ext_package="pycuda", ext_modules=[ NumpyExtension("_driver", [ "src/cpp/cuda.cpp", "src/cpp/bitlog.cpp", "src/wrapper/wrap_cudadrv.cpp", "src/wrapper/mempool.cpp", ]+EXTRA_SOURCES, include_dirs=INCLUDE_DIRS + EXTRA_INCLUDE_DIRS, library_dirs=LIBRARY_DIRS + conf["CUDADRV_LIB_DIR"], libraries=LIBRARIES + conf["CUDADRV_LIBNAME"], define_macros=list(EXTRA_DEFINES.iteritems()), extra_compile_args=conf["CXXFLAGS"], extra_link_args=conf["LDFLAGS"], ), Extension("_pvt_struct", ["src/wrapper/_pycuda_struct.c"], )], data_files=[ ("include/pycuda", glob.glob("src/cuda/*.hpp")) ], )