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

error 2 error #6633

ali_p_
Beginner
6,993 Views

Hello all 

im a physics student and i am working on a simulation project so my doctor gave me an old fortran script for the simulation which he had written few years ago the problem is when i try to debug it,it shows error #6633: the type of the actual argument differs from the type of the dummy argument.[0]

several times this is one of them  :

call moveto_w(0,0,wxy)
       dummy=setcolor(9)
       ekm=abs(phif(2,2))
       do j=1,ngx    
	ekm=amax1(ekm,phif(1,j),phif(2,j),phif(3,j))
       end do
       call moveto_w(500/ngx,phif(1,1)*100*.8/ekm,wxy) 
       do j=1,ngx 
	   dummy=lineto_w(j*500/ngx,phif(1,j)*100*.8/ekm)    
       end do
       call moveto_w(500/ngx,phif(2,1)*100*.8/ekm,wxy) 
       do  j=1,ngx 
	   dummy=lineto_w(j*500/ngx,phif(2,j)*100*.8/ekm)    
       end do

and the declarations of this subroutine goes like this:

subroutine fieldf (ith)
**************************************************************************      
       include 'fgraph.fd'
	common/param/ nsp,lx,ly,dx,dy,dt,nt
	common/cfield/ ngx,ngy ,iw,rho0,g1(34,34),ex(34,34),ey(34,34)
     $,bz(34,34)   
	common /xvp/ x(25602),y(25602),vx(25602),vy(25602)
	common/cntrl/it,time,ithlx,ithly,iex,iey,ixvx,iyvy,
     $  ivxvy,ifvx,ifvy          
	integer*2 dummy
       record /wxycoord/ wxy  
	integer ith,l,ng2,hdx,hdy,ik,jk 
	real lx,ly,pi,erun1,erun2,kdx2,sm(34),ksq(34),eset,phif(34,34)
     $,rhof(34,34),sc(34),rhok(34),lxlyi
	data ng2,pi/0,3.128/

ps:im not very familiar with fortran coding and im using vs2012 

0 Kudos
1 Solution
Arjen_Markus
Honored Contributor II
6,895 Views

>> now do i just create a file named "fgraph.fd" with this code in it and add it to the project's directory?

No, need for that. Like I said, the compiler can find it somewhere, possibly in its own installation directory.

This does make it possible to guess what is going on though. The structure "wxycoord" uses double precision reals, so my guess is that all coordinates are expected to be double precision. You will have to change your declarations from "real" to "double precision". And lines like:

call moveto_w(0,0,wxy)

call moveto_w(500/ngx,phif(1,1)*100*.8/ekm,wxy)

to (the "d0" indicates a double precision constant)

call moveto_w(0.0d0,0.0d0,wxy)

call moveto_w(500.0d0/ngx,phif(1,1)*100*.8d0/ekm,wxy)

to force the coordinates to double precision.

 

View solution in original post

0 Kudos
35 Replies
ali_p_
Beginner
2,133 Views

i did not change the original fgraph.fd 

 

0 Kudos
Arjen_Markus
Honored Contributor II
2,133 Views

Can you tell us which libraries are included in the link step? I found the settextposition routine (apparently the actual name is _fq_settextposition) in libifcore.lib, so that library should be included in any case

0 Kudos
ali_p_
Beginner
2,133 Views
r u suggesting to change the lines with "settextposition" to "_fq_settextposition"?
0 Kudos
FortranFan
Honored Contributor III
2,133 Views

ali p. wrote:

it's not in the routine that contain the include fgraph.fd 

but i solved it.

now i have 2 linking errors 

   desecription                                                                                                                                                               file

Error    1     error LNK2019: unresolved external symbol SETTEXTPOSITION referenced in function MAIN__    EM2DB.obj    
Error    2     fatal error LNK1120: 1 unresolved externals                                                                                        EM2DB.exe    

 

Isn't SETTEXTPOSITION an Intel graphics subroutine: https://software.intel.com/en-us/node/526772.  How're you linking your code?  If your setup and configuration is ok, this procedure should get found from the Intel's core Fortran library.

0 Kudos
ali_p_
Beginner
2,133 Views

thanks for responding 

i managed to solve the linking problem i think!!

and now when it starts running i get this runtime error forrtl:server 157:PROGRAM EXCEPTION access violation 

i keep getting this error 

any idea why ??!

em_0.jpg482344

0 Kudos
Arjen_Markus
Honored Contributor II
2,133 Views

Accessing array elements outside the bounds of the array or incorrect argument lists when you call a subroutine or a function are all ways to make the program crash with this type of errors. There are others as well. The fastest way forward is to run it in the debugger. It may be that the problem is gone when you do that. In that case use the option to print a proper stacktrace, that ought to give you an idea where things are going wrong.

There are other possibilities to hunt down the cause, like inserting write statements at strategic positions, but I would suggest you use the debugger first.

0 Kudos
ali_p_
Beginner
2,134 Views

