arrayfire / arrayfire-python

Python bindings for ArrayFire: A general purpose GPU library.

Home Page:https://arrayfire.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Arrayfire script requires Python Console to be restarted for multiple runs

opened this issue · comments

A Python script which calls a function to be solved on the GPU using arrayfire (with nested arrayfire sub-functions) will run fine once, giving the expected answer. However, when it is run a second time in the same Python console it returns NaN values, but does not throw an error at any point. I have tried removing allocated memory using arrayfire.device.device_gc(), and freeing device memory using free_device, free_pinned, device.init, etc., but have not had any luck. Restarting the Python console fixes the problem, as does running the following command (which cleares all GPU memory and requires the console to be restarted):

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

What are you even trying to do here ?? That code will cause segmentation faults.

If you can show some code that's leaking memory or producing NaN, it'll be helpful. The code you showed does not even work.