TransWikia.com

How do I set the buffer value to zero?

Stack Overflow Asked by kingwales on November 12, 2021

after I memory copy the value from GPU to CPU, how do I set the value to 0 with the same length? For example, cpubuff here.

cudaMemcpyAsync(
      (void*) cpubuff_, 
      (const void *) src_, 
      (size_t) buflen_, 
      (cudaMemcpyKind) cudaMemcpyDeviceToHost, 
      (cudaStream_t) *stream)

One Answer

If you want to zero out a buffer on the host, then you can call memset.

memset(cpubuff_, 0, buflen_);

Assuming you don't need the async functionality.

Answered by javascripting.dev on November 12, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP