triton
triton copied to clipboard
example_python使用多线程调用客户端,返回结果混乱
你好,我在example_python客户端里面加了多线程,每个线程去调用客户端,返回结果是混乱的,这应该怎么控制?
input0:[1,1,1,1]
input1:[2,2,2,2]
单线程:
--------------------------------------------
thread0
[3. 3. 3. 3.]
[-1. -1. -1. -1.]
--------------------------------------------
四个线程:
--------------------------------------------
thread0
[3. 3. 3. 3.]
[-1. -1. -1. -1.]
--------------------------------------------
--------------------------------------------
thread2
[3. 3. 3. 3.]
--------------------------------------------
[-1. -1. -1. -1.]
thread1
[3. 3. 3. 3.]
--------------------------------------------[-1. -1. -1. -1.]
--------------------------------------------
--------------------------------------------
thread3
[3. 3. 3. 3.]
[-1. -1. -1. -1.]
--------------------------------------------
Process finished with exit code 0
@wanghaohw 可以分享一下您的代码吗?
打印结果混乱是不是因为没有加锁导致的呢?