Module cuda_std::io[][src]

Expand description

Utilities for printing to stdout from GPU threads.

CUDA contains a syscall named vprintf which provides a way of atomically printing from GPU threads, this module provides safe wrappers over it. Printing is atomic, meaning that simultaneous calls from different threads (which will naturally happen) will not clash with eachother unlike printing from multiple CPU threads.

Important Notes

Printing output in CUDA is stored inside of a circular buffer which has a fixed size (1mb by default). If the buffer is filled, old output will be overwritten.

This buffer is flushed for:

  • Kernel launches
  • Synchronization (stream/device synchronization)
  • Blocking memory copies
  • Module load/unload
  • Context destruction

This does NOT include exiting the program, however, because rust uses RAII, unless you leak the context, output will always be flushed.