| 123456789101112131415161718192021222324252627 |
- import sys, os, subprocess
- import numpy as np
- # probably make this a real extension module
- from distutils.extension import Extension
- # gcc / msvc
- link_args = ['-fopenmp'] if sys.platform == 'linux2' else []
- compile_args = ['-fopenmp'] if sys.platform == 'linux2' else ['/openmp', '/wd4244']
- ext_modules = [Extension("skiplist",
- ["skiplist.pyx"],
- extra_compile_args=compile_args,
- extra_link_args=link_args)
- ]
- import pyximport; pyximport.install(setup_args={'include_dirs': [np.get_include(), ], 'ext_modules': ext_modules})
- # create cython annotation htmls
- f = os.path.join(os.path.dirname(sys.executable), 'Scripts/cython-script.py')
- try:
- subprocess.check_call([sys.executable, f, '-a', 'skiplist.pyx'])
- except subprocess.CalledProcessError:
- print('Error during cython annotation')
- # ==================================================
- import skiplist
- skiplist.test(10000, 2e8, parallel=True, load_stored=True)
|