Skip to content

Commit

Permalink
Fix parallelization of 3D Shift routines.
Browse files Browse the repository at this point in the history
  • Loading branch information
johncbowman committed Jul 24, 2016
1 parent 4a8b738 commit fc2efdd
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions fftw++.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,16 +215,13 @@ class fftw : public ThreadBase {
unsigned int nyzp=ny*nzp;
if(nx % 2 == 0 && ny % 2 == 0) {
unsigned int pinc=2*nzp;
Complex *pstop=data;
Complex *p=data;
#ifndef FFTWPP_SINGLE_THREAD
#pragma omp parallel for num_threads(threads)
#endif
for(unsigned i=0; i < nx; i++) {
if(i % 2) p -= nzp;
else p += nzp;
pstop += nyzp;
for(; p < pstop; p += pinc) {
for(unsigned int i=0; i < nx; i++) {
Complex *pstart=data+i*nyzp;
Complex *pstop=pstart+nyzp;
for(Complex *p=pstart+(1-(i % 2))*nzp; p < pstop; p += pinc) {
for(unsigned int k=0; k < nzp; k++) p[k]=-p[k];
}
}
Expand All @@ -240,16 +237,13 @@ class fftw : public ThreadBase {
unsigned int nyz=ny*nz;
if(nx % 2 == 0 && ny % 2 == 0) {
unsigned int pinc=2*nz;
double *pstop=data;
double *p=data;
#ifndef FFTWPP_SINGLE_THREAD
#pragma omp parallel for num_threads(threads)
#endif
for(unsigned i=0; i < nx; i++) {
if(i % 2) p -= nz;
else p += nz;
pstop += nyz;
for(; p < pstop; p += pinc) {
for(unsigned int i=0; i < nx; i++) {
double *pstart=data+i*nyz;
double *pstop=pstart+nyz;
for(double *p=pstart+(1-(i % 2))*nz; p < pstop; p += pinc) {
for(unsigned int k=0; k < nz; k++) p[k]=-p[k];
}
}
Expand Down

0 comments on commit fc2efdd

Please sign in to comment.