check transfer  0.1
Check data transfer for SDAccell OpenCL application
Public Member Functions | Public Attributes | List of all members
TF_CheckTransferOut Class Reference

check data transfer from device to host More...

#include <tf_checktransferout.h>

Inheritance diagram for TF_CheckTransferOut:
TF_TestThread TF_Test

Public Member Functions

void CheckBuffer (cl_uint *ptr)
 check data in the buffer More...
 
virtual void CleanupInThread ()
 Free any resource. More...
 
virtual void GetResultInThread ()
 Show results of test. More...
 
void GetStatus (void)
 Read status information from device. More...
 
virtual void PrepareInThread ()
 Prepare test. More...
 
virtual void Run ()
 Main body of test. More...
 
void SetBuffer (cl_uint *ptr)
 set test data in buffer buffer More...
 
void StartCalculateBuf (cl::Buffer *pDevice, cl::Event &event)
 Start kernel for buffer. More...
 
void StartWriteBuf (cl::Buffer *pDevice, cl_uint *pHost, cl::Event &event)
 Start data transfer. More...
 
virtual void StepTable ()
 Show table during test executing. More...
 
 TF_CheckTransferOut (TableEngine *pTable, TF_Device *pDevice, int argc, char **argv)
 Constructor. More...
 
void WaitForCalculateComplete (cl::Event &event)
 Wait for complete calculate. More...
 
void WaitForTransferBufComplete (cl::Event &event)
 Wait for complete data transfer. More...
 
 ~TF_CheckTransferOut ()
 Destructor. More...
 
- Public Member Functions inherited from TF_TestThread
void * Execute ()
 
virtual void GetResult ()
 Show result of test. More...
 
virtual int isComplete ()
 Return 1 when test is complete. More...
 
virtual int Prepare (int cnt)
 Prepare test. More...
 
virtual void Start ()
 Start of test. More...
 
virtual void Stop ()
 Stop of test. More...
 
 TF_TestThread (TableEngine *pTable, int argc, char **argv)
 
virtual ~TF_TestThread ()
 
- Public Member Functions inherited from TF_Test
virtual void StepMainThread ()
 Don't use. Reserve for future. More...
 
 TF_Test (TableEngine *pTable)
 

Public Attributes

TF_CheckTransferOut_task_datatd
 < Internal data for TF_CheckTransferOut More...
 
- Public Attributes inherited from TF_TestThread
pthread_attr_t m_attrThread
 
int m_CycleCnt
 
pthread_t m_hThread
 
int m_isComplete
 
int m_isException
 
int m_isPrepareComplete
 
int m_isTerminate
 
pthread_mutex_t m_ResultCompleteMutex
 
pthread_mutex_t m_ResultStartMutex
 
pthread_mutex_t m_StartMutex
 
pthread_mutex_t m_ThreadExitMutex
 
- Public Attributes inherited from TF_Test
TableEnginem_pTemplateEngine
 

Additional Inherited Members

- Static Public Member Functions inherited from TF_TestThread
static void * ThreadFunc (void *lpvThreadParm)
 

Detailed Description

check data transfer from device to host

Definition at line 19 of file tf_checktransferout.h.

Constructor & Destructor Documentation

◆ TF_CheckTransferOut()

TF_CheckTransferOut::TF_CheckTransferOut ( TableEngine pTable,
TF_Device pDevice,
int  argc,
char **  argv 
)

Constructor.

Parameters
argcNumber of arguments argv Pointer of argumnts

arguments of command line:

    -size   <n>             : size block of kilobytes, default 64
    -metric <n>             : 0 - binary:  1MB=2^10=1024*1024=1048576 bytes,
                                      1 - decimal: 1MB=10^6=1000*1000=1000000 bytes,
                                      default 0

Definition at line 132 of file tf_checktransferout.cpp.

References GetFromCommnadLine(), TF_CheckTransferOut_task_data::mbSize, TF_CheckTransferOut_task_data::metricMode, TF_CheckTransferOut_task_data::pDevice, TF_CheckTransferOut_task_data::sizeBlock, and td.

