LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-24-2010, 03:31 PM   #1
pimanlives
LQ Newbie
 
Registered: Feb 2010
Distribution: Ubuntu 9.10 (Karmic)
Posts: 5

Rep: Reputation: 0
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.
 
Old 03-24-2010, 04:27 PM   #2
jamescondron
Member
 
Registered: Jul 2007
Location: Scunthorpe, UK
Distribution: Ubuntu 8.10; Gentoo; Debian Lenny
Posts: 961

Rep: Reputation: 70
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.
 
Old 03-24-2010, 05:13 PM   #3
makyo
Member
 
Registered: Aug 2006
Location: Saint Paul, MN, USA
Distribution: {Free,Open}BSD, CentOS, Debian, Fedora, Solaris, SuSE
Posts: 735

Rep: Reputation: 76
Hi.

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.

Good luck ... cheers, makyo
 
Old 03-25-2010, 03:32 PM   #4
pimanlives
LQ Newbie
 
Registered: Feb 2010
Distribution: Ubuntu 9.10 (Karmic)
Posts: 5

Original Poster
Rep: Reputation: 0
Additional Information

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.

Code:
stat("tabulated.f", {st_mode=S_IFREG|0600, st_size=7145, ...}) = 0
pipe([3, 4])                            = 0
close(4)                                = 0
fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
rt_sigprocmask(SIG_BLOCK, [HUP INT QUIT TERM XCPU XFSZ], NULL, 8) = 0
vfork()                                 = 30884
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 30884
--- SIGCHLD (Child exited) @ 0 (0) ---
rt_sigreturn(0xffffffff)                = 30884
rt_sigprocmask(SIG_BLOCK, [HUP INT QUIT TERM XCPU XFSZ], NULL, 8) = 0

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.

Thanks,
Joe
 
Old 03-25-2010, 04:28 PM   #5
makyo
Member
 
Registered: Aug 2006
Location: Saint Paul, MN, USA
Distribution: {Free,Open}BSD, CentOS, Debian, Fedora, Solaris, SuSE
Posts: 735

Rep: Reputation: 76
Hi.

I downloaded towhee-6.2.7 from http://towhee.sourceforge.net/

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.

Best wishes ... cheers, makyo
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems executing fortran compiled executable dolfakar Linux - Newbie 4 08-27-2009 11:48 AM
compile fortran using g77 into executable binary image tuas Programming 2 11-21-2008 10:03 AM
C Fortran linking problem hhegab Fedora 2 12-06-2005 06:16 PM
C-Fortran linking problem hhegab Fedora 0 09-24-2005 03:03 AM
C-Fortran linking on FC4 hhegab Programming 2 09-24-2005 02:44 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration