Code Comments
Programming Forum and web based access to our favorite programming groups.i wrote a code an f90 code a while back which was giving results on some compiler. however, i just shifted to a Gnu Fortran 90/95 compiler. while trying to compile my code using the following command: g90 -o file randlib.f/src/* drive_mcmc.f90 , i get the following error messages. I have absolutely no clue to what they mean. Can anyone help me fix these? ------------------------------ In file randlib.f/src/qrgnin.f:48 END 1 Internal Error at (1): TODO: Functions with alternate entry points In file matrixoperations.f90:14 Included at drive_mcmc.f90:5 REAL,DIMENSION(size(A,1),size(B,2)) :: Mu 1 Error: Symbol 'mu' at (1) already has basic type of REAL In file matrixoperations.f90:26 Included at drive_mcmc.f90:5 Mu(i,j)=0 1 Error: Unclassifiable statement at (1) In file matrixoperations.f90:33 Included at drive_mcmc.f90:5 Mu(i,j)=Mu(i,j)+A(i,k)*B(k,j) 1 Error: Unclassifiable statement at (1) In file matrixoperations.f90:54 Included at drive_mcmc.f90:5 REAL,DIMENSION(size(A,1),size(A,2)) :: In 1 Error: Symbol 'in' at (1) already has basic type of REAL In file matrixoperations.f90:107 Included at drive_mcmc.f90:5 In(i,j)=B(i,j+m) 1 Error: Unclassifiable statement at (1) In file matrixoperations.f90:127 Included at drive_mcmc.f90:5 REAL,DIMENSION(size(A,2),size(A,1)) :: B 1 Error: Symbol 'b' at (1) already has basic type of REAL In file matrixoperations.f90:131 Included at drive_mcmc.f90:5 B(i,j)=A(j,i) 1 Error: Unclassifiable statement at (1) In file matrixoperations.f90:151 Included at drive_mcmc.f90:5 REAL,DIMENSION(size(A,1),size(A,2)) :: C 1 Error: Symbol 'c' at (1) already has basic type of REAL In file matrixoperations.f90:161 Included at drive_mcmc.f90:5 C(i,j) = A(i,j) + B(i,j) 1 Error: Unclassifiable statement at (1) In file matrixoperations.f90:180 Included at drive_mcmc.f90:5 REAL,DIMENSION(size(A,1),size(A,2)) :: C 1 Error: Symbol 'c' at (1) already has basic type of REAL In file matrixoperations.f90:190 Included at drive_mcmc.f90:5 C(i,j) = A(i,j) - B(i,j) 1 Error: Unclassifiable statement at (1) In file gibbsnorm.f90:9 Included at drive_mcmc.f90:8 use matrix 1 Fatal Error: Can't open module file 'matrix.mod' for reading at (1): No such file or directory --------------------------
Post Follow-up to this messageIn article <1116694719.122289.104750@f14g2000cwb.googlegroups.com>, "student" <adarsh@stat.tamu.edu> writes: > > i wrote a code an f90 code a while back which was giving results on > some compiler. however, i just shifted to a Gnu Fortran 90/95 compiler. > while trying to compile my code using the following command: > > g90 -o file randlib.f/src/* drive_mcmc.f90 , > > i get the following error messages. I have absolutely no clue to what > they mean. Can anyone help me fix these? > ------------------------------ > In file randlib.f/src/qrgnin.f:48 > > END > > 1 > Internal Error at (1): > TODO: Functions with alternate entry points > In file matrixoperations.f90:14 > Are you using GCC 4.0? Functions with alternate entry points were recently implemented, and the fix will be included in GCC 4.0.1 and GCC 4.1. You can get updated binraies through www.gfortran.org. -- Steve http://troutmask.apl.washington.edu/~kargl/
Post Follow-up to this messageWithout seeing the whole code, it's hard to know for sure. I've got a couple of guesses below. Dick Hendrickson student wrote: > i wrote a code an f90 code a while back which was giving results on > some compiler. however, i just shifted to a Gnu Fortran 90/95 compiler. > while trying to compile my code using the following command: > > g90 -o file randlib.f/src/* drive_mcmc.f90 , > > i get the following error messages. I have absolutely no clue to what > they mean. Can anyone help me fix these? > > > ------------------------------ > In file randlib.f/src/qrgnin.f:48 > > END > > 1 > Internal Error at (1): > TODO: Functions with alternate entry points If this is the error message, it indicates that there is an internal error in the compiler itself. It's not your fault and you should file a bug report with the compiler people. It's possible that the compiler bug caused all of the other problems. > In file matrixoperations.f90:14 > > Included at drive_mcmc.f90:5 > > REAL,DIMENSION(size(A,1),size(B,2)) :: Mu > 1 > Error: Symbol 'mu' at (1) already has basic type of REAL Most likely you've got another statement that declares Mu to be a variable. This is easy to do when using include files because you don't see everything. Are you sure that Mu isn't declared somewhere else? > In file matrixoperations.f90:26 > > Included at drive_mcmc.f90:5 > > Mu(i,j)=0 > 1 > Error: Unclassifiable statement at (1) Once there is a problem with the declarations of Mu, then there's likely to be problems when it's used (if the compiler doesn't know for sure what it is, it can't know for sure if you are using it correctly). Fix the declarations and this one will go away! > In file matrixoperations.f90:33 > > Included at drive_mcmc.f90:5 > > Mu(i,j)=Mu(i,j)+A(i,k)*B(k,j) > 1 > Error: Unclassifiable statement at (1) > In file matrixoperations.f90:54 > > Included at drive_mcmc.f90:5 > > REAL,DIMENSION(size(A,1),size(A,2)) :: In > 1 > Error: Symbol 'in' at (1) already has basic type of REAL > In file matrixoperations.f90:107 > > Included at drive_mcmc.f90:5 > > In(i,j)=B(i,j+m) > 1 > Error: Unclassifiable statement at (1) > In file matrixoperations.f90:127 > > Included at drive_mcmc.f90:5 > > REAL,DIMENSION(size(A,2),size(A,1)) :: B > 1 > Error: Symbol 'b' at (1) already has basic type of REAL > In file matrixoperations.f90:131 > > Included at drive_mcmc.f90:5 > > B(i,j)=A(j,i) > 1 > Error: Unclassifiable statement at (1) > In file matrixoperations.f90:151 > > Included at drive_mcmc.f90:5 > > REAL,DIMENSION(size(A,1),size(A,2)) :: C > 1 > Error: Symbol 'c' at (1) already has basic type of REAL > In file matrixoperations.f90:161 > > Included at drive_mcmc.f90:5 > > C(i,j) = A(i,j) + B(i,j) > 1 > Error: Unclassifiable statement at (1) > In file matrixoperations.f90:180 > > Included at drive_mcmc.f90:5 > > REAL,DIMENSION(size(A,1),size(A,2)) :: C > 1 > Error: Symbol 'c' at (1) already has basic type of REAL > In file matrixoperations.f90:190 > > Included at drive_mcmc.f90:5 > > C(i,j) = A(i,j) - B(i,j) > 1 > Error: Unclassifiable statement at (1) > In file gibbsnorm.f90:9 > > Included at drive_mcmc.f90:8 > > use matrix > 1 > Fatal Error: Can't open module file 'matrix.mod' for reading at (1): No You had errors in the routines in the matrix module, so the compiler didn't generate enough information to let the use matrix statement work. This one will go away when you get the other errors corrected. Dick Hendrickson > > such file or directory > -------------------------- >
Post Follow-up to this messageDick! That's not the problem. I have no "include" statements in the source code. And as I said this code was working fine on another compiler. I guess I need to look into what Steve has suggested.
Post Follow-up to this messageDick Hendrickson wrote: > Without seeing the whole code, it's hard to know > for sure. I've got a couple of guesses below. > > Dick Hendrickson > > student wrote: > Is this gfortran with an alias? > > If this is the error message, it indicates that there > is an internal error in the compiler itself. It's not > your fault and you should file a bug report with > the compiler people. It's possible that the compiler > bug caused all of the other problems. It also shows specifically that ENTRY or something like it was found in the source, and this is a known omission in the compiler. -- Tim Prince
Post Follow-up to this messageIn article <e%Mje.1907$kj7.1091@newssvr21.news.prodigy.com>, Tim Prince <timothyprince@sbcglobal.net> writes: > > It also shows specifically that ENTRY or something like it was found in th e > source, and this is a known omission in the compiler. Actually, it is fixed in the CVS repository. GCC 4.0.1 should include it. -- Steve http://troutmask.apl.washington.edu/~kargl/
Post Follow-up to this message"student" <adarsh@stat.tamu.edu> writes: > That's not the problem. I have no "include" statements in the source > code. And as I said this code was working fine on another compiler. I > guess I need to look into what Steve has suggested. I think you are going to need to show us the source if you need help with it. I'm sure puzzzled by how you could get messages like the one seen without having include, but in any case... The messages explicitly refer to something being already done. Regardless of whether the messages are correct or not, we'd need to see what came before in order to have even a chance of evaluating what is going on. -- Richard Maine email: my last name at domain domain: summertriangle dot net
Post Follow-up to this messageRichard! I am using the Fortran 90/95 compiler from Gnu compiler suite. The command that I gave at the command prompt is as follows: g90 -o file randlib.f/src/* matrixoperations.f90 gib.f90 drive_gibbs.f90 The directory randlib.f/src contains .f files to generate random number deviates. The other code files are as follows. Please inform me as to what you think about this. As I said earlier, this program was working fine on another compiler. ------------------------ PROGRAM drive_gibbs use matrix use mcmc IMPLICIT NONE REAL, DIMENSION(2) :: mu REAL, DIMENSION(2,2) :: sigma REAL, DIMENSION(2) :: sample,temp REAL, DIMENSION(6000,2) :: saved INTEGER :: i,j DO i = 1,size(mu,1) mu(i) = i end DO DO i = 1,size(sigma,1) DO j = 1,size(sigma,2) IF (i/=j) THEN ! sigma(i,j)=i+j ! sigma(i,j)=0 sigma(i,j)=0.4*(i+j) ELSE sigma(i,j) = i**2 end IF end DO end DO DO j = 1,size(sample,1) temp(j)=mu(j) end DO CALL gibbsnorm(temp,mu,sigma,sample) DO i = 1,50000 DO j = 1,size(sample,1) temp(j)=sample(j) end DO CALL gibbsnorm(temp,mu,sigma,sample) IF ((i > 20000).AND.(MOD(i,5)==0)) THEN DO j = 1,size(sample,1) saved(((i-20000)/5),j)=sample(j) end DO end IF end DO CALL printmatrix(saved) end PROGRAM DRIVE_GIBBS --------------------- MODULE matrix CONTAINS real function matrixmult(A,B) result(Mu) IMPLICIT NONE INTEGER :: i,j,k INTEGER :: m,n1,n2,p REAL,DIMENSION(:,:) :: A REAL,DIMENSION(:,:) :: B REAL,DIMENSION(size(A,1),size(B,2)) :: Mu m=size(A,1) n1=size(A,2) n2=size(B,1) p=size(B,2) IF (n1/=n2) THEN WRITE(*,*) "Error in the multiplication procedure: Dimensions not compatible" ELSE DO i=1,m DO j=1,p Mu(i,j)=0 end DO end DO DO i=1,m DO j=1,p DO k=1,n1 Mu(i,j)=Mu(i,j)+A(i,k)*B(k,j) end DO end DO end DO ENDIF end function matrixmult real function inv(A) result(In) IMPLICIT NONE REAL,DIMENSION(:,:) :: A INTEGER :: m REAL :: x,y INTEGER::i,j,k,l REAL,DIMENSION(size(A,1),2*size(A,2)) :: B REAL,DIMENSION(size(A,1),size(A,2)) :: In m=size(A,1) IF (size(A,1)/=size(A,2)) THEN WRITE(*,*) "Error in the inverse procedure: Matrix not square" STOP end IF DO i=1,m DO j=1,m B(i,j)=A(i,j) end DO DO j=(m+1),2*m IF((j-m)==i) then B(i,j)=1 else B(i,j)=0 end IF end DO end DO DO i=1,m x=B(i,i) IF (x /= 0) THEN DO j=i,2*m B(i,j)=B(i,j)/x end DO IF (i>1) THEN DO k=1,i-1 y=B(k,i) DO l=i,(2*m) B(k,l)=B(k,l)-y*B(i,l) end DO end DO ENDIF IF (i<m) THEN DO k=i+1,m y=B(k,i) DO l=i,(2*m) B(k,l)=B(k,l)-y*B(i,l) end DO end DO ENDIF ELSE WRITE(*,*) "Error in the inverse procedure: Singular Matrix" STOP ENDIF end DO DO i=1,m DO j=1,m In(i,j)=B(i,j+m) ENDDO ENDDO end function inv real function trans(A) result(B) IMPLICIT NONE INTEGER::i,j REAL,DIMENSION(:,:) :: A REAL,DIMENSION(size(A,2),size(A,1)) :: B DO i=1,size(A,1) DO j=1,size(A,2) B(i,j)=A(j,i) end DO end DO end function trans real function add(A,B) result(C) IMPLICIT NONE INTEGER::i,j REAL,DIMENSION(:,:) :: A,B REAL,DIMENSION(size(A,1),size(A,2)) :: C IF ((size(A,1)/=size(B,1)).OR.((size(A,2)/=size(B,2)))) THEN WRITE(*,*) "Error in the addition procedure: Matrix dimensions not compatible!" STOP ELSE DO i=1,size(A,1) DO j=1,size(A,2) C(i,j) = A(i,j) + B(i,j) end DO end DO ENDIF end function add real function difference(A,B) result(C) IMPLICIT NONE INTEGER::i,j REAL,DIMENSION(:,:) :: A,B REAL,DIMENSION(size(A,1),size(A,2)) :: C IF ((size(A,1)/=size(B,1)).OR.((size(A,2)/=size(B,2)))) THEN WRITE(*,*) "Error in the addition procedure: Matrix dimensions not compatible!" STOP ELSE DO i=1,size(A,1) DO j=1,size(A,2) C(i,j) = A(i,j) - B(i,j) end DO end DO ENDIF end function difference SUBROUTINE printmatrix(A) IMPLICIT NONE REAL,DIMENSION(:,:) :: A INTEGER :: i,j DO i = 1,size(A,1) WRITE(*,*) (A(i,j),j=1,size(A,2)) end DO WRITE(*,*) "" end SUBROUTINE printmatrix end MODULE matrix ------------------------------------------------ MODULE mcmc CONTAINS SUBROUTINE gibbsnorm(X,mean,varcov,sample) ! takes in mean and variance-covariance matrix of jointly normal random variables and returns a random sample from that density using Gibbs'Sampler procedure; X is the initial value matrix use matrix IMPLICIT NONE REAL, DIMENSION(:) :: mean,X REAL, DIMENSION(:,:) :: varcov REAL, DIMENSION(size(mean,1)), INTENT(OUT) :: sample REAL, DIMENSION (size(mean,1),size(mean,1)) :: delta REAL :: av,sd INTEGER :: m,i,j,k REAL, EXTERNAL :: gennor IF (size(mean,1)/=size(X,1)) THEN WRITE (*,*) "Error in gibbs sampler procedure: Dimension of the initial value matrix is not same as mean matrix!!" STOP end IF IF (size(varcov,1)/=size(varcov,2)) THEN WRITE(*,*) "Error in gibbs sampler procedure: The variance-covariance matrix is not square!!" STOP end IF IF (size(mean,1)/=size(varcov,1)) THEN WRITE (*,*) "Error in gibbs sampler procedure: Dimension of variance-covariance matrix is not same as mean matrix!!" STOP end IF m = size(mean,1) delta = inv(varcov) !inverse of the variance-covariance matrix DO k = 1,5 ! throw away the first 4 samples from the Gibbs' scheme DO i = 1,m av = mean(i) IF (delta(i,i)<=0) THEN WRITE (*,*) "Error in gibbs sampler procedure: not a valid variance-covariance matrix!!" STOP end IF sd = sqrt(1/delta(i,i)) ! variance of the conditional distribution of the i-th variable given the rest !! Calculation of the mean of the conditional distribution follows DO j = 1,m av = av - (X(j)-mean(j))*(delta(j,i)+delta(i,j))/(2*delta(i,i)) end DO av = av + (X(i)-mean(i))! mean of the conditional distribution of the i-th variable given the rest X(i)=gennor(av,sd) ! sampling from the conditional density, and updating value end DO end DO DO i = 1,m sample(i) = X(i) !save the fifth sample end DO end SUBROUTINE gibbsnorm end MODULE mcmc
Post Follow-up to this messagethe error messages are as follows: In file randlib.f/src/qrgnin.f:48 END 1 Internal Error at (1): TODO: Functions with alternate entry points In file matrixoperations.f90:14 REAL,DIMENSION(size(A,1),size(B,2)) :: Mu 1 Error: Symbol 'mu' at (1) already has basic type of REAL In file matrixoperations.f90:26 Mu(i,j)=0 1 Error: Unclassifiable statement at (1) In file matrixoperations.f90:33 Mu(i,j)=Mu(i,j)+A(i,k)*B(k,j) 1 Error: Unclassifiable statement at (1) In file matrixoperations.f90:54 REAL,DIMENSION(size(A,1),size(A,2)) :: In 1 Error: Symbol 'in' at (1) already has basic type of REAL In file matrixoperations.f90:107 In(i,j)=B(i,j+m) 1 Error: Unclassifiable statement at (1) In file matrixoperations.f90:127 REAL,DIMENSION(size(A,2),size(A,1)) :: B 1 Error: Symbol 'b' at (1) already has basic type of REAL In file matrixoperations.f90:131 B(i,j)=A(j,i) 1 Error: Unclassifiable statement at (1) In file matrixoperations.f90:151 REAL,DIMENSION(size(A,1),size(A,2)) :: C 1 Error: Symbol 'c' at (1) already has basic type of REAL In file matrixoperations.f90:161 C(i,j) = A(i,j) + B(i,j) 1 Error: Unclassifiable statement at (1) In file matrixoperations.f90:180 REAL,DIMENSION(size(A,1),size(A,2)) :: C 1 Error: Symbol 'c' at (1) already has basic type of REAL In file matrixoperations.f90:190 C(i,j) = A(i,j) - B(i,j) 1 Error: Unclassifiable statement at (1) In file gibbsnorm.f90:9 use matrix 1 Fatal Error: Can't open module file 'matrix.mod' for reading at (1): No such file or directory In file drive_gibbs.f90:11 use matrix 1 Fatal Error: Can't open module file 'matrix.mod' for reading at (1): No such file or directory
Post Follow-up to this messageFor some reason all the error messages didnot appear in my previous post. Here are they again: In file randlib.f/src/qrgnin.f:48 END 1 Internal Error at (1): TODO: Functions with alternate entry points In file matrixoperations.f90:14 REAL,DIMENSION(size(A,1),size(B,2)) :: Mu 1 Error: Symbol 'mu' at (1) already has basic type of REAL In file matrixoperations.f90:26 Mu(i,j)=0 1 Error: Unclassifiable statement at (1) In file matrixoperations.f90:33 Mu(i,j)=Mu(i,j)+A(i,k)*B(k,j) 1 Error: Unclassifiable statement at (1) In file matrixoperations.f90:54 REAL,DIMENSION(size(A,1),size(A,2)) :: In 1 Error: Symbol 'in' at (1) already has basic type of REAL In file matrixoperations.f90:107 In(i,j)=B(i,j+m) 1 Error: Unclassifiable statement at (1) In file matrixoperations.f90:127 REAL,DIMENSION(size(A,2),size(A,1)) :: B 1 Error: Symbol 'b' at (1) already has basic type of REAL In file matrixoperations.f90:131 B(i,j)=A(j,i) 1 Error: Unclassifiable statement at (1) In file matrixoperations.f90:151 REAL,DIMENSION(size(A,1),size(A,2)) :: C 1 Error: Symbol 'c' at (1) already has basic type of REAL In file matrixoperations.f90:161 C(i,j) = A(i,j) + B(i,j) 1 Error: Unclassifiable statement at (1) In file matrixoperations.f90:180 REAL,DIMENSION(size(A,1),size(A,2)) :: C 1 Error: Symbol 'c' at (1) already has basic type of REAL In file matrixoperations.f90:190 C(i,j) = A(i,j) - B(i,j) 1 Error: Unclassifiable statement at (1) In file gibbsnorm.f90:9 use matrix 1 Fatal Error: Can't open module file 'matrix.mod' for reading at (1): No such file or directory In file drive_gibbs.f90:11 use matrix 1 Fatal Error: Can't open module file 'matrix.mod' for reading at (1): No such file or directory
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.