Skip to content
Snippets Groups Projects
Commit b6d48fc7 authored by Chichi Lalescu's avatar Chichi Lalescu
Browse files

use fftw for inplace transposition

parent c772a1eb
No related branches found
No related tags found
No related merge requests found
......@@ -122,13 +122,12 @@ int RMHD_converter::convert(
fftwf_clip_zero_padding(this->f4r, this->r3);
// new array where mixed components will be placed
float *rtmp = fftwf_alloc_real( 2*this->f3r->local_size);
// mix components
this->f3r->interleave(this->r3, rtmp, 2);
this->f3r->interleave(this->r3, 2);
this->s->shuffle(rtmp, this->r3, ofile);
// new array where mixed components will be placed
float *rtmp = fftwf_alloc_real( 2*this->f3r->local_size);
this->s->shuffle(this->r3, rtmp, ofile);
fftwf_free(rtmp);
return EXIT_SUCCESS;
......
......@@ -239,13 +239,23 @@ int field_descriptor::transpose(
int field_descriptor::interleave(
float *input,
float *output,
int dim)
{
// TODO: implement inplace interleaver
for (int k = 0; k < this->local_size; k++)
for (int j = 0; j < dim; j++)
output[k*dim + j] = input[j*this->local_size + k];
fftwf_iodim howmany_dims[2];
howmany_dims[0].n = dim;
howmany_dims[0].is = this->local_size;
howmany_dims[0].os = 1;
howmany_dims[1].n = this->local_size;
howmany_dims[1].is = 1;
howmany_dims[1].os = dim;
const int howmany_rank = sizeof(howmany_dims)/sizeof(howmany_dims[0]);
fftwf_plan tmp = fftwf_plan_guru_r2r(
/*rank*/0, /*dims*/NULL,
howmany_rank, howmany_dims,
input, input, /*kind*/NULL, FFTW_ESTIMATE);
fftwf_execute(tmp);
fftwf_destroy_plan(tmp);
return EXIT_SUCCESS;
}
......
......@@ -57,7 +57,6 @@ class field_descriptor
int interleave(
float *input,
float *output,
int dim);
int interleave(
fftw_complex *input,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment