Beispiel #1
0
def configuration(parent_package='',top_path=None):
    from numpy.distutils.misc_util import Configuration, dict_append
    from numpy.distutils.system_info import system_info

    config = Configuration('numexprz', parent_package, top_path)
#    os.chdir( here )

    #try to find configuration for MKL, either from environment or site.cfg
    if op.exists('site.cfg'):
        mkl_config_data = config.get_info('mkl')
        # some version of MKL need to be linked with libgfortran, for this, use
        # entries of DEFAULT section in site.cfg
        default_config = system_info()
        dict_append(mkl_config_data,
                    libraries=default_config.get_libraries(),
                    library_dirs=default_config.get_lib_dirs())
    else:
        mkl_config_data = {}

    #setup information for C extension
    if os.name == 'nt':
        pthread_win = [ 'numexprz/win32/pthread.c' ]
    else:
        pthread_win = []
    extension_config_data = {
        'sources': ['numexprz/interpreter.cpp',
                    'numexprz/module.cpp',
                    'numexprz/numexpr_object.cpp'] + pthread_win,
        'depends': ['numexprz/interp_body.cpp',
                    'numexprz/complex_functions.hpp',
                    'numexprz/interpreter.hpp',
                    'numexprz/module.hpp',
                    'numexprz/msvc_function_stubs.hpp',
                    'numexprz/numexpr_config.hpp',
                    'numexprz/numexpr_object.hpp',
                    'numexprz/opcodes.hpp',
                    'numexprz/functions.hpp', 
                    'numexprz/complexf_functions.hpp',
                    'numexprz/missing_posix_functions.hpp',
                    'numexprz/str-two-way.hpp', ],
    }
    if os.name == 'nt':
        # Don't use GNU math or LINK.exe args on Win64 platform
        pass
    else:
        extension_config_data['libraries'] = ['m']
        extension_config_data['extra_compile_args'] = ['-funroll-all-loops', ]
        
    dict_append(extension_config_data, **mkl_config_data)
    if 'library_dirs' in mkl_config_data:
        library_dirs = ':'.join(mkl_config_data['library_dirs'])
    config.add_extension('interpreter', **extension_config_data)

    config.make_config_py()
    # Remove tests, it may be generating UNKNOWN.egg
    # config.add_subpackage('tests')

    #version handling
    config.get_version('version.py')
    return config
Beispiel #2
0
def configuration(parent_package='', top_path=None):
    # Create package configuration
    config = Configuration('cnn', parent_package, top_path)
    config.add_data_dir('tests')

    # Add Cython module extension
    config.add_include_dirs(config.name.replace('.', os.sep))
    info = system_info()
    opts = info.calc_extra_info()
    if info.cp.has_section('opencl'):
        info.section = 'opencl'
        config.add_include_dirs(info.get_include_dirs())
        opts['library_dirs'] = info.get_lib_dirs()
        opts['extra_link_args'] = ['-l%s' % s for s in info.get_libraries()]
    else:
        opencl_link_args = ['-lOpenCL']
    config.add_extension('_utils',
                         sources=['_utils.c', 'utils.c', 'opencl_utils.c'],
                         **opts)

    # Add OpenCL kernel files
    add_opencl_files(
        config, 'opencl',
        ['test1d.cl', 'convolve_image.cl', 'relu_max_pool_image.cl'])

    return config
Beispiel #3
0
        def configuration():
            from numpy.distutils.misc_util import Configuration, dict_append
            from numpy.distutils.system_info import system_info

            config = Configuration('numexpr')

            #try to find configuration for MKL, either from environment or site.cfg
            if op.exists('site.cfg'):
                mkl_config_data = config.get_info('mkl')
                # Some version of MKL needs to be linked with libgfortran.
                # For this, use entries of DEFAULT section in site.cfg.
                default_config = system_info()
                dict_append(mkl_config_data,
                            libraries=default_config.get_libraries(),
                            library_dirs=default_config.get_lib_dirs())
            else:
                mkl_config_data = {}

            # setup information for C extension
            if os.name == 'nt':
                pthread_win = ['numexpr/win32/pthread.c']
            else:
                pthread_win = []
            extension_config_data = {
                'sources': [
                    'numexpr/interpreter.cpp', 'numexpr/module.cpp',
                    'numexpr/numexpr_object.cpp'
                ] + pthread_win,
                'depends': [
                    'numexpr/interp_body.cpp', 'numexpr/complex_functions.hpp',
                    'numexpr/interpreter.hpp', 'numexpr/module.hpp',
                    'numexpr/msvc_function_stubs.hpp',
                    'numexpr/numexpr_config.hpp', 'numexpr/numexpr_object.hpp'
                ],
                'libraries': ['m'],
                'extra_compile_args': [
                    '-funroll-all-loops',
                ],
            }
            dict_append(extension_config_data, **mkl_config_data)
            if 'library_dirs' in mkl_config_data:
                library_dirs = ':'.join(mkl_config_data['library_dirs'])
            config.add_extension('interpreter', **extension_config_data)
            config.set_options(quiet=True)

            config.make_config_py()
            config.add_subpackage('tests', 'numexpr/tests')

            #version handling
            config.get_version('numexpr/version.py')
            return config