132  : TF_TestThread( pTable, argc, argv )
133 {
135 
136  td->sizeBlock = 1024 * GetFromCommnadLine( argc, argv, "-size", 64 );
137 
138  td->metricMode = GetFromCommnadLine( argc, argv, "-metric", 0 );
139  if( 0==td->metricMode )
140  td->mbSize = 1024*1024;
141  else
142  td->mbSize = 1000000;
143 
144  td->pDevice = pDevice;
145 
146 }
cl_uint sizeBlock
Size of block [bytes].
TF_TestThread(TableEngine *pTable, int argc, char **argv)
int GetFromCommnadLine(int argc, char **argv, const char *name, int defValue)
Get integer value from command line.
Definition: parse_cmd.cpp:29
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
cl_uint mbSize
bytes count in 1MB
< Internal data for TF_CheckTransferOut

◆ ~TF_CheckTransferOut()

TF_CheckTransferOut::~TF_CheckTransferOut ( )

Destructor.

Definition at line 149 of file tf_checktransferout.cpp.

References TF_CheckTransferOut_task_data::dpStatus, TF_CheckTransferOut_task_data::pBuffer, TF_CheckTransferOut_task_data::pBufOut, TF_CheckTransferOut_task_data::pStatus, and td.

150 {
151 
152  free( td->pBufOut[0] ); td->pBufOut[0]=NULL;
153  free( td->pBufOut[1] ); td->pBufOut[1]=NULL;
154  free( td->pStatus ); td->pStatus=NULL;
155 
156 
157  delete td->pBuffer[0]; td->pBuffer[0]=NULL;
158  delete td->pBuffer[1]; td->pBuffer[1]=NULL;
159  delete td->dpStatus; td->dpStatus=NULL;
160 
161 
162  delete td; td=NULL;
163 }
cl_uint * pBufOut[2]
pointers to buffers in the host memory
cl_uint * pStatus
pointer to status buffer in the host memory
cl::Buffer * pBuffer[2]
pointers to buffers in the device memory
cl::Buffer * dpStatus
pointer to status buffer in the device memory
TF_CheckTransferOut_task_data * td
< Internal data for TF_CheckTransferOut

Member Function Documentation

◆ CheckBuffer()

void TF_CheckTransferOut::CheckBuffer ( cl_uint *  ptr)

check data in the buffer

Definition at line 619 of file tf_checktransferout.cpp.

References TF_CheckTransferOut_task_data::BlockError, TF_CheckTransferOut_task_data::BlockOk, TF_CheckTransferOut_task_data::dataExpect, TF_CheckTransferOut_task_data::sizeBlock, and td.

620 {
621  cl_ulong *src = (cl_ulong*)ptr;
622  cl_uint count = td->sizeBlock / sizeof(cl_uint);
623  cl_ulong val=td->dataExpect;
624  cl_ulong di;
625  cl_ulong flag_error=0;
626  for( int ii=0; ii<count; ii++ )
627  {
628  di = *src++;
629 
630  if( di!=val )
631  {
632  flag_error++;
633  }
634  val++;
635  }
636  td->dataExpect=val;
637 
638  if( 0==flag_error )
639  td->BlockOk++;
640  else
641  td->BlockError++;
642 }
cl_uint sizeBlock
Size of block [bytes].
cl_uint BlockError
Count of incorrect blocks.
cl_ulong dataExpect
expect data from input
cl_uint BlockOk
Count of correct blocks.
TF_CheckTransferOut_task_data * td
< Internal data for TF_CheckTransferOut

◆ CleanupInThread()

void TF_CheckTransferOut::CleanupInThread ( )
virtual

Free any resource.

Implements TF_TestThread.

Definition at line 324 of file tf_checktransferout.cpp.

References TF_CheckTransferOut_task_data::q0, TF_CheckTransferOut_task_data::q1, and td.

325 {
326  printf( "TF_CheckTransferOut::%s\n", __FUNCTION__ );
327 
328  delete td->q0; td->q0=NULL;
329  delete td->q1; td->q1=NULL;
330 
331 
332 }
cl::CommandQueue * q0
Pointer to OpenCL command queue.
cl::CommandQueue * q1
Pointer to OpenCL command queue.
TF_CheckTransferOut_task_data * td
< Internal data for TF_CheckTransferOut

◆ GetResultInThread()

