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

OpenMP and shared memory programming

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 30, 2006, 11:09
Default OpenMP and shared memory programming
  #1
rt
Guest
 
Posts: n/a
1. Is OpenMP free tool (or library)? 2. Is it library or it must be incorporated in the compiler?

Thanks.
  Reply With Quote

Old   April 30, 2006, 16:35
Default Re: OpenMP and shared memory programming
  #2
Renato.
Guest
 
Posts: n/a
I don't know how to formally define OpenMP, but I could say that OpenMP is a parallelism standard and available as a compiler resource. The programmer defines parallel parts of his code by using OpenMP directives like:

! using Fortran syntax !$OMP PARALLEL DO DO I=1,1000 ... ENDDO !$OMP END PARALLEL DO

and use compiler flags in order to compile the program as a parallel program, for example:

ifort -c -openmp source1.f source2.f ...

you should also know the pros and cons about each parallelism paradigm (shared and distributed).

OpenMP is, in general, easy to implement, has bad scalability and only works in shared memory systems

MPI is, in general, hardest to implement, has good scalability and works with shared and distributed systems, so, MPI is more portable than OpenMP.

take a look in the OpenMP official site http://www.openmp.org for further details.

Regards

Renato.

  Reply With Quote

Old   April 30, 2006, 16:56
Default Re: OpenMP and shared memory programming
  #3
rt
Guest
 
Posts: n/a
Thank Rento

- But what compilers recently support OpenMP standard? (especially about MS VC 6.0, MS DF 6.2, GCC, F77)

- Also without considering simplicity of programming, how is performance of OpenMP in comparision with multi-thread programming (this question is due to my choice between these two techniques for extension of my code to shared memory and multi-core machines.

with Regards. rt
  Reply With Quote

Old   May 3, 2006, 10:54
Default Re: OpenMP and shared memory programming
  #4
Renato.
Guest
 
Posts: n/a
I got curious, what do you mean by multi-threading programming? WIN32 threads?! If so, I guess it's not a good idea to implement something in WIN32 threads. I only known OpenMP as a shared memory multi-threading approach for high performance computing problems involved in CFD.

Most of the modern compilers support OpenMP (I could list: Intel, Portland Group, Sun - I'm not sure but I guess Microsoft compilers also support it).

Regarding the multi-core processors, I guess the CPU vendors will not reinvent the wheel, in other words, they'll not build a cpu that will require a new parallel programming paradigm (I hope so). So, if you have a good program running in MPI or OpenMP it'll surely run and take advantage of multi-core cpus.

Regards

Renato.

  Reply With Quote

Old   May 3, 2006, 15:58
Default Re: OpenMP and shared memory programming
  #5
rt
Guest
 
Posts: n/a
Dear

I recently implement multi-threading on my code (CG (fully parallelable) solver related to incompressible flow solver) by using pthread library (on windows OS). But i don't gain any performance on multi-core cpu (intel 3000). I test it for problem with relatively large mesh (500000 FDM cell), but performance improvement was not acheived.

I relate this to overhead due to creating threades and joinig them. As my compiler MS VC 6.0 don't support OpenMP i don't implement it with OpenMP. My question is that how is overhead of OpenMP in comparition with pthread and is pthread suitable library for computationaly oriented programming (needs creating and joining thread per iteration)?

Thanks.
  Reply With Quote

Old   May 3, 2006, 20:16
Default Re: OpenMP and shared memory programming
  #6
Renato.
Guest
 
Posts: n/a
Well... pthread is a subject completely new for me... I only have some experience with OpenMP and MPI. I've implemented my code (incompressible fluid flow too) supporting hybrid parallelism (MPI, OpenMP or both at the same time). In my tests using standard systems (non multi-core), the MPI reached the best performances and OpenMP only got poor performances when compared with MPI. Thus, I could bet that MPI would also reach better performances than OpenMP when running in multi-core processors.

Renato.
  Reply With Quote

Old   May 4, 2006, 05:19
Default Re: OpenMP and shared memory programming
  #7
rt
Guest
 
Posts: n/a
Thanks.

I am completely agreement with you. My experience with MPI has been shown that running parallrl code (with MPI) on multi-core processor leads to a bout 2-fold speedup. But my assumption was that if we use special library related to shared memory programming such as pthread and openMP leads to better performance than MPI.

But why you use cupled MPI and OpenMP, if MPI leads to better performance you can define more than one process on the nodes which has more than one core (instead using OpenMP).

  Reply With Quote

Old   May 4, 2006, 08:55
Default Re: OpenMP and shared memory programming
  #8
Renato.
Guest
 
Posts: n/a
Interesting... I didn't know that there were libraries specially designed for multi-core processors. I guess MPI-2 have some issues related to multi-core. When you're installing the library you need to specify in which kind of system MPI-2 will run but I don't know how effective MPI is when running in multi-core processors (unfortunately, I haven't had the chance to use a multi-core system yet)

In fact I've not built a hybrid code intentionally. It was an extra resource that arose naturally. The program was born as a shared memory code to run in our old Cray SV1 (which didn't have MPI libraries available - not in our system), afterwards I implemented the MPI portion keeping the OpenMP feature untouched and the code is now portable to run in several different kind of systems.
  Reply With Quote

Old   May 4, 2006, 13:29
Default Re: OpenMP and shared memory programming
  #9
rt
Guest
 
Posts: n/a
Thank, for your useful disscasion.

with Best Wishes.
  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
OpenMP and fortran John Deas Main CFD Forum 0 May 17, 2007 17:53
Parallel computing and OpenMP ganesh Main CFD Forum 7 October 27, 2006 11:15


All times are GMT -4. The time now is 19:08.