File: setup_nested_prange_blas.py

package info (click to toggle)
python-threadpoolctl 3.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 356 kB
  • sloc: python: 1,447; sh: 189; ansic: 11; makefile: 2
file content (41 lines) | stat: -rw-r--r-- 1,097 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import os
from setuptools import Extension, setup
from Cython.Build import cythonize

from build_utils import set_cc_variables
from build_utils import get_openmp_flag

original_environ = os.environ.copy()
try:
    set_cc_variables("CC_OUTER_LOOP")
    openmp_flag = get_openmp_flag()

    use_custom_blas = os.getenv("INSTALL_BLAS", False)
    libraries = [use_custom_blas] if use_custom_blas else []
    custom_suffix = "_custom" if use_custom_blas else ""
    filename = f"nested_prange_blas{custom_suffix}.pyx"

    ext_modules = [
        Extension(
            "nested_prange_blas",
            [filename],
            extra_compile_args=openmp_flag,
            extra_link_args=openmp_flag,
            libraries=libraries,
        )
    ]

    setup(
        name="_openmp_test_helper_nested_prange_blas",
        ext_modules=cythonize(
            ext_modules,
            compiler_directives={
                "language_level": 3,
                "boundscheck": False,
                "wraparound": False,
            },
        ),
    )

finally:
    os.environ.update(original_environ)