Linking of fortran executable taking exorbitant amounts of time
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Linking of fortran executable taking exorbitant amounts of time
The issue I am currently facing is more of an annoyance / curiosity, and it may not even be a problem, but it sure feels like one.
Background: I am becoming a computational chemist (grad school begins in the fall) and the code I run is all in fortran. I am currently compiling with gfortran.
When I compile the code (on a box running ubuntu server), everything appears to compile fine, but the linking stage is taking five to ten minutes.
I ran the time command while making it and got the following results.
(I touched suijtab.f, everything else has already been compiled)
Quote:
time make
gfortran -c -O3 -fomit-frame-pointer -finline-functions -ffast-math suijtab.f
Linking testCompile ...
done
real 5m35.037s
user 0m15.050s
sys 0m10.460s
I just don't understand why it is taking 5 minutes of real time if it only takes 10 - 15 sec of system time?
I was hoping someone with more experience could shed some light or point me in the right direction. My initial forays proved fruitless, but that could have to do with my search queries being somewhat vague.
I don't know the answer through experience, but a failing hard drive can cause this problem in similar contexts; where reads/writes are significantly slowed down.
You might try attaching the compilation to 'strace' and seeing on what calls it is hanging.
If looking at the possible disk issue as jamescondron suggested does not seem like the problem, tell us the name of the code and where you got it.
I think there are some chemists out there who might stop by with suggestions. The group I was in many years ago did some support for chemistry (among other disciplines). The names Gaussian and GAMESS are a few codes that come to mind, for example. If the code is small enough and easily accessible, others may have the time and resources to try to duplicate the problem.
Unfortunately the computer is somewhat remote. When I head over tomorrow I will discern what I can about hard drive issues.
I have run strace (which I had not known about, thank you) and got the following as the spot where it hung, the "wait4 (-1," showed up and then it well, waited I guess. I am not sure if that command was from make or from strace though.
Two other things I found while stretching my brain:
1: I compiled the exact same code (it is on an nfs share, so exact same code) on a different machine in the cluster and it took 5 to 10 seconds rather than minutes. Which to me at least suggests hardware difficulties of some sort.
2: As I was compiling/linking on the original computer the entire system really started hanging, so after a quick "top" I saw that ld was taking up nearly all of the RAM the system had available, about 1 gig. I really don't understand why linking the code would take over a gig because the text for the code only ends up begin about 5M and the compiled product is under a meg.
The simulation code I am running is a pseudo open source molecular simulation suite, the open source version is Towhee-MCCCS, but my advisor was from the group and we are using the most current release.
I appreciate the help, I have a solution now, compile on a different computer , but I am going to keep working on why this happening. If you have any more tips I would love to hear about them.
Did the usual tar, ./configure, make. The compile took perhaps 5 minutes. I then touched one of the object files (as you did), and timed the make -- essentially the relink:
Code:
real 0m1.518s
user 0m0.376s
sys 0m0.304s
My working environment is:
Code:
OS, ker|rel, machine: Linux, 2.6.26-2-amd64, x86_64
Distribution : Debian GNU/Linux 5.0
gfortran GNU Fortran (Debian 4.3.2-1.1) 4.3.2
Although this was not the latest version of the code, it seemed to compile and link as I would expect. I did not run any of the tests. This machine has 3 GB memory.
So, no tips, just a kind of corroboration that you probably are right to be suspicious.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.