Solved

Need help in improving a FORTRAN application

Posted on 2009-04-02
12
481 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 2

Author Comment

by:abdriver2000
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 5

Expert Comment

by:dcesari
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thank you, I will be happy to help on this topic in the future if needed.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A short article about a problem I had getting the GPS LocationListener working.
This is about my first experience with programming Arduino.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

728 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now