83 dataOut=dataExpect=0xA0000000;
85 kernelName =
"check_cnt_m2a";
174 printf(
"TF_CheckTransferOut::%s\n\n", __FUNCTION__ );
186 printf(
"Alloc host memory 2 x %d ",
td->
sizeBlock );
188 void *ptr=(
void*)0xAAAA;
192 throw except_info(
"%s - memory allocation error ", __FUNCTION__);
198 throw except_info(
"%s - memory allocation error ", __FUNCTION__);
205 err = posix_memalign( &ptr, 4096, 16384 );
207 throw except_info(
"%s - memory allocation error ", __FUNCTION__);
214 printf(
"Alloc device memory 2 x %d (DDR0 & DDR1) ",
td->
sizeBlock );
218 cl_mem_ext_ptr_t input_buffer_ext;
220 input_buffer_ext.flags = XCL_MEM_DDR_BANK0;
221 input_buffer_ext.obj = NULL;
222 input_buffer_ext.param = 0;
225 CL_MEM_READ_WRITE | CL_MEM_EXT_PTR_XILINX,
235 cl_mem_ext_ptr_t input_buffer_ext;
237 input_buffer_ext.flags = XCL_MEM_DDR_BANK0;
238 input_buffer_ext.obj = NULL;
239 input_buffer_ext.param = 0;
242 CL_MEM_READ_WRITE | CL_MEM_EXT_PTR_XILINX,
252 cl_mem_ext_ptr_t input_buffer_ext;
254 input_buffer_ext.flags = XCL_MEM_DDR_BANK0;
255 input_buffer_ext.obj = NULL;
256 input_buffer_ext.param = 0;
259 CL_MEM_READ_WRITE | CL_MEM_EXT_PTR_XILINX,
273 cl_command_queue_properties properties0 = CL_QUEUE_PROFILING_ENABLE;
274 cl_command_queue_properties properties1 = CL_QUEUE_PROFILING_ENABLE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
279 if( CL_SUCCESS != err0 )
280 throw except_info(
"%s - Error for create CommandQueue q0; err=%d ", __FUNCTION__, err0 );
282 if( CL_SUCCESS != err1 )
283 throw except_info(
"%s - Error for create CommandQueue q1; err=%d ", __FUNCTION__, err1 );
287 for(
int ii=0; ii<512; ii++ )
294 cl_ulong *ptr = (cl_ulong *)&(
td->
pStatus[16]);
297 for(
int ii=0; ii<8; ii++ )
303 for(
int ii=0; ii<8; ii++ )
308 cl_int ret=
td->
q0->enqueueWriteBuffer(
326 printf(
"TF_CheckTransferOut::%s\n", __FUNCTION__ );
337 printf(
"\nTF_CheckTransferOut::%s\n\n", __FUNCTION__ );
342 if( 0xAA55==
td->
Sig )
344 printf(
"Sig=0xAA55 - Ok\n");
347 printf(
"Sig=0x%X - Error, expect 0xAA55\n",
td->
Sig );
357 printf(
"Test time = %-.0f s\n\n",
td->
testTime);
364 printf(
" 1 MB = 2^10 = 1024*1024 = 1048576 bytes\n");
366 printf(
" 1 MB = 10^6 = 1000000 bytes\n");
380 printf(
"\nTest finished successfully\n\n" );
382 printf(
"\nTest finished with errors\n\n" );
413 td->
q0->enqueueWriteBuffer(
430 cl::NDRange globalNDR(1,1,1);
431 cl::NDRange localNDR(1,1,1);
432 cl::NDRange offsetNDR=cl::NullRange;
438 td->
q1->enqueueNDRangeKernel(
451 td->
q1->enqueueNDRangeKernel(
475 cl::Event eventCompletionTransfer0;
476 cl::Event eventCompletionTransfer1;
477 cl::Event eventCompletionExecuting0;
478 cl::Event eventCompletionExecuting1;
481 std::vector<cl::Event> events0;
482 std::vector<cl::Event> events1;
485 int flag_first_velocity=1;
550 time_t currentTime = time(NULL);
551 time_t timeFromStart = currentTime -
td->
startTime;
569 if( 1==flag_first_velocity )
573 flag_first_velocity=0;
593 cl_ulong *dst = (cl_ulong*) ptr;
594 cl_uint count =
td->
sizeBlock /
sizeof(cl_ulong) / 16;
596 for( cl_uint ii=0; ii<count; ii++ )
621 cl_ulong *src = (cl_ulong*)ptr;
625 cl_ulong flag_error=0;
626 for(
int ii=0; ii<count; ii++ )
651 cl_int ret=
td->
q0->enqueueReadBuffer(
cl_uint * pBufOut[2]
pointers to buffers in the host memory
cl_uint sizeBlock
Size of block [bytes].
cl::Program program
OpenCL program.
float VelocityCurMin
minimum of VelocityCurrent
cl::CommandQueue * q0
Pointer to OpenCL command queue.
char * kernelName
kernel name
cl::Kernel krnl_read
OpenCL kernel for read data.
float VelocityAverage
average speed (from test start)
cl_uint BlockWr
Count of written blocks.
cl_uint * pStatus
pointer to status buffer in the host memory
except_info_t except_info(const char *fmt,...)
TableEngine * m_pTemplateEngine
virtual void PrepareInThread()
Prepare test.
virtual void CleanupInThread()
Free any resource.
virtual void StepTable()
Show table during test executing.
~TF_CheckTransferOut()
Destructor.
cl_uint Sig
Signature for status buffer.
cl_ulong8 arrayExpect
expect values for data block
cl_uint BlockRd
Count of read blocks.
void CheckBuffer(cl_uint *ptr)
check data in the buffer
float VelocityCurrent
current speed (on 4 secund interval)
cl::Buffer * pBuffer[2]
pointers to buffers in the device memory
cl_uint lastBlock
Number BlockWr for lastTick.
cl_int sizeOfuint16
Size of block in 512-bit words.
Base class for application with thread.
virtual void Run()
Main body of test.
cl_ulong dataOut
current data for output
float VelocityCurMax
maximum of VelocityCurrent
TF_CheckTransferOut_task_data()
cl_uint BlockError
Count of incorrect blocks.
clock_t lastTick
Number of last clock()
cl_ulong dataExpect
expect data from input
virtual int AddRowTable()=0
virtual void GetResultInThread()
Show results of test.
cl::Context context
OpenCL context.
cl_ulong flagGetStatus
1 - request for get status information
cl_uint BlockOk
Count of correct blocks.
cl::Buffer * dpStatus
pointer to status buffer in the device memory
void GetStatus(void)
Read status information from device.
int GetFromCommnadLine(int argc, char **argv, const char *name, int defValue)
Get integer value from command line.
cl::CommandQueue * q1
Pointer to OpenCL command queue.
time_t startTime
time of start main test cycle
virtual int SetValueTable(unsigned nRow, unsigned nColumn, const char *fmt,...)=0
common data for OpenCL device
cl_uint metricMode
0 - binary: 1MB=2^10 bytes, 1 - decimal: 1MB=10^6 bytes
TF_Device * pDevice
OpenCL device and program.
TF_CheckTransferOut_task_data * td
< Internal data for TF_CheckTransferOut
~TF_CheckTransferOut_task_data()
cl_uint RowNumber
Number of first row in the table.
float testTime
Time from test start.
time_t lastTime
time of last interval
std::string deviceName
OpenCL device name.
void SetBuffer(cl_uint *ptr)
set test data in buffer buffer
cl::Device device
OpenCL device.
cl::Kernel krnl_calculate
OpenCL kernel for calculate.
TF_CheckTransferOut(TableEngine *pTable, TF_Device *pDevice, int argc, char **argv)
Constructor.
void WaitForCalculateComplete(cl::Event &event)
Wait for complete calculate.
clock_t startTick
Number of start clock();.
cl_uint mbSize
bytes count in 1MB
< Internal data for TF_CheckTransferOut
void WaitForTransferBufComplete(cl::Event &event)
Wait for complete data transfer.
void StartWriteBuf(cl::Buffer *pDevice, cl_uint *pHost, cl::Event &event)
Start data transfer.
void StartCalculateBuf(cl::Buffer *pDevice, cl::Event &event)
Start kernel for buffer.