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

on module

roddur
Beginner
406 Views
Is there any way to check if a module that contains a subroutine is compiled and included correctly in the executable before running the job? I am asking this because, I have declared a module as
[cpp]!Program lm-lib.f	
module mlms CONTAINS subroutine lm(oidxdn,opnu,opold,oqnu,oqold,avw,lmx) implicit none ! Common blocks: ! --- dynamical memory allocation: integer wksize parameter(wksize=8000000) integer w(wksize) common/wkarr/w ! Controls for IO integer ishow,ncnt1,ncnt2,mcount parameter (ncnt1=1,ncnt2=2,mcount=20) character*4 cquit,err,output character*8 prgnam ! Parameters for options, structure, basis integer nbas,nclass,nl,nlrho,nsp,mmixat integer nit,nitat,ndel(3),ltmax(3),ifmt3d double precision bound(3,6),origin(3),plat(9,6),alat(2) logical switch(31) ! for iterations integer niter,mmixpq double precision beta,rmsdel,rms2,toleto,wc ! Class parameters integer mxclas parameter (mxclas=200) integer lmx(mxclas),lmxrho(mxclas),nrclas(mxclas), . konfig(0:3,mxclas) double precision dq(mxclas),qc(mxclas),qtot(2*mxclas), . ves(2*mxclas),vrmax(2*mxclas),wsr(mxclas),z(mxclas) character*4 clabl(mxclas) ! Symmetry group integer nsymop,ngen double precision symopm(9,48),symopv(3,48) character*72 symops(48),gens(48) ! BZ - integration / empty-sphere finder integer nkxyz(3),norder,nopts,npts double precision emin,eminc,emax,emaxc,range,tolef,width ! Empty-sphere finder double precision rmaxes,rmines integer nrxyz(3) ! Scaling wsr double precision asavol,facvol,gamma,ommax1(3),ommax2(3) ! Structure constant parameters integer ialpha,itrans,lmaxw,ndimin,jbasdn,ldn,mdn,nsmesh double precision dele,deltr,kap2,kfit,rmaxs,rmaxs2,eps ! Parameters relating to Ewald sums integer nkdmx double precision as,awald,tolews,vol ! for rhofit integer rfout ! for SYML integer mxline parameter (mxline=99) integer nq(mxline),nline double precision q1(3,mxline),q2(3,mxline) character*1 lab1(mxline),lab2(mxline) ! Local variables, functions and offsets to dynamic arrays integer fopn,i,ibas,ic,icalc,iprint,isym(10),j,lunit,len2,mxkp, . nkd,nkg,nkp,npp,nrxc,obeta,oadot0,oalph0,obas,obk, . odlat,oenu,oevrl,oglat,oibk,oiclas,oidmod,oidxdn,onrcls, . opnu,opp,oqnu,osigma,osigm2,otrtab,owk,owtkp,og parameter(npp=6) double precision avw,avwsr,dovl1(3),dovl2(3),efermi, . qb(9),vmtz logical begmom,convrg,lsmall,t,f,lpot,lsymst,lsdm1,nowrit character*30 csym(7) character*72 name,tit parameter(t=.true.,f=.false.) ! External calls external avwsr,chkcls,chkdis,chksym,chkwsr,defdr,defi,dscal,fexit, . finits,fopn,icopy,iprint,lunit,ioctrl,allocm,wkinit integer isum,ldim,nderiv,neighm,nmesh,ntet, . oadot,oadoto,oalpha,oalpho,ocg,ocy,odmad,odmat, . oeband,oemom,oiax,oidn,oidtet,oindcg,oirr,oixirr, . ojcg,onpr,opold,oqold,orwats,os,osdot,osdm1,osdm1s, . otrad,otral double precision detot,ebmax,ebmin,etot,etoto,sumdq,zval character*4 cnit data prgnam/'LM'/ data ialpha/0/,ifmt3d/1/,itrans/0/,jbasdn/1/,ldn/0/,lmaxw/8/, . ltmax/2,2,2/, mdn/0/, mmixat/2/, . mmixpq/1/, nbas/1/, nclass/1/, ndimin/350/,ngen/0/,nit/1/, . nitat/30/,niter/30/,nkdmx/250/,nkxyz/4,4,4/,nl/3/, . nopts /8001/, norder/0/,npts/1001/,nrxc/1/,nrxyz/0,0,0/, . nsp/1/ data as/.2d1/, beta/.5d0/,dele/.05d0/,deltr/.1d0/, efermi/-.25d0/, . kap2/.0d0/,kfit/0.d0/ ,emax/.2d1/ ,emaxc/.2d1/ ,emin/-.2d1/, . eminc/-.2d1/,eps/.0d0/,facvol/.1d1/,gamma/.0d0/, . ommax1/.16d0,.18d0,.20d0/,ommax2/.40d0,.45d0,.50d0/, . range/.5d1/ ,rmaxes/.40d1/, . rmaxs/.32d1/,rmaxs2/.35d1/,rmines/.9d0/,rms2/99.9999999d0/, . rmsdel/.1d-4/,tolef/.1d-5/,toleto/.1d-4/,tolews/.1d-5/, . vmtz/-.75d0/,wc/-.1d1/,width/.5d-2/ data clabl/mxclas*'E'/, cquit/'----'/, csym/7*'undef'/, . err/'ERR '/, gens/'E',47*' '/, output/'LM '/ data convrg/f/, switch/t,t,f,t,f,f,f,f,f,t, t,t,t,f,t,f,f,t,f,f, . f,f,f,f,t,t,f,f,f,t, f/ [/cpp]
and then used the module in another file
[cpp]!program lm-leb-end.f
       module mlmend
	use mlms
	CONTAINS

      subroutine lm_end(oidxdn,opnu,opold,oqnu,oqold,avw,lmx)
