Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29255 Discussions

error #7950: Procedure name in MODULE PROCEDURE statement must be the name of accessible module procedure. [FUNC]

milenko1976
Beginner
3,152 Views
I am having problem with this,I have adapted some Press subroutines.I am giving part of the code:
module minmod
interface func
module procedure func
end interface func
interface dfunc
module procedure dfunc
end interface dfunc
contains
subroutine dfpmin(p,gtol,iter,fret,func,dfunc)
use nrtype
use nr, only: lnsrch
use nre
use otp
use um
use vl
use funkcija
use izvod
I get this:minmod.f90(79): error #7950: Procedure name in MODULE PROCEDURE statement must be the name of accessible module procedure. [FUNC]
function func(x)
---------^
minmod.f90(5): error #7950: Procedure name in MODULE PROCEDURE statement must be the name of accessible module procedure. [DFUNC]
interface dfunc
----------^
minmod.f90(5): error #7407: Unresolved MODULE PROCEDURE specification name. [DFUNC]
interface dfunc
----------^
module funkcija
use cons
contains

function func(p)
implicit none
real,dimension(:),intent(in) :: p
real(kind(1d0)) func
real(kind(1d0)) row_sum, total
real,dimension(s) :: dist_ik

vv = reshape(p, (/ c,s /))

total = 0d0
do k=1,n_data
row_sum = 0d0
do i = 1, c
dist_ik = vv(i,:)-x(k,:)
row_sum = 1.0/dot_product(dist_ik, dist_ik) + row_sum
end do
total = 1d0/row_sum + total
end do
func= total
write(*,*)vv
end function func

end module funkcija
0 Kudos
11 Replies
Steven_L_Intel1
Employee
3,152 Views
Please try to come up with a small but complete source that reproduces the problem. There's not enough here so far to be able to help.
0 Kudos
milenko1976
Beginner
3,152 Views
I have mangaed to solve this.
0 Kudos
milenko1976
Beginner
3,152 Views
But again I am having same problem with this module.
milenko@milenkons:~/primeri/a1$ ifort -g -traceback -c minmod.f90
minmod.f90(17): error #6645: The name of the module procedure conflicts with a name in the encompassing scoping unit. [DFPMIN]
subroutine dfpmin(p,gtol,iter,fret,func,dfunc)
-----------^
minmod.f90(12): error #7950: Procedure name in MODULE PROCEDURE statement must be the name of accessible module procedure. [DFPMIN]
module procedure dfpmin
-----------------^
minmod.f90(33): error #6404: This name does not have a type, and must have an explicit type. [DFUNC]
g=dfunc(p)
--^
compilation aborted for minmod.f90 (code 1)
0 Kudos
milenko1976
Beginner
3,152 Views
These are files also necessary.
0 Kudos
Steven_L_Intel1
Employee
3,152 Views
Source minmod.f90 uses module lintr which uses nr. nr defines an interface for DFPMIN so it is not allowed for you to also define DFPMIN in minmod.f90. You can get around this by changing the USE line in minmod.f90 to be:

use lintr, dummy=>dfpmin

The complaint about DFUNC not having a type is correct - you have not declared DFUNC inside dfpmin.
0 Kudos
milenko1976
Beginner
3,152 Views
I see now,thanks Steve.
0 Kudos
milenko1976
Beginner
3,152 Views
Regarding dfunc I still have problems.
milenko@milenkons:~/primeri/a2$ ifort -g -traceback -c minmod.f90
minmod.f90(24): error #6406: Conflicting attributes or multiple declaration of name. [DFUNC]
real(sp),dimension(size(p)),external :: dfunc

I have get rid of nr,I am attaching last version of code.
0 Kudos
Steven_L_Intel1
Employee
3,152 Views
Sorry, we're having a problem with attachments right now. If the code is short, you can post it inline (use the "pencil" code insertion tool.) But you should be able to look for declarations of DFUNC and see if it is declared twice.
0 Kudos
milenko1976
Beginner
3,152 Views
This is after grep:
/home/milenko/primeri/a4/izvod.f90:5:interface dfunc
/home/milenko/primeri/a4/izvod.f90:6:module procedure dfunc
/home/milenko/primeri/a4/izvod.f90:7:end interface dfunc
/home/milenko/primeri/a4/izvod.f90:9:function dfunc(p)
/home/milenko/primeri/a4/izvod.f90:12:real(sp),dimension(size(p)) :: dfunc
/home/milenko/primeri/a4/izvod.f90:37:dfunc=dv
Binary file /home/milenko/primeri/a4/izvod.o matches
/home/milenko/primeri/a4/minmod.f90:17:subroutine dfpmin(p,gtol,iter,fret,func,dfunc)
/home/milenko/primeri/a4/minmod.f90:24:real(sp),dimension(size(p)),external :: dfunc
/home/milenko/primeri/a4/minmod.f90:34:g=dfunc(p)
/home/milenko/primeri/a4/minmod.f90:46:g=dfunc(p)

