Closed juanfariaso closed 2 years ago
Hi,
I would have to see more your code but it looks like the types of your arguments do not agree with the interface.
Vladimir
Dne so 6. 6. 2020 18:51 uživatel juanfariaso notifications@github.com napsal:
Dear LadaF, I am trying to use the library, however I fail to compile a very simple program following the usage_Fortran.txt directions.
I am compiling using this command:
gcc -IPoisFFT/bin/gcc -LPoisFFT/lib/gcc -lpoisfft testPoisFFT.f90
But I get the error:
testPoisFFT.f90:33:9:
Solver = PoisFFT_Solver3D([nx,ny,nz],[1.0,1.0,1.0],[(PoisFFT_Periodic, i = 1,6)])
1
Error: No initializer for component ‘nxyz’ given in the structure constructor at (1)!
testPoisFFT.f90:35:32:
call Execute(Solver, Phi, srhod)
1
Error: There is no specific subroutine for the generic ‘execute’ at (1)
I have compiled the dynamic and static libraries, and the tests runs fine.
I bet I am missing something very basic, I am very new on linking libraries.
Thanks!
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/LadaF/PoisFFT/issues/11, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFSIENYHPMEYTUEELGTIX3RVJXZ3ANCNFSM4NWFIQPA .
Hi, thanks for the quick reply. i am bassically trying to make this to work:
PROGRAM testfftpoisson
use PoisFFT, PoisFFT_Solver3D => PoisFFT_Solver3D_DP
implicit none
character*20 :: filename
real*8 :: rho(128,128,128),PHI(128,128,128)
integer :: nx,ny,nz,d(3),i
type(PoisFFT_Solver3D) :: Solver
nx = 128
ny = 128
nz = 128
open(200,file=trim(filename),status="old",form="unformatted")
read(200) d
read(200) rho
close(200)
Solver = PoisFFT_Solver3D(d,[1.0D0,1.0D0,1.0D0],[(PoisFFT_Periodic, i = 1,6)])
call Execute(Solver, Phi, rho)
call Finalize(Solver)
END PROGRAM
what I am doing wrong?
EDIT: I updated above for the type declarations
Ok, I solved the errors. It was all about type mismatch as you suggested. However, I am still getting this error, probably due to linking:
$ gfortran -IPoisFFT/bin/gcc -LPoisFFT/lib/gcc -lpoisfft sample.f90
/tmp/cc1yR3v1.o: In function `MAIN__':
sample.f90:(.text+0x46e): undefined reference to `__poisfft_dp_MOD_poisfft_solver3d__new'
sample.f90:(.text+0xce3): undefined reference to `__poisfft_dp_MOD_poisfft_solver3d__execute'
sample.f90:(.text+0xcef): undefined reference to `__poisfft_dp_MOD_poisfft_solver3d__finalize'
collect2: error: ld returned 1 exit status
I would appreciate if you can point me to the right way of linking this.. thanks!
Hi, I do not see implicit none in your code. I think you forgot to declare Phi.
Vladimir
On Sun, 7 Jun 2020 at 18:29, juanfariaso notifications@github.com wrote:
Ok, I solved the first error. You were right about the mismatch in types. But I still get the following error:
call Execute(Solver, Phi, rho)
1
Error: There is no specific subroutine for the generic ‘execute’ at (1)
Looks like the Execute routine is not being recognized, do you have any idea why is this? Am I doing the linking wrong?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/LadaF/PoisFFT/issues/11#issuecomment-640244189, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFSIEIBPVDJGCFTEDKEI3TRVO557ANCNFSM4NWFIQPA .
Hi Vladimir, Right, I solved that issue with the type declarations, but I am still getting the above error when all variable declarations are correct.
$ gfortran -IPoisFFT/bin/gcc -LPoisFFT/lib/gcc -lpoisfft sample.f90
/tmp/cc1yR3v1.o: In function `MAIN__':
sample.f90:(.text+0x46e): undefined reference to `__poisfft_dp_MOD_poisfft_solver3d__new'
sample.f90:(.text+0xce3): undefined reference to `__poisfft_dp_MOD_poisfft_solver3d__execute'
sample.f90:(.text+0xcef): undefined reference to `__poisfft_dp_MOD_poisfft_solver3d__finalize'
collect2: error: ld returned 1 exit status
It seems that is not linking properly, but I cant find the way to compile it correctly..
This is indeed a linking issue. I normally do not link to a library but incorporate the relevant files into my main program build process. But linking should work as well.
The following works for me (my PoisFFT is installed in $HOME/f/PoisFFT):
First
scons
in the PoisFFT/src directory
and then in the test program directory somewhere else:
gfortran -fopenmp -I$HOME/f/PoisFFT/bin/gcc -L$HOME/f/PoisFFT/lib/gcc
-lpoisfft -lfftw3 -lfftw3f -lfftw3_omp -lfftw3f_omp testpoisson.f90
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/f/PoisFFT/lib/gcc ./a.out
It is really hard to diagnose this without detailed knowledge of your system.
However, be aware that the order in which you supply the arguments to gfortran does matter and normally the libraries should come last, not first as you have it. In my case it compiles anyway but it could be the issue for you. See https://stackoverflow.com/questions/45135/why-does-the-order-in-which-libraries-are-linked-sometimes-cause-errors-in-gcc
So definitely try to move sample.f90 at the start of the command.
Another issue would be, if you required the static library. It is not built by default. And you shouldn't normally need it. You can try to build it anyway.
scons static_lib
If you try to use the static library, you definitely need to observe the correct order.
Vladimir
On Mon, 8 Jun 2020 at 11:40, juanfariaso notifications@github.com wrote:
Hi Vladimir, Right, I solved that issue with the type declarations, but I am still getting the above error when all variable declarations are correct.
$ gfortran -IPoisFFT/bin/gcc -LPoisFFT/lib/gcc -lpoisfft sample.f90 /tmp/cc1yR3v1.o: In function
MAIN__': sample.f90:(.text+0x46e): undefined reference to
poisfft_dp_MOD_poisfft_solver3dnew' sample.f90:(.text+0xce3): undefined reference to__poisfft_dp_MOD_poisfft_solver3d__execute' sample.f90:(.text+0xcef): undefined reference to
poisfft_dp_MOD_poisfft_solver3dfinalize' collect2: error: ld returned 1 exit statusIt seems that is not linking properly, but I cant find the way to compile it correctly..
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/LadaF/PoisFFT/issues/11#issuecomment-640492973, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFSIEIYIBY3RIPYPGT6Y7LRVSWY7ANCNFSM4NWFIQPA .
Great!, it compiles now, thank you very much. The order in the libraries was the issue.
The command that worked for me was:
gfortran -IPoisFFT/bin/gcc -LPoisFFT/lib/gcc sample.f90 -lpoisfft -lfftw3 -lfftw3f -lfftw3_omp -lfftw3f_omp
I can write the tool I need now.. thanks for the library it will be very useful!
Juan
Dear LadaF, I am trying to use the library, however I fail to compile a very simple program following the usage_Fortran.txt directions.
I am compiling using this command:
gcc -IPoisFFT/bin/gcc -LPoisFFT/lib/gcc -lpoisfft testPoisFFT.f90
But I get the error:
I have compiled the dynamic and static libraries, and the tests runs fine.
I bet I am missing something very basic, I am very new on linking libraries.
Thanks!