| 544 | } |
| 545 | |
| 546 | std::string GPUTreeLearner::GetBuildLog(const std::string &opts) { |
| 547 | boost::compute::program program = boost::compute::program::create_with_source(kernel_source_, ctx_); |
| 548 | try { |
| 549 | program.build(opts); |
| 550 | } |
| 551 | catch (boost::compute::opencl_error &e) { |
| 552 | auto error_code = e.error_code(); |
| 553 | std::string log("No log available.\n"); |
| 554 | // for other types of failure, build log might not be available; program.build_log() can crash |
| 555 | if (error_code == CL_INVALID_PROGRAM || error_code == CL_BUILD_PROGRAM_FAILURE) { |
| 556 | try { |
| 557 | log = program.build_log(); |
| 558 | } |
| 559 | catch(...) { |
| 560 | // Something bad happened. Just return "No log available." |
| 561 | } |
| 562 | } |
| 563 | return log; |
| 564 | } |
| 565 | // build is okay, log may contain warnings |
| 566 | return program.build_log(); |
| 567 | } |
| 568 | |
| 569 | void GPUTreeLearner::BuildGPUKernels() { |
| 570 | Log::Info("Compiling OpenCL Kernel with %d bins...", device_bin_size_); |
nothing calls this directly
no test coverage detected