【问题标题】:MPJ Express (Java MPI) running in Intellij IDEA在 Intellij IDEA 中运行的 MPJ Express (Java MPI)
【发布时间】:2016-07-21 06:21:29
【问题描述】:

我下载了mpj-v0_44并解压到C:\mpj

把Windows系统环境。变量 MPJ_HOMEC:\mpj 并在 PATH 中添加值 C:\mpj\bin

我在项目结构 -> 库中添加了mpi.jarmpj.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+"> of <"+size+">");
        MPI.Finalize();
    }
}

我创建了图片上描述的运行配置:

但我收到以下错误:

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

我在发布的 eclipse 中发现了类似的问题,但没有解决方案:

java.io.FileNotFoundException: null\conf\wrapper.conf (The system cannot find the path specified)

"Unresolved compilation problems" from running MPJ express in Eclipse Indigo

在 Eclipse 中一切正常,但我需要 Intellij IDEA!

PS: (如果您需要 javadoc,请为库源添加整个 C:\mpj\lib 文件夹和 C:\mpj\src 文件夹)

【问题讨论】:

    标签: java intellij-idea mpi mpj-express


    【解决方案1】:

    你需要把主类改成

    "runtime.starter.MPJRun"
    

    和 VM 选项以包含您的主类

    "-jar $MPJ_HOME$\lib\starter.jar nz.geek.colin.mpj.Main -np 4"
    

    这是因为 MPJExpress 运行然后加载您的程序以创建多个进程。

    如果 IntelliJ 抱怨 runtime.starter.MPJRun 未找到,您可以忽略它,但如果警告困扰您,您可以将 starter.jar 添加到项目中。

    【讨论】:

    • 它只是将类名添加到 VM 选项“-jar $MPJ_HOME$\lib\starter.jar Main -np 4”
    猜你喜欢
    • 2019-05-23
    • 1970-01-01
    • 2013-10-18
    • 2023-03-04
    • 2012-10-08
    • 2016-07-18
    • 1970-01-01
    • 2013-11-19
    • 2021-12-16
    相关资源
    最近更新 更多