0

I have a question related to parallel computing. I have a pretty big code written in C++ and which is parallelized using OpenMP on a shared memory basis. I wanted to ask is it possible to convert this shared memory code into a distributed memory code?

If possible what are the steps need to be performed? Thank you for your cooperation.

Thanks, Rahul Singh

Mysticial
  • 464,885
  • 45
  • 335
  • 332
  • Nobody can give you a definitive answer without more information. Post some relevant code, or explain how your program works a bit better. – Bojangles Apr 04 '12 at 16:20
  • I hope you realize that there is no general answer to this. Converting a shared-memory program to distributed is extremely application-specific. – Mysticial Apr 04 '12 at 16:21
  • 1
    Asking for a general answer to this is the same as asking for how to [parse HTML with regex](http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags). – Mysticial Apr 04 '12 at 16:24

2 Answers2

0

Most programs which can be parallelised to run on shared memory computers can also be parallelised to run on distributed memory computers. So yes, the problem that your OpenMP program solves can probably be solved on a distributed memory computer. However, converting your OpenMP program to a distributed memory program is a different matter. You might be better advised to start with a serial implementation and to parallelise that than to try to adapt one mode of parallel thinking for another mode of parallel execution.

So, the first step you seek might be to unparallelise your program. But, as the commentators have already indicated, it's very difficult to provide more useful advice than I already have (and I haven't provided any very useful advice at all) without knowing a lot more about your application.

High Performance Mark
  • 77,191
  • 7
  • 105
  • 161
0

Shared Memory and Distributed Memory are two distinct paradigms in parallel computing which often means different thinking strategies. Some parallel programming frameworks, like UPC or MPI, can be emulated to run on either shared or distributed machines although its better not to do so since , e.g. here, UPC is meant to be used on shared memory and MPI is meant to be used distributed memory machines. I'm not sure about OpenMP.

In either case, my advice is to fist think about how you could get parallelism in your code on a distributed architecture and then go with MPI. If you happen to be in the computational science business, there are already very well written packages, such as PETSc, from Argonne National Lab, and Trilinos, from Sandia National Lab, that may help you develop much faster.

mmirzadeh
  • 6,893
  • 8
  • 36
  • 47
  • MPI on shared memory is often a very good choice of approach, especially for codes which are to run on a wide range of machines. – High Performance Mark Apr 04 '12 at 19:39
  • @HighPerformanceMark I agree with that. It's just that doing MPI is usually much more work compared to something like OpenMP. SO if you are only concerned with Shared Memory, OpenMp/UPC could probably be a better choice. – mmirzadeh Apr 04 '12 at 20:42