staticbool testOpenCLDriver()
{ // A simple OpenCL test run in a separate process in order to test // whether the driver crashes (asserts,etc.) when trying to use OpenCL.
SAL_INFO("opencl", "Starting CL driver test");
SAL_INFO("opencl", "Starting CL test spreadsheet");
// A stale lock file would make the loading fail, so make sure to remove it. try {
::svt::DocumentLockFile lockFile( rURL );
lockFile.RemoveFileDirectly();
} catch (const css::uno::Exception&)
{
}
// What an unpleasant API to use.
css::uno::Reference< css::sheet::XCalculatable > xCalculatable( xComponent, css::uno::UNO_QUERY_THROW);
css::uno::Reference< css::sheet::XSpreadsheetDocument > xSpreadDoc( xComponent, css::uno::UNO_QUERY_THROW );
css::uno::Reference< css::sheet::XSpreadsheets > xSheets( xSpreadDoc->getSheets(), css::uno::UNO_SET_THROW );
css::uno::Reference< css::container::XIndexAccess > xIndex( xSheets, css::uno::UNO_QUERY_THROW );
css::uno::Reference< css::sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), css::uno::UNO_QUERY_THROW);
// So we insert our MAX call at the end on a named range.
css::uno::Reference< css::table::XCell2 > xThresh( xSheet->getCellByPosition(1,1), css::uno::UNO_QUERY_THROW ); // B2 double fThreshold = xThresh->getValue();
// We need pure OCL formulae all the way through the // dependency chain, or we fall-back.
xCalculatable->calculateAll();
// So we insert our MAX call at the end on a named range.
css::uno::Reference< css::table::XCell2 > xCell( xSheet->getCellByPosition(1,0), css::uno::UNO_QUERY_THROW );
xCell->setFormula(u"=MAX(results)"_ustr); double fResult = xCell->getValue();
if (aSelectedCLDeviceVersionID == officecfg::Office::Common::Misc::SelectedOpenCLDeviceIdentifier::get()) return;
// OpenCL device changed - sanity check it and disable if bad.
sal_Int32 nOrigMinimumSize = officecfg::Office::Calc::Formula::Calculation::OpenCLMinimumDataSize::get();
{ // set the minimum group size to something small for quick testing.
std::shared_ptr<comphelper::ConfigurationChanges> xBatch(comphelper::ConfigurationChanges::create());
officecfg::Office::Calc::Formula::Calculation::OpenCLMinimumDataSize::set(3/* small */, xBatch);
xBatch->commit();
}
// Hopefully at least basic functionality always works and broken OpenCL implementations break // only when they are used to compute something. If this assumptions turns out to be not true, // the driver check needs to be moved sooner. bool bSucceeded = testOpenCLDriver() && testOpenCLCompute(xDesktop, aURL);
{ // restore the minimum group size
std::shared_ptr<comphelper::ConfigurationChanges> xBatch(comphelper::ConfigurationChanges::create());
officecfg::Office::Calc::Formula::Calculation::OpenCLMinimumDataSize::set(nOrigMinimumSize, xBatch);
officecfg::Office::Common::Misc::SelectedOpenCLDeviceIdentifier::set(aSelectedCLDeviceVersionID, xBatch);
xBatch->commit();
}
if (!bSucceeded)
OpenCLZone::hardDisable();
} #endif// HAVE_FEATURE_OPENCL
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.