@Namespace(value="cv::cuda") @NoOffset @Properties(inherit=opencv_core.class) public class Stream extends Pointer
\note Currently, you may face problems if an operation is enqueued twice with different data. Some functions use the constant GPU memory, and next call may update the memory before the previous one has been finished. But calling different operations asynchronously is safe because each operation has its own constant buffer. Memory copy/upload/download/set operations to the buffers you hold are also safe.
\note The Stream class is not thread-safe. Please use different Stream objects for different CPU threads.
void thread1()
{
cv::cuda::Stream stream1;
cv::cuda::func1(..., stream1);
}
void thread2()
{
cv::cuda::Stream stream2;
cv::cuda::func2(..., stream2);
}
\note By default all CUDA routines are launched in Stream::Null() object, if the stream is not specified by user. In multi-threading environment the stream objects must be passed explicitly (see previous note).
Modifier and Type | Class and Description |
---|---|
static class |
Stream.Impl |
static class |
Stream.StreamCallback |
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter
Constructor and Description |
---|
Stream()
creates a new asynchronous stream
|
Stream(GpuMat.Allocator allocator)
creates a new asynchronous stream with custom allocator
|
Stream(long size)
Native array allocator.
|
Stream(Pointer p)
Pointer cast constructor.
|
Modifier and Type | Method and Description |
---|---|
Pointer |
cudaPtr()
return Pointer to CUDA stream
|
void |
enqueueHostCallback(Stream.StreamCallback callback,
Pointer userData)
\brief Adds a callback to be called on the host after all currently enqueued items in the stream have
completed.
|
static Stream |
Null()
return Stream object for default CUDA stream
|
Stream |
position(long position) |
boolean |
queryIfComplete()
\brief Returns true if the current stream queue is finished.
|
void |
waitEvent(Event event)
\brief Makes a compute stream wait on an event.
|
void |
waitForCompletion()
\brief Blocks the current CPU thread until all operations in the stream are complete.
|
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, hashCode, isNull, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetof, parseBytes, physicalBytes, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, toString, totalBytes, totalPhysicalBytes, withDeallocator, zero
public Stream(Pointer p)
Pointer.Pointer(Pointer)
.public Stream(long size)
Pointer.position(long)
.public Stream()
public Stream(@opencv_core.Ptr GpuMat.Allocator allocator)
@Cast(value="bool") public boolean queryIfComplete()
public void waitForCompletion()
public void waitEvent(@Const @ByRef Event event)
public void enqueueHostCallback(Stream.StreamCallback callback, Pointer userData)
\note Callbacks must not make any CUDA API calls. Callbacks must not perform any synchronization that may depend on outstanding device work or other callbacks that are not mandated to run earlier. Callbacks without a mandated order (in independent streams) execute in undefined order and may be serialized.
public Pointer cudaPtr()
Copyright © 2020. All rights reserved.