![Teledyne SP Devices ADQ7 User Manual Download Page 9](http://html1.mh-extra.com/html/teledyne-sp-devices/adq7/adq7_user-manual_1081089009.webp)
Classification
Revision
Public
PA1
Document ID
Print date
19-2241
2019-05-02
4.3.2
AMD
The DMA buffers allocated with OpenCL has one marker address each. Since the application only needs
2 markers in total, use the marker addresses associated with the data buffers.
4.4
Wait for a Completed Buffer
Two markers are used to detect completed buffers. The marker associated with data and data valid
buffers 0 will only take on odd values and the marker associated with data and data valid buffers 1
will take on even values. The initial marker value is 1 and the maximum marker value is
2
32
−
1
the
succeeding marker value will be 0.
4.4.1
Nvidia
Completed buffers are detected by host. Call function
WaitforGPUMarker()
which will return as soon as
a buffer is completed (since last function call) or when the specified timeout is reached.
WaitforGPU-
Marker()
will return the latest marker value via argument
marker_list
. The completed data and data
valid buffers can be determined as:
completed buffers
= (
returned marker
+
1
)
mod 2
It is also recommended to compare returned marker value with expected marker value to detect missed
buffers which typically means that streaming is faster than your application.
4.4.2
AMD
Completed buffers are detected by GPU. The function
clEnqueueWaitSignalAMD()
is used to make
GPU wait until the marker associated with the specified buffer is equal to or greater than the specified
value. Operations added to the queue after a
clEnqueueWaitSignalAMD()
will not be performed until
the
clEnqueueWaitSignalAMD()
operation is finished. When operations are added to the queue they
can be connected to a
cl_event
. Use function
clWaitForEvents()
to make host wait for one or several
events. It should be noted that in some systems
clWaitForEvents()
only returns when all
clEnqueue-
WaitSignalAMD()
calls are finished.
4.5
Detect and Handle Overflows
It is recommended to frequently check for overflows with ADQ function
GetStreamOverflow()
, no de-
tected overflows means that all data since last successful
GetStreamOverflow()
call is correct. If an
overflow is detected streaming has to be restarted by calling ADQ functions
StopStreaming()
,
SetupDMA-
P2p2D()
and
StartStreaming()
. Other than loss of data overflow may cause unexpected change in
throughput or a total halt of streaming.
4.6
Process Received Data and Reset the Data Valid Buffer
The samples are written in
int16_t
format into buffers. In two-channel mode samples from channel A
and B are interleaved. Macros in
gpu_streaming_defines.h
shows how to access a given sample in a
ADQ7 GPU Peer-To-Peer – User Guide
Page 8 of 11