Page 1 of 1

parallel programing

PostPosted: April 13th, 2006, 10:33 am
by hani
hi all
i want to use mpi library in delphi
(Mpi library is used in C++) is there any way to use it(mpi)Such as component in delphi
Thanks :cry: :cry: :cry:

PostPosted: April 13th, 2006, 10:38 am
by kokkoras
what is "mpi" ??

What is Mpi

PostPosted: April 19th, 2006, 7:36 am
by hani
Hi

MPI is library in C++ used to create More than one process to do
the same procedure so the result will be fast

Re: What is Mpi

PostPosted: April 19th, 2006, 8:15 am
by kokkoras
hani wrote:Hi MPI is library in C++ used to create More than one process to do the same procedure so the result will be fast


IMHO, you can't have any serious speed-up on single CPU machines. Have you consider using threads in Delphi?

PostPosted: April 19th, 2006, 8:56 am
by hani
Hi

Mpi like Threads in delphi but it is not threads
let me say if you want to sort a very large numer of numbers in one array
it will take alot of time but if you create more than one process(thread)
and each one sort a specific number of numbers and in the end we will
see the numbers is sorted

Mpi contain functions to do that without using thread
for example MPi_init used to create process........
_____________________________
Thanks
Hani

PostPosted: April 21st, 2006, 10:25 pm
by werdnareid
A quick explanation will help. MPI or Message Processing Interfaace is library designed to allow an application to run on multiple machines in the form of a process on each machine. which is unlike a thread which is designed to run as processes on the same machine as the main process which they serve(off course this excludes services).

i dont think there is a component designed to use MPI. you may have to work am a implimentation library then work on a component. i too have intrest in MPI but have not invested much time into it....there is a version that runs on windows.
the cool thing about delphi is that it should not bee too hard to make a package which staticically links to the functions found in the library.
dummy example below:
Code: Select all
procedure blah(some var :of some type): enternal 'some_mpi_dll"

PostPosted: April 24th, 2006, 9:02 am
by hani
Hi all
ok Iwill do that
Thank you all

PostPosted: April 26th, 2006, 12:45 am
by werdnareid
Note that i has a type in my inteded sample
procedure blah(some var :of some type): enternal 'some_mpi_dll"

corrected

procedure blah(some var :of some type): external 'some_mpi_dll"
or
procedure DoSomething; external 'MYLIB.DLL';

note that this method of calling the function/method directly from the dll is know as static there is another method which is a little more involved but more flexible check the page below.

http://info.borland.com/techpubs/delphi ... packg.html

PostPosted: April 26th, 2006, 9:04 am
by kokkoras
werdnareid wrote:A quick explanation will help. MPI or Message Processing Interfaace is library designed to allow an application to run on multiple machines in the form of a process on each machine. which is unlike a thread which is designed to run as processes on the same machine as the main process which they serve(off course this excludes services).


That's fine. BUT, where do we expect speed-up if we do all these in a single machine? Apart from some possible speed-up from better utilising the pipelining features of modern CPUs, I can't see anything more. In order to gain serious speed-up from parallelism you either have to run the same algorithm on different data (data parellelism) or run different algorithms/functions on the same data (function parallelism). In both cases you need more that one machines.

EDIT: I think I messed up the definitions (data parellelism vs. function parallelism). It should be the other way around.

PostPosted: April 26th, 2006, 10:38 pm
by werdnareid
Firstly let me say, that I was off the impression that you were fully aware of what MPI was and how it would benefit your project. If you aim is simply to gain speed (running application like word, excel or msaaccess) then you are barking up the wrong tree. MPI aims for improving the “speed i.e. applications that are CPU intensive”.
Applications like weather forecasting, cluster communication, vehicle crash modeling and the like are the focus of MPI.
Again if your plan is to write a applicaton to do faster word processing or a desktop applicatoin to talk to a database, MPI may no be the thing

PostPosted: April 26th, 2006, 11:04 pm
by kokkoras
werdnareid wrote:Firstly let me say, that I was off the impression that you were fully aware of what MPI was and how it would benefit your project.


I guess you are not replying to me. :) BTW, I am not aware of the MPI lib. I was talking generally on parallelism. Consider the application of filters to an image. You either assign each filter to a CPU (function parallelism) and have each CPU process the full image OR have all the filters to every CPU and process _a_part_ of the image (data parellelism).