How would you run two streams concurrently in Cupy?

ساخت وبلاگ
چکیده : How would you run two streams concurrently in Cupy? In the following code, I want to perform two asn... با عنوان : How would you run two streams concurrently in Cupy? بخوانید :

How would you run two streams concurrently in Cupy? In the following code, I want to perform two asnumpy operations concurrently, each converting half of the parent cupy array, registered_image_list into numpy arrays. Presently, the streams are running sequentially and there is no gain in terms of computation time. How the code should be modified in order for the streams to run concurrently?

import cupy as cp
import time
total_frames = 30

parent_list = cp.ndarray(shape=(total_frames,1080,1920,3))
list1 = parent_list[0:15,...]
list2 = parent_list[15:30,...]

stream1 = cp.cuda.stream.Stream()
stream2 = cp.cuda.stream.Stream()
stream1.synchronize()
stream2.synchronize()

start= time.time()
stream1.use()
registered_image_list1 = cp.asnumpy(list1)
stream2.use()
registered_image_list2 = cp.asnumpy(list2)

print(time.time()-start)
back soft...
ما را در سایت back soft دنبال می کنید

نویسنده : استخدام کار بازدید : 5 تاريخ : دوشنبه 19 آذر 1397 ساعت: 20:06