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

common data for OpenCL device More...

#include <tf_device.h>

Public Member Functions

 TF_Device (int argc, char **argv)
 
virtual ~TF_Device ()
 

Public Attributes

cl::Context context
 OpenCL context. More...
 
cl::Device device
 OpenCL device. More...
 
std::string deviceName
 OpenCL device name. More...
 
cl::Program program
 OpenCL program. More...
 
std::string xclbinFileName
 file name for container More...
 

Detailed Description

common data for OpenCL device

Definition at line 17 of file tf_device.h.

Constructor & Destructor Documentation

◆ TF_Device()

TF_Device::TF_Device ( int  argc,
char **  argv 
)
Parameters
argcNumber of arguments argv Pointer of argumnts

Arguments:

-file <path> : fullpath for xclbin, default "../binary_container_1.xclbin"

Definition at line 21 of file tf_device.cpp.

References context, device, deviceName, xcl::get_xil_devices(), GetStrFromCommnadLine(), xcl::import_binary_file(), program, and xclbinFileName.

22 {
23 
24 
25  printf( "Open device\n");
26  std::vector<cl::Device> devices = xcl::get_xil_devices();
27 
28  device = devices[0];
29  deviceName = device.getInfo<CL_DEVICE_NAME>();
30  printf( "Device: %s\n", deviceName.c_str());
31 
32  cl::Context context_i( device );
33  context = context_i;
34 
35  char str[512];
36  GetStrFromCommnadLine( argc, argv, "-file", "../binary_container_1.xclbin", str, 510 );
37  xclbinFileName = str;
38 
39  cl::Program::Binaries bins = xcl::import_binary_file( xclbinFileName.c_str() );
40  devices.resize(1);
41  cl::Program program_i(context, devices, bins);
42 
43  program = program_i;
44 
45 
46 
47 }
int GetStrFromCommnadLine(int argc, char **argv, const char *name, char *defValue, char *dst, int dstLen)
Get string value from command line.
Definition: parse_cmd.cpp:58
cl::Program program
OpenCL program.
Definition: tf_device.h:28
std::vector< cl::Device > get_xil_devices()
Definition: xcl2.cpp:63
cl::Context context
OpenCL context.
Definition: tf_device.h:27
std::string xclbinFileName
file name for container
Definition: tf_device.h:24
cl::Program::Binaries import_binary_file(std::string xclbin_file_name)
Definition: xcl2.cpp:66
cl::Device device
OpenCL device.
Definition: tf_device.h:26
std::string deviceName
OpenCL device name.
Definition: tf_device.h:22

◆ ~TF_Device()

TF_Device::~TF_Device ( )
virtual

Definition at line 49 of file tf_device.cpp.

49  {
50 
51 }

Member Data Documentation

◆ context

cl::Context TF_Device::context

OpenCL context.

Definition at line 27 of file tf_device.h.

Referenced by TF_CheckTransferIn::PrepareInThread(), TF_CheckTransferOut::PrepareInThread(), and TF_Device().

◆ device

cl::Device TF_Device::device

OpenCL device.

Definition at line 26 of file tf_device.h.

Referenced by TF_CheckTransferIn::PrepareInThread(), TF_CheckTransferOut::PrepareInThread(), and TF_Device().

◆ deviceName

std::string TF_Device::deviceName

OpenCL device name.

Definition at line 22 of file tf_device.h.

Referenced by TF_Device().

◆ program

cl::Program TF_Device::program

OpenCL program.

Definition at line 28 of file tf_device.h.

Referenced by TF_CheckTransferIn::PrepareInThread(), TF_CheckTransferOut::PrepareInThread(), and TF_Device().

◆ xclbinFileName

std::string TF_Device::xclbinFileName

file name for container

Definition at line 24 of file tf_device.h.

Referenced by TF_Device().


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