boostorg / compute

A C++ GPU Computing Library for OpenCL
http://boostorg.github.io/compute/
Boost Software License 1.0
1.52k stars 333 forks source link

program::build_log() returns error log only for first device #840

Open Perl99 opened 5 years ago

Perl99 commented 5 years ago

When you create a context with more than one device (like both Intel CPU and Intel GPU) and there is build error, the build_log() method only returns log for first device. It should do so for each device in the context.

In my case, build for the CPU was successful, but for the GPU had error. The build log only contained info about CPU.

rosenrodt commented 4 years ago

The build log is implemented in programs.hpp as:

 /// Returns the build log.
std::string build_log() const
{
    return get_build_info<std::string>(CL_PROGRAM_BUILD_LOG, get_devices().front());
}

You can try to change this line to something like this

 /// Returns the build log.
std::string build_log() const
{
    std::string full_log;
    for (auto& device : get_devices())
    {
        full_log = full_log + 
                   device.name() + 
                   '\n' + 
                   get_build_info<std::string>(CL_PROGRAM_BUILD_LOG, device);
    }
    return full_log;
}