Beispiel #4
0
        def configuration():
            from numpy.distutils.misc_util import Configuration, dict_append
            from numpy.distutils.system_info import system_info

            config = Configuration("numexpr")

            # try to find configuration for MKL, either from environment or site.cfg
            if op.exists("site.cfg"):
                mkl_config_data = config.get_info("mkl")
                # some version of MKL need to be linked with libgfortran, for this, use
                # entries of DEFAULT section in site.cfg
                default_config = system_info()
                dict_append(
                    mkl_config_data,
                    libraries=default_config.get_libraries(),
                    library_dirs=default_config.get_lib_dirs(),
                )
            else:
                mkl_config_data = {}

            # setup information for C extension
            if os.name == "nt":
                pthread_win = ["numexpr/win32/pthread.c"]
            else:
                pthread_win = []
            extension_config_data = {
                "sources": ["numexpr/interpreter.cpp", "numexpr/module.cpp", "numexpr/numexpr_object.cpp"]
                + pthread_win,
                "depends": [
                    "numexpr/interp_body.cpp",
                    "numexpr/complex_functions.hpp",
                    "numexpr/interpreter.hpp",
                    "numexpr/module.hpp",
                    "numexpr/msvc_function_stubs.hpp",
                    "numexpr/numexpr_config.hpp",
                    "numexpr/numexpr_object.hpp",
                ],
                "libraries": ["m"],
                "extra_compile_args": ["-funroll-all-loops"],
            }
            dict_append(extension_config_data, **mkl_config_data)
            if "library_dirs" in mkl_config_data:
                library_dirs = ":".join(mkl_config_data["library_dirs"])
            config.add_extension("interpreter", **extension_config_data)

            config.make_config_py()
            config.add_subpackage("tests", "numexpr/tests")

            # version handling
            config.get_version("numexpr/version.py")
            return config
Beispiel #5
0
def configuration():
    from numpy.distutils.misc_util import Configuration, dict_append
    from numpy.distutils.system_info import system_info

    config = Configuration('numexpr')

    #try to find configuration for MKL, either from environment or site.cfg
    if op.exists('site.cfg'):
        mkl_config_data = config.get_info('mkl')
        # some version of MKL need to be linked with libgfortran, for this, use
        # entries of DEFAULT section in site.cfg
        default_config = system_info()
        dict_append(mkl_config_data,
                    libraries = default_config.get_libraries(),
                    library_dirs = default_config.get_lib_dirs() )
    else:
        mkl_config_data = {}

    #setup information for C extension
    if os.name == 'nt':
        pthread_win = ['numexpr/win32/pthread.c']
    else:
        pthread_win = []
    extension_config_data = {
        'sources': ['numexpr/interpreter.cpp',
                    'numexpr/module.cpp',
                    'numexpr/numexpr_object.cpp'] + pthread_win,
        'depends': ['numexpr/interp_body.cpp',
                    'numexpr/complex_functions.hpp',
                    'numexpr/interpreter.hpp',
                    'numexpr/module.hpp',
                    'numexpr/msvc_function_stubs.hpp',
                    'numexpr/numexpr_config.hpp',
                    'numexpr/numexpr_object.hpp'],
        'libraries': ['m'],
        'extra_compile_args': ['-funroll-all-loops',],
        }
    dict_append(extension_config_data, **mkl_config_data)
    if 'library_dirs' in mkl_config_data:
        library_dirs = ':'.join(mkl_config_data['library_dirs'])
        rpath_link = '-Xlinker --rpath -Xlinker %s' % library_dirs
        extension_config_data['extra_link_args'] = [rpath_link]
    config.add_extension('interpreter', **extension_config_data)

    config.make_config_py()
    config.add_subpackage('tests', 'numexpr/tests')

    #version handling
    config.make_svn_version_py()
    config.get_version('numexpr/version.py')
    return config