[/cpp]

and as usual i have not redeclare the variables or data in lm-lib-end. This two are present in a directory MAIN. Then i compiled the code as
[cpp].f.o:
	$(FC) -c $(PREFLAGS) $(FFLAGS) $<
	mv $(*F).o $(*D)
#
.c.o:
	$(CC) $(CCFLAGS) -c $<
	mv $(*F).o $(*D)

irun:lm-lib.o lm-lib-end.o call.o $(lmobj)
	$(FC) $(FFLAGS) $(FPAR) -o $@  $(lmobj) lm-lib.o lm-lib-end.o call.o

lm-lib.o:MAIN/lm-lib.f 	 
	$(FC) -c MAIN/lm-lib.f 
lm-lib-end.o:MAIN/lm-lib-end.f 
	$(FC) -c MAIN/lm-lib-end.f -I/home/rudra/RECURSION_TRIAL/LMTO-A

call.o:call.f90
	$(FC) -c call.f90
[/cpp]

but now i am getting error as
[cpp]$ make
ifort -c MAIN/lm-lib-end.f -I/home/rudra/RECURSION_TRIAL/LMTO-A
MAIN/lm-lib-end.f(188): error #6385: The highest data type rank permitted is INTEGER(KIND=8).   [BEGMOM]
       if (begmom.and.iprint().ge.0) 
-----------^
MAIN/lm-lib-end.f(188): error #6385: The highest data type rank permitted is INTEGER(KIND=8).
       if (begmom.and.iprint().ge.0) 
-----------------^
[/cpp]
and so on. but if i define the variables again in lm-lib-end, then the program is gettin compiled(Result is wrong, ofcourse) can you tell me why?


0 Kudos
1 Reply
Steven_L_Intel1
Employee
406 Views
You want to add the .mod as an output of the compile of the module and as a dependency on the sources that USE it.

Also, your use of .and. on a LOGICAL is very risky, as the internal representation may not be what you think. If you are going to treat the values as integers, declare them as integers and use IAND.
0 Kudos
Reply