0

I am new to openMPI, I have problem understanding the concepts. (I found this pretty helpful)

1- Could anyone breifly explain why we use openMPI? To my understanding, OpenMPI is used to parallelize those sections of the code which can run in parallel.

2- why mpirun duplicates a single program? simply because my laptop is dual core?

3 - what changes in the code I need to apply to make it run correctly? I mean ONE program parallelized on two available cores? not 2 similar threads of the same program.

Community
  • 1
  • 1
sali
  • 219
  • 4
  • 10

1 Answers1

1

MPI is primarily of benefit when used in a multiple machine environment, in which you must run multiple processes.

It requires heavy modification of the program.

kec
  • 2,099
  • 11
  • 17
  • Thanks for your quick reply. So do I need to install and use openMP instead? and your reply basically means openMPI can NOT be used for shared memory multi-threading? – sali Apr 30 '14 at 02:15
  • OpenMP also requires modification, but not as much (arguably) as MPI. OpenMP only runs on a single machine, so the degree of parallelization will be limited by the number of cores on one machine. So if that works for you, then yes. – kec Apr 30 '14 at 02:17
  • thanks, so it is not as easy as like adding `#pragma omp parallel for` for heavy for loops! – sali Apr 30 '14 at 02:19
  • Well, if you already have a lot of suitable loops like that, then it can be as easy as that. – kec Apr 30 '14 at 02:20
  • then what would be the difference of openMPI and openMP? I mean can I still use openMPI and add `pragma` on suitable loops? – sali Apr 30 '14 at 02:22
  • 1
    OpenMP can't be distributed to multiple machines in a cluster, so the scalability is limited. [Here](http://www.dartmouth.edu/~rc/classes/intro_mpi/parallel_prog_compare.html) are a few points. – kec Apr 30 '14 at 02:25
  • 4
    Yes, you can combine OpenMP and MPI. Note that OpenMP is a standard, and MPI is a standard but OpenMPI is a specific implementation of MPI. (Kind of confusing.) – kec Apr 30 '14 at 02:27
  • Thanks, things are making better sense now. – sali Apr 30 '14 at 02:56