Beispiel #6
0
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration
    config = Configuration('pil_lite', parent_package, top_path, 'PIL')

    from numpy.distutils import system_info
    info = system_info.system_info()
    library_search_dirs = info.get_lib_dirs()
    include_search_dirs = info.get_include_dirs()

    for root in [JPEG_ROOT, ZLIB_ROOT]:
        if root is not None:
            lib_root, include_root = root
            add_directory(library_search_dirs, lib_root)
            add_directory(include_search_dirs, include_root)

    imaging_library_dirs = []
    imaging_include_dirs = ['libImaging']
    imaging_libraries = []
    imaging_defines = []

    def add_lib(library, include, macro):
        ret = find_library_file(library, library_search_dirs, include,
                                include_search_dirs, info)
        if ret is not None:
            imaging_libraries.append(library)
            imaging_library_dirs.append(ret[0])
            imaging_include_dirs.append(ret[1])
            imaging_defines.append((macro, None))
            return True
        else:
            return False

    z = add_lib('z', 'zlib.h', 'HAVE_LIBZ')
    if not z and sys.platform == 'win32':
        z = add_lib('zlib', 'zlib.h', 'HAVE_LIBZ')
    if z:
        numpy.distutils.log.info('Libz found.')
    else:
        numpy.distutils.log.info('Libz not found.')

    jpeg = add_lib('jpeg', 'jpeglib.h', 'HAVE_LIBJPEG')
    if jpeg:
        numpy.distutils.log.info('Libjpeg found.')
    else:
        numpy.distutils.log.info('Libjpeg not found.')

    if sys.platform == "win32":
        imaging_libraries.extend(["kernel32", "user32"])
    if struct.unpack("h", "\0\1")[0] == 1:
        imaging_defines.append(("WORDS_BIGENDIAN", None))
        numpy.distutils.log.info('Detected big-endian system.')
    else:
        numpy.distutils.log.info('Detected little-endian system.')

    config.add_extension('_imaging',
                         sources=['*.c',
                                  os.path.join('libImaging', '*.c')],
                         include_dirs=imaging_include_dirs,
                         library_dirs=imaging_library_dirs,
                         libraries=imaging_libraries,
                         define_macros=imaging_defines)

    return config
Beispiel #7
0
# This needs to be below the setuptools import
from distutils.core import setup, Extension

here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
    readme = f.read()

try:
    import pypandoc
    readme = pypandoc.convert(readme, 'md', 'rst')
except ImportError:
    pass

# Find the fftw3 headers
info = system_info()
incdirs = info.get_include_dirs()
libdirs = info.get_lib_dirs()

fftw = get_info('fftw3') or get_info('fftw')

if not fftw:
    print("We require either fftw3 or fftw to be present in order to build")
    sys.exit(1)

#define_macros = fftw['define_macros'],
ext_modules = [
    Extension('particleman.libst',
              include_dirs=incdirs + fftw['include_dirs'],
              libraries=fftw['libraries'],
              library_dirs=fftw['library_dirs'],
Beispiel #8
0
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration, dict_append
    from numpy.distutils.system_info import system_info

    config = Configuration('numexprz', parent_package, top_path)
    #    os.chdir( here )

    #try to find configuration for MKL, either from environment or site.cfg
    if op.exists('site.cfg'):
        mkl_config_data = config.get_info('mkl')
        # some version of MKL need to be linked with libgfortran, for this, use
        # entries of DEFAULT section in site.cfg
        default_config = system_info()
        dict_append(mkl_config_data,
                    libraries=default_config.get_libraries(),
                    library_dirs=default_config.get_lib_dirs())
    else:
        mkl_config_data = {}

    #setup information for C extension
    if os.name == 'nt':
        pthread_win = ['numexprz/win32/pthread.c']
    else:
        pthread_win = []
    extension_config_data = {
        'sources': [
            'numexprz/interpreter.cpp', 'numexprz/module.cpp',
            'numexprz/numexpr_object.cpp'
        ] + pthread_win,
        'depends': [
            'numexprz/interp_body.cpp',
            'numexprz/complex_functions.hpp',
            'numexprz/interpreter.hpp',
            'numexprz/module.hpp',
            'numexprz/msvc_function_stubs.hpp',
            'numexprz/numexpr_config.hpp',
            'numexprz/numexpr_object.hpp',
            'numexprz/opcodes.hpp',
            'numexprz/functions.hpp',
            'numexprz/complexf_functions.hpp',
            'numexprz/missing_posix_functions.hpp',
            'numexprz/str-two-way.hpp',
        ],
    }
    if os.name == 'nt':
        # Don't use GNU math or LINK.exe args on Win64 platform
        pass
    else:
        extension_config_data['libraries'] = ['m']
        extension_config_data['extra_compile_args'] = [
            '-funroll-all-loops',
        ]

    dict_append(extension_config_data, **mkl_config_data)
    if 'library_dirs' in mkl_config_data:
        library_dirs = ':'.join(mkl_config_data['library_dirs'])
    config.add_extension('interpreter', **extension_config_data)

    config.make_config_py()
    # Remove tests, it may be generating UNKNOWN.egg
    # config.add_subpackage('tests')

    #version handling
    config.get_version('version.py')
    return config