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

Using OpenMP similar to MPI? Bad idea?

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 1 Post By sbaffini
  • 1 Post By sbaffini

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 5, 2021, 04:12
Default Using OpenMP similar to MPI? Bad idea?
  #1
Senior Member
 
Sayan Bhattacharjee
Join Date: Mar 2020
Posts: 495
Rep Power: 8
aerosayan is on a distinguished road
I want to see if it's possible to use OpenMP to manage the multithreading of my solver instead of using MPI. I will be solving for supersonic flow over a ramp. There will be multiple block structured regions as shown in the pic.

Since the blocks will be small in size, it would be faster to make each CPU work on a different block instead of every CPU working on a single block. I know MPI is commonly used for tasks like this. But I want to see if OpenMP can be used instead.

The data will be stored in a shared memory model in a single PC, so OpenMP can access the complete data.

I'm thinking of making a function like solve_flow_in_block(block[i], omp_get_thread_num()) and putting it inside a #pragma omp parallel block that will execute until convergence.

Is it a good idea to do this? Or is it gonna blow up in my face?

PS : I only know OpenMP, and I only have a small system with limited resources. So I don't need MPI right now.
Attached Images
File Type: gif cfl3d-gridview.gif (18.2 KB, 31 views)
aerosayan is offline   Reply With Quote

Old   January 5, 2021, 07:48
Default
  #2
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,150
Blog Entries: 29
Rep Power: 39
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
For an unstructured grid I would have no doubt, MPI is easier and more rewarding.

For a structured grid, instead, I guess OpenMP is probably easier, but only because MPI would need to be extremely "verbose" in this case and the parallel decomposition would be a very limiting factor unless a lot of effort is put on it.

Still, my experience is only with MPI on unstructured grids, so take this with a grain of salt.
aerosayan likes this.
sbaffini is offline   Reply With Quote

Old   January 6, 2021, 05:31
Default
  #3
Senior Member
 
Sayan Bhattacharjee
Join Date: Mar 2020
Posts: 495
Rep Power: 8
aerosayan is on a distinguished road
Quote:
Originally Posted by sbaffini View Post
For an unstructured grid I would have no doubt, MPI is easier and more rewarding.

For a structured grid, instead, I guess OpenMP is probably easier, but only because MPI would need to be extremely "verbose" in this case and the parallel decomposition would be a very limiting factor unless a lot of effort is put on it.

Still, my experience is only with MPI on unstructured grids, so take this with a grain of salt.

I don't know MPI, but apparently there's a faster option in MPI that alllows it to not use its distributed memory model, instead use shared memory model.


How difficult is it to learn MPI and get started?

Currently I don't know with guarantee if OpenMP can handle the task I mentioned. Other option is to use the basic C++ multithreading.
aerosayan is offline   Reply With Quote

Old   January 6, 2021, 06:42
Default
  #4
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,150
Blog Entries: 29
Rep Power: 39
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
If you have even a very basic understanding of how distributed parallel works, then learning MPI, which is just a bunch of commands, is basically trivial. The actual problem with MPI is structuring the code (memory allocation and algorithms) so that everything works smoothly and nothing scales with the total number of cells or processors.

But, in my opinion, with respect to the shared memory approach, its main advantage is that nothing happens under the hood, except for few cases (like the remote memory access feature you were mentioning). So that you can actually structure the code to be fairly transparent to the parallel implementation.

If you are staying shared, consider that learning OpenMP will be useful in other languages (including Fortran)

I see no point in using MPI only with remote memory access. You would not build a true MPI code and still have the difficulties of a shared approach.
aerosayan likes this.
sbaffini is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Running on 4 node error MPI Errors[320798736] tailele STAR-CCM+ 4 April 2, 2020 05:59
Data Writing Problem in Intel MPI xuegy OpenFOAM Running, Solving & CFD 2 May 11, 2018 04:19
MPI profiling GeraBarna OpenFOAM Programming & Development 12 May 8, 2016 16:28
MPI and parallel computation Wang Main CFD Forum 7 April 15, 2004 12:25
Problems of Duns Codes! Martin J Main CFD Forum 8 August 15, 2003 00:19


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