void TF_CheckTransferOut::GetResultInThread ( )
virtual

Show results of test.

Implements TF_TestThread.

Definition at line 335 of file tf_checktransferout.cpp.

References TF_CheckTransferOut_task_data::BlockError, TF_CheckTransferOut_task_data::BlockOk, TF_CheckTransferOut_task_data::BlockRd, TF_CheckTransferOut_task_data::BlockWr, TF_CheckTransferOut_task_data::metricMode, TF_CheckTransferOut_task_data::Sig, TF_CheckTransferOut_task_data::sizeBlock, td, TF_CheckTransferOut_task_data::testTime, TF_CheckTransferOut_task_data::VelocityAverage, TF_CheckTransferOut_task_data::VelocityCurMax, and TF_CheckTransferOut_task_data::VelocityCurMin.

336 {
337  printf( "\nTF_CheckTransferOut::%s\n\n", __FUNCTION__ );
338  //GetStatus();
339 
340  int flag_error=0;
341 
342  if( 0xAA55==td->Sig )
343  {
344  printf( "Sig=0xAA55 - Ok\n");
345  } else
346  {
347  printf( "Sig=0x%X - Error, expect 0xAA55\n", td->Sig );
348  flag_error=1;
349  }
350  printf( "BlockWr = %d\n", td->BlockWr );
351  printf( "BlockRd = %d\n", td->BlockRd );
352  printf( "BlockOK = %d\n", td->BlockOk );
353  printf( "BlockError = %d\n\n", td->BlockError );
354 
355  printf( "Size of block = %u \n\n", td->sizeBlock);
356 
357  printf( "Test time = %-.0f s\n\n", td->testTime);
358 
359  printf( "VelocityAverage = %10.1f MB/s\n", td->VelocityAverage );
360  printf( "VelocityCurrentMax = %10.1f MB/s\n", td->VelocityCurMax );
361  printf( "VelocityCurrentMin = %10.1f MB/s\n\n", td->VelocityCurMin );
362 
363  if( 0==td->metricMode)
364  printf( " 1 MB = 2^10 = 1024*1024 = 1048576 bytes\n");
365  else
366  printf( " 1 MB = 10^6 = 1000000 bytes\n");
367 
368 
369 
370  if( td->BlockOk!=td->BlockRd )
371  flag_error++;
372 
373  if( 0 == td->BlockRd )
374  flag_error++;
375 
376  if( 0 != td->BlockError )
377  flag_error++;
378 
379  if( 0==flag_error )
380  printf( "\nTest finished successfully\n\n" );
381  else
382  printf( "\nTest finished with errors\n\n" );
383 
384 }
cl_uint sizeBlock
Size of block [bytes].
float VelocityCurMin
minimum of VelocityCurrent
float VelocityAverage
average speed (from test start)
cl_uint BlockWr
Count of written blocks.
cl_uint Sig
Signature for status buffer.
cl_uint BlockRd
Count of read blocks.
float VelocityCurMax
maximum of VelocityCurrent
cl_uint BlockError
Count of incorrect blocks.
cl_uint BlockOk
Count of correct blocks.
cl_uint metricMode
0 - binary: 1MB=2^10 bytes, 1 - decimal: 1MB=10^6 bytes
TF_CheckTransferOut_task_data * td
< Internal data for TF_CheckTransferOut
float testTime
Time from test start.

◆ GetStatus()

void TF_CheckTransferOut::GetStatus ( void  )

Read status information from device.

Definition at line 645 of file tf_checktransferout.cpp.

References TF_CheckTransferOut_task_data::BlockError, TF_CheckTransferOut_task_data::BlockOk, TF_CheckTransferOut_task_data::BlockRd, TF_CheckTransferOut_task_data::dpStatus, TF_CheckTransferOut_task_data::pStatus, TF_CheckTransferOut_task_data::q0, TF_CheckTransferOut_task_data::Sig, and td.

Referenced by Run().

