File: cupy_helper.py

package info (click to toggle)
python-pyqtgraph 0.14.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 8,168 kB
  • sloc: python: 54,831; makefile: 128; ansic: 40; sh: 2
file content (18 lines) | stat: -rw-r--r-- 523 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import os
from warnings import warn

from .. import getConfigOption


def getCupy():
    if getConfigOption("useCupy"):
        try:
            import cupy
        except ImportError:
            warn("cupy library could not be loaded, but 'useCupy' is set.")
            return None
        if os.name == "nt" and cupy.cuda.runtime.runtimeGetVersion() < 11000:
            warn("In Windows, CUDA toolkit should be version 11 or higher, or some functions may misbehave.")
        return cupy
    else:
        return None