[mpich-discuss] Connect MPI application to a Web service

Hisham Adel hosham2004 at yahoo.com
Thu Mar 17 09:33:22 CDT 2011


First thanks for your reply. I am searching for these APIs but I didn't find 
anything till now.


For you points here is my reply:


OK, but does that assume eternal life in perfect health of both the.....


>I want to run mpiexec one time only because the program load some data in memory 
>and I don't want to load the data for each client because it is the same.


So in this case your app doesn't spawn a process -- your seq C++
subsystem isn't a program, but a shared library.........

> Yes, my seq C++ subsystem is a shared library
 
Well, you can, but not without spawning a separate process: as a
command line tool, mpiexec provides its own entry point. If you don't
mind this, you don't need JNI in the first place, but you possibly do.

> how ? I tried but I failed I don't know how to run the program, because in this 
>case I will run it with Java not with mpiexec...


Otherwise there's the client-server approach: your MPI C++ system runs
as a whole separate server process, and the Java service code queries
the subservice thru tcp socket, RPC, or even something WS-ish if you
embed a small HTTP server and in your C++ code.

> I was thinking about this solution but I wanted to know if there is any APIs or 
>not....

(You'd have to see what to do about potentially overlapping requests,
but if the main Java WS allows them, that'd be something to consider
regardless of the approach.)

For a mere proof-of-concept hack, you could just execute mpiexec from
Java as a separate process using something like Runtime.exec().

> If I used Runtime.exec(), how will I pass the user requests to the library ?


It seems that there no solution except the client-server approach; connecting 
HTTP and C++.
 I think I will work with it.

If you you have any other ideas, please let me know.

Thanks and Regards,
Hisham





________________________________
From: Nicolas Rosner <nrosner at gmail.com>
To: mpich-discuss at mcs.anl.gov
Cc: Hisham Adel <hosham2004 at yahoo.com>
Sent: Wed, March 16, 2011 11:49:14 PM
Subject: Re: [mpich-discuss] Connect MPI application to a Web service

There might be some sort of API for this, but I'll let someone else
answer that part, and throw in a few alternative ideas
instead/meanwhile:


> I don't want to run mpiexec for each client request. I want to run mpiexec only 
>one time, then keep the program running waiting for other clients requests.

OK, but does that assume eternal life in perfect health of both the
external process and your app's own interface to it? In a server
context I'd consider relaxing the "only one time" design to something
closer to "not too often". Enabling the system to be self-healing in
this aspect adds complexity, but depending on the case could be well
worth its cost in robustness.


> For the sequential version [..] JNI.

So in this case your app doesn't spawn a process -- your seq C++
subsystem isn't a program, but a shared library. The Java code
triggers a call to a native C++ function directly; the main() entry
point is that of the `java' executable (possibly an app server or so).
Is that correct?


> for the parallel version [..] I don't know how to
> run the program in this case; I can't use mpiexec.

Well, you can, but not without spawning a separate process: as a
command line tool, mpiexec provides its own entry point. If you don't
mind this, you don't need JNI in the first place, but you possibly do.

If your main priority is to avoid any new processes, and/or using JNI
is mandatory by requirement, I can't think of much except what I
mentioned at the top (some API I'm not familiar with).

Otherwise there's the client-server approach: your MPI C++ system runs
as a whole separate server process, and the Java service code queries
the subservice thru tcp socket, RPC, or even something WS-ish if you
embed a small HTTP server and in your C++ code.

(You'd have to see what to do about potentially overlapping requests,
but if the main Java WS allows them, that'd be something to consider
regardless of the approach.)

For a mere proof-of-concept hack, you could just execute mpiexec from
Java as a separate process using something like Runtime.exec().


Hope this helps,

Nicolás



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20110317/3ef23ac9/attachment.htm>


More information about the mpich-discuss mailing list