module izvod
use cons
use nrtype
use ds
interface dfunc
module procedure dfunc
end interface dfunc
contains
function dfunc(p)
implicit none
real(sp),dimension(:),intent(in) :: p
real(sp),dimension(size(p)) :: dfunc

vv = reshape(p, (/ c,s /))

do i=1,c
do k=1,n_data
work_s=vv(i,:)-x(k,:)
work_cn(i,k)=1.0/dot_product(work_s,work_s)
end do
end do
write(*,*)work_cn
do k=1,n_data
work_n(k)=double_sum(work_cn(:,k))
end do
write(*,*)work_n

do i=1,c
work1_n=(work_cn(i,:)/work_n)**2
do k=1,s
dvv(i,k)=(double_sum(work1_n*vv(i,k))-double_sum(work1_n*x(i,k)))*2.0
end do
end do

dv=reshape(dvv,(/c*s/))
write(*,*)dv
dfunc=dv

end function

end module izvod
module minmod
use nrtype
use nre
use otp
use um
use lintr
use vl
use funkcija
use izvod

interface djs
module procedure dfpmin
end interface djs

contains

subroutine dfpmin(p,gtol,iter,fret,func,dfunc)
implicit none
integer(i4b), intent(out) :: iter
real(sp), intent(in) :: gtol
real(sp), intent(out) :: fret
real(sp), dimension(:), intent(inout) :: p
real(kind(1d0)),external :: func
real(sp),dimension(size(p)),external :: dfunc
integer(i4b), parameter :: itmax=200
real(sp), parameter :: stpmx=100.0_sp,eps=epsilon(p),tolx=4.0_sp*eps
integer(i4b) :: its
logical :: check
real(sp) :: den,fac,fad,fae,fp,stpmax,sumdg,sumxi
real(sp), dimension(size(p)) :: dg,g,hdg,pnew,xi
real(sp), dimension(size(p),size(p)) :: hessin

fp=func(p)
g=dfunc(p)
call unit_matrix(hessin)
xi=-g
stpmax=stpmx*max(vabs(p),real(size(p),sp))
do its=1,itmax
iter=its
call ckap(p,fp,g,xi,pnew,fret,stpmax,check,func)
fp=fret
xi=pnew-p
p=pnew
if (maxval(abs(xi)/max(abs(p),1.0_sp)) < tolx) return
dg=g
g=dfunc(p)
den=max(fret,1.0_sp)
if (maxval(abs(g)*max(abs(p),1.0_sp)/den) < gtol) return
dg=g-dg
hdg=matmul(hessin,dg)
fac=dot_product(dg,xi)
fae=dot_product(dg,hdg)
sumdg=dot_product(dg,dg)
sumxi=dot_product(xi,xi)
if (fac > sqrt(eps*sumdg*sumxi)) then
fac=1.0_sp/fac
fad=1.0_sp/fae
dg=fac*xi-fad*hdg
hessin=hessin+fac*outerprod(xi,xi)-&
fad*outerprod(hdg,hdg)+fae*outerprod(dg,dg)
end if
xi=-matmul(hessin,g)
end do
call nrerror('dfpmin: too many iterations')
end subroutine dfpmin

end module

I do not see where it could be defined onece again??
0 Kudos
Steven_L_Intel1
Employee
3,152 Views
In module izvod you declare DFUNC as a generic interface (and module procedure). In module minmod, which uses izvod, you declare DFUNC as an external array (I am not sure that's what you intended - the syntax you used is not appropriate for declaring a function.)

I would suggest deleting the declaration in minmod so you'll pick up the generic from izvod - this seems to be what you want.
0 Kudos
milenko1976
Beginner
3,152 Views
Thanks Steve.
This can be compiled.
0 Kudos
Reply