CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Big loop problem of fortran

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 28, 2004, 23:34
Default Big loop problem of fortran
  #1
Wen Long
Guest
 
Posts: n/a
Hi, friends:

I'd like to get your advice on a mysterious problem. I have a code running ocean wave boundary layer simulation. And I'm running for 1-day realization, with time step about 0.1 sec, which I have about 864000 time steps to march in a big loop.

It runs okay on my linux PC but pretty slow. Then I turned to an SGI origion 300 with 4 CPU's in order to get results faster. Problem being it stops somewhere around 100,000 timesteps, without any error info.

I suspected it might be size of integer has a limit for loop index?

Please help me, thanks a lot

Wen

  Reply With Quote

Old   March 29, 2004, 08:01
Default Re: Big loop problem of fortran
  #2
dominik
Guest
 
Posts: n/a
first of all if your code cannot take adventage of multiprocessor machine your code will not be faster.

secondly, it can be many things... checking sizes/ranges of floating/int variables is good to start with

then the fortran compiler is differnt i guess. if e.g. you run your code on your pc using gnu see if gnu is not available on SGI too.

then, write some log file on the fly to debug easier. success!
  Reply With Quote

Old   March 29, 2004, 08:48
Default Re: Big loop problem of fortran
  #3
Praveen
Guest
 
Posts: n/a
I have experienced situations when my codes run on linux but doesnt on SGI. In all cases there was a bug in the code. Check to see that you are not exceeding your array sizes.
  Reply With Quote

Old   March 29, 2004, 11:14
Default Re: Big loop problem of fortran
  #4
Jarmo Monttinen
Guest
 
Posts: n/a
Or this could be a memory issue, ie. if you use MPI you may need to define some memory parameters. The only way I can see this being the problem though is if you save a bunch of data each time-step, some of that in the memory. But it's more likely a bug, as all compilers are slightly different. A quick check could be to compile with -O3 for maximum optimization, this has sometimes helped me to discover a bug as the optimized code does something completely different than it is supposed to do.

-- Jarmo
  Reply With Quote

Old   March 29, 2004, 11:30
Default Re: Big loop problem of fortran
  #5
Wen Long
Guest
 
Posts: n/a
Hi, dominik,Praveen and Jarmo:

Thanks a lot,

I did find a array bound exceeding bug after using both -O3 and -check_bounds option in compile, and fixed it. But the problem still persists. It's usual f77 code, no MPI things are used.

One thing I'm not familiar with SGI is that, when I run the code, the gr_top command will show me that 4 copies/threads of the code are running at the same time, and there is one at the status of sleep, when the code becomes idle. Anything wrong with the 4 CPU?

Thanks again,

wen
  Reply With Quote

Old   March 29, 2004, 11:34
Default Re: Big loop problem of fortran
  #6
Wen Long
Guest
 
Posts: n/a
Thanks, dominik:

I found g77 on that machine too, and trying that out today.

Wen
  Reply With Quote

Old   March 29, 2004, 13:18
Default Re: Big loop problem of fortran
  #7
Jarmo Monttinen
Guest
 
Posts: n/a
Going back to Dominik's message:

How is the code parallelized if you are not using MPI? This might be the problem.

See if it runs with just one processor on the SGI.

-- Jarmo
  Reply With Quote

Old   March 30, 2004, 02:34
Default Re: Big loop problem of fortran
  #8
matej
Guest
 
Posts: n/a
Wen,

I guess you are using the 'apo' (autoparallelisation) switch to make your code parallel??

If it is the case, you might need to use some directives is a source code. The apo is not that clever as it sounds.

For finding another problems try ftncheck program for finding errors in the code. It's saving me hours every day. http://www.dsm.fordham.edu/~ftnchek/

Matej
  Reply With Quote

Old   April 1, 2004, 11:48
Default Re: Big loop problem of fortran(monster found)
  #9
Wen Long
Guest
 
Posts: n/a
Thanks, all your inputs add to my experience of debugging.

After careful debugging, I found the bug. I have a variable t accumulating time with very little step, like t=t+dt, while dt=1.e-4(sec) or so.. Turns out that when t is sufficiently large, say 1/3 day, then the rounding error of float addition will actually do nothing to t, which I used to jump out of loop, since t never changes beyond 1/3 day, it goes like a dead loop spinning. Ha, fancy that,

Wen

  Reply With Quote

Old   April 1, 2004, 12:38
Default Re: Big loop problem of fortran(monster found)
  #10
Jarmo Monttinen
Guest
 
Posts: n/a
Don't you just love computers

But, congratulations for finding it. That didn't even take that long! I guess this is a good example why we should stick with double precision.

-- Jarmo
  Reply With Quote

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
A big problem about scour around pile bojiezhang FLOW-3D 27 July 3, 2012 16:53
flow driven problem - fortran Matjaz CFX 4 April 11, 2011 13:52
the big problem about flow3dMP bojiezhang FLOW-3D 1 April 21, 2010 19:12
Problem with the FORTRAN compiler Eduardo CFX 2 December 2, 2009 16:28
Fortran Problem MM Main CFD Forum 2 April 18, 2007 14:59


All times are GMT -4. The time now is 11:40.