Source code for onnx_extended

# coding: utf-8
"""
More operators for onnx reference implementation.
Experimentation with openmp, CUDA.
"""

__version__ = "0.2.2"
__author__ = "Xavier Dupré"


[docs]def has_cuda() -> bool: """ Tells if cuda is available. """ from ._config import HAS_CUDA return HAS_CUDA == 1
[docs]def cuda_version() -> str: """ Tells which version of CUDA was used to build the CUDA extensions. """ if not has_cuda(): raise RuntimeError("CUDA extensions are not available.") from ._config import CUDA_VERSION return CUDA_VERSION
[docs]def cuda_version_int() -> tuple: """ Tells which version of CUDA was used to build the CUDA extensions. It returns `(0, 0)` if CUDA is not present. """ if not has_cuda(): return (0, 0) from ._config import CUDA_VERSION if not isinstance(CUDA_VERSION, str): return tuple() spl = CUDA_VERSION.split(".") return tuple(map(int, spl))
[docs]def compiled_with_cuda() -> bool: """ Checks it was compiled with CUDA. """ try: from .validation.cuda import cuda_example_py return cuda_example_py is not None except ImportError: return False
[docs]def get_cxx_flags() -> str: """ Returns `CXX_FLAGS`. """ from ._config import CXX_FLAGS return CXX_FLAGS
[docs]def get_stdcpp() -> int: """ Returns `CMAKE_CXX_STANDARD`. """ from ._config import CMAKE_CXX_STANDARD return CMAKE_CXX_STANDARD