分页: 1 / 1

求教:在ubuntu9.04下编译fortran程序时出现问题

发表于 : 2009-11-03 16:04
卷卷毛儿
我在ubuntu9.04下编译一个fortran程序,这个程序是网上下载的,它的makefile默认的编译器是g77,同时还提供了其他的编译选择,我先用默认的编译,出错了,然后我将FC改为ifort,还是不行,哪位大侠告诉我该怎么办啊?

另外,我希望这个程序运行时能给出每一步迭代所花的时间,这个貌似也要改makefile,可我不知道怎么改

下面是我的makefile部分内容,拜托好心人帮我看看,先谢谢了

#----------------------Linux with g77 -------- --------------------------------

FC = g77
FFLAGS = -c -u -O
FFLAGSundecl = -c -O
FFLAGSslamc1 = -c
TIMEIT = timeit_linux
LDFLAGS =

#----------------------- Linux pgf77 ------------------------------------------
# pgf77 = Portland Group compiler (http://www.pgroup.com)

#FC = pgf77
#FFLAGS = -c -fast
#FFLAGSundecl = -c -fast
#FFLAGSslamc1 = -c
#LDFLAGS = -Bstatic
#TIMEIT = timeit_linux

#----------------------- Linux ifc --------------------------------------------
# ifc = intel fortran compiler

#FC = ifc
#FFLAGS = -c -O3
#FFLAGSundecl = -c -O3
#FFLAGSslamc1 = -c
#LDFLAGS = -Vaxlib
#TIMEIT = timeit_linux

#---------------------- OSF on Compaq alpha -----------------------------------

#FC = f77
#FFLAGS = -c -fast
#FFLAGSundecl = -c -fast
#FFLAGSslamc1 = -c
#LDFLAGS =
#TIMEIT = timeit_osf

#------------------------- Sun fortran ----------------------------------------

#FC = f77
#FFLAGS = -fast -u
#FFLAGSundecl = -fast -O3 -c
#FFLAGSslamc1 = -c
#LDFLAGS = -fast -O3
#TIMEIT = timeit_sun

#---------------------- AIX fortran on RS6000 ---------------------------------

#FC = xlf
#FFLAGS = -O
#FFLAGSundecl = -O -c
#FFLAGSslamc1 = -c
#LDFLAGS = -O
#TIMEIT = timeit_ibm6000

#------------------------ SGI IRIX on R4000 -----------------------------------
# -mips2 option generates code using the MIPS 2 instruction set [R4000 cpu]

#FC = f77
#FFLAGS = -u -mips2 -O2
#FFLAGSundecl = -mips2 -O2 -c
#FFLAGSslamc1 = -c
#LDFLAGS = -mips2 -O2
#TIMEIT = timeit_sgi

#--------- SGI IRIX on R5000, R8000, or R10000 systems ------------------------
# -mips4 option generates code using the MIPS IV instruction set [supported on
# R5000, R8000, and R10000 cpus]

#FC = f77
#FFLAGS = -u -mips4 -O2
#FFLAGSundecl = -mips4 -O2 -c
#FFLAGSslamc1 = -c
#LDFLAGS = -mips4 -O2
#TIMEIT = timeit_sgi

#----------------------- HP AUX -----------------------------------------------

#FC = f77
#FFLAGS = -O3 -c
#FFLAGSundecl = -O3
#FFLAGSslamc1 = -c
#LDFLAGS =
#TIMEIT = timeit_hp

Re: 求教:在ubuntu9.04下编译fortran程序时出现问题

发表于 : 2009-11-03 17:14
pisit
错误提示贴上来。

Re: 求教:在ubuntu9.04下编译fortran程序时出现问题

发表于 : 2009-11-03 21:33
卷卷毛儿
楼上的大侠,我刚才发的那个makefile是一个较低版本的,现在我才发现那个软件又出了个新的版本,这个软件是用fortran90编写的,它的makefile是这样的:


#******************************************************************************
#
# Compiler and options
#
# FC specifies the fortran 90 compiler
# FFLAGS are compilation options
# LFLAGS are flags for linking
#
#############################################################################
# Examples

# 1. g95 compiler
# sp + no MKL + no OpenMP + no MPI

# define the following:
PRECISION = dp
CXFFTMKL.f = cxfft3_mkl_fake.f90
CXFFTMKL.o = cxfft3_mkl_fake.o
MKLM =
DOMP =
OPENMP =
MPI.f = mpi_fake.f90
MPI.o = mpi_fake.o
DMPI =
FC = g95
FFLAGS = -O2
LFLAGS =

#-------------------------------------------------------------------

# 2. gfortran compiler
# sp + no MKL + OpenMP + no MPI

