I downloaded mpj-v0_44 and extracted it to C:\mpj
Put Windows system env. variables MPJ_HOME
to C:\mpj
and in PATH added value C:\mpj\bin
I added mpi.jar
, mpj.jar
in Project Structure -> Libraries
and wrote simple helloworld mpi program:
import mpi.MPI;
public class Main {
public static void main(String[] args) {
MPI.Init(args);
int me = MPI.COMM_WORLD.Rank();
int size = MPI.COMM_WORLD.Size();
System.out.println("Hello world from <"+me+"> of <"+size+">");
MPI.Finalize();
}
}
I created run configuration described on picture:
But I get the following error:
MPJ Express (0.44) is started in the multicore configuration
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at runtime.starter.MulticoreStarter$1.run(MulticoreStarter.java:281)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: 0
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:122)
... 6 more
I found similar problems in eclipse posted but none solution worked:
java.io.FileNotFoundException: null\conf\wrapper.conf (The system cannot find the path specified)
"Unresolved compilation problems" from running MPJ express in Eclipse Indigo
In Eclipse everything works fine but I need Intellij IDEA!
PS:
(if you need javadoc add whole C:\mpj\lib
folder and C:\mpj\src
folder for library sources)
You need to change the main class to
"runtime.starter.MPJRun"
and VM options to include your main class
"-jar $MPJ_HOME$\lib\starter.jar nz.geek.colin.mpj.Main -np 4"
This is because MPJExpress runs and then loads your program in order to create multiple processes.
If IntelliJ complains about runtime.starter.MPJRun not found you can ignore it but if the warning bothers you you can add the starter.jar to the project.