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

Nicolas Rosner nrosner at gmail.com
Wed Mar 16 17:49:14 CDT 2011


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


More information about the mpich-discuss mailing list