83 dataOut=dataExpect=0xA0000000;
86 kernelName =
"gen_cnt";
175 printf(
"TF_CheckTransferIn::%s\n\n", __FUNCTION__ );
185 printf(
"Alloc host memory 2 x %d ",
td->
sizeBlock );
187 void *ptr=(
void*)0xAAAA;
191 throw except_info(
"%s - memory allocation error ", __FUNCTION__);
197 throw except_info(
"%s - memory allocation error ", __FUNCTION__);
204 err = posix_memalign( &ptr, 4096, 16384 );
206 throw except_info(
"%s - memory allocation error ", __FUNCTION__);
213 printf(
"Alloc device memory 2 x %d (DDR0 & DDR1) ",
td->
sizeBlock );
217 cl_mem_ext_ptr_t input_buffer_ext;
219 input_buffer_ext.flags = XCL_MEM_DDR_BANK0;
220 input_buffer_ext.obj = NULL;
221 input_buffer_ext.param = 0;
224 CL_MEM_READ_WRITE | CL_MEM_EXT_PTR_XILINX,
234 cl_mem_ext_ptr_t input_buffer_ext;
236 input_buffer_ext.flags = XCL_MEM_DDR_BANK0;
237 input_buffer_ext.obj = NULL;
238 input_buffer_ext.param = 0;
241 CL_MEM_READ_WRITE | CL_MEM_EXT_PTR_XILINX,
251 cl_mem_ext_ptr_t input_buffer_ext;
253 input_buffer_ext.flags = XCL_MEM_DDR_BANK0;
254 input_buffer_ext.obj = NULL;
255 input_buffer_ext.param = 0;
258 CL_MEM_READ_WRITE | CL_MEM_EXT_PTR_XILINX,
272 cl_command_queue_properties properties0 = CL_QUEUE_PROFILING_ENABLE;
273 cl_command_queue_properties properties1 = CL_QUEUE_PROFILING_ENABLE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
278 if( CL_SUCCESS != err0 )
279 throw except_info(
"%s - Error for create CommandQueue q0; err=%d ", __FUNCTION__, err0 );
281 if( CL_SUCCESS != err1 )
282 throw except_info(
"%s - Error for create CommandQueue q1; err=%d ", __FUNCTION__, err1 );
286 for(
int ii=0; ii<512; ii++ )
293 cl_ulong *ptr = (cl_ulong *)&(
td->
pStatus[16]);
296 for(
int ii=0; ii<8; ii++ )
302 for(
int ii=0; ii<8; ii++ )
307 cl_int ret=
td->
q0->enqueueWriteBuffer(
325 printf(
"TF_CheckTransferIn::%s\n\n", __FUNCTION__ );
336 printf(
"\nTF_CheckTransferIn::%s\n\n", __FUNCTION__ );
341 if( 0xAA56==
td->
Sig )
343 printf(
"Sig=0xAA56 - Ok\n");
346 printf(
"Sig=0x%X - Error, expect 0xAA56\n",
td->
Sig );
356 printf(
"Test time = %-.0f s\n\n",
td->
testTime);
363 printf(
" 1 MB = 2^10 = 1024*1024 = 1048576 bytes\n");
365 printf(
" 1 MB = 10^6 = 1000000 bytes\n");
376 printf(
"\nTest finished successfully\n\n" );
378 printf(
"\nTest finished with errors\n\n" );
409 td->
q0->enqueueReadBuffer(
426 cl::NDRange globalNDR(1,1,1);
427 cl::NDRange localNDR(1,1,1);
428 cl::NDRange offsetNDR=cl::NullRange;
434 td->
q1->enqueueNDRangeKernel(
459 cl::Event eventCompletionTransfer0;
460 cl::Event eventCompletionTransfer1;
461 cl::Event eventCompletionExecuting0;
462 cl::Event eventCompletionExecuting1;
465 std::vector<cl::Event> events0;
466 std::vector<cl::Event> events1;
469 int flag_first_velocity=1;
528 time_t currentTime = time(NULL);
529 time_t timeFromStart = currentTime -
td->
startTime;
547 if( 1==flag_first_velocity )
551 flag_first_velocity=0;
571 cl_ulong *dst = (cl_ulong*) ptr;
572 cl_uint count =
td->
sizeBlock /
sizeof(cl_ulong) / 16;
574 for( cl_uint ii=0; ii<count; ii++ )
599 cl_ulong *src = (cl_ulong*)ptr;
603 cl_ulong flag_error=0;
604 for(
int ii=0; ii<count; ii++ )
629 cl_int ret=
td->
q0->enqueueReadBuffer(
cl::CommandQueue * q1
Pointer to OpenCL command queue.
cl_ulong flagGetStatus
1 - request for get status information
~TF_CheckTransferIn_task_data()
cl_uint BlockRd
Count of read blocks.
< Internal data for TF_CheckTransferIn
cl::Program program
OpenCL program.
TF_Device * pDevice
OpenCL device and program.
void StartCalculateBuf(cl::Buffer *pDevice, cl::Event &event)
Start kernel for buffer.
cl_ulong dataExpect
expect data from input
time_t lastTime
time of last interval
virtual void PrepareInThread()
Prepare test.
cl::Buffer * pBuffer[2]
pointers to buffers in the device memory
void SetBuffer(cl_uint *ptr)
set test data in buffer buffer
cl_ulong8 arrayExpect
expect values for data block
cl_uint BlockOk
Count of correct blocks.
TF_CheckTransferIn_task_data()
cl::CommandQueue * q0
Pointer to OpenCL command queue.
TF_CheckTransferIn_task_data * td
< Internal data for TF_CheckTransferIn
float VelocityCurMax
maximum of VelocityCurrent
except_info_t except_info(const char *fmt,...)
cl::Buffer * dpStatus
pointer to status buffer in the device memory
cl_int sizeOfuint16
Size of block in 512-bit words.
TableEngine * m_pTemplateEngine
virtual void Run()
Main body of test.
~TF_CheckTransferIn()
Destructor.
cl_uint sizeBlock
Size of block [bytes].
clock_t startTick
Number of start clock();.
cl_uint mbSize
bytes count in 1MB
cl_uint RowNumber
Number of first row in the table.
void CheckBuffer(cl_uint *ptr)
check data in the buffer
void GetStatus(void)
Read status information from device.
cl_uint BlockWr
Count of written blocks.
Base class for application with thread.
virtual void GetResultInThread()
Show results of test.
void WaitForCalculateComplete(cl::Event &event)
Wait for complete calculate.
cl_uint * pBufOut[2]
pointers to buffers in the host memory
virtual void StepTable()
Show table during test executing.
cl_ulong dataOut
current data for output
cl_uint * pStatus
pointer to status buffer in the host memory
void StartReadBuf(cl::Buffer *pDevice, cl_uint *pHost, cl::Event &event)
Start data transfer.
cl::Kernel krnl_calculate
OpenCL kernel for calculate.
virtual int AddRowTable()=0
float VelocityCurrent
current speed (on 4 secund interval)
cl::Context context
OpenCL context.
virtual void CleanupInThread()
Free any resource.
cl_uint lastBlock
Number BlockWr for lastTick.
int GetFromCommnadLine(int argc, char **argv, const char *name, int defValue)
Get integer value from command line.
cl_uint metricMode
0 - binary: 1MB=2^10 bytes, 1 - decimal: 1MB=10^6 bytes
virtual int SetValueTable(unsigned nRow, unsigned nColumn, const char *fmt,...)=0
common data for OpenCL device
float VelocityCurMin
minimum of VelocityCurrent
TF_CheckTransferIn(TableEngine *pTable, TF_Device *pDevice, int argc, char **argv)
Constructor.
cl_uint BlockError
Count of incorrect blocks.
cl::Device device
OpenCL device.
clock_t lastTick
Number of last clock()
float VelocityAverage
average speed (from test start)
time_t startTime
time of start main test cycle
void WaitForTransferBufComplete(cl::Event &event)
Wait for complete data transfer.
std::string deviceName
OpenCL device name.
char * kernelName
kernel name
cl_uint Sig
Signature for status buffer.
float testTime
Time from test start.