- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have downloaded and installed compiler,following the instructions but..The program mt3,I am trying to compile and debug is directory of 11 files,written in FORTRAN77.How to do it?
milenko@hp6830s:~$ source /opt/intel/Compiler/11.1/072/bin/ifortvars.sh intel64
milenko@hp6830s:~$ which fort
milenko@hp6830s:~$ which ifort
/opt/intel/Compiler/11.1/072/bin/intel64/ifort
How should I link comiler and mt3 program?
milenko@hp6830s:~$ source /opt/intel/Compiler/11.1/072/bin/ifortvars.sh intel64
milenko@hp6830s:~$ which fort
milenko@hp6830s:~$ which ifort
/opt/intel/Compiler/11.1/072/bin/intel64/ifort
How should I link comiler and mt3 program?
Link Copied
13 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The standard Unix/Linux way:
ifort a.f b.f c.f d.f e.f f.f g.f h.f i.f j.f k.f
./a.out
if the eleven files are a.f,..., k.f
ifort a.f b.f c.f d.f e.f f.f g.f h.f i.f j.f k.f
./a.out
if the eleven files are a.f,..., k.f
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well besides that,I have 3 .dat files.How to invoke them?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OPEN is fortran 77 syntax. Any non-standard scheme for opening the files is up to you to discover. If you want help, you'll need to give us more detail.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I know for OPEN.What I thought is a makefile,analogy to gcc.Any links would be great to see examples.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am giving one detail more form my makefile(gcc):
# Executables
mt1: mt1.o indat.o re2.o defpol12.o boufld.o koef3.o gaussr.o sflfld.o koef3rhs.o gaussrrhs.o surfce.o d2.dat fdat.dat fres.dat fun.dat
$(F77) $(FLAGS) -o mt1 mt1.o indat.o re2.o defpol12.o boufld.o koef3.o gaussr.o sflfld.o koef3rhs.o gaussrrhs.o surfce.o
How should I presnt this to Intel 11.1 compiler?
# Executables
mt1: mt1.o indat.o re2.o defpol12.o boufld.o koef3.o gaussr.o sflfld.o koef3rhs.o gaussrrhs.o surfce.o d2.dat fdat.dat fres.dat fun.dat
$(F77) $(FLAGS) -o mt1 mt1.o indat.o re2.o defpol12.o boufld.o koef3.o gaussr.o sflfld.o koef3rhs.o gaussrrhs.o surfce.o
How should I presnt this to Intel 11.1 compiler?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In your makefile, insert this line near the top:
F77 = ifort
F77 = ifort
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What about flags?Are they really important?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
At this stage, probably not, especially if the code was brought over from a different of machine/compiler combination. Look up the Intel users guide and choose flags suitable for debugging: -g and -traceback. Once you get the program working, record the results, raise the optimization level, and see if the new results are close enough.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks mecej4.
I still have multiple main problem
indat.f:(.text+0x0): multiple definition of `MAIN__'
mt3.o:mt3.f:(.text+0x0): first defined here
Changed compiler flags but no results.
I still have multiple main problem
indat.f:(.text+0x0): multiple definition of `MAIN__'
mt3.o:mt3.f:(.text+0x0): first defined here
Changed compiler flags but no results.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There isn't any compiler flag to ignore a second main program. If you mean for one of them to be ignored, you'll have to remove it in source code, e.g. by pre-processor conditional compilation directives.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It appears that you did not use the makefile that you posted an extract from earlier. The line for mt1 does not show both indat.o and mt3.o.
A Fortran program may consist of (i) exactly one main program routine, plus (ii) zero or more subroutines plus (iii) zero or more function subprograms (setting aside (iv) BLOCKDATA, COMMON blocks, etc).
You are trying to use two main program routines in one program. If you don't mind the analogy, it is similar to having two bicycles. You can only ride one of them at one time.
You have to make the selection of the main program yourself. Compiler switches and makefiles will not do that selection for you.
You will probably benefit from reading introductory textbooks on programming.
A Fortran program may consist of (i) exactly one main program routine, plus (ii) zero or more subroutines plus (iii) zero or more function subprograms (setting aside (iv) BLOCKDATA, COMMON blocks, etc).
You are trying to use two main program routines in one program. If you don't mind the analogy, it is similar to having two bicycles. You can only ride one of them at one time.
You have to make the selection of the main program yourself. Compiler switches and makefiles will not do that selection for you.
You will probably benefit from reading introductory textbooks on programming.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks.
But I know that only one main is allowed,it should be mt3.Actually I am calling subroutine indat from mt3(it should give me conductivity map).Look at my makefile:
INTEL_MKL = /opt/intel/Compiler/11.1/072/mkl
F77 = ifort
LD = ifort
CPPFLAGS = -C -traditional $(DFLAGS) -I$(INTEL_INC)
FCFLAGS = $(DFLAGS) -I$(INTEL_INC) -O2 -g -traceback
LDFLAGS = $(FCFLAGS)
LIBS = -L$(INTEL_LIB) -lmkl_intel_lp64
OBJECTS_ARCHITECTURE = machine_intel.o
# Executables
mt3: mt3.o indat.o iaa.o re2.o defpol12.o boufld.o koef3.o gaussr.o sflfld.o koef3rhs.o gaussrrhs.o surfce.o d2.dat fdat.dat fres.dat fun.dat
$(F77) $(FLAGS) -o mt3 mt3.o indat.o iaa.o re2.o defpol12.o boufld.o koef3.o gaussr.o sflfld.o koef3rhs.o gaussrrhs.o surfce.o
What is wrong?
But I know that only one main is allowed,it should be mt3.Actually I am calling subroutine indat from mt3(it should give me conductivity map).Look at my makefile:
INTEL_MKL = /opt/intel/Compiler/11.1/072/mkl
F77 = ifort
LD = ifort
CPPFLAGS = -C -traditional $(DFLAGS) -I$(INTEL_INC)
FCFLAGS = $(DFLAGS) -I$(INTEL_INC) -O2 -g -traceback
LDFLAGS = $(FCFLAGS)
LIBS = -L$(INTEL_LIB) -lmkl_intel_lp64
OBJECTS_ARCHITECTURE = machine_intel.o
# Executables
mt3: mt3.o indat.o iaa.o re2.o defpol12.o boufld.o koef3.o gaussr.o sflfld.o koef3rhs.o gaussrrhs.o surfce.o d2.dat fdat.dat fres.dat fun.dat
$(F77) $(FLAGS) -o mt3 mt3.o indat.o iaa.o re2.o defpol12.o boufld.o koef3.o gaussr.o sflfld.o koef3rhs.o gaussrrhs.o surfce.o
What is wrong?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mangage to solve the problem.
Just get rid of one END!
Just get rid of one END!

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page