646 {
647  if( NULL==td->pStatus )
648  return;
649 
650 
651  cl_int ret=td->q0->enqueueReadBuffer(
652  *(td->dpStatus),
653  CL_TRUE,
654  0,
655  512,
656  td->pStatus,
657  NULL,
658  NULL
659  );
660 
661  td->Sig = td->pStatus[0];
662  td->BlockRd = td->pStatus[1];
663  td->BlockOk = td->pStatus[2];
664  td->BlockError = td->pStatus[3];
665 
666 }
cl::CommandQueue * q0
Pointer to OpenCL command queue.
cl_uint * pStatus
pointer to status buffer in the host memory
cl_uint Sig
Signature for status buffer.
cl_uint BlockRd
Count of read blocks.
cl_uint BlockError
Count of incorrect blocks.
cl_uint BlockOk
Count of correct blocks.
cl::Buffer * dpStatus
pointer to status buffer in the device memory
TF_CheckTransferOut_task_data * td
< Internal data for TF_CheckTransferOut

◆ PrepareInThread()

void TF_CheckTransferOut::PrepareInThread ( )
virtual

Prepare test.

This function executed before main body of test.

Implements TF_TestThread.

Definition at line 171 of file tf_checktransferout.cpp.

References TF_Device::context, TF_CheckTransferOut_task_data::dataOut, TF_Device::device, TF_CheckTransferOut_task_data::dpStatus, except_info(), TF_CheckTransferOut_task_data::krnl_calculate, TF_CheckTransferOut_task_data::krnl_read, TF_CheckTransferOut_task_data::pBuffer, TF_CheckTransferOut_task_data::pBufOut, TF_CheckTransferOut_task_data::pDevice, TF_Device::program, TF_CheckTransferOut_task_data::pStatus, TF_CheckTransferOut_task_data::q0, TF_CheckTransferOut_task_data::q1, TF_CheckTransferOut_task_data::sizeBlock, TF_CheckTransferOut_task_data::sizeOfuint16, and td.

