포트란90 고수님께 부탁드립니다.-인스톨문제
글쓴이: phyo / 작성시간: 수, 2005/02/09 - 12:34오후
제가 프로그램을 인스톨할려고 make 했는데, 도중 에러가 났습니다. (레드헷 9)
PGF90-S-0038-Symbol, malloc, has not been explicitly declared
(../src/ccmlsm_share/getmen.F)
포트란 프로그램인 getmen.F는 다음과 같습니다. 간단한 시뮬레이션 모델입니다. 물론 많은 파일 중 하나입니다.
#include <misc.h> #ifndef WORDSIZE #define WORDSIZE 8 #endif subroutine getmem(calledby,nwords,address) C----------------------------------------------------------------------- C C Interface routine for dynamic memory allocation. Replaces automatic C arrays on Cray. Isolates machine-specific code for portable model. C C---------------------------Code history-------------------------------- C C Original version: J. Rosinski April, 1993 C T. Acker, March 1996 C C----------------------------------------------------------------------- c c $Id: getmem.F,v 1.4 1998/03/04 23:56:07 jet Exp $ c $Author: jet $ c C----------------------------------------------------------------------- implicit none C----------------------------------------------------------------------- #if ( defined SPMD ) #include <hpstats.h> #endif C-----------------------------Arguments--------------------------------- C C Input C character*(*) calledby integer nwords ! Number of machine words needed C C Output C pointer (address,space) ! Pointer to dynamically allocated space real space C C--------------------------Local Variables------------------------------ C #if ( defined CRAY ) || ( defined T3D ) || ( defined T3E ) integer ier ! Error return code #endif #if ( defined SUN ) || ( defined RS6K ) integer malloc external malloc #endif C C----------------------------------------------------------------------- C #if ( defined CRAY ) || ( defined T3D ) || ( defined T3E ) CMIC$ GUARD call hpalloc(address,nwords,ier,0) CMIC$ END GUARD if (ier.ne.0) then write(6,*)'GETMEM from ',calledby,': Bad return code = ',ier if (ier.eq.-1) then write(6,*) nwords,' is not between 1 and 2**31' else if (ier.eq.-2) then write(6,*)'No more memory available' end if call endrun end if #endif #if ( defined RS6K ) address = malloc(%val(WORDSIZE*nwords)) if (address.eq.0) then write(6,*)'GETMEM from ',calledby,' Cannot malloc ',nwords, $ ' words' call endrun end if #endif #if ( defined SUN ) || ( defined SGI ) || ( defined HP ) #if ( ! defined SPMD ) CCCC$DIR CRITICAL_SECTION #endif address = malloc(WORDSIZE*nwords) if (address.eq.0) then write(6,*)'GETMEM from ',calledby,' Cannot malloc ',nwords, $ ' words' call endrun end if #if ( ! defined SPMD ) CCCC$DIR END_CRITICAL_SECTION #endif #endif #if ( defined SPMD ) if (chkheap) then if (address.lt.smallest) smallest = address if (address.gt.biggest) biggest = address c c The following computation assumes byte-addressable machine c cursize = (biggest - smallest) + nwords*8 if (cursize.gt.maxsize) then maxsize = cursize write(6,*)' New heap maximum =',maxsize, $ ' bytes from ',calledby end if end if c c Initialize heap memory to Infinity c c write(6,*)'First,last addresses from getmem:',address, c $ address + nwords*8 c if (mod(address,8).ne.0) then c write(6,*)'GETMEM: called by ',calledby,' not on 8-byte bdy' c stop c end if c commented out setbits call in SPMD branch...saves 10 sec/day c on 32-nodes of SPP c call setbits(address,nwords) #endif C return C end
Forums:
답변은 아니고요... F90 코드는 이렇게 생겼나요? 전처리 명령어에
답변은 아니고요... F90 코드는 이렇게 생겼나요?
전처리 명령어에 포인터에 malloc까지... :shock:
저는 F77만 써봤는지라 신기해서 끄적거려 봤습니다. ^^;
옛날에 F77 대충 알고 있었는데 F90 코드를 보니까 전혀 적응이 안
옛날에 F77 대충 알고 있었는데 F90 코드를 보니까 전혀 적응이 안 되네요. 많이 달라진 듯... :)
- 토끼군
댓글 달기