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

check data transfer from host to device More...

#include <tf_checktransferin.h>

Inheritance diagram for TF_CheckTransferIn:
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 StartReadBuf (cl::Buffer *pDevice, cl_uint *pHost, cl::Event &event)
 Start data transfer. More...
 
virtual void StepTable ()
 Show table during test executing. More...
 
 TF_CheckTransferIn (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_CheckTransferIn ()
 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_CheckTransferIn_task_datatd
 < Internal data for TF_CheckTransferIn 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 host to device

Definition at line 19 of file tf_checktransferin.h.

Constructor & Destructor Documentation

◆ TF_CheckTransferIn()

TF_CheckTransferIn::TF_CheckTransferIn ( 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 133 of file tf_checktransferin.cpp.

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

133  : TF_TestThread( pTable, argc, argv )
134 {
136 
137  td->sizeBlock = 1024 * GetFromCommnadLine( argc, argv, "-size", 64 );
138 
139  td->metricMode = GetFromCommnadLine( argc, argv, "-metric", 0 );
140  if( 0==td->metricMode )
141  td->mbSize = 1024*1024;
142  else
143  td->mbSize = 1000000;
144 
145  td->pDevice = pDevice;
146 
147 }
< Internal data for TF_CheckTransferIn
TF_Device * pDevice
OpenCL device and program.
TF_TestThread(TableEngine *pTable, int argc, char **argv)
TF_CheckTransferIn_task_data * td
< Internal data for TF_CheckTransferIn
cl_uint sizeBlock
Size of block [bytes].
cl_uint mbSize
bytes count in 1MB
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_CheckTransferIn()

TF_CheckTransferIn::~TF_CheckTransferIn ( )

Destructor.

Definition at line 150 of file tf_checktransferin.cpp.

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

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

Member Function Documentation

◆ CheckBuffer()

void TF_CheckTransferIn::CheckBuffer ( cl_uint *  ptr)

check data in the buffer

Definition at line 597 of file tf_checktransferin.cpp.

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

Referenced by Run().

598 {
599  cl_ulong *src = (cl_ulong*)ptr;
600  cl_uint count = td->sizeBlock / sizeof(cl_ulong);
601  cl_ulong val=td->dataExpect;
602  cl_ulong di;
603  cl_ulong flag_error=0;
604  for( int ii=0; ii<count; ii++ )
605  {
606  di = *src++;
607 
608  if( di!=val )
609  {
610  flag_error++;
611  }
612  val++;
613  }
614  td->dataExpect=val;
615 
616  if( 0==flag_error )
617  td->BlockOk++;
618  else
619  td->BlockError++;
620 }
cl_ulong dataExpect
expect data from input
cl_uint BlockOk
Count of correct blocks.
TF_CheckTransferIn_task_data * td
< Internal data for TF_CheckTransferIn
cl_uint sizeBlock
Size of block [bytes].
cl_uint BlockError
Count of incorrect blocks.

◆ CleanupInThread()

void TF_CheckTransferIn::CleanupInThread ( )
virtual

Free any resource.

Implements TF_TestThread.

Definition at line 323 of file tf_checktransferin.cpp.

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

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

◆ GetResultInThread()

void TF_CheckTransferIn::GetResultInThread ( )
virtual

Show results of test.

Implements TF_TestThread.

Definition at line 334 of file tf_checktransferin.cpp.

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

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

◆ GetStatus()

void TF_CheckTransferIn::GetStatus ( void  )

Read status information from device.

Definition at line 623 of file tf_checktransferin.cpp.

References TF_CheckTransferIn_task_data::BlockWr, TF_CheckTransferIn_task_data::dpStatus, TF_CheckTransferIn_task_data::pStatus, TF_CheckTransferIn_task_data::q0, TF_CheckTransferIn_task_data::Sig, and td.

Referenced by Run().

624 {
625  if( NULL==td->pStatus )
626  return;
627 
628 
629  cl_int ret=td->q0->enqueueReadBuffer(
630  *(td->dpStatus),
631  CL_TRUE,
632  0,
633  512,
634  td->pStatus,
635  NULL,
636  NULL
637  );
638 
639  td->Sig = td->pStatus[0];
640  td->BlockWr = td->pStatus[1];
641 
642 }
cl::CommandQueue * q0
Pointer to OpenCL command queue.
TF_CheckTransferIn_task_data * td
< Internal data for TF_CheckTransferIn
cl::Buffer * dpStatus
pointer to status buffer in the device memory
cl_uint BlockWr
Count of written blocks.
cl_uint * pStatus
pointer to status buffer in the host memory
cl_uint Sig
Signature for status buffer.

◆ PrepareInThread()

void TF_CheckTransferIn::PrepareInThread ( )
virtual

Prepare test.

This function executed before main body of test.

Implements TF_TestThread.

Definition at line 172 of file tf_checktransferin.cpp.

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

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

◆ Run()

void TF_CheckTransferIn::Run ( )
virtual

Main body of test.

Implements TF_TestThread.

Definition at line 454 of file tf_checktransferin.cpp.

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

455 {
457 
458 
459  cl::Event eventCompletionTransfer0;
460  cl::Event eventCompletionTransfer1;
461  cl::Event eventCompletionExecuting0;
462  cl::Event eventCompletionExecuting1;
463  cl_int ret;
464 
465  std::vector<cl::Event> events0;
466  std::vector<cl::Event> events1;
467 
468  int flag_continue=0;
469  int flag_first_velocity=1;
470 
471 
472 
473  td->lastTime = td->startTime = time(NULL);
474 
475  // start check buffer 0 on device - quick time
476  StartCalculateBuf( td->pBuffer[0], eventCompletionExecuting0 );
477 
478 
479  for( ; ; )
480  {
481  if( this->m_isTerminate )
482  break;
483 
484 
485  if( td->flagGetStatus )
486  {
487  GetStatus();
488  td->flagGetStatus=0;
489  }
490 
491  // Main body
492 
493  WaitForCalculateComplete( eventCompletionExecuting0 );
494 
495  // start data transfer from buffer 0 on device - quick time
496  StartReadBuf( td->pBuffer[0], td->pBufOut[0], eventCompletionTransfer0 );
497 
498  // start check buffer 1 on device - quick time
499  StartCalculateBuf( td->pBuffer[1], eventCompletionExecuting1 );
500 
501  if( flag_continue )
502  {
503  // check buffer 0 - long time operation
504  CheckBuffer( td->pBufOut[1] );
505  }
506 
507  // wait complete transfer 0 - first wait
508  WaitForTransferBufComplete( eventCompletionTransfer0 );
509 
510  WaitForCalculateComplete( eventCompletionExecuting1 );
511 
512  // start data transfer from buffer 1 on device - quick time
513  StartReadBuf( td->pBuffer[1], td->pBufOut[1], eventCompletionTransfer1 );
514 
515  // start check buffer 0 on device - quick time
516  StartCalculateBuf( td->pBuffer[0], eventCompletionExecuting0 );
517 
518  // check buffer 0 - long time operation
519  CheckBuffer( td->pBufOut[0] );
520 
521  // wait complete transfer 1 - first wait
522  WaitForTransferBufComplete( eventCompletionTransfer1 );
523 
524 
525  flag_continue=1;
526 
527 
528  time_t currentTime = time(NULL);
529  time_t timeFromStart = currentTime - td->startTime;
530  time_t diff = currentTime - td->lastTime;
531  td->testTime = timeFromStart;
532 
533  if( diff >= 4 )
534  {
535  double velocity = (1.0L*(td->BlockRd-td->lastBlock)*td->sizeBlock)/diff;
536 
537  td->VelocityCurrent = velocity / (td->mbSize);
538 
539 
540  velocity = 1.0L*(td->BlockRd)*td->sizeBlock/timeFromStart;
541 
542  td->VelocityAverage = velocity / (td->mbSize);
543 
544  td->lastTime = currentTime;
545  td->lastBlock = td->BlockRd;
546 
547  if( 1==flag_first_velocity )
548  {
551  flag_first_velocity=0;
552  } else
553  {
556 
559 
560  }
561  }
562  }
563 
564  GetStatus();
565 
566 }
cl_ulong flagGetStatus
1 - request for get status information
cl_uint BlockRd
Count of read blocks.
void StartCalculateBuf(cl::Buffer *pDevice, cl::Event &event)
Start kernel for buffer.
time_t lastTime
time of last interval
cl::Buffer * pBuffer[2]
pointers to buffers in the device memory
TF_CheckTransferIn_task_data * td
< Internal data for TF_CheckTransferIn
float VelocityCurMax
maximum of VelocityCurrent
TableEngine * m_pTemplateEngine
Definition: tf_test.h:21
cl_uint sizeBlock
Size of block [bytes].
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.
void WaitForCalculateComplete(cl::Event &event)
Wait for complete calculate.
cl_uint * pBufOut[2]
pointers to buffers in the host memory
void StartReadBuf(cl::Buffer *pDevice, cl_uint *pHost, cl::Event &event)
Start data transfer.
virtual int AddRowTable()=0
float VelocityCurrent
current speed (on 4 secund interval)
cl_uint lastBlock
Number BlockWr for lastTick.
float VelocityCurMin
minimum of VelocityCurrent
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.
float testTime
Time from test start.

◆ SetBuffer()

void TF_CheckTransferIn::SetBuffer ( cl_uint *  ptr)

set test data in buffer buffer

set test data in buffer

Definition at line 569 of file tf_checktransferin.cpp.

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

570 {
571  cl_ulong *dst = (cl_ulong*) ptr;
572  cl_uint count = td->sizeBlock / sizeof(cl_ulong) / 16;
573  cl_ulong val=td->dataOut;
574  for( cl_uint ii=0; ii<count; ii++ )
575  {
576  *dst++=val++;
577  *dst++=val++;
578  *dst++=val++;
579  *dst++=val++;
580  *dst++=val++;
581  *dst++=val++;
582  *dst++=val++;
583  *dst++=val++;
584  *dst++=val++;
585  *dst++=val++;
586  *dst++=val++;
587  *dst++=val++;
588  *dst++=val++;
589  *dst++=val++;
590  *dst++=val++;
591  *dst++=val++;
592  }
593  td->dataOut=val;
594 }
TF_CheckTransferIn_task_data * td
< Internal data for TF_CheckTransferIn
cl_uint sizeBlock
Size of block [bytes].
cl_ulong dataOut
current data for output

◆ StartCalculateBuf()

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

Start kernel for buffer.

Definition at line 423 of file tf_checktransferin.cpp.

References TF_CheckTransferIn_task_data::dpStatus, TF_CheckTransferIn_task_data::krnl_calculate, TF_CheckTransferIn_task_data::q1, TF_CheckTransferIn_task_data::sizeOfuint16, and td.

Referenced by Run().

424 {
425 
426  cl::NDRange globalNDR(1,1,1);
427  cl::NDRange localNDR(1,1,1);
428  cl::NDRange offsetNDR=cl::NullRange;
429 
430  td->krnl_calculate.setArg( 0, *pBufDevice );
431  td->krnl_calculate.setArg( 1, *(td->dpStatus) );
432  td->krnl_calculate.setArg( 2, td->sizeOfuint16 );
433 
434  td->q1->enqueueNDRangeKernel(
436  offsetNDR,
437  globalNDR,
438  localNDR,
439  NULL, //&events0,
440  &event //&eventCompletionExecuting0
441 
442  );
443 
444 }
cl::CommandQueue * q1
Pointer to OpenCL command queue.
TF_CheckTransferIn_task_data * td
< Internal data for TF_CheckTransferIn
cl::Buffer * dpStatus
pointer to status buffer in the device memory
cl_int sizeOfuint16
Size of block in 512-bit words.
cl::Kernel krnl_calculate
OpenCL kernel for calculate.

◆ StartReadBuf()

void TF_CheckTransferIn::StartReadBuf ( cl::Buffer *  pDevice,
cl_uint *  pHost,
cl::Event &  event 
)

Start data transfer.

Definition at line 407 of file tf_checktransferin.cpp.

References TF_CheckTransferIn_task_data::BlockRd, TF_CheckTransferIn_task_data::q0, TF_CheckTransferIn_task_data::sizeBlock, and td.

Referenced by Run().

408 {
409  td->q0->enqueueReadBuffer(
410  *(pBufDevice),
411  CL_FALSE,
412  0,
413  td->sizeBlock,
414  pHost,
415  NULL,
416  &event
417  );
418 
419  td->BlockRd++;
420 }
cl_uint BlockRd
Count of read blocks.
cl::CommandQueue * q0
Pointer to OpenCL command queue.
TF_CheckTransferIn_task_data * td
< Internal data for TF_CheckTransferIn
cl_uint sizeBlock
Size of block [bytes].

◆ StepTable()

void TF_CheckTransferIn::StepTable ( )
virtual

Show table during test executing.

Implements TF_TestThread.

Definition at line 383 of file tf_checktransferin.cpp.

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

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

◆ WaitForCalculateComplete()

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

Wait for complete calculate.

Definition at line 447 of file tf_checktransferin.cpp.

Referenced by Run().

448 {
449  event.wait();
450 }

◆ WaitForTransferBufComplete()

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

Wait for complete data transfer.

Definition at line 401 of file tf_checktransferin.cpp.

Referenced by Run().

402 {
403  event.wait();
404 }

Member Data Documentation

◆ td

TF_CheckTransferIn_task_data* TF_CheckTransferIn::td

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