the debugger dosn't show errors or warnings and run through to this point 

im also using this file as data file 

laser parameters Io,kl,ml,wo,wpe,ld,lat,npr,z,ne
1e9,.16,.25,3.2899,8.602e12,.0001,200,2,13,1.788521
nsp,lx,ly,ngy,ngx,nt,dt,ie,irho,ixy,ifvx,ihis
1,100.,100.,32,32,2000,.08,2,50,50,200,1         
p,wp,wc,qm,vx0,vy0,x1,y1,vt,iw
22500,1.,1.,-1.,0.,0.,0.0,0.0,1.0,2
name of the output fiels(electrostatic mode,history)
mod20cc.dat    his20cc.dat    ve20cc.dat

 

0 Kudos
ali_p_
Beginner
2,134 Views

so i did set several breakpoints and i found the statement 

that is causing this error

         subroutine accel(ilp,iup,m,q,ke,te,DRE,Einb)            
*************************************************
	  common /param/nsp,lx,ly,dx,dy,dt,nt
	  common/cfield/ngx,ngy,iw,rho0,g1(34,34),ex(34,34),ey(34,34)
     $,bz(34,34)     
	  common /xvp/ x(25602),y(25602),vx(25602),vy(25602)
          real m ,q ,ke,ae,tem,ael,exx,exxx,eyy,eyyy,vxvy,lx
     $,ly,dx,dy,dt,ex,ey,dre,sumx,sumy,te,bzz,bzzz,einb,m2
	  integer j1,i1 
	  ael=1.
*******  advance velocity one time step
	 dxdt=dx/dt
	 ae=(q/m)*dt/dxdt
	 AE=0.5*ae
	 if(ae.eq.ael) go to 60
	  tem=ae/ael
	 do 1 i=1,ngy+1
	 do 1 j=1,ngx+1
	 ex(i,j)=ex(i,j)*tem
	 ey(i,j)=ey(i,j)*tem 
1        continue
	 ael=ae
60       continue
******** select acceleration weighting *******
c         goto 300
        do 3 i=ilp,iup-1
	i1=y(i)
	j1=x(i)
	exx=ex(i1+2,j1+2)*(y(i)-i1)*(x(i)-j1)+ex(i1+2,j1+1)*(y(i)-i1)*
     $    (j1+1-x(i))+ex(i1+1,j1+2)*(i1+1-y(i))*(x(i)-i1)                                                 
	 exxx=exx+ex(i1+1,j1+1)*(i1+1-y(i))*(j1+1-x(i)) 
	 eyy=ey(i1+2,j1+2)*(y(i)-i1)*(x(i)-j1)+ey(i1+2,j1+1)*(y(i)-i1)*
     $    (j1+1-x(i))+ey(i1+1,j1+2)*(i1+1-y(i))*(x(i)-i1)
	 eyyy=eyy+ey(i1+1,j1+1)*(i1+1-y(i))*(j1+1-x(i))
	bzz=bz(i1+2,j1+2)*(y(i)-i1)*(x(i)-j1)+bz(i1+2,j1+1)*(y(i)-i1)*
     $    (j1+1-x(i))+bz(i1+1,j1+2)*(i1+1-y(i))*(x(i)-i1)                                                 
	bzzz=bzz+bz(i1+1,j1+1)*(i1+1-y(i))*(j1+1-x(i)) 
	c=cos(bzzz*dt)
	s=sin(bzzz*dt)
	vy(i)=vy(i)+eyyy
	 vx(i)=vx(i)+exxx
	 vyy=-vx(i)*s+vy(i)*c
	 vxx=vx(i)*c+vy(i)*s
	 vy(i)=vyy+eyyy
3        vx(i)=vxx+exxx    
	 vxvy=0.
c         am=0.5*wp2m*(lx/ngx)**2
         Einb=Einb*.5/(iup-1)*1/(dxdt*dxdt)
         m2=m/2

it's this last one (Einb=Einb*.5/(iup-1)*1/(dxdt*dxdt)
                            m2=m/2)

i don't know what's wrong with it as i mentioned i don't use fortran 

 

0 Kudos
FortranFan
Honored Contributor III
2,134 Views

ali p. wrote:

.. as i mentioned i don't use fortran 

I notice you keep mentioning you don't use Fortran.  And you've also mentioned you're a student of Physics (graduate school?) and that your "doctor" (thesis advisor?) has given you some code to run.  Since you're a student, you can help yourself greatly if you take a structured approach to learning Fortran using readily available online resources (even YouTube has a lot to offer on Fortran) including some links shown below.  If you're studying Physics, Fortran skills can be something you will find valuable for the rest of your Physics/science/technical career, plus if you are able to study something like Physics at some advanced level, picking up Fortran such as from the PDF link below should be a "piece of cake", just a few days' worth of effort following which you can resolve by yourself almost all the problems you're bringing up in the long thread in this topic.

