Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smallbin double linked list corruption for specific data #345

Closed
WinfredHuang opened this issue Jan 11, 2024 · 2 comments
Closed

Smallbin double linked list corruption for specific data #345

WinfredHuang opened this issue Jan 11, 2024 · 2 comments

Comments

@WinfredHuang
Copy link

WinfredHuang commented Jan 11, 2024

debug-8-7298.csv

On my machine (Rocky Linux 8.9; FFTW 3.3.5), when loading this data and execute FFTW, it reports a smallbin double linked list corruption.
I'm also using xtensor-fftw, so I also opened an issue there (link)

The example is as following (C++ code):

fstream fs_debug;
fs_debug.open("/home/winfred/l1b-pro/data/output/debug-8-7298.csv", ios::in);
xtensor<float, 2> delta_sigx_han_t = xt::load_csv<float>(fs_debug);
xtensor<float, 1> delta_sigx_han_tt = xt::zeros<float>({delta_sigx_han_t.size()});
for (int i = 0; i < delta_sigx_han_t.size(); i++)
{
    delta_sigx_han_tt(i) = delta_sigx_han_t(0, i);
}
auto pdsig_t = xt::fftw::rfft(delta_sigx_han_tt);
@stevengj
Copy link
Contributor

stevengj commented Jan 11, 2024

Not clear to me that this is a corruption in FFTW itself rather than a bug in xtensor.

@WinfredHuang
Copy link
Author

WinfredHuang commented Jan 12, 2024

@stevengj Wait! I changed my code as the following and the error still exists.

fstream fs_debug;
fs_debug.open("/home/winfred/l1b-pro/data/output/debug-8-7298.csv", ios::in);

vector<float> v_result;
string cell;
while (std::getline(fs_debug, cell, ','))
{
    v_result.push_back(stof(cell));
}
// This checks for a trailing comma with no data after it.
if (!fs_debug && cell.empty())
{
}

cout << v_result.size() << endl;    // 4096

vector<fftw_complex> result(v_result.size());
fftw_complex *in = reinterpret_cast<fftw_complex *>(fftw_malloc(sizeof(fftw_complex) * v_result.size()));

for (int i = 0; i < v_result.size(); ++i)
{
    in[i][0] = v_result[i];
    in[i][1] = 0.0;
}

fftw_complex *out = reinterpret_cast<fftw_complex *>(fftw_malloc(sizeof(fftw_complex) * v_result.size()));
fftw_plan plan = fftw_plan_dft_1d(v_result.size(), in, out, FFTW_FORWARD, FFTW_ESTIMATE);

fftw_execute(plan);

fftw_destroy_plan(plan);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants