Linking to Linux OpenCL ICD and printing OpenCL platforms in diagnostics.

This commit is contained in:
clemahieu 2016-04-03 20:28:06 -05:00
commit ec6e72ae36
3 changed files with 20 additions and 3 deletions

View file

@ -206,7 +206,7 @@ set_target_properties (rai_wallet qt_test PROPERTIES LINK_FLAGS "${PLATFORM_LINK
if (WIN32)
set (PLATFORM_LIBS ws2_32 mswsock)
else (WIN32)
set (PLATFORM_LIBS pthread)
set (PLATFORM_LIBS pthread OpenCL)
endif (WIN32)
if (WIN32)

View file

@ -2468,6 +2468,17 @@ bool rai::handle_node_options (boost::program_options::variables_map & vm)
rai::uint256_union junk2 (0);
rai::kdf kdf;
kdf.phs (junk1, "", junk2);
std::cout << "Dumping OpenCL information" << std::endl;
bool error (false);
rai::opencl_environment environment (error);
if (!error)
{
environment.dump ();
}
else
{
std::cout << "Error initializing OpenCL" << std::endl;
}
}
else if (vm.count ("key_create"))
{
@ -2962,4 +2973,4 @@ work (false)
auto working (rai::working_path ());
boost::filesystem::create_directories (working);
node = std::make_shared <rai::node> (init, *service, 24000, working, alarm, logging, work);
}
}

View file

@ -410,6 +410,12 @@ rai::opencl_environment::opencl_environment (bool & error_a)
void rai::opencl_environment::dump ()
{
auto index (0);
auto device_count (0);
for (auto & i: devices)
{
device_count += i.second.size ();
}
std::cout << boost::str (boost::format ("Found %1% platforms and %2% devices\n") % devices.size () % device_count);
for (auto i (devices.begin ()), n (devices.end ()); i != n; ++i, ++index)
{
std::vector <unsigned> queries = {CL_PLATFORM_PROFILE, CL_PLATFORM_VERSION, CL_PLATFORM_NAME, CL_PLATFORM_VENDOR, CL_PLATFORM_EXTENSIONS};
@ -591,4 +597,4 @@ uint64_t rai::opencl_work::generate_work (rai::uint256_union const & root_a)
cl_int finishError = clFinish (queue);
}
return result;
}
}