http://www.egr.unlv.edu/~ed/fortran (find a downloadable PDF file at the site) 

and 

http://fortranwiki.org/fortran/show/Tutorials 

Now if you're interested in advancing yourself further in Fortran, you can also try the recommendations by Dr Fortran as suggested here: https://software.intel.com/en-us/blogs/2013/12/30/doctor-fortran-in-its-...

0 Kudos
mecej4
Honored Contributor III
2,134 Views

There are two calls to subroutine ACCEL. In the second of these, in line 577 of the source code that you gave in #26, the last argument is the constant 0.0. The statement on line 629 attempts to update the value of this argument; i.e., an attempt is made to write a new value into a read-only memory location. You need to ask your doctor what to do, but a simple fix that may suffice is to replace "0.0" in line 577 by "(0.0)".

0 Kudos
ali_p_
Beginner
2,134 Views
FortranFan wrote:

Quote:

ali p. wrote:

.. as i mentioned i don't use fortran 

I notice you keep mentioning you don't use Fortran.  And you've also mentioned you're a student of Physics (graduate school?) and that your "doctor" (thesis advisor?) has given you some code to run.  Since you're a student, you can help yourself greatly if you take a structured approach to learning Fortran using readily available online resources (even YouTube has a lot to offer on Fortran) including some links shown below.  If you're studying Physics, Fortran skills can be something you will find valuable for the rest of your Physics/science/technical career, plus if you are able to study something like Physics at some advanced level, picking up Fortran such as from the PDF link below should be a "piece of cake", just a few days' worth of effort following which you can resolve by yourself almost all the problems you're bringing up in the long thread in this topic.

http://www.egr.unlv.edu/~ed/fortran (find a downloadable PDF file at the site) 

and 

http://fortranwiki.org/fortran/show/Tutorials 

Now if you're interested in advancing yourself further in Fortran, you can also try the recommendations by Dr Fortran as suggested here: https://software.intel.com/en-us/blogs/2013/12/30/doctor-fortran-in-its-...

actually im undergraduate and i am familier with c++ and i dont have that much programing application in my study and it wont be that easy for me to learn fortran cuz its look like a very complicated lang with so much compiling issues I dont get that with c++ although my work is not that sophisticated and another thing english is not my first language so it would be rather hard for me to start to learn about new coding style and will take some time to do it..thanks for recomending these sources though We actually have (modern fortran explained ) book in my uni library l will take a look at it
0 Kudos
ali_p_
Beginner
2,134 Views
mecej4 wrote:

There are two calls to subroutine ACCEL. In the second of these, in line 577 of the source code that you gave in #26, the last argument is the constant 0.0. The statement on line 629 attempts to update the value of this argument; i.e., an attempt is made to write a new value into a read-only memory location. You need to ask your doctor what to do, but a simple fix that may suffice is to replace "0.0" in line 577 by "(0.0)".

Thanks i will try that..hope it works
0 Kudos
Arjen_Markus
Honored Contributor II
2,134 Views

ali p. wrote:

 

actually im undergraduate and i am familier with c++ and i dont have that much programing application in my study
and it wont be that easy for me to learn fortran cuz its look like a very complicated lang with so much compiling issues
I dont get that with c++ although my work is not that sophisticated
and another thing english is not my first language so it would be rather hard for me to start to learn about new coding style
and will take some time to do it..thanks for recomending these sources though
We actually have (modern fortran explained ) book in my uni library l will take a look at it

 

In my experience C++ is far more complicated than Fortran. The problem you are facing is that you are dealing with old program code that does not take advantage of the facilities that have been defined some 30 years ago with the publication of the newer standard Fortran 90 and are unfamiliar with the syntax. I understand this is frustrating, but that is hardly the fault of the language itself. Just my two cents ;)

 

0 Kudos
ali_p_
Beginner
2,134 Views

arjenmarkus wrote:

Quote:

In my experience C++ is far more complicated than Fortran. The problem you are facing is that you are dealing with old program code that does not take advantage of the facilities that have been defined some 30 years ago with the publication of the newer standard Fortran 90 and are unfamiliar with the syntax. I understand this is frustrating, but that is hardly the fault of the language itself. Just my two cents ;)

 

[/quote

Thanks very much u look like a fortran genius,and yeah i understand that fortran had few versions and that what causing the trouble..but does

That mean if i compile this on old fortran 77 compiler only on old system it might work without problems ?? And if so which system and compiler i can use for that.

0 Kudos
mecej4
Honored Contributor III
2,134 Views

ali p. wrote:

I understand that fortran had few versions and that what causing the trouble..but does that mean if I compile this on old fortran 77 compiler only on old system it might work without problems ?

There is no need to launch grand discourses on C++ versus Fortran, or to resurrect old computer boxes.

The Fortran program given to you has a bug and I showed you a simple fix for it. Make that correction and run the program. If the output graphs look right, the story ends there. If not, you can come back with your objections.

0 Kudos
Reply