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

  • Context: Fortran 
  • Thread starter Thread starter Milentije
  • Start date Start date
  • Tags Tags
    Fortran
Click For Summary
SUMMARY

The discussion centers on resolving issues with a Fortran makefile that fails to correctly calculate travel times due to problems with the `findiff2d.o` file, which relies on six subroutines. The user employs the Intel Fortran Compiler (ifort) with optimization flags `-O2` and debugging flag `-g`. The makefile requires adjustments to ensure proper linking of the subroutines and possibly the addition of explicit rules for converting Fortran source files to object files. Clarification on the nature of the errors is also necessary to determine if the issue lies within the code itself.

PREREQUISITES
  • Understanding of Fortran programming and its compilation process
  • Familiarity with makefiles and their structure
  • Knowledge of Intel Fortran Compiler (ifort) and its flags
  • Basic concepts of linking and dependencies in programming
NEXT STEPS
  • Research how to create explicit rules in makefiles for Fortran source files
  • Learn about debugging techniques in Fortran using Intel Fortran Compiler
  • Explore dependency management in makefiles for complex projects
  • Investigate common issues in Fortran code that can lead to incorrect calculations
USEFUL FOR

This discussion is beneficial for Fortran developers, software engineers working with scientific computing, and anyone involved in optimizing makefiles for complex Fortran projects.

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...
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 2 ·
Replies
2
Views
18K
  • · Replies 54 ·
2
Replies
54
Views
5K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
6K
  • · Replies 4 ·
Replies
4
Views
38K
  • · Replies 6 ·
Replies
6
Views
6K
Replies
2
Views
2K
  • · Replies 82 ·
3
Replies
82
Views
29K