Fortran How can I fix my Fortran makefile to properly calculate travel times on nodes?

  • Thread starter Thread starter Milentije
  • Start date Start date
  • Tags Tags
    Fortran
AI Thread Summary
The discussion revolves around issues with a Fortran program that is not producing correct calculations due to problems with the findiff2d.o file, which relies on six other subroutines. The user seeks guidance on how to ensure these subroutines are correctly referenced in the makefile. The provided makefile uses Intel Fortran Compiler (ifort) for compiling and linking but contains a typo in the variable name for flags. Suggestions include checking for built-in rules for converting Fortran source files to object files and possibly adding explicit dependencies in the makefile. There is also a hint that if the program compiles but does not run correctly, the issue may lie within the code itself rather than the makefile setup.
Milentije
Messages
47
Reaction score
0
I have made and compiled a programme,but the calculations are not good,because it has somehow problems with findfiff2d.o file(calulates travel-times on nodes).May be the problem is that findiff2d calls 6 other subroutines.So main=>findiff2d=>expand,sort,pass,stensilcs2d,fnod e,fside.So how to tell them to look for these 6 subroutines?
My makefile:
FC= ifort
LD = ifort
FCFLAGS = -O2 -g
LDFLAGS = $(FCFLAGS)
# Executables
main: main.o model.o findiff2d.o findnode.o timenearsrc.o readsrc.o fnode.o expand.o fside.o sort.o pass.o stencils2d.o find.o timeinterp.o timeinterp2d.o timelinear.o time1d.o timeb2d.o timec2d.o blkdat.o fd.par fd.com
$(FC) $(FCLAGS) -o main main.o model.o findiff2d.o findnode.o timenearsrc.o readsrc.o fnode.o expand.o fside.o sort.o pass.o stencils2d.o find.o timeinterp.o timeinterp2d.o timelinear.o time1d.o timeb2d.o timec2d.o blkdat.o

What should I change?
 
Technology news on Phys.org
Is there a built-in rule for converting fortran source files to .o files? You may need to add one. It's been a long time...ah here, for .c files:

%.o : %.c
$(CC) $(CFLAGS) $(INCLUDE) $<

Or else you can make explicit dependencies something like:

main.o: main.cOr maybe that wasn't actually your question. If it all links and doesn't run correctly perhaps your code is wrong? I guess I need clarification...
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...

Similar threads

Replies
2
Views
18K
Replies
4
Views
38K
Back
Top