arrayfire python free device memory

402 views Asked by At

I am tryin to use arrayfire with python.

I have an GTX550Ti and use opencl backend since I don't seem to get cuda working (don't know if compute version 2.1 of the 550Ti is too low for arrayfire). I try to free memory / arrays that are allocated using statement such as

import numpy as np
import arrayfire as af

arr_h = np.arange(2**15,dtype=np.complex64)
arr_d = af.np_to_af_array(arr_h)

af.free_device(arr_d)

the free_device complains and says it need a pointer. If I use either

af.free_device(arr_d.raw_ptr())

or

af.free_device(arr_d.device_ptr())

I get an error:

OSError: exception: access violation reading 0xFFFFFFFFFFFFFFFFFFF

So.. what is the correct way to free memory?

1

There are 1 answers

1
DarkZeros On BEST ANSWER
af.free_device(devicepointer)

Frees a device object. But you are trying to free an array inside the device. I would try any of these:

arr_d = af.Array()
arr_d = None
del arr_d