【发布时间】:2013-02-12 16:53:15
【问题描述】:
我看到流程一和流程二(如下)的方式是相同的,因为它们花费的时间相同。我错了吗?
allOfData_A= data_A1 + data_A2
allOfData_B= data_B1 + data_B2
allOFData_C= data_C1 + data_C2
Data_C is the output of the kernel operation of both Data_A & Data_B. (Like C=A+B)
The HW supports one DeviceOverlap (concurrent) operation.
流程一:
MemcpyAsync data_A1 stream1 H->D
MemcpyAsync data_A2 stream2 H->D
MemcpyAsync data_B1 stream1 H->D
MemcpyAsync data_B2 stream2 H->D
sameKernel stream1
sameKernel stream2
MemcpyAsync result_C1 stream1 D->H
MemcpyAsync result_C2 stream2 D->H
流程二:(操作相同,顺序不同)
MemcpyAsync data_A1 stream1 H->D
MemcpyAsync data_B1 stream1 H->D
sameKernel stream1
MemcpyAsync data_A2 stream2 H->D
MemcpyAsync data_B2 stream2 H->D
sameKernel stream2
MemcpyAsync result_C1 stream1 D->H
MemcpyAsync result_C2 stream2 D->H
【问题讨论】:
-
它们的放置顺序非常重要,你应该按照第一个内核执行时第二个数据已经开始复制的顺序放置。
-
这个问题有不同的答案,具体取决于您使用的硬件以及内核的性质。请更具体。
-
这是一个一般性问题。假设它是带有一个 cpy 引擎的 Fermi HW。 (Kepler 有什么不同吗?)您还在寻找什么其他具体的东西?
标签: cuda cuda-streams