check transfer  0.1
Check data transfer for SDAccell OpenCL application
tf_device.cpp
Go to the documentation of this file.
1 /*
2  * tf_device.cpp
3  *
4  * Created on: Sep 4, 2017
5  * Author: user52
6  */
7 
8 #include <tf_device.h>
9 #include "parse_cmd.h"
10 
11 /**
12 *
13 * \param argc Number of arguments
14 * \parma argv Pointer of argumnts
15 *
16 * Arguments:
17 *
18 * -file <path> : fullpath for xclbin, default "../binary_container_1.xclbin"
19 *
20 */
21 TF_Device::TF_Device( int argc, char** argv )
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 }
48 
50 
51 }
52 
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
TF_Device(int argc, char **argv)
Definition: tf_device.cpp:21
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
virtual ~TF_Device()
Definition: tf_device.cpp:49
cl::Device device
OpenCL device.
Definition: tf_device.h:26
std::string deviceName
OpenCL device name.
Definition: tf_device.h:22