CreateSyncStream#

Fully qualified name: cupva_utils::CreateSyncStream

Defined in cupva_host_utils.hpp

cupva::Stream cupva_utils::CreateSyncStream(cupva::Stream stream)#

Construct a new sync Stream object from an existing Stream object.

This API allows users to convert an existing cupva::Stream to a cupva::Stream which synchronizes with the CPU before returning from the submit() method.

One example of using this API may be to conditionally replace an existing, fully initialized Stream with a SyncStream:

void SomeFunction(cupva::Stream &s)
{
    // s was initialized upstream as an ordinary cupva::Stream
    #if DEBUG
        s = cupva_utils::CreateSyncStream(std::move(s));
        // From now on, submissions to s will synchronize with CPU before returning from submit()
    #endif
}

Usage considerations

  • Allowed context for the API call

    • Interrupt handler: No

    • Signal handler: No

    • Thread-safe: No

    • Re-entrant: No

    • Async/Sync: Sync

  • Required privileges: None

  • Allowed execution state

    • Initialization: Yes

    • Operational: Yes

    • Reinit/Deinit Preparation: Yes

  • Maturity: GA

Parameters:

stream – The pre-existing cupva::Stream

Throws:

std::bad_alloc – internal allocations failed

Pre:

None