标签: mpj-express

在Intellij IDEA中运行的MPJ Express(Java MPI)

我下载了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+"> 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 …
Run Code Online (Sandbox Code Playgroud)

java intellij-idea mpi mpj-express

3
推荐指数
1
解决办法
2894
查看次数

MP J Express中Scatter and Gather的工作原理

我要为我的项目创建一个新的集群api.所以这些天我开始学习MP J Express.我只是用这种方式用Scatter和Gather编写程序.但是我得到Null点异常.没有想到哪里出错了?

这是我的代码

    import mpi.MPI;

    public class ScatterGather {
        public static void main(String args[]){
        MPI.Init(args);
        int rank = MPI.COMM_WORLD.Rank();
        int size = MPI.COMM_WORLD.Size();
        int unitSize=4,root=0;
        int sendbuf[]=null;
        if(rank==root){
          sendbuf= new int[unitSize*size];
        }
        int recvbuf[] = new int[unitSize];
      MPI.COMM_WORLD.Scatter(sendbuf,0,unitSize,MPI.INT,recvbuf,0,unitSize,MPI.INT,root);
        if(rank!=root){
            for(int i=0;i<unitSize;i++){
               recvbuf[i]=rank;
            }
        }
      MPI.COMM_WORLD.Gather(recvbuf,0,unitSize,MPI.INT,sendbuf,0,unitSize,MPI.INT,root);
        if(rank==root){
           for(int i=0;i<unitSize;i++){
                System.out.println(sendbuf[i]+ " ");
           }
        }
        MPI.Finalize();
     }
}
Run Code Online (Sandbox Code Playgroud)

这是错误日志

MPJ Express (0.43) is started in the multicore configuration
mpi.MPIException: java.lang.NullPointerException
at mpi.SimplePackerInt.unpack(SimplePackerInt.java:112)
at mpi.Comm.recv(Comm.java:1499)
at mpi.PureIntracomm.MST_Scatter(PureIntracomm.java:1102)
at mpi.PureIntracomm.Scatter(PureIntracomm.java:1066)
at mpi.Intracomm.Scatter(Intracomm.java:420)
at …
Run Code Online (Sandbox Code Playgroud)

java cluster-computing mpi mpj-express

1
推荐指数
1
解决办法
1009
查看次数