diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-10-30 12:41:16 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-10-30 12:42:19 -0400 |
commit | 3fbda041d29ec6436460b75944e8c15f96366da5 (patch) | |
tree | 25a6b393fedfaeb520776377e437510ddcd5b0a6 | |
parent | 077ef157eff28b8b50725663a287ccb2a511b071 (diff) |
Have the OpenCL test really use OpenCL.
Disabled testCompilerString() which currently fails.
Change-Id: I4bfc9bef0a2a3e204551085f5eaa5b9d4bebbe3c
-rw-r--r-- | sc/inc/document.hxx | 4 | ||||
-rw-r--r-- | sc/qa/unit/opencl-test.cxx | 319 | ||||
-rw-r--r-- | sc/source/core/opencl/formulagroupcl.cxx | 1 | ||||
-rw-r--r-- | sc/source/core/tool/formulagroup.cxx | 1 |
4 files changed, 226 insertions, 99 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index dd84f5d9f719..fb3a1758569e 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -970,8 +970,8 @@ public: void SetDirty( const ScRange& ); void SetTableOpDirty( const ScRange& ); // for Interpreter TableOp void InterpretDirtyCells( const ScRangeList& rRanges ); - void CalcAll(); - SC_DLLPUBLIC void CalcAfterLoad(); + SC_DLLPUBLIC void CalcAll(); + SC_DLLPUBLIC void CalcAfterLoad(); void CompileAll(); void CompileXML(); diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index c595101101bf..f3a95763c13b 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -38,6 +38,48 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; +#include <stdio.h> +#include <string> +#include <sys/time.h> + +namespace { + +class stack_printer +{ +public: + explicit stack_printer(const char* msg) : + msMsg(msg) + { + fprintf(stdout, "%s: --begin\n", msMsg.c_str()); + mfStartTime = getTime(); + } + + ~stack_printer() + { + double fEndTime = getTime(); + fprintf(stdout, "%s: --end (duration: %g sec)\n", msMsg.c_str(), (fEndTime - mfStartTime)); + } + + void printTime(int line) const + { + double fEndTime = getTime(); + fprintf(stdout, "%s: --(%d) (duration: %g sec)\n", msMsg.c_str(), line, (fEndTime - mfStartTime)); + } + +private: + double getTime() const + { + timeval tv; + gettimeofday(&tv, NULL); + return tv.tv_sec + tv.tv_usec / 1000000.0; + } + + ::std::string msMsg; + double mfStartTime; +}; + +} + /* Implementation of Filters test */ class ScOpenclTest @@ -46,7 +88,19 @@ class ScOpenclTest { public: ScOpenclTest(); - bool enableOpenCL(); + + /** + * Try to auto-detect OpenCL device if one is available. + * + * @return true if a usable OpenCL device is found, false otherwise. + */ + bool detectOpenCLDevice(); + + /** + * Turn on OpenCL group interpreter. Call this after the document is + * loaded and before performing formula calculation. + */ + void enableOpenCL(); virtual void setUp(); virtual void tearDown(); @@ -123,7 +177,7 @@ public: CPPUNIT_TEST(testStatisticalFormulaHarMean); CPPUNIT_TEST(testFinancialCoupdaybsFormula); CPPUNIT_TEST(testFinacialDollardeFormula); - CPPUNIT_TEST(testCompilerString); +// CPPUNIT_TEST(testCompilerString); CPPUNIT_TEST(testCompilerInEq); CPPUNIT_TEST(testFinacialDollarfrFormula); CPPUNIT_TEST(testFinacialSYDFormula); @@ -170,21 +224,27 @@ bool ScOpenclTest::load(const OUString &rFilter, const OUString &rURL, return bLoaded; } -bool ScOpenclTest::enableOpenCL() +bool ScOpenclTest::detectOpenCLDevice() { sc::FormulaGroupInterpreter::enableOpenCL(true); return sc::FormulaGroupInterpreter::switchOpenCLDevice(OUString(),true); } +void ScOpenclTest::enableOpenCL() +{ + sc::FormulaGroupInterpreter::enableOpenCL(true); +} + void ScOpenclTest::testCompilerNested() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/compiler/nested.", ODS); ScDocument* pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/compiler/nested.", ODS); ScDocument* pDocRes = xDocShRes->GetDocument(); @@ -202,14 +262,15 @@ void ScOpenclTest::testCompilerNested() void ScOpenclTest::testCompilerString() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/compiler/string.", ODS); CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocSh.Is()); ScDocument* pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/compiler/string.", ODS); CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocShRes.Is()); @@ -231,14 +292,15 @@ void ScOpenclTest::testCompilerString() void ScOpenclTest::testCompilerInEq() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/compiler/ineq.", ODS); CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocSh.Is()); ScDocument* pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/compiler/ineq.", ODS); CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocShRes.Is()); @@ -258,7 +320,7 @@ void ScOpenclTest::testCompilerInEq() #if 0 void ScOpenclTest::testSharedFormulaXLSStockHistory() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("stock-history.", XLS); @@ -290,7 +352,7 @@ void ScOpenclTest::testSharedFormulaXLSStockHistory() void ScOpenclTest::testSharedFormulaXLSGroundWater() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("ground-water-daily.", XLS); @@ -315,13 +377,14 @@ void ScOpenclTest::testSharedFormulaXLSGroundWater() void ScOpenclTest::testSharedFormulaXLS() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("sum_ex.", XLS); ScDocument *pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("sum_ex.", XLS); ScDocument *pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -417,13 +480,14 @@ void ScOpenclTest::testSharedFormulaXLS() //[AMLOEXT-76] void ScOpenclTest::testMathFormulaCos() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/math/cos.", XLS); ScDocument* pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/math/cos.", XLS); ScDocument* pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -439,14 +503,15 @@ void ScOpenclTest::testMathFormulaCos() void ScOpenclTest::testFinacialFormula() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/financial/general.", XLS); CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocSh.Is()); ScDocument* pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/financial/general.", XLS); CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocShRes.Is()); ScDocument* pDocRes = xDocShRes->GetDocument(); @@ -597,13 +662,16 @@ void ScOpenclTest::testFinacialFormula() //[AMLOEXT-20] void ScOpenclTest::testStatisticalFormulaCorrel() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/statistical/Correl.", ODS); CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocSh.Is()); ScDocument* pDoc = xDocSh->GetDocument(); - CPPUNIT_ASSERT(pDoc); xDocSh->DoHardRecalc(true); + CPPUNIT_ASSERT(pDoc); + enableOpenCL(); + pDoc->CalcAll(); + ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Correl.", ODS); CPPUNIT_ASSERT_MESSAGE("Failed to load document.", xDocShRes.Is()); ScDocument* pDocRes = xDocShRes->GetDocument(); @@ -621,12 +689,15 @@ void ScOpenclTest::testStatisticalFormulaCorrel() } void ScOpenclTest::testStatisticalFormulaFisher() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/statistical/Fisher.", XLS); ScDocument* pDoc = xDocSh->GetDocument(); - CPPUNIT_ASSERT(pDoc); xDocSh->DoHardRecalc(true); + CPPUNIT_ASSERT(pDoc); + enableOpenCL(); + pDoc->CalcAll(); + ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Fisher.", XLS); ScDocument* pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -643,12 +714,15 @@ void ScOpenclTest::testStatisticalFormulaFisher() //[AMLOEXT-44] void ScOpenclTest::testStatisticalFormulaFisherInv() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/statistical/FisherInv.", XLS); ScDocument* pDoc = xDocSh->GetDocument(); - CPPUNIT_ASSERT(pDoc); xDocSh->DoHardRecalc(true); + CPPUNIT_ASSERT(pDoc); + enableOpenCL(); + pDoc->CalcAll(); + ScDocShellRef xDocShRes = loadDoc("opencl/statistical/FisherInv.", XLS); ScDocument* pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -665,12 +739,15 @@ void ScOpenclTest::testStatisticalFormulaFisherInv() //[AMLOEXT-45] void ScOpenclTest::testStatisticalFormulaGamma() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/statistical/Gamma.", XLS); ScDocument* pDoc = xDocSh->GetDocument(); - CPPUNIT_ASSERT(pDoc); xDocSh->DoHardRecalc(true); + CPPUNIT_ASSERT(pDoc); + enableOpenCL(); + pDoc->CalcAll(); + ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Gamma.", XLS); ScDocument* pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -687,12 +764,13 @@ void ScOpenclTest::testStatisticalFormulaGamma() //[AMLOEXT-46] void ScOpenclTest::testFinacialFvscheduleFormula() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/financial/Fvschedule.", XLS); ScDocument *pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/financial/Fvschedule.", XLS); ScDocument *pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -709,12 +787,13 @@ void ScOpenclTest::testFinacialFvscheduleFormula() //[AMLOEXT-69] void ScOpenclTest::testFinacialSYDFormula() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/financial/SYD.", XLS); ScDocument *pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/financial/SYD.", XLS); ScDocument *pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -731,12 +810,13 @@ void ScOpenclTest::testFinacialSYDFormula() void ScOpenclTest::testFinacialIRRFormula() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/financial/IRR.", XLS); ScDocument *pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/financial/IRR.", XLS); ScDocument *pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -753,11 +833,13 @@ void ScOpenclTest::testFinacialIRRFormula() //[AMLOEXT-49] void ScOpenclTest::testStatisticalFormulaGammaLn() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/statistical/GammaLn.", XLS); ScDocument* pDoc = xDocSh->GetDocument(); - CPPUNIT_ASSERT(pDoc); xDocSh->DoHardRecalc(true); + CPPUNIT_ASSERT(pDoc); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/statistical/GammaLn.", XLS); ScDocument* pDocRes = xDocShRes->GetDocument(); @@ -775,12 +857,13 @@ void ScOpenclTest::testStatisticalFormulaGammaLn() //[AMLOEXT-50] void ScOpenclTest::testStatisticalFormulaGauss() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/statistical/Gauss.", XLS); ScDocument* pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Gauss.", XLS); ScDocument* pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -797,11 +880,14 @@ void ScOpenclTest::testStatisticalFormulaGauss() //[AMLOEXT-52] void ScOpenclTest::testStatisticalFormulaGeoMean() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/statistical/GeoMean.", XLS); ScDocument* pDoc = xDocSh->GetDocument(); - CPPUNIT_ASSERT(pDoc); xDocSh->DoHardRecalc(true); + CPPUNIT_ASSERT(pDoc); + enableOpenCL(); + pDoc->CalcAll(); + ScDocShellRef xDocShRes = loadDoc("opencl/statistical/GeoMean.", XLS); ScDocument* pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -818,11 +904,14 @@ void ScOpenclTest::testStatisticalFormulaGeoMean() //[AMLOEXT-51] void ScOpenclTest::testStatisticalFormulaHarMean() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/statistical/HarMean.", XLS); ScDocument* pDoc = xDocSh->GetDocument(); - CPPUNIT_ASSERT(pDoc); xDocSh->DoHardRecalc(true); + CPPUNIT_ASSERT(pDoc); + enableOpenCL(); + pDoc->CalcAll(); + ScDocShellRef xDocShRes = loadDoc("opencl/statistical/HarMean.", XLS); ScDocument* pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -839,12 +928,13 @@ void ScOpenclTest::testStatisticalFormulaHarMean() //[AMLOEXT-53] void ScOpenclTest::testFinacialSLNFormula() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/financial/SLN.", XLS); ScDocument *pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/financial/SLN.", XLS); ScDocument *pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -861,12 +951,13 @@ void ScOpenclTest::testFinacialSLNFormula() void ScOpenclTest::testFinacialMIRRFormula() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/financial/MIRR.", XLS); ScDocument *pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/financial/MIRR.", XLS); ScDocument *pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -884,12 +975,13 @@ void ScOpenclTest::testFinacialMIRRFormula() // [AMLOEXT-55] void ScOpenclTest::testFinancialCoupdaybsFormula() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/financial/Coupdaybs.", XLS); ScDocument *pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/financial/Coupdaybs.", XLS); ScDocument *pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -905,12 +997,13 @@ void ScOpenclTest::testFinancialCoupdaybsFormula() //[AMLOEXT-56] void ScOpenclTest::testFinacialDollardeFormula() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/financial/Dollarde.", XLS); ScDocument *pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/financial/Dollarde.", XLS); ScDocument *pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -927,12 +1020,13 @@ void ScOpenclTest::testFinacialDollardeFormula() //[AMLOEXT-70] void ScOpenclTest::testFinancialCoupdaysFormula() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/financial/Coupdays.", XLS); ScDocument *pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/financial/Coupdays.", XLS); ScDocument *pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -948,12 +1042,13 @@ void ScOpenclTest::testFinancialCoupdaysFormula() //[AMLOEXT-72] void ScOpenclTest::testFinancialCoupdaysncFormula() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/financial/Coupdaysnc.", XLS); ScDocument *pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/financial/Coupdaysnc.", XLS); ScDocument *pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -968,12 +1063,13 @@ void ScOpenclTest::testFinancialCoupdaysncFormula() } void ScOpenclTest::testFinacialRateFormula() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/financial/RATE.", XLS); ScDocument *pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/financial/RATE.", XLS); ScDocument *pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -990,12 +1086,13 @@ void ScOpenclTest::testFinacialRateFormula() //[AMLOEXT-54] void ScOpenclTest::testFinancialAccrintmFormula() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/financial/Accrintm.", XLS); ScDocument *pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/financial/Accrintm.", XLS); ScDocument *pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -1011,11 +1108,13 @@ void ScOpenclTest::testFinancialAccrintmFormula() //[AMLOEXT-57] void ScOpenclTest::testStatisticalFormulaNegbinomdist() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/statistical/Negbinomdist." ,XLS); ScDocument* pDoc = xDocSh->GetDocument(); - CPPUNIT_ASSERT(pDoc); xDocSh->DoHardRecalc(true); + CPPUNIT_ASSERT(pDoc); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Negbinomdist." ,XLS); ScDocument* pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -1033,12 +1132,13 @@ void ScOpenclTest::testStatisticalFormulaNegbinomdist() //[AMLOEXT-64] void ScOpenclTest::testFinacialDollarfrFormula() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/financial/Dollarfr.", XLS); ScDocument *pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/financial/Dollarfr.", XLS); ScDocument *pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -1055,12 +1155,13 @@ void ScOpenclTest::testFinacialDollarfrFormula() //[AMLOEXT-71] void ScOpenclTest::testFinacialDISCFormula() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/financial/DISC.", XLS); ScDocument *pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/financial/DISC.", XLS); ScDocument *pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -1077,12 +1178,13 @@ void ScOpenclTest::testFinacialDISCFormula() //[AMLOEXT-75] void ScOpenclTest::testFinacialINTRATEFormula() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/financial/INTRATE.", XLS); ScDocument *pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/financial/INTRATE.", XLS); ScDocument *pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -1099,11 +1201,13 @@ void ScOpenclTest::testFinacialINTRATEFormula() //[AMLOEXT-82] void ScOpenclTest::testStatisticalFormulaPearson() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/statistical/Pearson.", XLS); ScDocument* pDoc = xDocSh->GetDocument(); - CPPUNIT_ASSERT(pDoc); xDocSh->DoHardRecalc(true); + CPPUNIT_ASSERT(pDoc); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Pearson.", XLS); ScDocument* pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -1120,11 +1224,13 @@ void ScOpenclTest::testStatisticalFormulaPearson() //[AMLOEXT-83] void ScOpenclTest::testStatisticalFormulaRsq() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/statistical/Rsq.", XLS); ScDocument* pDoc = xDocSh->GetDocument(); - CPPUNIT_ASSERT(pDoc); xDocSh->DoHardRecalc(true); + CPPUNIT_ASSERT(pDoc); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/statistical/Rsq.", XLS); ScDocument* pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -1141,12 +1247,13 @@ void ScOpenclTest::testStatisticalFormulaRsq() //[AMLOEXT-90] void ScOpenclTest::testMathFormulaCsc() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/math/csc.", ODS); ScDocument* pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/math/csc.", ODS); ScDocument* pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -1162,12 +1269,13 @@ void ScOpenclTest::testMathFormulaCsc() //[AMLOEXT-92] void ScOpenclTest::testFinacialXNPVFormula() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/financial/XNPV.", XLS); ScDocument *pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/financial/XNPV.", XLS); ScDocument *pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -1189,12 +1297,13 @@ void ScOpenclTest::testFinacialXNPVFormula() } void ScOpenclTest::testFinacialPriceMatFormula() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/financial/PriceMat.", XLS); ScDocument *pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/financial/PriceMat.", XLS); ScDocument *pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -1209,11 +1318,13 @@ void ScOpenclTest::testFinacialPriceMatFormula() } void ScOpenclTest::testFinacialFormulaReceived() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/financial/Received.", XLS); ScDocument* pDoc = xDocSh->GetDocument(); - CPPUNIT_ASSERT(pDoc); xDocSh->DoHardRecalc(true); + CPPUNIT_ASSERT(pDoc); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/financial/Received.", XLS); ScDocument* pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -1229,11 +1340,13 @@ void ScOpenclTest::testFinacialFormulaReceived() } void ScOpenclTest::testFinancialFormulaCumipmt() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/financial/Cumipmt.", XLS); ScDocument* pDoc = xDocSh->GetDocument(); - CPPUNIT_ASSERT(pDoc); xDocSh->DoHardRecalc(true); + CPPUNIT_ASSERT(pDoc); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/financial/Cumipmt.", XLS); ScDocument* pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -1249,11 +1362,13 @@ void ScOpenclTest::testFinancialFormulaCumipmt() } void ScOpenclTest::testFinancialFormulaCumprinc() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/financial/Cumprinc.", XLS); ScDocument* pDoc = xDocSh->GetDocument(); - CPPUNIT_ASSERT(pDoc); xDocSh->DoHardRecalc(true); + CPPUNIT_ASSERT(pDoc); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/financial/Cumprinc.", XLS); ScDocument* pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -1269,12 +1384,13 @@ void ScOpenclTest::testFinancialFormulaCumprinc() } void ScOpenclTest::testFinacialRRIFormula() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/financial/RRI.", XLS); ScDocument *pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/financial/RRI.", XLS); ScDocument *pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -1289,12 +1405,13 @@ void ScOpenclTest::testFinacialRRIFormula() } void ScOpenclTest::testFinacialEFFECT_ADDFormula() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/financial/EFFECT_ADD.", XLS); ScDocument *pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/financial/EFFECT_ADD.", XLS); ScDocument *pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -1310,11 +1427,13 @@ void ScOpenclTest::testFinacialEFFECT_ADDFormula() } void ScOpenclTest::testFinacialNominalFormula() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/financial/Nominal.", XLS); ScDocument* pDoc = xDocSh->GetDocument(); - CPPUNIT_ASSERT(pDoc); xDocSh->DoHardRecalc(true); + CPPUNIT_ASSERT(pDoc); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/financial/Nominal.", XLS); ScDocument* pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -1330,12 +1449,13 @@ void ScOpenclTest::testFinacialNominalFormula() } void ScOpenclTest::testFinacialTBILLEQFormula() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/financial/TBILLEQ.", XLS); ScDocument *pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/financial/TBILLEQ.", XLS); ScDocument *pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -1350,12 +1470,13 @@ void ScOpenclTest::testFinacialTBILLEQFormula() } void ScOpenclTest::testFinacialTBILLPRICEFormula() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/financial/TBILLPRICE.", XLS); ScDocument *pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/financial/TBILLPRICE.", XLS); ScDocument *pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -1370,12 +1491,13 @@ void ScOpenclTest::testFinacialTBILLPRICEFormula() } void ScOpenclTest::testFinacialTBILLYIELDFormula() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/financial/TBILLYIELD.", XLS); ScDocument *pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/financial/TBILLYIELD.", XLS); ScDocument *pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -1390,12 +1512,13 @@ void ScOpenclTest::testFinacialTBILLYIELDFormula() } void ScOpenclTest::testFinacialYIELDFormula() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/financial/YIELD.", XLS); ScDocument *pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/financial/YIELD.", XLS); ScDocument *pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -1411,12 +1534,13 @@ void ScOpenclTest::testFinacialYIELDFormula() void ScOpenclTest::testFinacialYIELDDISCFormula() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/financial/YIELDDISC.", XLS); ScDocument *pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/financial/YIELDDISC.", XLS); ScDocument *pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); @@ -1432,12 +1556,13 @@ void ScOpenclTest::testFinacialYIELDDISCFormula() void ScOpenclTest::testFinacialYIELDMATFormula() { - if (!enableOpenCL()) + if (!detectOpenCLDevice()) return; ScDocShellRef xDocSh = loadDoc("opencl/financial/YIELDMAT.", XLS); ScDocument *pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); - xDocSh->DoHardRecalc(true); + enableOpenCL(); + pDoc->CalcAll(); ScDocShellRef xDocShRes = loadDoc("opencl/financial/YIELDMAT.", XLS); ScDocument *pDocRes = xDocShRes->GetDocument(); CPPUNIT_ASSERT(pDocRes); diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index c71d2a047ae5..4a01cb04c24b 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1291,6 +1291,7 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc, const ScAddress& rTopPos, const ScFormulaCellGroupRef& xGroup, ScTokenArray& rCode ) { + fprintf(stdout, "FormulaGroupInterpreterOpenCL::interpret: opencl\n"); generateRPNCode(rDoc, rTopPos, rCode); // printf("Vector width = %d\n", xGroup->mnLength); // Constructing "AST" diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx index 257335909e81..b4a1801c3801 100644 --- a/sc/source/core/tool/formulagroup.cxx +++ b/sc/source/core/tool/formulagroup.cxx @@ -289,6 +289,7 @@ bool FormulaGroupInterpreterSoftware::interpret(ScDocument& rDoc, const ScAddres const ScFormulaCellGroupRef& xGroup, ScTokenArray& rCode) { + fprintf(stdout, "FormulaGroupInterpreterSoftware::interpret: software\n"); typedef boost::unordered_map<const formula::FormulaToken*, formula::FormulaTokenRef> CachedTokensType; // Decompose the group into individual cells and calculate them individually. |