0

Is there a way of resetting the GPU through arrayfire with each run without restarting the Python console?

I have a python script which calls a number of functions to be executed on a GPU using arrayfire. The script gives the expected result when run once, but if run a second time without changing any parameters it returns NaN values. This stops once I either restart the Python console or, equivalently, run the following:

import arrayfire as af
af.device.free_device(af.device.device_mem_info()['alloc']['bytes'])

which restarts the console after clearing all allocated device memory.

I'm having a hard time seeing what could be going wrong here; the program runs well the first time, so I think that it is likely to be a command that I can't find in the docs that I am missing.

I have tried most of the functions in the docs which looks promising (device_gc, free_device, free_pinned, device.init, etc.) but have not had much luck. I have also attempted to use reload(arrayfire) too.

Could this be a bug? Any advice would be appreciated.

I'm using: nvidia quadro M4000, Python 2.7, windows 7, Spyder 3

  • I don't think that is the correct way to use [free_device or device_mem_info](http://arrayfire.org/arrayfire-python/arrayfire.device.html#module-arrayfire.device), please look at the hyperlinked page to see the return values of `device_mem_info` and arguments of `free_device` . If you think clearing the memory might help your case, `device_gc` is the function you are looking for. – pradeep Jan 31 '17 at 13:59
  • Thanks for the comment. I forgot to mention before, but I have been trying `device_gc` as well, and while I can see the memory usage reduce after I call it, the problem still persists... I've updated the question so that it is included. –  Jan 31 '17 at 14:24

0 Answers0