一个小实用程序,通过cython绑定获取openmp使用的实际线程数。
omp-thread-count的Python项目详细描述
OpenMP线程计数器
一个小的python模块,通过cython绑定获取omp使用的实际线程数。
- 自由软件:麻省理工学院许可证
- 文档:https://omp-thread-count.readthedocs.org。
为什么
因为gcc/cython在调用openmp.get_thread_num或openmp.get_max_threads时总是返回1。
安装
要安装,请运行:
pip install omp-thread-count
在OSX和其他平台中,您可能需要指定一个编译器 OpenMP支持,如下:
CC=gcc-4.8 pip install omp-thread-count
使用量
从python代码导入:
importomp_thread_countn_threads=omp_thread_count.get_thread_count()
从cython代码导入:
fromomp_thread_count._ompcimportget_thread_count
在扩展名“include_dirs中使用omp_thread_count.get_includes()到 使用头文件。
学分
这个包是用Cookiecutter和audreyr/cookiecutter-pypackage项目模板创建的。
历史记录
0.2.1(2016-06-21)
- 改进包装和ci支持。
- 简化的cython码。
- 修复了对Python3.5的支持。
0.2.0(2016-06-19)
- 为第三方cimports添加了pxd文件。
0.1.0(2016-06-18)
- pypi上的第一个版本。