import cupy on demand , because it eats almost 2Gb paging file in every subprocess

This commit is contained in:
iperov 2021-07-24 10:48:42 +04:00
commit b546c735a1
3 changed files with 56 additions and 50 deletions

View file

@ -1,6 +1,6 @@
from typing import List
import cupy as cp
class CuPyDeviceInfo:
@ -55,6 +55,7 @@ def get_available_devices() -> List[CuPyDeviceInfo]:
"""
global _cupy_devices
if _cupy_devices is None:
import cupy as cp # BUG eats 1.8Gb paging file per process, so import on demand
devices = []
for i in range (cp.cuda.runtime.getDeviceCount()):