Solved

Need help in improving a FORTRAN application

Posted on 2009-04-02
12
524 Views
Last Modified: 2013-11-08
I have been asked to look into a FORTRAN application. I have never learnt this language, but I have to give it my best shot.
Here is what I need to know:
1. What are the best practices followed in FORTRAN? Do's and Don'ts
2. Maintainability: Is there an efficient way to maintain code in FORTRAN?
3. Code optimization: How can I locate dead code or diuplicate code? Are there any commonly available or freely downloadable tools?
4. Any efficient algorithms that I need to know?
5. Is there an URL which will show me all the versions of FORTRAN along with their features?
6. Any other info or link you may think will be useful to me?
0
Comment
Question by:abdriver2000
  • 7
  • 2
12 Comments
 
LVL 50

Expert Comment

by:Lowfatspread
ID: 24052316
wikipedia gives a brief overview of the language and history...

to advance further with this you need to be more specific...

what machine/os environments are you dealing with?
what are the general usages for the programs you will be maintaining?

 
0
 
LVL 5

Accepted Solution

by:
dcesari earned 50 total points
ID: 24057500
I agree that some more information about the purpose of your work would help, anyway, I suppose you are going to write code in the fortran 90/95 standard, not the obsolete fortran 77 -this can be viewed already as the first suggestion- since good free compilers are available also for f95 (gfortran, g95);

For point 1 I can suggest a couple of links:

http://www.metoffice.gov.uk/research/nwp/numerical/fortran90/f90_standards.html
http://www.mad.zmaw.de/fileadmin/extern/IMDI/WP2b_coding_rules.ps

which give mainly estethical suggestions about how to write readable Fortran code, probably not everything should be taken literally, but you can learn something useful.

For a more advanced approach, I suggest the link about writing Fortran code in an object-oriented way:

http://www.cs.rpi.edu/~szymansk/oof90.html

and, if you can read Italian, though I am afraid not, then a link of my own:

http://www.webalice.it/o.drofa/davide/f90/slide/

The most basic suggestion for writing good Fortran 95 code is: use modules!
0
 
LVL 5

Assisted Solution

by:dcesari
dcesari earned 50 total points
ID: 24057587
Concerning point n. 2, I have experience in using automake/autoconf also for managing Fortran projects, but this makes sense mainly in an Unix-like environment, I can give further information if needed; for a simpler and more hand-made approach using makefiles, see again my page, this time in English:

http://www.webalice.it/o.drofa/davide/fortran_corner_en.html

at the Makefile-fortran section.

For point n. 3 I suggest compiling using profiling options (how to do it depends on compiler, but most compilers do have these options), in order to have runtime information about how many times every subroutine is used and how much it costs in terms of computation time; this practice is more or less the same for Fortran as for any other compiled language, such as C or C++.

Point n. 4: this really depends on the purpose of your program
Point n. 5 depends on the platform and operating system you are using, unless you mean the existing fortran standards; concerning fortran standards I can say the following:

F77: old standard not suitable for modern code, but still many legacy code exists written in this standard
F90: a big change with respect to F77, allows more readable and structured code (free format, MODULES)
F95: very little changes with respect to F90, most compilers including the free ones support the F95 additional features, so F90 and F95 are almost synonims nowadays
F2003: up to now it is mainly a standard on paper, but some commercial compilers which partially implement the standard are starting to appear, I suggest you to neglect for starting

In general the standards are backward compatible, apart from very obsolete features, so a F95 compiler can compile also most existing F77 code.
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 2

Author Comment

by:abdriver2000
ID: 24057874
This is a robotic application. The application provides the coordinates for the robotic arm to pickup and place components on the shop floor.
0
 
LVL 5

Expert Comment

by:dcesari
ID: 24058229
Well I have not much experience in this field, but I guess this may involve computations in 3d space, use of transformation matrices and so on...

If so, F90/F95 have their own optimized intrinsic functions for very basic linear algebra computations (see e.g. dot_product() and matmul() ), for something more advanced but still of general use, such as more complex linear algebra, matrix inversion and so on, you probably should have a look to freely available packages like blas and lapack before writing your own routines; for statistical computation there is not much freely available for Fortran, the commercial IMSL libraries are the most commonly used, as far as I know.

I forgot to say, if you need a manual on Fortran, try to go on the web page of a good commercial compiler (see links in the suggested wikipedia page), usually the reference manuals are freely
downloadable.
0
 
LVL 5

Expert Comment

by:dcesari
ID: 24165426
If you need more specific answers, please reformulate the questions with more details on the basis of the answers given; in my opinion, with the elements provided, it is difficult to give more specific answers, thanks.

0
 
LVL 5

Expert Comment

by:dcesari
ID: 24165466
If you need more specific answers, please reformulate the questions with more details on the basis of the answers given; in my opinion, with the elements provided, it is difficult to give more specific answers, thanks.
0
 
LVL 5

Expert Comment

by:dcesari
ID: 24195351
I do not know whether I am the one who has to decide about this, from my point of view, the comments I made with ID: 24057500 and ID: 24057587 provide an answer suitable to the request and the information provided, so I would go for point #3, but I agree to answer further on the same thread if the Author can provide more information about his application and OS/compiler/platform.

Thanks, dcesari

0
 
LVL 2

Author Comment

by:abdriver2000
ID: 24227182
The questions that were raised have really not been answered here. The problem here is I really do not have much info than what is already provided. I don't see a way to take this forward until I get more info from my seniors.

I am ok with awarding points to dcesari for his/her efforts.
0
 
LVL 5

Expert Comment

by:dcesari
ID: 24241540
Thank you, I will be happy to help on this topic in the future if needed.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question