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

modfftw contiguous pointer error with gfortran 8.5.0 #78

Closed
fjansson opened this issue Sep 2, 2022 · 3 comments
Closed

modfftw contiguous pointer error with gfortran 8.5.0 #78

fjansson opened this issue Sep 2, 2022 · 3 comments

Comments

@fjansson
Copy link
Contributor

fjansson commented Sep 2, 2022

gfortran 8.5.0 reports an error Assignment to contiguous pointer from non-contiguous target in modfftw.f90,

p210_flat(1:itot*jmax*konx)=> fptr(1:itot*jmax*konx)

p210_flat is declared contiguous, fptr is not. I haven't seen any other compilers complaining about this.
It seems to me it would be safe to declare also fptr as contiguous, because it comes from

ptr = fftw_alloc_real(sz)
call c_f_pointer(ptr, fptr, (/sz/))

which should be a contiguous array. @jiskattema what do you think?
I tested making fptr contiguous, and at least it compiles then.

The compiler output:

/home/fjansson/dales/src/modfftw.f90:165:34:

     p210_flat(1:itot*jmax*konx)=> fptr(1:itot*jmax*konx)
                                  1
Error: Assignment to contiguous pointer from non-contiguous target at (1)
/home/fjansson/dales/src/modfftw.f90:167:34:

     p201_flat(1:itot*konx*iony)=> fptr(1:itot*konx*iony)
                                  1
Error: Assignment to contiguous pointer from non-contiguous target at (1)
/home/fjansson/dales/src/modfftw.f90:178:6:

       p210_flat,  &       ! array; location of transform k is: in + k * idist
      1
@jiskattema
Copy link
Contributor

I added ``contiguousin the hope the compiler could make stuff a bit faster. I apparently missedfptr```.

It seems to me it would be safe to declare also fptr as contiguous.

Sounds good to me too, If it compiles, and the output looks good, go ahead.

@fjansson
Copy link
Contributor Author

fjansson commented Sep 5, 2022

Thanks @jiskattema !

gfortran 8 apparently has a bug with handling contiguous, noted here: https://github.com/fabm-model/fabm/wiki/Building-and-installing#supported-compilers. Perhaps that's the reason other compilers don't complain. I will try adding contiguous also on fptr, since that fixes compilation on gfortran 8.

Otherwise a workaround is to not use FFTW with gfortran 8.

@fjansson
Copy link
Contributor Author

fjansson commented Jun 7, 2023

Fixed with 731c2ea released in v4.4.1.

@fjansson fjansson closed this as completed Jun 7, 2023
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