# define the following:
#PRECISION = sp
#CXFFTMKL.f = cxfft3_mkl_fake.f90
#CXFFTMKL.o = cxfft3_mkl_fake.o
#MKLM =
#DOMP =
#OPENMP = -fopenmp
#MPI.f = mpi_fake.f90
#MPI.o = mpi_fake.o
#DMPI =
#FC = gfortran
#FFLAGS = -O2
#LFLAGS =

#----------------------------------------------------------------------
# 3. NAG f95 compiler
# sp + no MKL + no OpenMP + no MPI

# define the following:
#PRECISION = sp
#CXFFTMKL.f = cxfft3_mkl_fake.f90
#CXFFTMKL.o = cxfft3_mkl_fake.o
#MKLM =
#DOMP =
#OPENMP =
#MPI.f = mpi_fake.f90
#MPI.o = mpi_fake.o
#DMPI =
#FC = f95
#FFLAGS = -O2
#LFLAGS =

#----------------------------------------------------------------------
# 4. ifort compiler
# sp + no MKL + no OpenMP + no MPI,

# define the following:
#PRECISION = sp
#CXFFTMKL.f = cxfft3_mkl_fake.f90
#CXFFTMKL.o = cxfft3_mkl_fake.o
#MKLM =
#DOMP =
#OPENMP =
#MPI.f = mpi_fake.f90
#MPI.o = mpi_fake.o
#DMPI =
#FC = ifort
#FFLAGS = -O2
#LFLAGS =

#----------------------------------------------------------------------
# 5. ifort compiler
# sp + MKL + no OpenMP + no MPI,

# define the following:
#PRECISION = sp
#CXFFTMKL.f = $(MKL_f)
#CXFFTMKL.o = $(MKL_o)
#MKLM = $(MKL_m)
#DOMP =
#OPENMP =
#MPI.f = mpi_fake.f90
#MPI.o = mpi_fake.o
#DMPI =
#FC = ifort
#FFLAGS = -O2
#LFLAGS =

#----------------------------------------------------------------------
# 6. ifort compiler
# sp + no MKL + OpenMP + no MPI,

# define the following:
#PRECISION = sp
#CXFFTMKL.f = cxfft3_mkl_fake.f90
#CXFFTMKL.o = cxfft3_mkl_fake.o
#MKLM =
#DOMP = -Dopenmp
#OPENMP = -openmp
#MPI.f = mpi_fake.f90
#MPI.o = mpi_fake.o
#DMPI =
#FC = ifort
#FFLAGS = -O2
#LFLAGS =

#----------------------------------------------------------------------
# 7. ifort compiler
# sp + MKL + OpenMP + no MPI

# following definitions work for artemis
# before compiling, type
# module purge
# module load intel-mkl

# define the following:
#PRECISION = sp
#CXFFTMKL.f = $(MKL_f)
#CXFFTMKL.o = $(MKL_o)
#MKLM = $(MKL_m)
#DOMP = -Dopenmp
#OPENMP = -openmp
#MPI.f = $(MPI_f)
#MPI.o = $(MPI_o)
#DMPI =
#FC = ifort
#FFLAGS = -O2
#LFLAGS = -traceback -lmkl_em64t -lmkl_intel_thread -lmkl_core \
# -lguide -lpthread -lmkl_intel_lp64

#----------------------------------------------------------------------
# 8. ifort compiler (via mpif90)
# sp + MKL + OpenMP + MPI

# following definitions work for artemis
# before compiling, type
# module purge
# module load intel-mkl openmpi

# define the following:
#PRECISION = sp
#CXFFTMKL.f = $(MKL_f)
#CXFFTMKL.o = $(MKL_o)
#MKLM = $(MKL_m)
#DOMP = -Dopenmp
#OPENMP = -openmp
#MPI.f = $(MPI_f)
#MPI.o = $(MPI_o)
#DMPI = -Dmpi
#FC = mpif90
#FFLAGS = -O2
#LFLAGS = -traceback -lmkl_em64t -lmkl_intel_thread -lmkl_core \
# -lguide -lpthread -lmkl_intel_lp64 -lmpi

#******************************************************************************

我把FC用g95,gfortran,g95,ifort都试过了,但是都出错,比如我用g95时,出现如下:

cpp -P -traditional-cpp -Ddp ddprecision.f90 \
ddprecision_cpp.f90
g95 -c -O2 ddprecision_cpp.f90 -o ddprecision.o
make: g95: Command not found
make: *** [ddprecision.mod] Error 127

Re: 求教:在ubuntu9.04下编译fortran程序时出现问题

发表于 : 2009-11-03 21:34
卷卷毛儿
拜托大侠耐心点帮我看看,我都快急死了