1

我最近开始在 Windows 上使用 MPJExpress。文档中提到的所有配置是否都适用于windows

运行这个小程序:-

import mpi.*;

public class HelloWorld {
    public static void main(String args[]) throws Exception {
        MPI.Init(args);
        int me = MPI.COMM_WORLD.Rank();
        int size = MPI.COMM_WORLD.Size();
        System.out.println("Hi from <" + me + ">");
        MPI.Finalize();
    }
}

当我运行它时,我得到了这个错误: -

Exception in thread "main" mpi.MPIException: Usage: java MPI <myrank> <conf_file> <device_name> conf_file can be, ../conf/xdev.conf <Local>OR http://holly.dsg.port.ac.uk:15000/xdev.conf <Remote>
    at mpi.MPI.Init(MPI.java:232)

../conf/xdev.conf 中没有 xdev.conf 文件(我还检查了以前的 MPJExpress 版本)也无法访问http://holly.dsg.port.ac.uk:15000/xdev.conf

当我看到 MPJDev.java 的代码时,我看看是否

(args.length < 3) {

      throw new MPJDevException("Usage: " + 
        "java MPJDev <myrank> <conf_file> <device_name>"
       +"conf_file can be, ../conf/xdev.conf <Local>"
       +"OR http://holly.dsg.port.ac.uk:15000/xdev.conf <Remote>");

    }

我做错了什么,得到上述异常。看起来 args.length 小于 3,所以我得到了上述异常。我该如何纠正它?

4

1 回答 1

1

@aadityachauhan 您无法使用 Run as Java Application 选项运行 MPJ Express 应用程序。为此,您需要在 VM Arguments 部分中传递参数。您可以查看此Youtube 视频教程的前半部分以使用 Eclipse 运行 MPJ Express。

于 2015-06-25T17:46:52.287 回答