MCPcopy Create free account
hub / github.com/ccsb-scripps/AutoDock-GPU / getProgramInfo

Function getProgramInfo

wrapcl/src/Programs.cpp:29–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27
28#ifdef PROGRAM_INFO_DISPLAY
29int getProgramInfo(cl_program program)
30{
31 cl_uint i;
32 cl_int err;
33
34 cl_context* context_in_program;
35 cl_uint* num_dev_in_program;
36 cl_device_id* device_ids_program;
37 char* program_source;
38 size_t* program_bin_size;
39 unsigned char** program_binaries;
40 cl_uint* ref_count_program;
41
42 size_t sizeParam;
43
44 // ----------------------------------------------------------------------------
45 // Query Context in program
46 printf("\n-----------------------------------------------------------------------\n");
47 err = clGetProgramInfo(program,CL_PROGRAM_CONTEXT,0,NULL,&sizeParam);
48 if (err != CL_SUCCESS){
49 printf("Error: clGetProgramInfo() %d\n",err);
50 fflush(stdout);
51 return EXIT_FAILURE;
52 }
53
54 context_in_program = (cl_context*) malloc(sizeof(cl_context) * sizeParam);
55 err = clGetProgramInfo(program,CL_PROGRAM_CONTEXT,sizeParam,context_in_program,NULL);
56 if (err != CL_SUCCESS){
57 printf("Error: clGetProgramInfo() %d\n",err);
58 fflush(stdout);
59 return EXIT_FAILURE;
60 }
61
62 printf(" %-45s: %x \n", "CL_PROGRAM_CONTEXT", *context_in_program);
63 free(context_in_program);
64
65 // ----------------------------------------------------------------------------
66 // Query Number of devices targeted by the program
67
68 err = clGetProgramInfo(program,CL_PROGRAM_NUM_DEVICES,0,NULL,&sizeParam);
69 if (err != CL_SUCCESS){
70 printf("Error: clGetProgramInfo() %d\n",err);
71 fflush(stdout);
72 return EXIT_FAILURE;
73 }
74
75 num_dev_in_program = (cl_uint*) malloc(sizeof(cl_uint) * sizeParam);
76 err = clGetProgramInfo(program,CL_PROGRAM_NUM_DEVICES,sizeParam,num_dev_in_program,NULL);
77 if (err != CL_SUCCESS){
78 printf("Error: clGetProgramInfo() %d\n",err);
79 fflush(stdout);
80 return EXIT_FAILURE;
81 }
82
83 printf(" %-45s: %u \n", "CL_PROGRAM_NUM_DEVICES", *num_dev_in_program);
84
85 // Store num devices
86 cl_uint num_dev_tmp = *num_dev_in_program;

Callers 2

ImportSourceToProgramFunction · 0.85
ImportBinaryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected