【问题标题】:JAVA loop issueJAVA循环问题
【发布时间】:2013-04-07 14:54:37
【问题描述】:

大家好,我的代码循环有问题,我要做的是运行一段代码 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

但是在添加循环之前,我有这段代码并且运行良好:

编辑

是什么导致程序中的循环给出错误消息,我该如何解决这个问题?

谢谢

【问题讨论】:

    标签: java mpi


    【解决方案1】:

    错误出现在 SimplePacker 中,并引发了 MPIException。 您能否提供一些 SimplePacker 的编码器,在 MPI.Rec()- 方法中调用?

    【讨论】:

    • 你昨天问了同样的问题!
    • 是的,但是没有找到答案,真的让我很困惑
    • 那么为什么另一个问题有一个公认的答案呢?加油!
    • 接受的答案是循环问题,之后我遇到了这个问题,谢谢,做错了什么,在添加循环之前,代码工作得很好,如上图
    猜你喜欢
    • 2011-07-03
    • 1970-01-01
    • 1970-01-01
    • 2019-07-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多