172 {
173  printf( "\n");
174  printf( "TF_CheckTransferOut::%s\n\n", __FUNCTION__ );
175 
176  cl::Kernel krnl_read( td->pDevice->program, "check_read_input" );
177  td->krnl_read = krnl_read;
178 
179  cl::Kernel krnl_calculate( td->pDevice->program, "check_cnt_m2a" );
180  td->krnl_calculate = krnl_calculate;
181 
182 
183  td->sizeOfuint16 = td->sizeBlock/64; // count of words by 512 bits
184 
185 
186  printf( "Alloc host memory 2 x %d ", td->sizeBlock );
187  {
188  void *ptr=(void*)0xAAAA;
189  int err;
190  err = posix_memalign( &ptr, 4096, td->sizeBlock );
191  if( err )
192  throw except_info( "%s - memory allocation error ", __FUNCTION__);
193  td->pBufOut[0] = (cl_uint*) ptr;
194  //printf( "ptr=%p\n", ptr );
195 
196  err = posix_memalign( &ptr, 4096, td->sizeBlock );
197  if( err )
198  throw except_info( "%s - memory allocation error ", __FUNCTION__);
199  td->pBufOut[1] = (cl_uint*) ptr;
200 
201  //printf( "ptr=%p\n", ptr );
202 
203 
204 
205  err = posix_memalign( &ptr, 4096, 16384 );
206  if( err )
207  throw except_info( "%s - memory allocation error ", __FUNCTION__);
208  td->pStatus = (cl_uint*) ptr;
209 
210 
211  }
212  printf( " - Ok\n" );
213 
214  printf( "Alloc device memory 2 x %d (DDR0 & DDR1) ", td->sizeBlock );
215  {
216  cl::Buffer *pBuf;
217 
218  cl_mem_ext_ptr_t input_buffer_ext;
219 
220  input_buffer_ext.flags = XCL_MEM_DDR_BANK0;
221  input_buffer_ext.obj = NULL;
222  input_buffer_ext.param = 0;
223 
224  pBuf = new cl::Buffer( td->pDevice->context,
225  CL_MEM_READ_WRITE | CL_MEM_EXT_PTR_XILINX,
226  td->sizeBlock,
227  &input_buffer_ext
228  );
229  td->pBuffer[0] = pBuf;
230  }
231 
232  {
233  cl::Buffer *pBuf;
234 
235  cl_mem_ext_ptr_t input_buffer_ext;
236 
237  input_buffer_ext.flags = XCL_MEM_DDR_BANK0;
238  input_buffer_ext.obj = NULL;
239  input_buffer_ext.param = 0;
240 
241  pBuf = new cl::Buffer( td->pDevice->context,
242  CL_MEM_READ_WRITE | CL_MEM_EXT_PTR_XILINX,
243  td->sizeBlock,
244  &input_buffer_ext
245  );
246  td->pBuffer[1] = pBuf;
247  }
248 
249  {
250  cl::Buffer *pBuf;
251 
252  cl_mem_ext_ptr_t input_buffer_ext;
253 
254  input_buffer_ext.flags = XCL_MEM_DDR_BANK0;
255  input_buffer_ext.obj = NULL;
256  input_buffer_ext.param = 0;
257 
258  pBuf = new cl::Buffer( td->pDevice->context,
259  CL_MEM_READ_WRITE | CL_MEM_EXT_PTR_XILINX,
260  16384,
261  &input_buffer_ext
262  );
263  td->dpStatus = pBuf;
264 
265 
266  }
267 
268 
269  {
270  cl_int err0;
271  cl_int err1;
272 
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;
275 
276  td->q0 = new cl::CommandQueue(td->pDevice->context, td->pDevice->device, properties0, &err0 );
277  td->q1 = new cl::CommandQueue(td->pDevice->context, td->pDevice->device, properties1, &err1 );
278 
279  if( CL_SUCCESS != err0 )
280  throw except_info( "%s - Error for create CommandQueue q0; err=%d ", __FUNCTION__, err0 );
281 
282  if( CL_SUCCESS != err1 )
283  throw except_info( "%s - Error for create CommandQueue q1; err=%d ", __FUNCTION__, err1 );
284 
285  }
286  {
287  for( int ii=0; ii<512; ii++ )
288  {
289  td->pStatus[ii]=0;
290  }
291  td->pStatus[0]=0xBB66;
292 
293  cl_ulong val=td->dataOut;
294  cl_ulong *ptr = (cl_ulong *)&(td->pStatus[16]);
295 
296  // Set initial value
297  for( int ii=0; ii<8; ii++ )
298  {
299  *ptr++ = val++;
300  }
301 
302  // Set add const
303  for( int ii=0; ii<8; ii++ )
304  {
305  *ptr++=8;
306  }
307 
308  cl_int ret=td->q0->enqueueWriteBuffer(
309  *(td->dpStatus),
310  CL_TRUE,
311  0,
312  4096,
313  td->pStatus,
314  NULL,
315  NULL
316  );
317  }
318 
319  printf( " - Ok\n" );
320 
321 }
cl_uint * pBufOut[2]
pointers to buffers in the host memory
cl_uint sizeBlock
Size of block [bytes].
cl::Program program
OpenCL program.
Definition: tf_device.h:28
cl::CommandQueue * q0
Pointer to OpenCL command queue.
cl::Kernel krnl_read
OpenCL kernel for read data.
cl_uint * pStatus
pointer to status buffer in the host memory
except_info_t except_info(const char *fmt,...)
Definition: exceptinfo.cpp:25
cl::Buffer * pBuffer[2]
pointers to buffers in the device memory
cl_int sizeOfuint16
Size of block in 512-bit words.
cl_ulong dataOut
current data for output
cl::Context context
OpenCL context.
Definition: tf_device.h:27
cl::Buffer * dpStatus
pointer to status buffer in the device memory
cl::CommandQueue * q1
Pointer to OpenCL command queue.
TF_Device * pDevice
OpenCL device and program.
TF_CheckTransferOut_task_data * td
< Internal data for TF_CheckTransferOut
cl::Device device
OpenCL device.
Definition: tf_device.h:26
cl::Kernel krnl_calculate
OpenCL kernel for calculate.

◆ Run()

void TF_CheckTransferOut::Run ( )
virtual

Main body of test.

Implements TF_TestThread.

Definition at line 470 of file tf_checktransferout.cpp.

