Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6956 Discussions

ERROR LINK2019 when using 2-D poisson solver

zlh007
Beginner
295 Views

In the Intel visual fortran 10with Miscrosoft visual studio 2005, Ican't compile successfully the code example given by manual of MKL poisson library witherrors:
Error1 error LNK2019: unresolved external symbol _D_INIT_HELMHOLTZ_2D referenced in function _MAIN__PoissonSolver.obj
Error2 error LNK2019: unresolved external symbol _D_COMMIT_HELMHOLTZ_2D referenced in function _MAIN__PoissonSolver.obj
Error3 error LNK2019: unresolved external symbol _D_HELMHOLTZ_2D referenced in function _MAIN__PoissonSolver.obj
Error4 error LNK2019: unresolved external symbol _FREE_HELMHOLTZ_2D referenced in function _MAIN__PoissonSolver.obj
Error5 fatal error LNK1120: 4 unresolved externalsDebug\PoissonSolver.exe

The code is :
include 'mkl_dfti.f90'
include 'mkl_poisson.f90'
program Poisson_2D_double_precision
! Include modules defined by mkl_poisson.f90 and mkl_dfti.f90 header files
use mkl_dfti
use mkl_poisson
implicit none
integer nx,ny
! Note that the size of the transform nx must be even !!!
parameter(nx=6, ny=6)
double precision pi
parameter(pi=3.14159265358979324D0)
integer ix, iy, i, stat
integer ipar(128)
double precision ax, bx, ay, by, lx, ly, hx, hy, xi, yi, cx, cy
double precision dpar(5*nx/2+7)
! Note that proper packing of data in right-hand side array f is
! automatically provided by the following declaration of the arrays
double precision f(nx+1,ny+1), u(nx+1,ny+1)
double precision bd_ax(ny+1), bd_bx(ny+1), bd_ay(nx+1), bd_by(nx+1)
double precision q
type(DFTI_DESCRIPTOR), pointer :: xhandle
character(4) BCtype
! Printing the header for the example
print *, ''
print *, ' Example of use of MKL Poisson Library'
print *, ' **********************************************'
!*******************************************************************************
q=0.0D0
! Computing the mesh size hx in x-direction
lx=bx-ax
hx=lx/nx
! Computing the mesh size hy in y-direction
ly=by-ay
hy=ly/ny
! Filling in the values of the TRUE solution u(x,y)=sin(2*pi*x)*sin(2*pi*y)+1
! in the mesh points into the array u
! Filling in the right-hand side f(x,y)=(8*pi*pi+q)*sin(2*pi*x)*sin(2*pi*y)+q
! in the mesh points into the array f.
! We choose the right-hand side to correspond to the TRUE solution
! of Poisson equation.
! Here we are using the mesh sizes hx and hy computed before to compute
! the coordinates (xi,yi) of the mesh points
do iy=1,ny+1
do ix=1,nx+1
xi=hx*(ix-1)/lx
yi=hy*(iy-1)/ly
cx=dsin(2*pi*xi)
cy=dsin(2*pi*yi)
u(ix,iy)=1.0D0*cx*cy
f(ix,iy)=(8.0D0*pi**2)*u(ix,iy)
u(ix,iy)=u(ix,iy)+1.0D0
enddo
enddo
! Setting the type of the boundary conditions on each side of the rectangular
! domain:
! On the boundary laying on the line x=0(=ax) Dirichlet boundary condition
! will be used
! On the boundary laying on the line x=1(=bx) Dirichlet boundary condition
! will be used
! On the boundary laying on the line y=0(=ay) Neumann boundary condition
! will be used
! On the boundary laying on the line y=1(=by) Neumann boundary condition
! will be used
BCtype = 'DDNN'
! Setting the values of the boundary function G(x,y) that is equal to
! the TRUE solution
! in the mesh points laying on Dirichlet boundaries
do iy = 1,ny+1
bd_ax(iy) = 1.0D0
bd_bx(iy) = 1.0D0
enddo
! Setting the values of the boundary function g(x,y) that is equal
! to the normal derivative
! of the TRUE solution in the mesh points laying on Neumann boundaries
do ix = 1,nx+1
bd_ay(ix) = -2.0*pi*dsin(2*pi*(ix-1)/nx)
bd_by(ix) = 2.0*pi*dsin(2*pi*(ix-1)/nx)
enddo
! Initializing ipar array to make it free from garbage
do i=1,128
ipar(i)=0
enddo
! Initializing simple data structures of Poisson Library for
! 2D Poisson Solver
call D_INIT_HELMHOLTZ_2D(ax, bx, ay, by, nx, ny, BCtype, q, ipar, dpar, stat)
if (stat.ne.0) goto 999
! Initializing complex data structures of Poisson Library for
! 2D Poisson Solver
! NOTE: Right-hand side f may be altered after the Commit step.
! If you want to keep it,
! you should save it in another memory location!
call d_commit_Helmholtz_2D(f, bd_ax, bd_bx, bd_ay, bd_by, xhandle, ipar, dpar, stat)
if (stat.ne.0) goto 999
! Computing the approximate solution of 2D Poisson problem
! NOTE: Boundary data stored in the arrays bd_ax, bd_bx, bd_ay, bd_by
! should not be changed
! between the Commit step and the subsequent call to the Solver routine!
! Otherwise the results may be wrong.
call d_Helmholtz_2D(f, bd_ax, bd_bx, bd_ay, bd_by, xhandle, ipar, dpar, stat)
if (stat.ne.0) goto 999
! Cleaning the memory used by xhandle
call free_Helmholtz_2D(xhandle, ipar, stat)
if (stat.ne.0) goto 999
! Now we can use xhandle to solve another 2D Poisson problem
! Printing the results
write(*,10) nx
write(*,11) ny
print *, ''
! Watching the error along the line x=hx
ix=2
do iy=1,ny+1
write(*,12) (ix-1)*hx, (iy-1)*hy, f(ix,iy)-u(ix,iy)
enddo
print *, ''
! Success message to print if everything is OK
print *, ' Double precision 2D Poisson example has successfully PASSED'
print *, ' through all steps of computation!'
! Jumping over failure message
go to 1
! Failure message to print if something went wrong
999 print *, 'Double precision 2D Poisson example FAILED to compute the solution...'
1 continue
10 format(1x,'The number of mesh intervals in x-direction is nx=',I1)
11 format(1x,'The number of mesh intervals in y-direction is ny=',I1)
12 format(1x,'In the mesh point (',F5.3,',',F5.3,') the error between the computed and the true solution is equal to ', E10.3)
! End of the example code
end
I have configured the compiler as:
1. adding tools->Options->Intel Fortran->LibrariesC:\Program Files\Intel\MKL\10.0.012\ia32\lib
Include:C:\Program Files\Intel\MKL\10.0.012\include
2.InProject > Properties > Linker > Input-> the Additional Dependencies line, insert:
mkl_intel_c.lib mkl_intel_thread.lib mkl_solver.lib mkl_core.lib libguide.lib
3. The MKl lib directory is also addedas the project additional library directories.

