hammerlab / flowdec

TensorFlow Deconvolution for Microscopy Data
Apache License 2.0
89 stars 26 forks source link

How to release the memory after flowdec processing #40

Closed joaomamede closed 3 years ago

joaomamede commented 3 years ago

The only thing I could find was this but it worked:

from numba import cuda
cuda.select_device(0)
cuda.close()
#the memory was released here!
cuda.select_device(0)
eric-czech commented 3 years ago

Thanks for sharing! Several people have asked about that in the past and I don't think anyone has thought about (or at least I haven't) trying to use a different library to free GPU memory held by the same Python process. I'm surprised that works but good to know there is at least one way to force it.

joaomamede commented 3 years ago

I think tensorflow 1 had a function to reset it, but not TF2.x.

Happy to help, and thank you for flowdec, I have an accepted article and another submitted with flowdec deconvolved data, it really helped having this!