gpt4 book ai didi

java - 调用 MPI.Init(args) 时出现异常

转载 作者:行者123 更新时间:2023-12-01 11:22:45 25 4
gpt4 key购买 nike

我最近开始在 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,所以我得到了上面的异常。我该如何纠正它?

最佳答案

@aadityachauhan 您无法使用“作为 Java 应用程序运行”选项来运行 MPJ Express 应用程序。为此,您需要在 VM Arguments 部分传递参数。你可以看看这个Youtube Video Tutorial的前半部分使用 Eclipse 运行 MPJ Express。

关于java - 调用 MPI.Init(args) 时出现异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31055641/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com