fpo*_*pic 3 java intellij-idea mpi mpj-express
我下载了mpj-v0_44并将其提取到C:\mpj
把Windows系统环境。变量MPJ_HOME来C:\mpj在PATH增值C:\mpj\bin
我说mpi.jar,mpj.jar在项目结构- >库
并编写了简单的helloworld mpi程序:
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+"> from <"+size);
MPI.Finalize();
}
}
Run Code Online (Sandbox Code Playgroud)
但是我收到以下错误:
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
Run Code Online (Sandbox Code Playgroud)
我在发布的日食中发现了类似的问题,但是没有解决方案:
java.io.FileNotFoundException:null \ conf \ wrapper.conf(系统找不到指定的路径)
在Eclipse Indigo中运行MPJ Express导致“未解决的编译问题”
在Eclipse中一切正常,但是我需要Intellij IDEA!
PS :(如果需要javadoc,请添加整个C:\mpj\lib文件夹和C:\mpj\src用于库源的文件夹)
您需要将主类更改为
"runtime.starter.MPJRun"
Run Code Online (Sandbox Code Playgroud)
和VM选项以包括您的主要班级
"-jar $MPJ_HOME$\lib\starter.jar nz.geek.colin.mpj.Main -np 4"
Run Code Online (Sandbox Code Playgroud)
这是因为MPJExpress先运行然后加载程序才能创建多个进程。
如果IntelliJ抱怨找不到runtime.starter.MPJRun,则可以忽略它,但是如果警告困扰您,可以将starter.jar添加到项目中。
| 归档时间: |
|
| 查看次数: |
2894 次 |
| 最近记录: |