References TableEngine::AddRowTable(), TF_CheckTransferOut_task_data::BlockWr, TF_CheckTransferOut_task_data::flagGetStatus, GetStatus(), TF_CheckTransferOut_task_data::lastBlock, TF_CheckTransferOut_task_data::lastTime, TF_TestThread::m_isTerminate, TF_Test::m_pTemplateEngine, TF_CheckTransferOut_task_data::mbSize, TF_CheckTransferOut_task_data::pBuffer, TF_CheckTransferOut_task_data::pBufOut, TF_CheckTransferOut_task_data::RowNumber, SetBuffer(), TF_CheckTransferOut_task_data::sizeBlock, StartCalculateBuf(), TF_CheckTransferOut_task_data::startTime, StartWriteBuf(), td, TF_CheckTransferOut_task_data::testTime, TF_CheckTransferOut_task_data::VelocityAverage, TF_CheckTransferOut_task_data::VelocityCurMax, TF_CheckTransferOut_task_data::VelocityCurMin, TF_CheckTransferOut_task_data::VelocityCurrent, WaitForCalculateComplete(), and WaitForTransferBufComplete().

471 {
473 
474 
475  cl::Event eventCompletionTransfer0;
476  cl::Event eventCompletionTransfer1;
477  cl::Event eventCompletionExecuting0;
478  cl::Event eventCompletionExecuting1;
479  cl_int ret;
480 
481  std::vector<cl::Event> events0;
482  std::vector<cl::Event> events1;
483 
484  int flag_wait=0;
485  int flag_first_velocity=1;
486 
487 
488  td->lastTime = td->startTime = time(NULL);
489 
490  // set buffer 0 on host - long time operation
491  SetBuffer( td->pBufOut[0] );
492 
493  // start data transfer for buffer 0 on device - quick time
494  StartWriteBuf( td->pBuffer[0], td->pBufOut[0], eventCompletionTransfer0 );
495 
496  // set buffer 1 on host - long time operation
497  SetBuffer( td->pBufOut[1] );
498 
499  for( ; ; )
500  {
501  if( this->m_isTerminate )
502  break;
503 
504 
505  if( td->flagGetStatus )
506  {
507  GetStatus();
508  td->flagGetStatus=0;
509  }
510 
511  // Main body
512 
513  // wait complete transfer 0 - first wait
514  WaitForTransferBufComplete( eventCompletionTransfer0 );
515 
516  if( flag_wait )
517  // wait for buffer1 processing
518  WaitForCalculateComplete( eventCompletionExecuting1 );
519 
520  // start data transfer for buffer 1 on device - quick time
521  StartWriteBuf( td->pBuffer[1], td->pBufOut[1], eventCompletionTransfer1 );
522 
523 
524  // start check buffer 0 on device - quick time
525  StartCalculateBuf( td->pBuffer[0], eventCompletionExecuting0 );
526 
527  // set buffer 0 on host - long time operation
528  SetBuffer( td->pBufOut[0] );
529 
530  // wait for complete transfer 0 - second wait
531  WaitForTransferBufComplete( eventCompletionTransfer1 );
532 
533  // wait for buffer0 processing
534  WaitForCalculateComplete( eventCompletionExecuting0 );
535 
536  // start data transfer for buffer 0 on device - quick time
537  StartWriteBuf( td->pBuffer[0], td->pBufOut[0], eventCompletionTransfer0 );
538 
539 
540  // start check buffer 1 on device - quick time
541  StartCalculateBuf( td->pBuffer[1], eventCompletionExecuting1 );
542 
543  // set buffer 1 on host - long time operation
544  SetBuffer( td->pBufOut[1] );
545 
546  flag_wait=1;
547 
548 
549 
550  time_t currentTime = time(NULL);
551  time_t timeFromStart = currentTime - td->startTime;
552  time_t diff = currentTime - td->lastTime;
553  td->testTime = timeFromStart;
554 
555  if( diff >= 4 )
556  {
557  double velocity = (1.0L*(td->BlockWr-td->lastBlock)*td->sizeBlock)/diff;
558 
559  td->VelocityCurrent = velocity / (td->mbSize);
560 
561 
562  velocity = 1.0L*(td->BlockWr)*td->sizeBlock/timeFromStart;
563 
564  td->VelocityAverage = velocity / (td->mbSize);
565 
566  td->lastTime = currentTime;
567  td->lastBlock = td->BlockWr;
568 
569  if( 1==flag_first_velocity )
570  {
573  flag_first_velocity=0;
574  } else
575  {
578 
581 
582  }
583  }
584  }
585 
586  GetStatus();
587 
588 }
cl_uint * pBufOut[2]
pointers to buffers in the host memory
cl_uint sizeBlock
Size of block [bytes].
float VelocityCurMin
minimum of VelocityCurrent
float VelocityAverage
average speed (from test start)
cl_uint BlockWr
Count of written blocks.
TableEngine * m_pTemplateEngine
Definition: tf_test.h:21
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.
float VelocityCurMax
maximum of VelocityCurrent
virtual int AddRowTable()=0
cl_ulong flagGetStatus
1 - request for get status information
void GetStatus(void)
Read status information from device.
time_t startTime
time of start main test cycle
TF_CheckTransferOut_task_data * td
< Internal data for TF_CheckTransferOut
cl_uint RowNumber
Number of first row in the table.
float testTime
Time from test start.
time_t lastTime
time of last interval
void SetBuffer(cl_uint *ptr)
set test data in buffer buffer
void WaitForCalculateComplete(cl::Event &event)
Wait for complete calculate.
cl_uint mbSize
bytes count in 1MB
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.

