大家好,我的代码循环有问题,我想做的是运行一段代码 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
但是在添加循环之前,我有这段代码并且工作正常:
编辑
是什么导致程序中的循环给出错误消息,我该如何解决这个问题?
谢谢