Hello,

A few days ago I visited a lecture of a teacher in an university that was about parallel processing.

He explained why it's good etc, and how you can make programs that use multiple cpus in C.
He used MPI and the code looked nice, wasn't too hard and got the job done. But in order to compile the program u needed to use mpicc (so not gcc, vcc or bcc)
and to run the program you had to write something like:

shell$ /opt/openmpi-1.3.1/bin/mpirun -np 4 a.out

in that line, you also specify how many cores you want to use.

So my question is: Is there any other multiprocessing api that uses local variables, and messages to coordinate the work of the cpus that can be compiled by visual c++ or devc++ and doesn't need that weird command line to execute. that you can choose the amount of cores inside the program?

I hope that makes sense, else, please reply for a detailed explanation.

Thanks in advance,
Tigran

Thanks for the reply,

But why are there terms like multithreading and multiprocessing?
For what i've heared (but i'm not sure of) multithreading organises the tasks in one core. But i'm probably wrong :P

Are these POSIX threads also usable for windows? and are they as fast as the threads in the windows api?

You're right, but normally it's the Operating System's task to distribute all the threads over the available CPU-cores ...

POSIX Threads is also available for Windows here ...
If you want to use Windows' native API you might want to check this ...

MPI is likely not what you want if you simply want to utilize multiple cores/CPUs on a single computer.

Learn multithreading first.

So why would i even bother learning MPI if multithreading does all the multicore stuff.

I think that if you're dealing with normal computers multithreading will speed-up your program more than enough, but it's still the operating system which has the task to distribute those threads among all the available CPU-cores, so the efficiency also depends on what os you are using ...

This article has been dead for over six months. Start a new discussion instead.