◆ SetBuffer()

void TF_CheckTransferOut::SetBuffer ( cl_uint *  ptr)

set test data in buffer buffer

set test data in buffer

Definition at line 591 of file tf_checktransferout.cpp.

References TF_CheckTransferOut_task_data::dataOut, TF_CheckTransferOut_task_data::sizeBlock, and td.

Referenced by Run().

592 {
593  cl_ulong *dst = (cl_ulong*) ptr;
594  cl_uint count = td->sizeBlock / sizeof(cl_ulong) / 16;
595  cl_ulong val=td->dataOut;
596  for( cl_uint ii=0; ii<count; ii++ )
597  {
598  *dst++=val++;
599  *dst++=val++;
600  *dst++=val++;
601  *dst++=val++;
602  *dst++=val++;
603  *dst++=val++;
604  *dst++=val++;
605  *dst++=val++;
606  *dst++=val++;
607  *dst++=val++;
608  *dst++=val++;
609  *dst++=val++;
610  *dst++=val++;
611  *dst++=val++;
612  *dst++=val++;
613  *dst++=val++;
614  }
615  td->dataOut=val;
616 }
cl_uint sizeBlock
Size of block [bytes].
cl_ulong dataOut
current data for output
TF_CheckTransferOut_task_data * td
< Internal data for TF_CheckTransferOut

◆ StartCalculateBuf()

void TF_CheckTransferOut::StartCalculateBuf ( cl::Buffer *  pDevice,
cl::Event &  event 
)

Start kernel for buffer.

Definition at line 427 of file tf_checktransferout.cpp.

References TF_CheckTransferOut_task_data::dpStatus, TF_CheckTransferOut_task_data::krnl_calculate, TF_CheckTransferOut_task_data::krnl_read, TF_CheckTransferOut_task_data::q1, TF_CheckTransferOut_task_data::sizeOfuint16, and td.

Referenced by Run().

428 {
429 
430  cl::NDRange globalNDR(1,1,1);
431  cl::NDRange localNDR(1,1,1);
432  cl::NDRange offsetNDR=cl::NullRange;
433 
434 
435  td->krnl_calculate.setArg( 0, *(td->dpStatus) );
436  td->krnl_calculate.setArg( 1, td->sizeOfuint16 );
437 
438  td->q1->enqueueNDRangeKernel(
440  offsetNDR,
441  globalNDR,
442  localNDR,
443  NULL, //&events0,
444  &event //&eventCompletionExecuting0
445 
446  );
447 
448  td->krnl_read.setArg( 0, *pBufDevice );
449  td->krnl_read.setArg( 1, td->sizeOfuint16 );
450 
451  td->q1->enqueueNDRangeKernel(
452  td->krnl_read,
453  offsetNDR,
454  globalNDR,
455  localNDR,
456  NULL, // &events0,
457  NULL // &eventCompletionExecuting0
458 
459  );
460 }
cl::Kernel krnl_read
OpenCL kernel for read data.
cl_int sizeOfuint16
Size of block in 512-bit words.
cl::Buffer * dpStatus
pointer to status buffer in the device memory
cl::CommandQueue * q1
Pointer to OpenCL command queue.
TF_CheckTransferOut_task_data * td
< Internal data for TF_CheckTransferOut
cl::Kernel krnl_calculate
OpenCL kernel for calculate.

