'trottersuzuki/src/solver.cpp',
                     'trottersuzuki/trottersuzuki_wrap.cxx']

    ts_module = Extension('_trottersuzuki', sources=sources_files,
                          include_dirs=[numpy_include, 'src'],
                          extra_compile_args=extra_compile_args,
                          libraries=libraries,
                          )
    if CUDA is not None:
        ts_module.sources += ['trottersuzuki/src/cc2kernel.cu',
                              'trottersuzuki/src/hybrid.cu']
        ts_module.define_macros = [('CUDA', None)]
        ts_module.include_dirs.append(CUDA['include'])
        ts_module.library_dirs = [CUDA['lib']]
        ts_module.libraries += ['cudart', 'cublas']
        ts_module.runtime_library_dirs = [CUDA['lib']]
        if len(ts_module.extra_compile_args['cc']) > 0:
            extra_args = ts_module.extra_compile_args['cc'][0]
        else:
            extra_args = ""
        ts_module.extra_compile_args['nvcc'] = ['-use_fast_math',
                                                '--ptxas-options=-v', '-c',
                                                '--compiler-options',
                                                '-fPIC ' + extra_args]
    cmdclass = {'build_ext': custom_build_ext}


setup(name='trottersuzuki',
      version='1.5.2',
      license='GPL3',
      author="Peter Wittek, Luca Calderaro",
    ts_module = Extension(
        '_trottersuzuki',
        sources=sources_files,
        include_dirs=[numpy_include, 'src'],
        extra_compile_args=extra_compile_args,
        libraries=libraries,
    )
    if CUDA is not None:
        ts_module.sources += [
            'trottersuzuki/src/cc2kernel.cu', 'trottersuzuki/src/hybrid.cu'
        ]
        ts_module.define_macros = [('CUDA', None)]
        ts_module.include_dirs.append(CUDA['include'])
        ts_module.library_dirs = [CUDA['lib']]
        ts_module.libraries += ['cudart', 'cublas']
        ts_module.runtime_library_dirs = [CUDA['lib']]
        if len(ts_module.extra_compile_args['cc']) > 0:
            extra_args = ts_module.extra_compile_args['cc'][0]
        else:
            extra_args = ""
        ts_module.extra_compile_args['nvcc'] = [
            '-use_fast_math', '--ptxas-options=-v', '-c', '--compiler-options',
            '-fPIC ' + extra_args
        ]
    cmdclass = {'build_ext': custom_build_ext}

setup(name='trottersuzuki',
      version='1.5.2',
      license='GPL3',
      author="Peter Wittek, Luca Calderaro",
      author_email='*****@*****.**',
Exemple #3
0
def create_exension():
    global EPICSBASE, HOSTARCH
    umacros = []
    macros = []
    cflags = []
    lflags = []
    dlls = []
    extra_objects = []
    libraries = ["ca", "Com"]
    CMPL = 'gcc'
    UNAME = platform.system()
    ARCH = platform.architecture()[0]
    # platform dependent libraries and macros
    if UNAME.lower() == "windows":
        UNAME = "WIN32"
        static = False
        if HOSTARCH in ['win32-x86', 'windows-x64', 'win32-x86-debug', 'windows-x64-debug']:
            if not SHARED:
                dlls = ['Com.dll', 'ca.dll']
                for dll in dlls:
                    dllpath = os.path.join(EPICSBASE, 'bin', HOSTARCH, dll)
                    if not os.path.exists(dllpath):
                        static = True
                        break
                    shutil.copy(dllpath,
                                os.path.join(os.path.dirname(os.path.abspath(__file__)), 'src', 'CaChannel'))
            macros += [('_CRT_SECURE_NO_WARNINGS', 'None'), ('EPICS_CALL_DLL', '')]
            cflags += ['/Z7']
            CMPL = 'msvc'
        if HOSTARCH in ['win32-x86-static', 'windows-x64-static'] or static:
            libraries += ['ws2_32', 'user32', 'advapi32']
            macros += [('_CRT_SECURE_NO_WARNINGS', 'None'), ('EPICS_DLL_NO', '')]
            umacros += ['_DLL']
            cflags += ['/EHsc', '/Z7']
            lflags += ['/LTCG']
            if HOSTARCH[-5:] == 'debug':
                libraries += ['msvcrtd']
                lflags += ['/NODEFAULTLIB:libcmtd.lib']
            else:
                libraries += ['msvcrt']
                lflags += ['/NODEFAULTLIB:libcmt.lib']
            CMPL = 'msvc'
        # GCC compiler
        if HOSTARCH in ['win32-x86-mingw', 'windows-x64-mingw']:
            macros += [('_MINGW', ''), ('EPICS_DLL_NO', '')]
            lflags += ['-static']
            CMPL = 'gcc'
        if HOSTARCH == 'windows-x64-mingw':
            macros += [('MS_WIN64', '')]
            CMPL = 'gcc'
    elif UNAME.lower() == "darwin":
        CMPL = 'clang'
        HOSTARCH = 'darwin-x86'
        if not SHARED:
            extra_objects = [os.path.join(EPICSBASE, 'lib', HOSTARCH, 'lib%s.a' % lib) for lib in libraries]
            libraries = []
    elif UNAME.lower() == "linux":
        CMPL = 'gcc'
        if not SHARED:
            extra_objects = [os.path.join(EPICSBASE, 'lib', HOSTARCH, 'lib%s.a' % lib) for lib in libraries]
            libraries = ['rt']
            if subprocess.call('nm %s | grep -q rl_' % os.path.join(EPICSBASE, 'lib', HOSTARCH, 'libCom.a'), shell=True) == 0:
                libraries += ['readline']
    else:
        print("Platform", UNAME, ARCH, " Not Supported")
        sys.exit(1)

    include_dirs = [os.path.join(EPICSBASE, "include"),
                    os.path.join(EPICSBASE, "include", "os", UNAME),
                    os.path.join(EPICSBASE, "include", "compiler", CMPL),
                    ]

    ca_module = Extension('CaChannel._ca',
                          sources=['src/CaChannel/_ca.cpp'],
                          extra_compile_args=cflags,
                          include_dirs=include_dirs,
                          define_macros=macros,
                          undef_macros=umacros,
                          extra_link_args=lflags,
                          extra_objects=extra_objects,
                          libraries=libraries,
                          library_dirs=[os.path.join(EPICSBASE, "lib", HOSTARCH)])

    if UNAME == "Linux" and SHARED:
        ca_module.runtime_library_dirs = [os.path.join(EPICSBASE, "lib", HOSTARCH)]

    return [ca_module], dlls
Exemple #4
0
def create_exension():
    global EPICSBASE, HOSTARCH
    umacros = []
    macros = []
    cflags = []
    lflags = []
    dlls = []
    extra_objects = []
    libraries = ["ca", "Com"]
    CMPL = 'gcc'
    UNAME = platform.system()
    ARCH = platform.architecture()[0]
    # platform dependent libraries and macros
    if UNAME.lower() == "windows":
        UNAME = "WIN32"
        static = False
        if HOSTARCH in [
                'win32-x86', 'windows-x64', 'win32-x86-debug',
                'windows-x64-debug'
        ]:
            if not SHARED:
                dlls = ['Com.dll', 'ca.dll']
                for dll in dlls:
                    dllpath = os.path.join(EPICSBASE, 'bin', HOSTARCH, dll)
                    if not os.path.exists(dllpath):
                        static = True
                        break
                    dll_filepath = os.path.join(
                        os.path.dirname(os.path.abspath(__file__)), 'src',
                        'CaChannel', dll)
                    if not os.path.exists(dll_filepath) or not filecmp.cmp(
                            dllpath, dll_filepath):
                        shutil.copy(dllpath, dll_filepath)
            macros += [('_CRT_SECURE_NO_WARNINGS', 'None'),
                       ('EPICS_CALL_DLL', '')]
            cflags += ['/Z7']
            CMPL = 'msvc'
        if HOSTARCH in ['win32-x86-static', 'windows-x64-static'] or static:
            libraries += ['ws2_32', 'user32', 'advapi32']
            macros += [('_CRT_SECURE_NO_WARNINGS', 'None'),
                       ('EPICS_DLL_NO', '')]
            umacros += ['_DLL']
            cflags += ['/EHsc', '/Z7']
            lflags += ['/LTCG']
            if HOSTARCH[-5:] == 'debug':
                libraries += ['msvcrtd']
                lflags += ['/NODEFAULTLIB:libcmtd.lib']
            else:
                libraries += ['msvcrt']
                lflags += ['/NODEFAULTLIB:libcmt.lib']
            CMPL = 'msvc'
        # GCC compiler
        if HOSTARCH in ['win32-x86-mingw', 'windows-x64-mingw']:
            macros += [('_MINGW', ''), ('EPICS_DLL_NO', '')]
            lflags += ['-static']
            CMPL = 'gcc'
        if HOSTARCH == 'windows-x64-mingw':
            macros += [('MS_WIN64', '')]
            CMPL = 'gcc'
    elif UNAME.lower() == "darwin":
        CMPL = 'clang'
        HOSTARCH = 'darwin-x86'
        if not SHARED:
            extra_objects = [
                os.path.join(EPICSBASE, 'lib', HOSTARCH, 'lib%s.a' % lib)
                for lib in libraries
            ]
            libraries = []
    elif UNAME.lower() == "linux":
        CMPL = 'gcc'
        if not SHARED:
            extra_objects = [
                os.path.join(EPICSBASE, 'lib', HOSTARCH, 'lib%s.a' % lib)
                for lib in libraries
            ]
            libraries = ['rt']
            if subprocess.call(
                    'nm %s | grep -q rl_' %
                    os.path.join(EPICSBASE, 'lib', HOSTARCH, 'libCom.a'),
                    shell=True) == 0:
                libraries += ['readline']
    else:
        print("Platform", UNAME, ARCH, " Not Supported")
        sys.exit(1)

    include_dirs = [
        os.path.join(EPICSBASE, "include"),
        os.path.join(EPICSBASE, "include", "os", UNAME),
        os.path.join(EPICSBASE, "include", "compiler", CMPL),
    ]

    ca_module = Extension(
        'CaChannel._ca',
        sources=['src/CaChannel/_ca.cpp'],
        extra_compile_args=cflags,
        include_dirs=include_dirs,
        define_macros=macros,
        undef_macros=umacros,
        extra_link_args=lflags,
        extra_objects=extra_objects,
        libraries=libraries,
        library_dirs=[os.path.join(EPICSBASE, "lib", HOSTARCH)])

    if UNAME == "Linux" and SHARED:
        ca_module.runtime_library_dirs = [
            os.path.join(EPICSBASE, "lib", HOSTARCH)
        ]

    return [ca_module], dlls
Exemple #5
0
            openmp = "gomp"
        cmdclass = {"build_ext": custom_build_ext}
        somoclu_module = Extension(
            "somoclu._somoclu_wrap",
            sources=sources_files,
            include_dirs=[numpy_include, "src"],
            extra_compile_args={"cc": extra_compile_args},
            libraries=[openmp],
        )
    if CUDA is not None:
        somoclu_module.sources.append("somoclu/src/denseGpuKernels.cu")
        somoclu_module.define_macros = [("CUDA", None)]
        somoclu_module.include_dirs.append(CUDA["include"])
        somoclu_module.library_dirs = [CUDA["lib"]]
        somoclu_module.libraries += ["cudart", "cublas"]
        somoclu_module.runtime_library_dirs = [CUDA["lib"]]
        somoclu_module.extra_compile_args["nvcc"] = [
            "-use_fast_math",
            "--ptxas-options=-v",
            "-c",
            "--compiler-options",
            "-fPIC " + extra_compile_args[0],
        ]

try:
    setup(
        name="somoclu",
        version="1.7.5",
        license="GPL3",
        author="Peter Wittek, Shi Chao Gao",
        author_email="",