大家好,我的代码循环存在问题,我要执行的工作是运行一段代码20次,跟踪所用的时间,然后将平均值除以20
这是目前不起作用的代码:
edit
它给了我以下错误:
PJ Express (0.35) is started in the cluster configuration
Starting process <0> on <Tornado>
Starting process <1> on <Predator>
mpi.MPIException: Error in SimplePacker : count <1> is less than length <2>
at mpi.SimplePackerChar.unpack(SimplePackerChar.java:105)
at mpi.Comm.recv(Comm.java:1305)
at mpi.Comm.Recv(Comm.java:1255)
at PingPongVariousLengths.main(PingPongVariousLengths.java:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at runtime.daemon.Wrapper.execute(Wrapper.java:165)
at runtime.daemon.Wrapper.main(Wrapper.java:180)
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at runtime.daemon.Wrapper.execute(Wrapper.java:165)
at runtime.daemon.Wrapper.main(Wrapper.java:180)
Caused by: mpi.MPIException: mpi.MPIException: mpi.MPIException: Error in Simple
Packer : count <1> is less than length <2>
at mpi.Comm.Recv(Comm.java:1259)
at PingPongVariousLengths.main(PingPongVariousLengths.java:29)
... 6 more
Caused by: mpi.MPIException: mpi.MPIException: Error in SimplePacker : count <1>
is less than length <2>
at mpi.Comm.recv(Comm.java:1317)
at mpi.Comm.Recv(Comm.java:1255)
... 7 more
Caused by: mpi.MPIException: Error in SimplePacker : count <1> is less than leng
th <2>
at mpi.SimplePackerChar.unpack(SimplePackerChar.java:105)
at mpi.Comm.recv(Comm.java:1305)
... 8 more
但是在添加循环之前,我有以下代码,并且工作正常:
编辑
是什么导致程序中的循环给出错误消息,以及如何解决此问题?
谢谢
最佳答案
该错误在SimplePacker中,并引发了MPIException。
您能否提供您的SimplePacker编码器,该编码器可以在MPI.Rec()-方法中调用?