PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

modules?
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
deeppow



Joined: 02 Feb 2012
Posts: 51

PostPosted: Sat May 11, 2013 11:37 am    Post subject: modules? Reply with quote

There is something basic I don't understand about modules. I want to convert include files that shared data via the old common block structure by changing the files to modules.

Extracted the basic issue to a simple example. If I leave the module in the file with the program and other subroutines, no problem. If I take the module out as a separate file I get the following typical error:
E:\PGI_5-11-2013mod2\Source Files\fall.f90(8) : error F0004 : Corrupt or Old Module file E:\PGI_5-11-2013mod2\Include Files\constants.mod
error F0004 : Corrupt or Old Module file E:\PGI_5-11-2013mod2\Include Files\constants.mod

Could someone suggest what I'm doing wrong please?

Code:

      module constants
         integer, parameter :: np=2000, dbl=selected_real_kind(14,100)
         real(dbl) :: g=9.807, dtmin=.001, kspg=10., mass = 100.0
      end module constants



      program fall
!
      use constants
      implicit none
!
!   Program to calculate the dynamics of a falling body
!
      real(dbl), allocatable :: v(:),z(:),t(:), zreal(:)
      real(dbl) dt
      integer nsteps
!
      allocate (v(np),z(np),t(np),zreal(np))
      call input(z,dt)
      call odesolve(v,z,t,dt,nsteps)
      call realans(t,z,nsteps,zreal)
      call output (t,z,zreal,v,nsteps)
      stop
      end


      subroutine input (z,dt)
      use constants
      implicit none
.
.
      return
      end


      subroutine odesolve(v,z,t,dt,nsteps)
      use constants
      implicit none
!
      real (dbl) v(*),z(*),t(*),dt,c0,c1
      integer i,nsteps
.
.
      return
      end


      subroutine realans(t,z,nsteps,zreal)
      use constants
      implicit none
.
.
      return
      end

      subroutine output(t,z,zreal,v,nsteps)
      use constants, only : dbl
      implicit none
.
.
      return
      end


Same problem with either PVF 13.4 or 13.5 using VS2008 in Windows 7 64-bit.

Thanks
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6146
Location: The Portland Group Inc.

PostPosted: Mon May 13, 2013 10:09 am    Post subject: Reply with quote

Hi Ralph,

This error typically occurs when the module file being using was created with a different compiler (either an older PGI or another vendor). Can you try cleaning out the Include directory and then recompiling?

Thanks,
Mat
Back to top
View user's profile
deeppow



Joined: 02 Feb 2012
Posts: 51

PostPosted: Mon May 13, 2013 10:44 am    Post subject: Reply with quote

Matt,

That was the source code and the include directory was clean. Redid it, same result.

constants module (constants.mod)
Code:

      module constants
!
         integer, parameter :: np=2000, dbl=selected_real_kind(14,100)
!
         real(dbl) :: g=9.807,dtmin=.001, kspg=10., mass = 100.0
!
      end module constants


program.f90
Code:

      program fall
!
      use constants
!
      implicit none
!
!   Program to calculate the dynamics of a falling body
!
      real(dbl), allocatable :: v(:),z(:),t(:), zreal(:)
      real(dbl) dt
      integer nsteps
!
      allocate (v(np),z(np),t(np),zreal(np))
      call input(z,dt)
      call odesolve(v,z,t,dt,nsteps)
      call realans(t,z,nsteps,zreal)
      call output (t,z,zreal,v,nsteps)
      stop
      end
!
      subroutine input (z,dt)
      use constants
      implicit none
!
      real(dbl) z(*),dt
!
      write(6,'(a)',advance='no') ' Initial height (meters): '
      read *, z(1)
      write(6,'(a)',advance='no') 'Time step size (seconds): '
      read *, dt
      if(dt.le.0.) dt=dtmin
      return
      end
!
      subroutine odesolve(v,z,t,dt,nsteps)
!
      use constants
      implicit none
!
      real (dbl) v(*),z(*),t(*),dt,c0,c1
      integer i,nsteps
!
      t(1)=0.
      v(1)=0.
!
!   Set some useful constants
!
      c1=dt*kspg/mass
      c0= c1*z(1)-g*dt
!
      do 100 i=2,np
         v(i)= (c0-c1*z(i-1)+(1.-0.25*c1*dt)*v(i-1))/(1.+.25*c1*dt)
         z(i)= z(i-1)+dt*.5*(v(i)+v(i-1))
         t(i)=t(i-1)+dt
         if(z(i).lt.0.) go to 200
 100     continue
      write(6,*) 'Ran out of space to continue integration'
      write(6,*) ' Last height was ',z(np),' meters'
      i=np
 200  nsteps=i
!     return
      end
!
      subroutine realans(t,z,nsteps,zreal)
      use constants
      implicit none
!
      real(dbl) t(*),z(*),zreal(*),c1,c2
      integer i,nsteps
      c1=g*mass/kspg
      c2=sqrt(kspg/mass)
!
      do 10 i=1,nsteps
  10  zreal(i)=c1*cos(c2*t(i)) + z(1)-c1
      return
      end
!
      subroutine output(t,z,zreal,v,nsteps)
      use constants, only : dbl
      implicit none
!
      real(dbl) v(*),z(*),t(*), zreal(*)
      integer nsteps,i
      print *, 'Results are in fall.output'
      open (11,file='fall.output')
      write(11,2000)
      do 300 i=1,nsteps
      write(11,2001) t(i),z(i),zreal(i),z(i)-zreal(i)
 300  continue
 2000 format (21x,'Computed',8x,'Actual',/,
     &        6x,'Time',12x,'Height',9x,'Height',9x,'Error')
 2001 format (1x,1p,4e15.7)
      return
      end


Compiler directives:
-g -Bstatic -Mbackslash -I"F:\test-PGI\Include files" -I"d:\program files\pgi\win64\13.5\include" -I"D:\Program Files\PGI\Microsoft Open Tools 11\include" -I"D:\Program Files\PGI\Microsoft Open Tools 11\PlatformSDK\include" -Minform=warn

This has gota be something simple that I'm doing wrong.
Back to top
View user's profile
ams



Joined: 14 Jul 2004
Posts: 41

PostPosted: Mon May 13, 2013 12:34 pm    Post subject: Reply with quote

Ralph,

Your test case compiles for me using 13.5, both within PVF and from the command line. It's possible that the location of the generated constants.mod could be an issue. What have you specified for PVF's Fortran | General | Module Path property?

Annemarie
Back to top
View user's profile
deeppow



Joined: 02 Feb 2012
Posts: 51

PostPosted: Mon May 13, 2013 4:48 pm    Post subject: Reply with quote

Annemarie,

Yes, I've input the module path in PVF's Fortran->General->Module Path. I've also tried it in same location as the .f90 file and in both at the same time. I assume your file extension is .mod but I've tried .f90 too.

I'm using PVF in VS2008 in Windows 7 64-bit. Same resolute for PVF 13.4 and 13.5.

I'm totally stumped.


-ralph
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group