- #1
- 3,971
- 328
Hello guys, I am trying to run a pretty substantial piece of code, coded in Fortran. There are many many modules (~10) and the dependencies of one module/piece of code on another is quite complex. As I am not the original author of the code, I am still not intimately familiar with every single part of this code. However, I do understand what the code is supposed to do, and how it basically works in general. What I want to do is to modify a portion of the code and tag on another module in order to allow the code to do some extra stuff that I need it to do. I have made the modifications to the code, and have written my new module.
Now I am onto the part where I want to actually run the modified code. And here I run into a problem. In order to run the code originally, all I had to do was type in on my command line in a terminal was "make bulb-new" and then "auto.run", and the code will start running in that terminal. But since I have written a new module, and I need to use a different linear-algebra pack for finding eigen-values and eigen-vectors, I need to modify what the terminal is doing so that it will run the modified code. I think that in order to do this I have to modify the "makefile" file so that the terminal makes all the object files correctly. Sadly, I have never before had to modify a "makefile" so I don't understand very much what is going on.
Here is the makefile:
Anyone know of a good tutorial on make-files and how to write them, and the syntax in them, etc?
It's hard for me to parse what is happening in this document. Essentially what I need to do is incorporate the new linear algebra pack zheev since I am running a different linear-algebra pack for parts of the code (but zheev3 will still be used in parts of the code as well), and then create and include my new module "spincohere.f90", which is only used by the main program "bulb.new" and not any other modules. That should be a pretty quick fix to this makefile right?
Now I am onto the part where I want to actually run the modified code. And here I run into a problem. In order to run the code originally, all I had to do was type in on my command line in a terminal was "make bulb-new" and then "auto.run", and the code will start running in that terminal. But since I have written a new module, and I need to use a different linear-algebra pack for finding eigen-values and eigen-vectors, I need to modify what the terminal is doing so that it will run the modified code. I think that in order to do this I have to modify the "makefile" file so that the terminal makes all the object files correctly. Sadly, I have never before had to modify a "makefile" so I don't understand very much what is going on.
Here is the makefile:
Code:
MACH = gfortran
include makefile.$(MACH)
.DUMMY : init
.DEFAULT : bulb-new
zheev3 :
cd zheevh3-F-1.0; $(MAKE) all F77='$(F77)' F77COMP='$(F77COMP)' FFLAGS='$(FFLAGS)' FOPT='$(FOPT)'
init :
make zheev3
bulb-new : params.o parallel.o helectron.o keep_clocks.o bulb-new.o rannyu.o spline.o splint.o
$(F90PAR) $(LDFLGS) $(FOPT) -o bulb-new bulb-new.o params.o helectron.o keep_clocks.o parallel.o rannyu.o spline.o splint.o zheevh3-F-1.0/*.o $(FLIBS)
bulb-new3 : params.o parallel.o keep_clocks.o bulb-new3.o rannyu.o
$(F90PAR) $(LDFLGS) $(FOPT) -o bulb-new3 bulb-new3.o params.o helectron.o keep_clocks.o parallel.o rannyu.o $(FLIBS)
keep_clocks.o : keep_clocks.F90 params.o
$(F90) $(FFLAGS) $(FOPT) -c keep_clocks.F90
params_numeric.o : params_numeric.F90
$(F90) $(FFLAGS) $(FOPT) -c params_numeric.F90
params.o : params.F90
$(F90) $(FFLAGS) $(FOPT) -c params.F90
helectron.o : helectron.F90
$(F90) $(FFLAGS) $(FOPT) -c helectron.F90
parallel.o : params.o parallel.F90
$(F90) $(FFLAGS) $(FOPT) -c parallel.F90
cdfsave.o : params_numeric.o cdfsave.F90
$(F90) $(FFLAGS) $(FOPT) $(INCNETCDF) -c cdfsave.F90
bulb-new.o : params.o parallel.o keep_clocks.o bulb-new.F90
$(F90) $(FFLAGS) $(FOPT) -c bulb-new.F90
bulb-new3.o : params.o parallel.o keep_clocks.o bulb-new3.F90
$(F90) $(FFLAGS) $(FOPT) -c bulb-new3.F90
rannyu.o : rannyu.f
$(F77) $(F77FLGS) $(FOPT) -c rannyu.f
spline.o : spline.f
$(F77) $(F77FLGS) $(FOPT) -c spline.f
splint.o : splint.f
$(F77) $(F77FLGS) $(FOPT) -c splint.f
plotit : plotit.F90
$(F90) $(FFLAGS) $(FOPT) -o plotit plotit.F90 $(LIBGRACE)
plotdens : params_numeric.o plotdens.F90
$(F90) $(FFLAGS) $(FOPT) -o plotdens plotdens.F90 params_numeric.o $(LIBGRACE) $(LIBCDF)
# needed cdfsave.o in above two lines also for cdf data file
printhvv : params.o printhvv.F90
$(F90) $(FFLAGS) $(FOPT) -o printhvv printhvv.F90 params.o
printhe : params.o printhe.F90
$(F90) $(FFLAGS) $(FOPT) -o printhe printhe.F90 params.o
tar :
tar -cvf laptop.tar cdfsave.F90 keep_clocks.F90 params.F90 bulb-new.F90 rannyu.f plotit.F90 printhvv.F90 printhe.F90 parallel.F90 params_numeric.F90 plotdens.F90 params_numeric.F90 cdfsave.F90 helectron.F90 splint.f spline.f Makefile makefile* bulb*in* *run* zheevh3-F-1.0
clean :
\rm *.o bulb-new
Anyone know of a good tutorial on make-files and how to write them, and the syntax in them, etc?
It's hard for me to parse what is happening in this document. Essentially what I need to do is incorporate the new linear algebra pack zheev since I am running a different linear-algebra pack for parts of the code (but zheev3 will still be used in parts of the code as well), and then create and include my new module "spincohere.f90", which is only used by the main program "bulb.new" and not any other modules. That should be a pretty quick fix to this makefile right?
Last edited: