Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

difference between thread library and mpi in c++

When it comes to parallel programming, I have only been exposed to multithreading but recently I have been presented with mpi I tried to make sense of what the difference is through searching online but was to no avail. I think they are both libraries for the sake of parallelizing your code correct? If so how are they different?or are they even comparable like an apple and an orange. Can someone clarify?


1 Answers

Multithreading is strictly on the same computer, same program and same memory space. MPI is basically multiprocessing, which is different programs that communicate together. MPI has the advantage that you can parallelize its programs and run it on cluster systems, so, different computers. Multithreading is considered much simpler. C++ doesn't have a standard implementation of multiprocessing, which is why MPI libraries are used for that purpose.

More information here.

like image 182
The Quantum Physicist Avatar answered Oct 26 '25 06:10

The Quantum Physicist



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!