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

cpu time

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 19, 1998, 12:51
Default cpu time
  #1
Gengsheng Wei
Guest
 
Posts: n/a
Dear sirs,

I encountered a strange problem when I made my CFD code using FORTRAN.

I have many subroutines in my code. In order to avoid defining arrays repeatedly in the subroutines, I made a file to define all the arrays used in the code, comn.f. In each subroutine, I only use INCLUDE to define the arrays like:

subroutine momentum include 'comn.f'

I found if I increase the number of arrays in comn.f but do not change any other things in the code, the CPU time increases significantly.

I wonder if the way I define array is expensive in CPU. I wonder if you would please give me explainations and suggestions.

Thanks you very much.

G. Wei
  Reply With Quote

Old   November 19, 1998, 15:22
Default Re: cpu time
  #2
Clifford Arnold
Guest
 
Posts: n/a
There are many possible expainations for this, and it is likely that you are experiencing more than one of the possible reasons. I assume you are referring to execution time of the simulation, and not compile time. If the issue is compiler time, then who cares (I don't).

Here are a few ideas: (1) The number of dimensions in your arrays. The best would be one dimensional arrays. There are a number of additional index calculations when using many array indicies. Of course a three dimensional array can be manipulated as a one-dimensional array. (2) paging due to address space being larger than physical memory. The more array space, the more likely you are paging between memory and disk (3) The order of accessing the array

Do l =

Do m =

A(m,l,k) = ...

is faster than

Do l =

Do m =

A(k,l,m) = ...

If you are paging, the difference in these two formulations is dramatic.

(4) size of the address space that is frequently accessed. The optimimum is to have the size of frequenlty accessed data be smaller than your cache, and certainly smaller than your physical memory. There are ingenious ways to layout arrays so as to accomplish this. The old fashion techniques for vector computers, and computers with multiple levels of memory are very applicable here, and can speed performance on today's cpus significantly.
  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
TimeVaryingMappedFixedValue irishdave OpenFOAM Running, Solving & CFD 32 June 16, 2021 06:55
Computational time sunnysun OpenFOAM Running, Solving & CFD 5 March 16, 2009 03:32
IcoFoam parallel woes msrinath80 OpenFOAM Running, Solving & CFD 9 July 22, 2007 02:58
AMG versus ICCG msrinath80 OpenFOAM Running, Solving & CFD 2 November 7, 2006 15:15
CPU time in Fluent5 HGG FLUENT 0 May 7, 2001 19:10


All times are GMT -4. The time now is 06:00.