Skip to content

Commit

Permalink
Return a valid JSON when no OpenCL platforms found
Browse files Browse the repository at this point in the history
  • Loading branch information
Galarius committed Aug 25, 2023
1 parent e269352 commit 9f07f77
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/clinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,19 +526,16 @@ class CLInfo final : public ICLInfo
public:
nlohmann::json json()
{
const auto platforms = GetPlatforms();
if (platforms.size() == 0)
{
return {};
}

std::vector<nlohmann::json> jsonPlatforms;
for (const auto& platform : platforms)
const auto platforms = GetPlatforms();
if (platforms.size() > 0)
{
logger()->trace("{}", GetPlatformDescription(platform));
jsonPlatforms.emplace_back(GetPlatformJSONInfo(platform));
for (const auto& platform : platforms)
{
logger()->trace("{}", GetPlatformDescription(platform));
jsonPlatforms.emplace_back(GetPlatformJSONInfo(platform));
}
}

return nlohmann::json {{"PLATFORMS", jsonPlatforms}};
}

Expand Down

0 comments on commit 9f07f77

Please sign in to comment.