【发布时间】:2015-09-22 13:31:22
【问题描述】:
我一直在尝试使用 MPJExpress 发送对象:-
StateP randomState = HeuristicSolverUtility.createRandom(Constants.DIMENSION , Constants.w1);
MPI.COMM_WORLD.Isend(randomState , 0 , 1 , MPI.OBJECT , 3 , Constants.STARTOPERATION);
或者使用,从这个答案here,以这种形式
StateP[] stateArray = new StateP[1];
stateArray[0] = randomState;
MPI.COMM_WORLD.Isend(stateArray , 0 , 1 , MPI.OBJECT , 3 , Constants.STARTOPERATION);
当上面的代码行被执行时,我得到了这个异常:-
java.lang.reflect.InvocationTargetException
Caused by: mpi.MPIException: mpi.MPIException: java.lang.ClassCastException: common.model.StateP cannot be cast to [Ljava.lang.Object;
at mpi.Comm$9.handleCompletion(Comm.java:1678)
StateP 类是可序列化的
public class StateP implements State , Serializable
{
这里没有可接受的解决方案:- Send objects with MPJ express
投票最多的答案对我不起作用。 我该如何纠正这个,我做错了什么?
如果需要,这是我的 MPJ.IReceive 函数
StateP startingState = HeuristicSolverUtility.generateGoalState(Constants.DIMENSION, Constants.w1);
Request request = MPI.COMM_WORLD.Irecv(startingState, 0, 1, MPI.OBJECT, 0, Constants.STARTOPERATION);
request.Wait();
【问题讨论】:
-
你能试试那个帖子的第二个答案吗?在我看来,它应该可以解决您的问题。
标签: java debugging mpi mpj-express