Transcription of CUDA C/C++ Streams and Concurrency
{{id}} {{{paragraph}}}
CUDA C/C++ Streams and ConcurrencySteve RennichNVIDIAC oncurrencyThe ability to perform multiple CUDA operations simultaneously(beyond multi-threaded parallelism)CUDA Kernel <<<>>>cudaMemcpyAsync (HostToDevice)cudaMemcpyAsync (DeviceToHost)Operations on the CPUF ermi architecture can simultaneously support(compute capability +)Up to 16 CUDA kernels on GPU2 cudaMemcpyAsyncs (must be in different directions)Computation on the CPUS treamsStreamA sequence of operations that execute in issue-order on the GPUP rogramming model used to effect concurrencyCUDA operations in different Streams may run concurrentlyCUDA operations from different Streams may be interleavedK1K2K3K4 Concurrency ExampleSerialConcurrent overlap kernel and D2H copycudaMemcpyAsync(H2D)cudaMemcpyAsync( D2H)Kernel<<<>>>timecudaMemcpyAsync(H2D) performance improvementstreamsHD2K2HD3DH2 Amount of ConcurrencySerial (1x)2-way Concurrency (up to 2x)3-way Concurrency (up to 3x)4-way Concurrency (3x+)4+ way concurrencyKernel <<< >>>cudaMemcpyAsync(H2D)cudaMemcpyAsync(D2 H)K1K2K3K4cudaMemcpyAsync(H2D)DH1DH
cudaEventCreateWithFlags ( &event, cudaEventDisableTiming ) Concurrency Guidelines Code to programming model – Streams Future devices will continually improve HW representation of streams model Pay attention to issue order Can make a difference
Domain:
Source:
Link to this page:
Please notify us if you found a problem with this document:
{{id}} {{{paragraph}}}