Skip to content
Permalink
Browse files

fix Exception("nn devices are not initialized. Run initialize_main_en…

…v() in main process.")
  • Loading branch information
iperov committed Mar 24, 2020
1 parent 2d5e949 commit 8ad2a5373e810e2a7eeac3e896373748f638f2de
Showing with 3 additions and 1 deletion.
  1. +3 −1 core/leras/device.py
@@ -84,6 +84,9 @@ def get_devices_at_least_mem(self, totalmemsize_gb):

@staticmethod
def initialize_main_env():
os.environ['NN_DEVICES_INITIALIZED'] = '1'
os.environ['NN_DEVICES_COUNT'] = '0'

min_cc = int(os.environ.get("TF_MIN_REQ_CAP", 35))
libnames = ('libcuda.so', 'libcuda.dylib', 'nvcuda.dll')
for libname in libnames:
@@ -129,7 +132,6 @@ def initialize_main_env():
})
cuda.cuCtxDetach(context)

os.environ['NN_DEVICES_INITIALIZED'] = '1'
os.environ['NN_DEVICES_COUNT'] = str(len(devices))
for i, device in enumerate(devices):
os.environ[f'NN_DEVICE_{i}_NAME'] = device['name']

0 comments on commit 8ad2a53

Please sign in to comment.
You can’t perform that action at this time.