◆ StartWriteBuf()

void TF_CheckTransferOut::StartWriteBuf ( cl::Buffer *  pDevice,
cl_uint *  pHost,
cl::Event &  event 
)

Start data transfer.

Definition at line 411 of file tf_checktransferout.cpp.

References TF_CheckTransferOut_task_data::BlockWr, TF_CheckTransferOut_task_data::q0, TF_CheckTransferOut_task_data::sizeBlock, and td.

Referenced by Run().

412 {
413  td->q0->enqueueWriteBuffer(
414  *(pBufDevice),
415  CL_FALSE,
416  0,
417  td->sizeBlock,
418  pHost,
419  NULL,
420  &event
421  );
422 
423  td->BlockWr++;
424 }
cl_uint sizeBlock
Size of block [bytes].
cl::CommandQueue * q0
Pointer to OpenCL command queue.
cl_uint BlockWr
Count of written blocks.
TF_CheckTransferOut_task_data * td
< Internal data for TF_CheckTransferOut

◆ StepTable()

void TF_CheckTransferOut::StepTable ( )
virtual

Show table during test executing.

Implements TF_TestThread.

Definition at line 387 of file tf_checktransferout.cpp.

References TF_CheckTransferOut_task_data::BlockError, TF_CheckTransferOut_task_data::BlockOk, TF_CheckTransferOut_task_data::BlockRd, TF_CheckTransferOut_task_data::BlockWr, TF_CheckTransferOut_task_data::flagGetStatus, TF_Test::m_pTemplateEngine, TF_CheckTransferOut_task_data::RowNumber, TableEngine::SetValueTable(), td, TF_CheckTransferOut_task_data::testTime, TF_CheckTransferOut_task_data::VelocityAverage, and TF_CheckTransferOut_task_data::VelocityCurrent.

388 {
389  m_pTemplateEngine->SetValueTable( td->RowNumber, 1, (unsigned)td->BlockWr, "%10d" );
390  m_pTemplateEngine->SetValueTable( td->RowNumber, 2, (unsigned)td->BlockRd, "%10d" );
391 
392  m_pTemplateEngine->SetValueTable( td->RowNumber, 3, (unsigned)td->BlockOk, "%10d" );
393  m_pTemplateEngine->SetValueTable( td->RowNumber, 4, (unsigned)td->BlockError, "%10d" );
396 
397  m_pTemplateEngine->SetValueTable( td->RowNumber, 0, "OUT:%7.1f", td->testTime );
398 
399 
400  td->flagGetStatus=1;
401 }
float VelocityAverage
average speed (from test start)
cl_uint BlockWr
Count of written blocks.
TableEngine * m_pTemplateEngine
Definition: tf_test.h:21
cl_uint BlockRd
Count of read blocks.
float VelocityCurrent
current speed (on 4 secund interval)
cl_uint BlockError
Count of incorrect blocks.
cl_ulong flagGetStatus
1 - request for get status information
cl_uint BlockOk
Count of correct blocks.
virtual int SetValueTable(unsigned nRow, unsigned nColumn, const char *fmt,...)=0
TF_CheckTransferOut_task_data * td
< Internal data for TF_CheckTransferOut
cl_uint RowNumber
Number of first row in the table.
float testTime
Time from test start.

◆ WaitForCalculateComplete()

void TF_CheckTransferOut::WaitForCalculateComplete ( cl::Event &  event)

Wait for complete calculate.

Definition at line 463 of file tf_checktransferout.cpp.

Referenced by Run().

464 {
465  event.wait();
466 }

◆ WaitForTransferBufComplete()

void TF_CheckTransferOut::WaitForTransferBufComplete ( cl::Event &  event)

Wait for complete data transfer.

Definition at line 405 of file tf_checktransferout.cpp.

Referenced by Run().

406 {
407  event.wait();
408 }

Member Data Documentation

◆ td

TF_CheckTransferOut_task_data* TF_CheckTransferOut::td

The documentation for this class was generated from the following files: