CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

OpenFOAM performance

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 20, 2020, 16:29
Default OpenFOAM performance
  #1
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
Hi!


I'm just curious if anyone can provide some data about the performance profile of any OpenFOAM solver? I mean the time spent for the different functions. Now I'm interested in the equation formulation. So as i know for example let's assume some useless equation:

Code:
solve(fvm::laplacian(T)+fvc::div(U)+fvc::div(k)+fvc::div(someVariable))
If I'm right, it will create a matrix from fvm::laplacian(T) which will contains 3 vectors (ldu matrix and source), THEN it will create a vector from fvc::div(U) and loop through it and add to the matrix. Then a new vector for div(k), add it to the matrix with a loop, then new vector for div(someVariable) add it to the matrix. So I hope you already know the question.
Is it really feasible to create the equation system this way?
I just made a really dummy code in c++ to check the difference between four loop and add one by one and between a single loop but add four times. As i expected the results are clear. One loop, four addition wins. The second method is 2x faster. (In the code the clock starts after the vectors are initialized with some data.)


So are there any tests about it? I know this is a "small part" of the code but the difference is huge.
Attached Images
File Type: png loops.png (117.4 KB, 18 views)
simrego is offline   Reply With Quote

Old   February 21, 2020, 01:04
Thumbs up
  #2
HPE
Senior Member
 
HPE's Avatar
 
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 932
Rep Power: 12
HPE is on a distinguished road
The performance questions are tricky. The outcome from a performance analysis is difficult to generalise, as you have attempted to deduce some insight from another piece of code (which is good by itself).

The steps you have elaborated in your post are mostly discarded by the compiler, which operates in a more clever way than a human can do.

For OpenFOAM, or any other CFD software, the bottleneck is not CPU, not the number of floating-point opers. You can confidently assume that the floating-point oper cost for OpenFOAM is free. The bottleneck is memory and caching.

But the most important challenge is the maintenance, for which the code must be maintainable, for which it must be expressive and intuitive for human readers.

My suggestion is that trust compiler and do not worry about the performance, which is good for OpenFOAM. I personally saw a 1.5 billion cell two-phase simulation for the Japan earthquake, and the weak scaling is virtually resembling to the ideal curve.

At least these are my opinions.
HPE is offline   Reply With Quote

Old   February 21, 2020, 04:10
Default
  #3
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
You call the constructor of fvc::grad so it will create this object. Then add it to the previous one, loop through the vectors, etc. I'm not an expert in programming but correct me if I'm wrong.
I know that the memory access for the CPU is problematic in these kind of software, but looping through the same vector multiple times and access its data multiple times while you could use it once, I think it is the same what you are talking about. Memory...
That's why I'm interested if are there any tests about that.
simrego is offline   Reply With Quote

Old   February 21, 2020, 04:45
Default
  #4
HPE
Senior Member
 
HPE's Avatar
 
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 932
Rep Power: 12
HPE is on a distinguished road
>> You call the constructor of fvc::grad so it will create this object. Then add it to the previous one, loop through the vectors.

That's what is coded, but that's not what the machine instructions that compiler and linker assemble. Even if you would code it differently, the compiler would produce the same instructions. I had raised this question once in stackexchange, and the top answer was telling me like "don't worry, compilers are smarter than you, a lot smarter".

So those are my opinions. Somebody else may provide more tangible insight.
HPE is offline   Reply With Quote

Old   February 21, 2020, 12:51
Default
  #5
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
<Deleted post>

Last edited by simrego; February 22, 2020 at 03:39.
simrego is offline   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
Is anyone using OpenFOAM to simulate the performance of rocket motors with openfoam? Fengwei OpenFOAM 1 October 25, 2013 01:06
New OpenFOAM Forum Structure jola OpenFOAM 2 October 19, 2011 06:55
Parallel performance OpenFoam Vs Fluent prapanj Main CFD Forum 0 March 26, 2009 05:43
64bitrhel5 OF installation instructions mirko OpenFOAM Installation 2 August 12, 2008 18:07
Intelbs MPI and performance tools in OpenFOAM hplum OpenFOAM 16 December 16, 2007 14:58


All times are GMT -4. The time now is 02:10.