mardi 30 juin 2015

FFTW exports wisdom file but cannot load it

I am trying to achieve better performance for FFTW operations. For that reason I decided to use wisdom files for plan creation, but the problem is that it can't load the plans from wisdom files (exporting wisdoms works well). I tried to export the wisdom to a file and on the next program run to load it backthe wisdom file, but the function always returns 0 for any filename (even for non existing ones). I also tried it woth loading from a string but it doesn't work either.

There seem to be similar questions asked here, but none of them are answered or the problem was somewhere else. So is this a bug from the library, or am I doing something wrong?

As shown belove, is the code for loading the wisdom from a string using a file for content import (to show that the content is available in the file):

FILE * pfile;
string str="";
pfile=fopen("Gotham.txt","r");

if(pfile==0)
    cout<<"Could not open file"<<endl;
else
    cout<<"interesting"<<endl;

vector <char> buffer=0;
long length;

if(pfile)
{
    fseek(pfile,0,SEEK_END);
    length=ftell(pfile);
    fseek(pfile,0,SEEK_SET);
    buffer.assign(length,'\0');
    if(buffer)
        fread(buffer,1,length,pfile);
    fclose(pfile);
}
string stra(buffer);
cout<<stra<<endl;   //content could be read
free(buffer);

int ret=fftwf_import_wisdom_from_string(reinterpret_cast<const char*>(&buffer[0]));

Aucun commentaire:

Enregistrer un commentaire