提交 fca77a86 authored 作者: Josh Bleecher Snyder's avatar Josh Bleecher Snyder

atexit-registered calls are executed in LIFO order, so reverse these calls

上级 1c296908
...@@ -94,10 +94,11 @@ if cuda_available: ...@@ -94,10 +94,11 @@ if cuda_available:
gpu_init() gpu_init()
cuda_available = True cuda_available = True
cuda_initialization_error_message = "" cuda_initialization_error_message = ""
# do garbage collection before releasing the gpu to avoid releasing invalid pointers later
atexit.register(gc.collect)
# actively closing our gpu session presents segfault-on-exit on some systems # actively closing our gpu session presents segfault-on-exit on some systems
atexit.register(gpu_shutdown) atexit.register(gpu_shutdown)
# do garbage collection before releasing the gpu to avoid releasing invalid pointers later
# note that atexit-registered calls are called in LIFO order
atexit.register(gc.collect)
except EnvironmentError, e: except EnvironmentError, e:
cuda_available = False cuda_available = False
cuda_initialization_error_message = e.message cuda_initialization_error_message = e.message
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论