test_skiplist.py 1001 B

123456789101112131415161718192021222324252627
  1. import sys, os, subprocess
  2. import numpy as np
  3. # probably make this a real extension module
  4. from distutils.extension import Extension
  5. # gcc / msvc
  6. link_args = ['-fopenmp'] if sys.platform == 'linux2' else []
  7. compile_args = ['-fopenmp'] if sys.platform == 'linux2' else ['/openmp', '/wd4244']
  8. ext_modules = [Extension("skiplist",
  9. ["skiplist.pyx"],
  10. extra_compile_args=compile_args,
  11. extra_link_args=link_args)
  12. ]
  13. import pyximport; pyximport.install(setup_args={'include_dirs': [np.get_include(), ], 'ext_modules': ext_modules})
  14. # create cython annotation htmls
  15. f = os.path.join(os.path.dirname(sys.executable), 'Scripts/cython-script.py')
  16. try:
  17. subprocess.check_call([sys.executable, f, '-a', 'skiplist.pyx'])
  18. except subprocess.CalledProcessError:
  19. print('Error during cython annotation')
  20. # ==================================================
  21. import skiplist
  22. skiplist.test(10000, 2e8, parallel=True, load_stored=True)