本文整理汇总了Python中setuptools.Extension.define_macros方法的典型用法代码示例。如果您正苦于以下问题:Python Extension.define_macros方法的具体用法?Python Extension.define_macros怎么用?Python Extension.define_macros使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类setuptools.Extension
的用法示例。
在下文中一共展示了Extension.define_macros方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Extension
# 需要导入模块: from setuptools import Extension [as 别名]
# 或者: from setuptools.Extension import define_macros [as 别名]
libraries = ['gomp']
sources_files = ['trottersuzuki/src/common.cpp',
'trottersuzuki/src/cpublock.cpp',
'trottersuzuki/src/model.cpp',
'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}
示例2: Extension
# 需要导入模块: from setuptools import Extension [as 别名]
# 或者: from setuptools.Extension import define_macros [as 别名]
else:
extra_compile_args = ['-fopenmp']
if 'CC' in os.environ and 'clang-omp' in os.environ['CC']:
openmp = 'iomp5'
else:
openmp = 'gomp'
cmdclass = {'build_ext': custom_build_ext}
somoclu_module = Extension('_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.6.1',
license='GPL3',