Note: I have successfully using many other MKL libraries, such asmkl_dfti and mkl_trig_transforms, butmkl_poisson didn't work.How do I resolve this problem?

0 Kudos
3 Replies
Artem_V_Intel
Employee
295 Views
Hello zlh007,

The newest versions of Intel Visual Fortran Compiler 11.1.048 and MKL 10.2 Update 2 is availible now. Please try to use them. You can download it from the Registration Center.

Also may be this article will be useful for you.

Thanks,
Art

0 Kudos
zlh007
Beginner
295 Views
Hello zlh007,

The newest versions of Intel Visual Fortran Compiler 11.1.048 and MKL 10.2 Update 2 is availible now. Please try to use them. You can download it from the Registration Center.

Also may be this article will be useful for you.

Thanks,
Art


Thanks for your reply! MyIVF compliler is 10.1.011 and MKL is 10.0.011.Can't the poissonlibrary work OK in this environment? Is there any other method to resolve my problem besides installing the newcompliler and MKL?
0 Kudos
zlh007
Beginner
295 Views
Quoting - zlh007

Thanks for your reply! MyIVF compliler is 10.1.011 and MKL is 10.0.011.Can't the poissonlibrary work OK in this environment? Is there any other method to resolve my problem besides installing the newcompliler and MKL?

I have update my IVF and MKL to new version, the 2-D helmholtz solver (using the example code given by MKL) can be compiled OK! Thanks!
0 Kudos
Reply