You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Firstly, I installed mpi. And I follow the make post-install instructions completely.
Secondly, I write one tested code for testing the interpolation functionality of scifor.
Module ParameterPack
Implicit None
Real(8), Parameter :: Pi=3.1415926535897932384626d0
Integer, Parameter :: Nt = 1025
Real(8), Save :: Array(2, 1:Nt)
End Module ParameterPack
! ------------------------------------------------------------------------------
! -----------------------------------------------------------------------------!
Module FunPack
Use ParameterPack
Use Scifor
Implicit None
! ------------------------------------------------------------------!
! (1) Function Fun(x) !
! ------------------------------------------------------------------!
Contains
! -----------------------------------------------------------------------------!
Function Fun(x)
Real(8) :: Fun
Real(8), Intent(in) :: x
Integer, Save :: Iswitch = 0
Real(8) :: yout
Real(8), Dimension(Nt) :: xin, yin
! ----------------------------------------------------------------------------!
xin = Array(1,:)
yin = Array(2,:)
Call cubic_spline(xin, yin, x, yout)
Fun = yout
Return
End Function Fun
! -----------------------------------------------------------------------------
End Module FunPack
! -----------------------------------------------------------------------------!
Program InterPolate
Use ParameterPack
Use Scifor
Use FunPack
Implicit None
Integer :: loop, i
Real(8) :: dx, x, y
Real(8), Dimension(1:Nt) :: line_gas
Real :: ttime
! -----------------------------------------------------------------------------
Open(11, file="line_gas.dat")
Do i = 1, Nt
Read(11,*) line_gas(i)
End Do
! -----------------------------------------------------------------------------
dx = 75.0d0/(Nt-1)
Do loop = 1, Nt
x = dx*(loop-1)
Array(1, loop) = x
Array(2, loop) = line_gas(loop)
End Do
! -----------------------------------------------------------------------------
Open(10, file="dt_sci_gas.dat")
Do loop = 0, 75000
x = 0.001d0*loop
y = Fun(x)
Write(10, *) x, y
EndDo
Close(10)
! -----------------------------------------------------------------------------
Call CPU_time(ttime)
Write(*,*) "-----------------------------------------------------------"
Write(*,*) "ttime=:", ttime
! ------------------------------------------------------------------
End Program InterPolate
After I input $ mpif90 $(pkg-config --cflags --libs scifor) test_cubic_spline.f95
It returned an error to me as follows.
/tmp/ccBaLEme.o: In function `__funpack_MOD_fun':
test_cubic_spline.f95:(.text+0xd8): undefined reference to `__sf_interpolate_MOD_d_cub_interp_s'
collect2: error: ld returned 1 exit status
However, it works when I compile this code by gfortran test_cubic_spline.f95 -I/home/wangy/opt/scifor/gnu/4.6.31/include -L/home/wangy/opt/scifor/gnu/4.6.31/lib -lscifor.
The text was updated successfully, but these errors were encountered:
WangYun1995
changed the title
Another issue with failed to compile with mpif90 $(pkg-config --cflags --libs scifor) test.f90
Another issue with failed to compile with mpif90 $(pkg-config --cflags --libs scifor) test.f95Dec 2, 2020
If the output of $(pkg-config --cflags --libs scifor) command is wrong then the linking is ineffective and returns undefined reference, i.e. the procedure can not be find in any provided library or object file.
The explicit string you supply is correct and make the compilation works (you can safely replace fortran with mpif90).
Follow the instructions on the other issue to fix pkg-config. Then everything should work fine.
Your code compiled as a piece of cake on my system.
Firstly, I installed mpi. And I follow the make post-install instructions completely.
Secondly, I write one tested code for testing the interpolation functionality of scifor.
After I input
$ mpif90 $(pkg-config --cflags --libs scifor) test_cubic_spline.f95
It returned an error to me as follows.
However, it works when I compile this code by
gfortran test_cubic_spline.f95 -I/home/wangy/opt/scifor/gnu/4.6.31/include -L/home/wangy/opt/scifor/gnu/4.6.31/lib -lscifor
.The text was updated successfully, but these errors were encountered: