| 449 | } |
| 450 | |
| 451 | static cl_int getSingleBinaryFromProgram(cl_program program, |
| 452 | std::vector<unsigned char*> & binary) |
| 453 | { |
| 454 | // 3 - Determine the size of each program binary |
| 455 | size_t size; |
| 456 | cl_int err = clGetProgramInfo(program, CL_PROGRAM_BINARY_SIZES, |
| 457 | sizeof(size_t), |
| 458 | &size, NULL); |
| 459 | if (err != CL_SUCCESS) |
| 460 | { |
| 461 | std::cerr << "Error querying for program binary sizes" << std::endl; |
| 462 | return err; |
| 463 | } |
| 464 | |
| 465 | binary.resize(size); |
| 466 | binary[0] = new unsigned char[size]; |
| 467 | |
| 468 | unsigned char * binary_address[1] = { binary[0] }; |
| 469 | |
| 470 | // 4 - Get all of the program binaries |
| 471 | err = clGetProgramInfo(program, CL_PROGRAM_BINARIES, 1 * sizeof(unsigned char*), |
| 472 | binary_address, NULL); |
| 473 | |
| 474 | |
| 475 | if (err != CL_SUCCESS) |
| 476 | { |
| 477 | delete[] binary[0]; |
| 478 | #if CAPS_DEBUG |
| 479 | std::cerr << "Error querying for program binaries" << std::endl; |
| 480 | #endif |
| 481 | return err; |
| 482 | } |
| 483 | |
| 484 | return CL_SUCCESS; |
| 485 | } |
| 486 | |
| 487 | cl_int FFTBinaryLookup::writeCacheFile(std::vector<unsigned char*> &data) |
| 488 | { |