Dear arrayfire programmers,
I'm trying to use arrayfire for an signal processing application (written in C) with large amounts of data. The occurring problem is that the arrayfire arrays, which are used inside an (indefinitely long running) while loop, use up more and more of the GPU memory until it runs out of space. Each iteration of the loop adds five new memory pointers of about 1 MB size.
This example shows my problem (of course it's watered down to the essential problem, the real program features some external structures, however the problem also occurs with this example):
`int cycle = 0;
int MAX = 100000;
int signal_length = 32;
int window_length = 8;
float signal[signal_length];
float window[window_length];
for (int i = 0; i<signal_length; i++) {
signal[i] = cos(2M_PI/(fft_length(i+0.5)*2));
}
for (int i = 0; i<window_length; i++) {
window[i] = sin(M_PIi1./(fft_length*-1));
}
af_array d_signal, d_window;
int n_dims = 4;
dim_t signal_dims[] = {fft_length, signal_length/fft_length,1,1};
dim_t window_dims[] = {fft_length,1,1,1};
af_constant(&d_signal,0.,n_dims,signal_dims,f32);
af_constant(&d_window,0.,n_dims,window_dims,f32);
while(cycle < MAX) {
af_write_array(d_signal,(void*)signal,sizeof(signal),f32);
af_write_array(d_window,(void*)window,sizeof(window),f32);
af_mul(&d_signal, d_signal, d_window, 1);
af_fft(&d_signal,d_signal,1,fft_length);
af_print_array(d_signal);
const char* msf;
af_print_mem_info(&msg,0);
printf("%s\n",msg);
af_device_gc();
getchar();
}`
So the result of this is an increasing number of used up space and of stored arrays. Is there any chance to get rid of arrays, which are not needed anymore? Since the memory manager saves most of the arrays as AF LOCK 'Yes', I am not able to get rid of them.
Any help would be appreciated.
Cheers!
Dear arrayfire programmers,
I'm trying to use arrayfire for an signal processing application (written in C) with large amounts of data. The occurring problem is that the arrayfire arrays, which are used inside an (indefinitely long running) while loop, use up more and more of the GPU memory until it runs out of space. Each iteration of the loop adds five new memory pointers of about 1 MB size.
This example shows my problem (of course it's watered down to the essential problem, the real program features some external structures, however the problem also occurs with this example):
`int cycle = 0;
int MAX = 100000;
int signal_length = 32;
int window_length = 8;
float signal[signal_length];
float window[window_length];
for (int i = 0; i<signal_length; i++) {
signal[i] = cos(2M_PI/(fft_length(i+0.5)*2));
}
for (int i = 0; i<window_length; i++) {
window[i] = sin(M_PIi1./(fft_length*-1));
}
af_array d_signal, d_window;
int n_dims = 4;
dim_t signal_dims[] = {fft_length, signal_length/fft_length,1,1};
dim_t window_dims[] = {fft_length,1,1,1};
af_constant(&d_signal,0.,n_dims,signal_dims,f32);
af_constant(&d_window,0.,n_dims,window_dims,f32);
while(cycle < MAX) {
af_write_array(d_signal,(void*)signal,sizeof(signal),f32);
af_write_array(d_window,(void*)window,sizeof(window),f32);
af_mul(&d_signal, d_signal, d_window, 1);
af_fft(&d_signal,d_signal,1,fft_length);
af_print_array(d_signal);
const char* msf;
af_print_mem_info(&msg,0);
printf("%s\n",msg);
af_device_gc();
getchar();
}`
So the result of this is an increasing number of used up space and of stored arrays. Is there any chance to get rid of arrays, which are not needed anymore? Since the memory manager saves most of the arrays as AF LOCK 'Yes', I am not able to get rid of them.
Any help would be appreciated.
Cheers!