[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - 2 commits - sc/qa sc/source
sc/qa/unit/data/xls/opencl/math/sumproductTest.xls |binary sc/qa/unit/opencl-test.cxx | 26 ++ sc/source/core/opencl/formulagroupcl.cxx | 52 ++--- 3 files changed, 72 insertions(+), 6 deletions(-) New commits: commit cb699c576c91f7c1de98036a01c369402eee073e Author: I-Jui (Ray) Sung r...@multicorewareinc.com Date: Mon Nov 25 01:10:04 2013 -0600 GPU Calc: a test case for unrolling SumOfProduct AMLOEXT-245 BUG Change-Id: Ia8756af26c765820a04137a87f6681447dd18efd diff --git a/sc/qa/unit/data/xls/opencl/math/sumproductTest.xls b/sc/qa/unit/data/xls/opencl/math/sumproductTest.xls new file mode 100644 index 000..28eaebf Binary files /dev/null and b/sc/qa/unit/data/xls/opencl/math/sumproductTest.xls differ diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index 6fabd98..f1ab881 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -244,6 +244,7 @@ public: void testStatisticalFormulaCovar(); void testLogicalFormulaAnd(); void testMathFormulaSumProduct(); +void testMathFormulaSumProduct2(); void testStatisticalParallelCountBug(); CPPUNIT_TEST_SUITE(ScOpenclTest); CPPUNIT_TEST(testSharedFormulaXLS); @@ -418,6 +419,7 @@ public: CPPUNIT_TEST(testStatisticalFormulaCovar); CPPUNIT_TEST(testLogicalFormulaAnd); CPPUNIT_TEST(testMathFormulaSumProduct); +CPPUNIT_TEST(testMathFormulaSumProduct2); CPPUNIT_TEST(testStatisticalParallelCountBug); CPPUNIT_TEST_SUITE_END(); @@ -4792,6 +4794,30 @@ void ScOpenclTest::testMathFormulaSumProduct() xDocSh-DoClose(); xDocShRes-DoClose(); } +//[AMLOEXT-245] +void ScOpenclTest::testMathFormulaSumProduct2() +{ +if (!detectOpenCLDevice()) +return; +ScDocShellRef xDocSh = loadDoc(opencl/math/sumproductTest., XLS); +ScDocument* pDoc = xDocSh-GetDocument(); +CPPUNIT_ASSERT(pDoc); +enableOpenCL(); +pDoc-CalcAll(); +ScDocShellRef xDocShRes = loadDoc(opencl/math/sumproductTest., XLS); +ScDocument* pDocRes = xDocShRes-GetDocument(); +CPPUNIT_ASSERT(pDocRes); +// Check the results of formula cells in the shared formula range. +for (SCROW i = 2; i = 12; ++i) +{ +double fLibre = pDoc-GetValue(ScAddress(4,i,1)); +double fExcel = pDocRes-GetValue(ScAddress(4,i,1)); +CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel)); +} +xDocSh-DoClose(); +xDocShRes-DoClose(); +} + //[AMLOEXT-217] void ScOpenclTest:: testLogicalFormulaAnd() { commit fecc3486633d9a83e5c1f501fbd8c2256d65cbf7 Author: I-Jui (Ray) Sung r...@multicorewareinc.com Date: Mon Nov 25 01:13:44 2013 -0600 GPU Calc: fixed a SUMPRODUCT problem ALMOEXT-245 Change-Id: Iedbbdc612232a939b2270e373313c872de831c20 diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index ad6ccc1..515fc89 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1107,10 +1107,30 @@ public: ss for(int outLoop=0; outLoop nCurWindowSize/outLoopSize ; outLoop++){\n\t; for(int count=0; count outLoopSize; count++){ -ss i = outLoop*outLoopSize+count;\n\t; +ss i = outLoop*outLoopSize+count;\n; if(count==0){ -temp3 currentCount0 = i+gid0+1;\n\t; -temp3 currentCount1 = i+1;\n\t; +for (unsigned i = 0; i vSubArguments.size(); i++) +{ +tmpCur = vSubArguments[i]-GetFormulaToken(); +if(ocPush==tmpCur-GetOpCode()) +{ +pCurDVR= dynamic_cast +const formula::DoubleVectorRefToken *(tmpCur); +if(!pCurDVR-IsStartFixed() !pCurDVR-IsEndFixed()) +{ +temp3 currentCount; +temp3 i; +temp3 =i+gid0+1;\n; +} +else +{ +temp3 currentCount; +temp3 i; +temp3 =i+1;\n; +} +} +} + temp3 tmp = fsum(; for (unsigned i = 0; i vSubArguments.size(); i++){ if (i) @@ -1153,10 +1173,30 @@ public: for(unsigned int count=nCurWindowSize/outLoopSize*outLoopSize; count nCurWindowSize; count++) { -ss i = count;\n\t; +ss i = count;\n; if(count==nCurWindowSize/outLoopSize*outLoopSize){ -temp4 currentCount0 =
[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - 2 commits - sc/qa sc/source
sc/qa/unit/data/ods/opencl/compiler/nested.ods |binary sc/source/core/opencl/formulagroupcl.cxx| 57 ++-- sc/source/core/opencl/formulagroupcl_public.hxx |1 sc/source/core/opencl/opbase.cxx|6 ++ sc/source/core/opencl/opbase.hxx|1 5 files changed, 42 insertions(+), 23 deletions(-) New commits: commit 6769a8a4c0ffb3dfaa236988cf9915805b4abeac Author: Wei Wei wei...@multicorewareinc.com Date: Fri Nov 22 17:18:21 2013 -0600 GPU Calc: Testcase for Sums of Product that have out-of-bound window AMLOEXT-244 BUG Change-Id: Iefce62484b2189b37b747bfd4b739115dafbc40d diff --git a/sc/qa/unit/data/ods/opencl/compiler/nested.ods b/sc/qa/unit/data/ods/opencl/compiler/nested.ods index 5957844..83310fa5 100644 Binary files a/sc/qa/unit/data/ods/opencl/compiler/nested.ods and b/sc/qa/unit/data/ods/opencl/compiler/nested.ods differ commit 521acd05aba7fb35a244a6302584a950d4904fbe Author: Wei Wei wei...@multicorewareinc.com Date: Fri Nov 22 17:16:49 2013 -0600 GPU Calc: Sum of product doesn't check out-of-bound accesses AMLOEXT-244 FIX Change-Id: I5f49f7acccaabd2a97d8ac4bfba4b973889278f1 diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 2c795cc..ad6ccc1 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -444,13 +444,26 @@ public: } virtual void GenSlidingWindowFunction(std::stringstream ) {} -virtual std::string GenSlidingWindowDeclRef(bool=false) const +virtual std::string GenSlidingWindowDeclRef(bool nested=false) const { +size_t nArrayLength = mpDVR-GetArrayLength(); std::stringstream ss; if (!bIsStartFixed !bIsEndFixed) +{ +if (nested) +ss ((i+gid0) nArrayLength ?; ss Base::GetName() [i + gid0]; +if (nested) +ss :NAN); +} else +{ +if (nested) +ss (i nArrayLength ?; ss Base::GetName() [i]; +if (nested) +ss :NAN); +} return ss.str(); } /// Controls how the elements in the DoubleVectorRef are traversed @@ -533,9 +546,9 @@ return nCurWindowSize; if(count==0){ temp1 if(i + gid0 mpDVR-GetArrayLength(); temp1 ){\n\t\t; -temp1 tmp = ; +temp1 tmp = legalize(; temp1 mpCodeGen-Gen2(GenSlidingWindowDeclRef(), tmp); -temp1 ;\n\t\t\t; +temp1 , tmp);\n\t\t\t; temp1 }\n\t; } ss temp1.str(); @@ -548,9 +561,9 @@ return nCurWindowSize; if(count==nCurWindowSize/outLoopSize*outLoopSize){ temp2 if(i + gid0mpDVR-GetArrayLength(); temp2 ){\n\t\t; -temp2 tmp = ; +temp2 tmp = legalize(; temp2 mpCodeGen-Gen2(GenSlidingWindowDeclRef(), tmp); -temp2 ;\n\t\t\t; +temp2 , tmp);\n\t\t\t; temp2 }\n\t; } ss temp2.str(); @@ -571,9 +584,9 @@ return nCurWindowSize; for(int count=0; count outLoopSize; count++){ ss i = outLoop*outLoopSize+count;\n\t; if(count==0){ -temp1 tmp = ; +temp1 tmp = legalize(; temp1 mpCodeGen-Gen2(GenSlidingWindowDeclRef(), tmp); -temp1 ;\n\t\t\t; +temp1 , tmp);\n\t\t\t; } ss temp1.str(); } @@ -583,9 +596,9 @@ return nCurWindowSize; for(unsigned int count=nCurWindowSize/outLoopSize*outLoopSize; count nCurWindowSize; count++){ ss i = count;\n\t; if(count==nCurWindowSize/outLoopSize*outLoopSize){ -temp2 tmp = ; +temp2 tmp = legalize(; temp2 mpCodeGen-Gen2(GenSlidingWindowDeclRef(), tmp); -temp2 ;\n\t\t\t; +temp2 , tmp);\n\t\t\t; } ss temp2.str(); } @@ -673,13 +686,13 @@ public: ss tmp = mpCodeGen-GetBottom() ;\n; ss int loopOffset = l*512;\n; ss if((loopOffset + lidx + offset + 256) end) {\n; -ss tmp = mpCodeGen-Gen2( -A[loopOffset + lidx + offset], tmp)
[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - 2 commits - sc/qa sc/source
sc/qa/unit/data/xls/opencl/statistical/Betainv.xls |binary sc/qa/unit/opencl-test.cxx | 25 +++ sc/source/core/opencl/formulagroupcl.cxx |5 sc/source/core/opencl/op_statistical.cxx | 153 + sc/source/core/opencl/op_statistical.hxx |8 - sc/source/core/opencl/opbase.cxx |4 sc/source/core/opencl/opinlinefun_statistical.cxx |1 sc/source/core/tool/token.cxx |1 8 files changed, 193 insertions(+), 4 deletions(-) New commits: commit ca30bd2c6c637746fb56dc9ef45bc84baa743faa Author: hongyu zhong hon...@multicorewareinc.com Date: Sat Nov 16 17:33:30 2013 +0800 GPU Calc: implemented BETAINV AMLOEXT-201 FIX Change-Id: I68a7277b7353ed5a6f4d2ea8d1a4f7fb894bf487 Signed-off-by: haochen haoc...@multicorewareinc.com diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index b9469f2..0d63e4c 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1762,6 +1762,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments( mvSubArguments.push_back(SoPHelper(ts, ft-Children[i],new OpSumX2PY2)); break; +case ocBetaInv: +mvSubArguments.push_back(SoPHelper(ts, + ft-Children[i],new OpBetainv)); + break; case ocExternal: if ( !(pChild-GetExternal().compareTo(OUString( com.sun.star.sheet.addin.Analysis.getEffect diff --git a/sc/source/core/opencl/op_statistical.cxx b/sc/source/core/opencl/op_statistical.cxx index ddad803..48c015d 100644 --- a/sc/source/core/opencl/op_statistical.cxx +++ b/sc/source/core/opencl/op_statistical.cxx @@ -6198,6 +6198,159 @@ void OpBetaDist::GenSlidingWindowFunction(std::stringstream ss, ss return tmp;\n; ss }\n; } +void OpBetainv::BinInlineFun(std::setstd::string decls, +std::setstd::string funs) +{ +decls.insert(fMachEpsDecl); +funs.insert(); +decls.insert(fMaxGammaArgumentDecl); +funs.insert(); +decls.insert(lcl_IterateInverseBetaInvDecl); +funs.insert(lcl_IterateInverseBetaInv); +decls.insert(GetBetaDistDecl); +funs.insert(GetBetaDist); +decls.insert(lcl_HasChangeOfSignDecl); +funs.insert(lcl_HasChangeOfSign); +decls.insert(lcl_HasChangeOfSignDecl); +funs.insert(lcl_HasChangeOfSign); +decls.insert(lcl_HasChangeOfSignDecl); +funs.insert(lcl_HasChangeOfSign); +decls.insert(lcl_GetBetaHelperContFracDecl); +funs.insert(lcl_GetBetaHelperContFrac); +decls.insert(GetBetaDistPDFDecl); +funs.insert(GetBetaDistPDF); +decls.insert(GetLogBetaDecl); +funs.insert(GetLogBeta); +decls.insert(GetBetaDecl); +funs.insert(GetBeta); +decls.insert(lcl_getLanczosSumDecl); +funs.insert(lcl_getLanczosSum); +} +void OpBetainv::GenSlidingWindowFunction( +std::stringstream ss,const std::string sSymName, +SubArguments vSubArguments) +{ +ss \ndouble sSymName; +ss _ BinFuncName() (; +for (unsigned i = 0; i vSubArguments.size(); i++) +{ +if (i) +ss ,; +vSubArguments[i]-GenSlidingWindowDecl(ss); +} +ss )\n; +ss {\n; +ss double tmp0,tmp1,tmp2,tmp3,tmp4;\n; +ss int gid0=get_global_id(0);\n; +size_t i = vSubArguments.size(); +size_t nItems = 0; +ss \n; +//while (i-- 1) +for (i = 0; i vSubArguments.size(); i++) +{ +FormulaToken *pCur = vSubArguments[i]-GetFormulaToken(); +assert(pCur); +if (pCur-GetType() == formula::svDoubleVectorRef) +{ +const formula::DoubleVectorRefToken* pDVR = +dynamic_castconst formula::DoubleVectorRefToken *(pCur); +size_t nCurWindowSize = pDVR-GetRefRowSize(); +ss for (int i = ; +if (!pDVR-IsStartFixed() pDVR-IsEndFixed()) { +#ifdef ISNAN +ss gid0; ipDVR-GetArrayLength(); +ssinCurWindowSize ; i++){\n; +#else +ss gid0; i nCurWindowSize ; i++)\n; +#endif +} else if (pDVR-IsStartFixed() !pDVR-IsEndFixed()) { +#ifdef ISNAN +ss 0; ipDVR-GetArrayLength(); +ssi gid0+ nCurWindowSize ; i++){\n; +#else +ss 0; i gid0+ nCurWindowSize ; i++)\n; +#endif +} else if (!pDVR-IsStartFixed() !pDVR-IsEndFixed()){ +#ifdef ISNAN +ss 0; i + gid0pDVR-GetArrayLength(); +ss i nCurWindowSize ; i++){\n; +#else +ss 0; i nCurWindowSize ; i++)\n; +#endif +} +else { +#ifdef ISNAN +ss 0; i nCurWindowSize ; i++){\n; +#else +ss 0; i nCurWindowSize ; i++)\n; +#endif +} +
[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - 2 commits - sc/qa sc/source
sc/qa/unit/data/xls/opencl/financial/Duration_ADD.xls |binary sc/qa/unit/opencl-test.cxx| 25 +++ sc/source/core/opencl/formulagroupcl.cxx |6 + sc/source/core/opencl/op_financial.cxx| 60 ++ sc/source/core/opencl/op_financial.hxx| 14 sc/source/core/opencl/opinlinefun_finacial.cxx| 32 + 6 files changed, 136 insertions(+), 1 deletion(-) New commits: commit 163fd27708ab56baf731d9c65ccc7a5120024f45 Author: xinjiang xinji...@multicorewareinc.com Date: Tue Nov 5 09:31:14 2013 +0800 GPU Calc: unit test cases for DURATION_ADD Need open macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test AMLOEXT-121 BUG Change-Id: Id78c89f77cdfe14d368831c22ff708b968e8fee2 Signed-off-by: haochen haoc...@multicorewareinc.com Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com diff --git a/sc/qa/unit/data/xls/opencl/financial/Duration_ADD.xls b/sc/qa/unit/data/xls/opencl/financial/Duration_ADD.xls new file mode 100644 index 000..18e5ddb Binary files /dev/null and b/sc/qa/unit/data/xls/opencl/financial/Duration_ADD.xls differ diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index 69c8c3e..3ecd34c 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -133,6 +133,7 @@ public: void testStatisticalFormulaStandard(); void testStatisticalFormulaWeibull(); void testStatisticalFormulaMedian(); +void testFinancialDuration_ADDFormula(); CPPUNIT_TEST_SUITE(ScOpenclTest); CPPUNIT_TEST(testSharedFormulaXLS); CPPUNIT_TEST(testFinacialFormula); @@ -195,6 +196,7 @@ public: CPPUNIT_TEST(testStatisticalFormulaStandard); CPPUNIT_TEST(testStatisticalFormulaWeibull); CPPUNIT_TEST(testStatisticalFormulaMedian); +CPPUNIT_TEST(testFinancialDuration_ADDFormula); CPPUNIT_TEST_SUITE_END(); private: @@ -1904,7 +1906,28 @@ void ScOpenclTest:: testFinacialPPMTFormula() xDocSh-DoClose(); xDocShRes-DoClose(); } - +//[AMLOEXT-121] +void ScOpenclTest:: testFinancialDuration_ADDFormula() +{ +if (!detectOpenCLDevice()) +return; +ScDocShellRef xDocSh = loadDoc(opencl/financial/Duration_ADD., XLS); +ScDocument* pDoc = xDocSh-GetDocument(); +CPPUNIT_ASSERT(pDoc); +enableOpenCL(); +pDoc-CalcAll(); +ScDocShellRef xDocShRes = loadDoc(opencl/financial/Duration_ADD., XLS); +ScDocument* pDocRes = xDocShRes-GetDocument(); +CPPUNIT_ASSERT(pDocRes); +for (SCROW i = 0; i = 9; ++i) +{ +double fLibre = pDoc-GetValue(ScAddress(6, i, 0)); +double fExcel = pDocRes-GetValue(ScAddress(6, i, 0)); +CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel)); +} +xDocSh-DoClose(); +xDocShRes-DoClose(); +} ScOpenclTest::ScOpenclTest() : ScBootstrapFixture( /sc/qa/unit/data ) { commit 159bc70c590e2efb74fc1234480b43cff220731b Author: xinjiang xinji...@multicorewareinc.com Date: Tue Nov 5 09:47:10 2013 +0800 GPU Calc: implement fix for DURATION_ADD AMLOEXT-121 FIX Change-Id: Ie6b10eacc4e5fc0b2dcfe816982836b8b244af05 Signed-off-by: haochen haoc...@multicorewareinc.com Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 96e8f0f..fec3a68 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1179,6 +1179,12 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments( mvSubArguments.push_back(SoPHelper(ts, ft-Children[i], new OpCoupnum)); } +else if ( !(pChild-GetExternal().compareTo(OUString( + com.sun.star.sheet.addin.Analysis.getDuration +{ +mvSubArguments.push_back( +SoPHelper(ts, ft-Children[i], new OpDuration_ADD)); +} break; default: throw UnhandledToken(pChild, unhandled opcode); diff --git a/sc/source/core/opencl/op_financial.cxx b/sc/source/core/opencl/op_financial.cxx index 3597f9f..0b46835 100644 --- a/sc/source/core/opencl/op_financial.cxx +++ b/sc/source/core/opencl/op_financial.cxx @@ -574,6 +574,66 @@ void OpDuration::GenSlidingWindowFunction(std::stringstream ss, ss }; } +void OpDuration_ADD::BinInlineFun(std::setstd::string decls, +std::setstd::string funs) +{ +decls.insert(GetDurationDecl);decls.insert(lcl_GetcoupnumDecl); +decls.insert(GetYearFracDecl);decls.insert(DaysToDateDecl); +decls.insert(GetNullDateDecl);decls.insert(DateToDaysDecl); +decls.insert(DaysInMonthDecl);decls.insert(IsLeapYearDecl); +funs.insert(GetDuration);funs.insert(lcl_Getcoupnum); +funs.insert(GetYearFrac);funs.insert(DaysToDate); +
[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - 2 commits - sc/qa sc/source
sc/qa/unit/data/xls/opencl/financial/Amordegrc.xls |binary sc/qa/unit/opencl-test.cxx | 24 ++ sc/source/core/opencl/formulagroupcl.cxx |6 sc/source/core/opencl/op_financial.cxx | 171 + sc/source/core/opencl/op_financial.hxx | 10 + 5 files changed, 211 insertions(+) New commits: commit 8aee57d797ac1e6e34c5a689103195dfd6c8251c Author: minwang m...@multicorewareinc.com Date: Tue Nov 5 10:02:29 2013 +0800 GPU Calc: unit test cases for AMORDEGRC in GPU calc Need open macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test AMLOEXT-98 BUG Change-Id: I0867627c69eefdbc7127d19559af23fbd70b3ccc Signed-off-by: haochen haoc...@multicorewareinc.com Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com diff --git a/sc/qa/unit/data/xls/opencl/financial/Amordegrc.xls b/sc/qa/unit/data/xls/opencl/financial/Amordegrc.xls new file mode 100644 index 000..7cb9e47 Binary files /dev/null and b/sc/qa/unit/data/xls/opencl/financial/Amordegrc.xls differ diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index 3ecd34c..75d28ca 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -134,6 +134,7 @@ public: void testStatisticalFormulaWeibull(); void testStatisticalFormulaMedian(); void testFinancialDuration_ADDFormula(); +void testFinancialAmordegrcFormula(); CPPUNIT_TEST_SUITE(ScOpenclTest); CPPUNIT_TEST(testSharedFormulaXLS); CPPUNIT_TEST(testFinacialFormula); @@ -197,6 +198,7 @@ public: CPPUNIT_TEST(testStatisticalFormulaWeibull); CPPUNIT_TEST(testStatisticalFormulaMedian); CPPUNIT_TEST(testFinancialDuration_ADDFormula); +CPPUNIT_TEST(testFinancialAmordegrcFormula); CPPUNIT_TEST_SUITE_END(); private: @@ -1516,6 +1518,28 @@ void ScOpenclTest::testFinacialXNPVFormula() xDocSh-DoClose(); xDocShRes-DoClose(); } +//[AMLOEXT-98] +void ScOpenclTest::testFinancialAmordegrcFormula() +{ + if (!detectOpenCLDevice()) +return; +ScDocShellRef xDocSh = loadDoc(opencl/financial/Amordegrc., XLS); +ScDocument* pDoc = xDocSh-GetDocument(); +CPPUNIT_ASSERT(pDoc); +enableOpenCL(); +pDoc-CalcAll(); +ScDocShellRef xDocShRes = loadDoc(opencl/financial/Amordegrc., XLS); +ScDocument* pDocRes = xDocShRes-GetDocument(); +CPPUNIT_ASSERT(pDocRes); +for (SCROW i = 0; i = 9; ++i) +{ +double fLibre = pDoc-GetValue(ScAddress(7, i, 0)); +double fExcel = pDocRes-GetValue(ScAddress(7, i, 0)); +CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel)); +} +xDocSh-DoClose(); +xDocShRes-DoClose(); +} //[AMLOEXT-99] void ScOpenclTest:: testFinancialISPMTFormula() { commit 55c2a05521e3bc7281abf1fefb345bce50549152 Author: minwang m...@multicorewareinc.com Date: Tue Nov 5 10:16:40 2013 +0800 GPU Calc: implement fix for AMORDEGRC in GPU calc AMLOEXT-98 FIX Change-Id: I9f63d023161e5ad7981374dedffb6f00663a1c66 Signed-off-by: haochen haoc...@multicorewareinc.com Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index fec3a68..d68b17b 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1185,6 +1185,12 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments( mvSubArguments.push_back( SoPHelper(ts, ft-Children[i], new OpDuration_ADD)); } +else if ( !(pChild-GetExternal().compareTo(OUString( + com.sun.star.sheet.addin.Analysis.getAmordegrc +{ +mvSubArguments.push_back(SoPHelper(ts, ft-Children[i], +new OpAmordegrc)); +} break; default: throw UnhandledToken(pChild, unhandled opcode); diff --git a/sc/source/core/opencl/op_financial.cxx b/sc/source/core/opencl/op_financial.cxx index 0b46835..6681b78 100644 --- a/sc/source/core/opencl/op_financial.cxx +++ b/sc/source/core/opencl/op_financial.cxx @@ -2894,6 +2894,177 @@ void OpCoupnum::GenSlidingWindowFunction(std::stringstream ss, ss return tmp;\n; ss }; } +void OpAmordegrc::BinInlineFun(std::setstd::string decls, +std::setstd::string funs) +{ +decls.insert(nKorrValDecl); decls.insert(RoundDecl); +decls.insert(IsLeapYearDecl);decls.insert(DaysInMonthDecl); +decls.insert(DaysToDateDecl); decls.insert(DateToDaysDecl); +decls.insert(GetNullDateDecl); decls.insert(GetYearFracDecl); +funs.insert(Round); +funs.insert(IsLeapYear);funs.insert(DaysInMonth); +funs.insert(DaysToDate);funs.insert(DateToDays); +funs.insert(GetNullDate);funs.insert(GetYearFrac); +} +void OpAmordegrc::GenSlidingWindowFunction(std::stringstream ss, +
[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - 2 commits - sc/qa sc/source
sc/qa/unit/data/xls/opencl/financial/Amorlinc.xls |binary sc/qa/unit/opencl-test.cxx| 24 +++ sc/source/core/opencl/formulagroupcl.cxx |6 sc/source/core/opencl/op_financial.cxx| 154 +- sc/source/core/opencl/op_financial.hxx|9 + 5 files changed, 192 insertions(+), 1 deletion(-) New commits: commit 1e6fb09e53ea88d494d428d1fbabab2ab952d24b Author: minwang m...@multicorewareinc.com Date: Tue Nov 5 10:28:57 2013 +0800 GPU Calc: unit test cases for AMORLINC in GPU calc Need open macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test AMLOEXT-110 BUG Change-Id: Ia6e1333e7d1c91ff9b8a916109a8aa60f4725e03 Signed-off-by: haochen haoc...@multicorewareinc.com Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com diff --git a/sc/qa/unit/data/xls/opencl/financial/Amorlinc.xls b/sc/qa/unit/data/xls/opencl/financial/Amorlinc.xls new file mode 100644 index 000..5962334 Binary files /dev/null and b/sc/qa/unit/data/xls/opencl/financial/Amorlinc.xls differ diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index 75d28ca..c62d82e 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -135,6 +135,7 @@ public: void testStatisticalFormulaMedian(); void testFinancialDuration_ADDFormula(); void testFinancialAmordegrcFormula(); +void testFinancialAmorlincFormula(); CPPUNIT_TEST_SUITE(ScOpenclTest); CPPUNIT_TEST(testSharedFormulaXLS); CPPUNIT_TEST(testFinacialFormula); @@ -199,6 +200,7 @@ public: CPPUNIT_TEST(testStatisticalFormulaMedian); CPPUNIT_TEST(testFinancialDuration_ADDFormula); CPPUNIT_TEST(testFinancialAmordegrcFormula); +CPPUNIT_TEST(testFinancialAmorlincFormula); CPPUNIT_TEST_SUITE_END(); private: @@ -1585,6 +1587,28 @@ void ScOpenclTest::testStatisticalFormulaMedian() xDocSh-DoClose(); xDocShRes-DoClose(); } +//[AMLOEXT-110] +void ScOpenclTest::testFinancialAmorlincFormula() +{ +if (!detectOpenCLDevice()) +return; +ScDocShellRef xDocSh = loadDoc(opencl/financial/Amorlinc., XLS); +ScDocument *pDoc = xDocSh-GetDocument(); +CPPUNIT_ASSERT(pDoc); +enableOpenCL(); +pDoc-CalcAll(); +ScDocShellRef xDocShRes = loadDoc(opencl/financial/Amorlinc., XLS); +ScDocument *pDocRes = xDocShRes-GetDocument(); +CPPUNIT_ASSERT(pDocRes); +for (SCROW i = 0; i = 9; ++i) +{ +double fLibre = pDoc-GetValue(ScAddress(7, i, 0)); +double fExcel = pDocRes-GetValue(ScAddress(7, i, 0)); +CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel)); +} +xDocSh-DoClose(); +xDocShRes-DoClose(); +} void ScOpenclTest::testFinacialPriceMatFormula() { if (!detectOpenCLDevice()) commit 8ecf00aecd2c40a7e1bdbfedc0379178004808c8 Author: minwang m...@multicorewareinc.com Date: Tue Nov 5 10:33:53 2013 +0800 GPU Calc: implement fix for AMORLINC in GPU calc AMLOEXT-110 FIX Change-Id: I068924cc83288261102ea03e29449e0faf8686f9 Signed-off-by: haochen haoc...@multicorewareinc.com Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index d68b17b..e3e5d6b 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1191,6 +1191,12 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments( mvSubArguments.push_back(SoPHelper(ts, ft-Children[i], new OpAmordegrc)); } +else if ( !(pChild-GetExternal().compareTo(OUString( + com.sun.star.sheet.addin.Analysis.getAmorlinc +{ +mvSubArguments.push_back(SoPHelper(ts, ft-Children[i], +new OpAmorlinc)); +} break; default: throw UnhandledToken(pChild, unhandled opcode); diff --git a/sc/source/core/opencl/op_financial.cxx b/sc/source/core/opencl/op_financial.cxx index 6681b78..dcf882c 100644 --- a/sc/source/core/opencl/op_financial.cxx +++ b/sc/source/core/opencl/op_financial.cxx @@ -3065,7 +3065,159 @@ void OpAmordegrc::GenSlidingWindowFunction(std::stringstream ss, ss return tmp;\n; ss }; } - +void OpAmorlinc::BinInlineFun(std::setstd::string decls, +std::setstd::string funs) +{ +decls.insert(nKorrValDecl); decls.insert(RoundDecl); +decls.insert(IsLeapYearDecl);decls.insert(DaysInMonthDecl); +decls.insert(DaysToDateDecl); decls.insert(DateToDaysDecl); +decls.insert(GetNullDateDecl); decls.insert(GetYearFracDecl); +funs.insert(Round); +funs.insert(IsLeapYear);funs.insert(DaysInMonth); +funs.insert(DaysToDate);funs.insert(DateToDays); +funs.insert(GetNullDate);funs.insert(GetYearFrac); +} +void
[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - 2 commits - sc/qa sc/source
sc/qa/unit/data/ods/opencl/math/Abs.ods |binary sc/qa/unit/opencl-test.cxx | 28 +++ sc/source/core/opencl/formulagroupcl.cxx |5 sc/source/core/opencl/op_math.cxx| 32 +++ sc/source/core/opencl/op_math.hxx|8 +++ sc/source/core/tool/token.cxx|1 6 files changed, 74 insertions(+) New commits: commit bab01caa314a98e715d25c19d719c96b838310b3 Author: yangzhang yangzh...@multicorewareinc.com Date: Mon Nov 4 15:36:56 2013 +0800 GPU Calc: implement fix for ABS AMLOEXT-47 FIX Change-Id: I438ad01d717dbc34ea8bc45e8f6de4f7d0c2bf2c Signed-off-by: haochen haoc...@multicorewareinc.com Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 3e80351..0b69d4e 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1023,6 +1023,11 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments( case ocSinHyp: mvSubArguments.push_back(SoPHelper(ts, ft-Children[i],new OpSinh)); +break; +case ocAbs: +mvSubArguments.push_back(SoPHelper(ts, + ft-Children[i], new OpAbs)); +break; case ocExternal: if ( !(pChild-GetExternal().compareTo(OUString( com.sun.star.sheet.addin.Analysis.getEffect diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx index 32d2eb5..b3afda2 100644 --- a/sc/source/core/opencl/op_math.cxx +++ b/sc/source/core/opencl/op_math.cxx @@ -110,6 +110,38 @@ void OpSinh::GenSlidingWindowFunction(std::stringstream ss, ss }; } +void OpAbs::GenSlidingWindowFunction(std::stringstream ss, +const std::string sSymName, SubArguments vSubArguments) +{ +ss \ndouble sSymName; +ss _ BinFuncName() (; +for (unsigned i = 0; i vSubArguments.size(); i++) +{ +if (i) +ss ,; +vSubArguments[i]-GenSlidingWindowDecl(ss); +} +ss ) {\n; +ss int gid0 = get_global_id(0);\n; +ss double tmp = GetBottom() ;\n; +#ifdef ISNAN +FormulaToken *tmpCur0 = vSubArguments[0]-GetFormulaToken(); +const formula::SingleVectorRefToken*tmpCurDVR0= +dynamic_castconst formula::SingleVectorRefToken *(tmpCur0); +ss int buffer_len = ; +ss tmpCurDVR0-GetArrayLength(); +ss ;\n; +ss if((gid0)=buffer_len || isNan(; +ss vSubArguments[0]-GenSlidingWindowDeclRef(); +ss ))\n; +ss tmp = GetBottom() ;\nelse \n; +#endif +ss tmp = ; +ss vSubArguments[0]-GenSlidingWindowDeclRef(); +ss ;\n; +ss return fabs(tmp);\n; +ss }; +} }} diff --git a/sc/source/core/opencl/op_math.hxx b/sc/source/core/opencl/op_math.hxx index 7399a6a..1e59c41 100644 --- a/sc/source/core/opencl/op_math.hxx +++ b/sc/source/core/opencl/op_math.hxx @@ -38,6 +38,14 @@ public: const std::string sSymName, SubArguments vSubArguments); virtual std::string BinFuncName(void) const { return Sinh; } }; + +class OpAbs:public Normal{ +public: +virtual void GenSlidingWindowFunction(std::stringstream ss, +const std::string sSymName, SubArguments vSubArguments); +virtual std::string GetBottom(void) { return 0.0; } +virtual std::string BinFuncName(void) const { return ScAbs; } +}; }} #endif commit e753429f1c51aed08b972367437c87978f12e83a Author: yangzhang yangzh...@multicorewareinc.com Date: Mon Nov 4 14:58:13 2013 +0800 GPU Calc: unit test cases for ABS Need open macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test AMLOEXT-47 BUG Change-Id: Ie33b4e5fad47f58a33ecdb0405521e7df694148c Signed-off-by: haochen haoc...@multicorewareinc.com Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com diff --git a/sc/qa/unit/data/ods/opencl/math/Abs.ods b/sc/qa/unit/data/ods/opencl/math/Abs.ods new file mode 100644 index 000..2e55c73 Binary files /dev/null and b/sc/qa/unit/data/ods/opencl/math/Abs.ods differ diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index f0d1e88..3a9493b 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -125,6 +125,7 @@ public: void testFinancialDurationFormula(); void testFinancialCoupnumFormula(); void testMathFormulaSinh(); +void testMathFormulaAbs(); CPPUNIT_TEST_SUITE(ScOpenclTest); CPPUNIT_TEST(testSharedFormulaXLS); CPPUNIT_TEST(testFinacialFormula); @@ -179,6 +180,7 @@ public: CPPUNIT_TEST(testFinancialDurationFormula); CPPUNIT_TEST(testFinancialCoupnumFormula); CPPUNIT_TEST(testMathFormulaSinh); +CPPUNIT_TEST(testMathFormulaAbs); CPPUNIT_TEST_SUITE_END(); private: @@
[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - 2 commits - sc/qa sc/source
sc/qa/unit/data/xls/opencl/financial/PV.xls |binary sc/qa/unit/opencl-test.cxx | 24 sc/source/core/opencl/formulagroupcl.cxx|4 sc/source/core/opencl/op_financial.cxx | 144 sc/source/core/opencl/op_financial.hxx |8 + sc/source/core/tool/token.cxx |1 6 files changed, 181 insertions(+) New commits: commit cdb3b9f846278a9b148d094f5e5ddd3a567b09a4 Author: yiming ju yim...@multicorewareinc.com Date: Mon Nov 4 15:54:15 2013 +0800 GPU Calc: implement fix for PV AMLOEXT-73 FIX Change-Id: I0b9014a5d78165adaaa41c7e6cc05e876981f37d Signed-off-by: haochen haoc...@multicorewareinc.com Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 0b69d4e..72cf329 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1028,6 +1028,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments( mvSubArguments.push_back(SoPHelper(ts, ft-Children[i], new OpAbs)); break; +case ocBW: +mvSubArguments.push_back(SoPHelper(ts, + ft-Children[i], new OpPV)); +break; case ocExternal: if ( !(pChild-GetExternal().compareTo(OUString( com.sun.star.sheet.addin.Analysis.getEffect diff --git a/sc/source/core/opencl/op_financial.cxx b/sc/source/core/opencl/op_financial.cxx index b5b9a5c..3597f9f 100644 --- a/sc/source/core/opencl/op_financial.cxx +++ b/sc/source/core/opencl/op_financial.cxx @@ -3390,6 +3390,150 @@ void OpTbillyield::GenSlidingWindowFunction( ss }\n; } +void OpPV::GenSlidingWindowFunction( +std::stringstream ss, const std::string sSymName, SubArguments +vSubArguments) +{ +ss \ndouble sSymName; +ss _ BinFuncName() (; +for (unsigned i = 0; i vSubArguments.size(); i++) +{ +if (i) +ss ,; +vSubArguments[i]-GenSlidingWindowDecl(ss); +} +ss ) {\n; +ss double result = 0;\n; +ss int gid0 = get_global_id(0);\n; +ss double zins;\n; +ss double zzr;\n; +ss double rmz;\n; +ss double zw;\n; +ss double flag;\n; + +#ifdef ISNAN + FormulaToken *tmpCur0 = vSubArguments[0]-GetFormulaToken(); + const formula::SingleVectorRefToken*tmpCurDVR0= dynamic_castconst + formula::SingleVectorRefToken *(tmpCur0); + + FormulaToken *tmpCur1 = vSubArguments[1]-GetFormulaToken(); + const formula::SingleVectorRefToken*tmpCurDVR1= dynamic_castconst + formula::SingleVectorRefToken *(tmpCur1); + + FormulaToken *tmpCur2 = vSubArguments[2]-GetFormulaToken(); + const formula::SingleVectorRefToken*tmpCurDVR2= dynamic_castconst + formula::SingleVectorRefToken *(tmpCur2); + + const formula::SingleVectorRefToken*tmpCurDVR3; + const formula::SingleVectorRefToken*tmpCurDVR4; + +if(vSubArguments.size()3) +{ +FormulaToken *tmpCur3 = vSubArguments[3]-GetFormulaToken(); +tmpCurDVR3= dynamic_castconst formula::SingleVectorRefToken *( +tmpCur3); +ss int buffer_zw_len = ; +ss tmpCurDVR3-GetArrayLength(); +ss ;\n; +} + +if(vSubArguments.size()4) +{ +FormulaToken *tmpCur4 = vSubArguments[4]-GetFormulaToken(); +tmpCurDVR4= dynamic_castconst formula::SingleVectorRefToken *( +tmpCur4); +ss int buffer_flag_len = ; +ss tmpCurDVR4-GetArrayLength(); +ss ;\n; +} + +ss int buffer_zins_len = ; +ss tmpCurDVR0-GetArrayLength(); +ss ;\n; + +ss int buffer_zzr_len = ; +ss tmpCurDVR1-GetArrayLength(); +ss ;\n; + +ss int buffer_rmz_len = ; +ss tmpCurDVR2-GetArrayLength(); +ss ;\n; + +#endif + +#ifdef ISNAN +ssif(gid0=buffer_zins_len || isNan(; +ss vSubArguments[0]-GenSlidingWindowDeclRef(); +ss))\n; +sszins = 0;\nelse \n; +#endif +sszins = ; +ss vSubArguments[0]-GenSlidingWindowDeclRef(); +ss;\n; + +#ifdef ISNAN +ssif(gid0=buffer_zzr_len || isNan(; +ss vSubArguments[1]-GenSlidingWindowDeclRef(); +ss))\n; +sszzr = 0;\nelse \n; +#endif +sszzr = ; +ss vSubArguments[1]-GenSlidingWindowDeclRef(); +ss;\n; + +#ifdef ISNAN +ssif(gid0=buffer_rmz_len || isNan(; +ss vSubArguments[2]-GenSlidingWindowDeclRef(); +ss))\n; +ssrmz = 0;\nelse \n; +#endif +ssrmz = ; +ss vSubArguments[2]-GenSlidingWindowDeclRef(); +ss;\n; + +if(vSubArguments.size()3) +{ +#ifdef ISNAN +ssif(gid0=buffer_zw_len || isNan(; +ss vSubArguments[3]-GenSlidingWindowDeclRef(); +ss))\n; +sszw = 0;\nelse \n; +#endif +ss
[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - 2 commits - sc/qa sc/source
sc/qa/unit/data/xls/opencl/math/sin.xls |binary sc/qa/unit/opencl-test.cxx | 24 sc/source/core/opencl/formulagroupcl.cxx |4 sc/source/core/opencl/op_math.cxx| 30 +- sc/source/core/opencl/op_math.hxx|8 +++- sc/source/core/tool/token.cxx|1 + 6 files changed, 65 insertions(+), 2 deletions(-) New commits: commit 4b08a4109ce12530c34c9fe05e1077ce4587f15e Author: fengzeng fengz...@multicorewareinc.com Date: Mon Nov 4 16:25:48 2013 +0800 GPU Calc: implement fix for SIN AMLOEXT-58 FIX Change-Id: I68d23a66fd46b239911f8ba686b0492ca7783267 Signed-off-by: haochen haoc...@multicorewareinc.com Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 72cf329..e4a28ba 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1032,6 +1032,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments( mvSubArguments.push_back(SoPHelper(ts, ft-Children[i], new OpPV)); break; +case ocSin: +mvSubArguments.push_back(SoPHelper(ts, + ft-Children[i], new OpSin)); +break; case ocExternal: if ( !(pChild-GetExternal().compareTo(OUString( com.sun.star.sheet.addin.Analysis.getEffect diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx index b3afda2..3d7d4c9 100644 --- a/sc/source/core/opencl/op_math.cxx +++ b/sc/source/core/opencl/op_math.cxx @@ -109,7 +109,35 @@ void OpSinh::GenSlidingWindowFunction(std::stringstream ss, ss return tmp;\n; ss }; } - +void OpSin::GenSlidingWindowFunction(std::stringstream ss, +const std::string sSymName, SubArguments vSubArguments) +{ +FormulaToken *tmpCur = vSubArguments[0]-GetFormulaToken(); +const formula::SingleVectorRefToken*tmpCurDVR= dynamic_castconst + formula::SingleVectorRefToken *(tmpCur); +ss \ndouble sSymName; +ss _ BinFuncName() (; +for (unsigned i = 0; i vSubArguments.size(); i++) +{ +if (i) +ss ,; +vSubArguments[i]-GenSlidingWindowDecl(ss); +} +ss )\n; +ss {\n; +ss int gid0=get_global_id(0);\n; +ss double arg0 = vSubArguments[0]-GenSlidingWindowDeclRef(); +ss ;\n; +#ifdef ISNAN +ss if(isNan(arg0)||(gid0=; +ss tmpCurDVR-GetArrayLength(); +ss ))\n; +ss arg0 = 0;\n; +#endif +ss double tmp=sin(arg0);\n; +ss return tmp;\n; +ss }; +} void OpAbs::GenSlidingWindowFunction(std::stringstream ss, const std::string sSymName, SubArguments vSubArguments) { diff --git a/sc/source/core/opencl/op_math.hxx b/sc/source/core/opencl/op_math.hxx index 1e59c41..1dbfec9 100644 --- a/sc/source/core/opencl/op_math.hxx +++ b/sc/source/core/opencl/op_math.hxx @@ -38,7 +38,13 @@ public: const std::string sSymName, SubArguments vSubArguments); virtual std::string BinFuncName(void) const { return Sinh; } }; - +class OpSin: public Normal +{ +public: +virtual void GenSlidingWindowFunction(std::stringstream ss, +const std::string sSymName, SubArguments vSubArguments); +virtual std::string BinFuncName(void) const { return Sin; } +}; class OpAbs:public Normal{ public: virtual void GenSlidingWindowFunction(std::stringstream ss, commit 89da92c9434ae1069aa195545e2813d418e837f6 Author: fengzeng fengz...@multicorewareinc.com Date: Mon Nov 4 16:20:25 2013 +0800 GPU Calc: unit test cases for SIN Need open macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test AMLOEXT-58 BUG Change-Id: I484b86650e3e7bb11aa59aad6ae01be152aa2cef Signed-off-by: haochen haoc...@multicorewareinc.com Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com diff --git a/sc/qa/unit/data/xls/opencl/math/sin.xls b/sc/qa/unit/data/xls/opencl/math/sin.xls new file mode 100644 index 000..71ea0d1 Binary files /dev/null and b/sc/qa/unit/data/xls/opencl/math/sin.xls differ diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index 3186ed7..684bea7 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -127,6 +127,7 @@ public: void testMathFormulaSinh(); void testMathFormulaAbs(); void testFinacialPVFormula(); +void testMathFormulaSin(); CPPUNIT_TEST_SUITE(ScOpenclTest); CPPUNIT_TEST(testSharedFormulaXLS); CPPUNIT_TEST(testFinacialFormula); @@ -183,6 +184,7 @@ public: CPPUNIT_TEST(testMathFormulaSinh); CPPUNIT_TEST(testMathFormulaAbs); CPPUNIT_TEST(testFinacialPVFormula); +CPPUNIT_TEST(testMathFormulaSin); CPPUNIT_TEST_SUITE_END(); private: @@ -1175,6
[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - 2 commits - sc/qa sc/source
sc/qa/unit/data/xls/opencl/math/tan.xls |binary sc/qa/unit/opencl-test.cxx | 24 sc/source/core/opencl/formulagroupcl.cxx |4 sc/source/core/opencl/op_math.cxx| 30 +- sc/source/core/opencl/op_math.hxx|8 sc/source/core/tool/token.cxx|1 + 6 files changed, 66 insertions(+), 1 deletion(-) New commits: commit 14412c045c0f9a06ff2b3f4bdb9b3542ede4ebfe Author: fengzeng fengz...@multicorewareinc.com Date: Mon Nov 4 16:36:26 2013 +0800 GPU Calc: implemented TAN AMLOEXT-60 FIX Change-Id: Ibdbc0f22e152f5b73191f3a16e9e5489c0007fc3 Signed-off-by: haochen haoc...@multicorewareinc.com Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index e4a28ba..900bcd8 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1036,6 +1036,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments( mvSubArguments.push_back(SoPHelper(ts, ft-Children[i], new OpSin)); break; +case ocTan: +mvSubArguments.push_back(SoPHelper(ts, + ft-Children[i], new OpTan)); +break; case ocExternal: if ( !(pChild-GetExternal().compareTo(OUString( com.sun.star.sheet.addin.Analysis.getEffect diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx index 3d7d4c9..c5c213c 100644 --- a/sc/source/core/opencl/op_math.cxx +++ b/sc/source/core/opencl/op_math.cxx @@ -170,7 +170,35 @@ void OpAbs::GenSlidingWindowFunction(std::stringstream ss, ss return fabs(tmp);\n; ss }; } - +void OpTan::GenSlidingWindowFunction(std::stringstream ss, +const std::string sSymName, SubArguments vSubArguments) +{ +FormulaToken *tmpCur = vSubArguments[0]-GetFormulaToken(); +const formula::SingleVectorRefToken*tmpCurDVR= dynamic_castconst + formula::SingleVectorRefToken *(tmpCur); +ss \ndouble sSymName; +ss _ BinFuncName() (; +for (unsigned i = 0; i vSubArguments.size(); i++) +{ +if (i) +ss ,; +vSubArguments[i]-GenSlidingWindowDecl(ss); +} +ss )\n; +ss {\n; +ss int gid0=get_global_id(0);\n; +ss double arg0 = vSubArguments[0]-GenSlidingWindowDeclRef(); +ss ;\n; +#ifdef ISNAN +ss if(isNan(arg0)||(gid0=; +ss tmpCurDVR-GetArrayLength(); +ss ))\n; +ss arg0 = 0;\n; +#endif +ss double tmp=tan(arg0);\n; +ss return tmp;\n; +ss }; +} }} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/opencl/op_math.hxx b/sc/source/core/opencl/op_math.hxx index 1dbfec9..ed5a4e9 100644 --- a/sc/source/core/opencl/op_math.hxx +++ b/sc/source/core/opencl/op_math.hxx @@ -52,6 +52,14 @@ public: virtual std::string GetBottom(void) { return 0.0; } virtual std::string BinFuncName(void) const { return ScAbs; } }; +class OpTan: public Normal +{ +public: +virtual void GenSlidingWindowFunction(std::stringstream ss, +const std::string sSymName, SubArguments vSubArguments); + +virtual std::string BinFuncName(void) const { return Tan; } +}; }} #endif commit 02e44285f47f8f0933de595c528bae6314fae5c2 Author: fengzeng fengz...@multicorewareinc.com Date: Mon Nov 4 16:32:44 2013 +0800 GPU Calc: unit test cases for TAN Need open macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test AMLOEXT-60 BUG Change-Id: I29433afcc8403fd6938d39667b18e786f4e5b6fc Signed-off-by: haochen haoc...@multicorewareinc.com Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com diff --git a/sc/qa/unit/data/xls/opencl/math/tan.xls b/sc/qa/unit/data/xls/opencl/math/tan.xls new file mode 100644 index 000..2a73718 Binary files /dev/null and b/sc/qa/unit/data/xls/opencl/math/tan.xls differ diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index 684bea7..21c839a 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -128,6 +128,7 @@ public: void testMathFormulaAbs(); void testFinacialPVFormula(); void testMathFormulaSin(); +void testMathFormulaTan(); CPPUNIT_TEST_SUITE(ScOpenclTest); CPPUNIT_TEST(testSharedFormulaXLS); CPPUNIT_TEST(testFinacialFormula); @@ -185,6 +186,7 @@ public: CPPUNIT_TEST(testMathFormulaAbs); CPPUNIT_TEST(testFinacialPVFormula); CPPUNIT_TEST(testMathFormulaSin); +CPPUNIT_TEST(testMathFormulaTan); CPPUNIT_TEST_SUITE_END(); private: @@ -1199,6 +1201,28 @@ void ScOpenclTest::testMathFormulaSin() xDocSh-DoClose(); xDocShRes-DoClose(); } +//[AMLOEXT-60] +void ScOpenclTest::testMathFormulaTan() +{ +if
[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - 2 commits - sc/qa sc/source
sc/qa/unit/data/xls/opencl/math/tanh.xls |binary sc/qa/unit/opencl-test.cxx | 24 sc/source/core/opencl/formulagroupcl.cxx |4 sc/source/core/opencl/op_math.cxx| 31 +++ sc/source/core/opencl/op_math.hxx|8 sc/source/core/tool/token.cxx|1 + 6 files changed, 68 insertions(+) New commits: commit d8a23a6239abb78cb3d4a4c631de288869135406 Author: fengzeng fengz...@multicorewareinc.com Date: Mon Nov 4 16:50:16 2013 +0800 GPU Calc: implemented TANH AMLOEXT-61 FIX Change-Id: I7c8dcc23d85aa809f134446dcab97e51405d58c2 Signed-off-by: haochen haoc...@multicorewareinc.com Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 900bcd8..b2f403a 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1040,6 +1040,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments( mvSubArguments.push_back(SoPHelper(ts, ft-Children[i], new OpTan)); break; +case ocTanHyp: +mvSubArguments.push_back(SoPHelper(ts, + ft-Children[i], new OpTanH)); +break; case ocExternal: if ( !(pChild-GetExternal().compareTo(OUString( com.sun.star.sheet.addin.Analysis.getEffect diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx index c5c213c..d7286be 100644 --- a/sc/source/core/opencl/op_math.cxx +++ b/sc/source/core/opencl/op_math.cxx @@ -199,6 +199,37 @@ void OpTan::GenSlidingWindowFunction(std::stringstream ss, ss return tmp;\n; ss }; } +void OpTanH::GenSlidingWindowFunction(std::stringstream ss, +const std::string sSymName, SubArguments vSubArguments) +{ +FormulaToken *tmpCur = vSubArguments[0]-GetFormulaToken(); +const formula::SingleVectorRefToken*tmpCurDVR= dynamic_castconst + formula::SingleVectorRefToken *(tmpCur); +ss \ndouble sSymName; +ss _ BinFuncName() (; +for (unsigned i = 0; i vSubArguments.size(); i++) +{ +if (i) +ss ,; +vSubArguments[i]-GenSlidingWindowDecl(ss); +} +ss )\n; +ss {\n; +ss int gid0=get_global_id(0);\n; +ss double arg0 = vSubArguments[0]-GenSlidingWindowDeclRef(); +ss ;\n; +#ifdef ISNAN +ss if(isNan(arg0)||(gid0=; +ss tmpCurDVR-GetArrayLength(); +ss ))\n; +ss arg0 = 0;\n; +#endif +ss double tmp=tanh(arg0);\n; +ss return tmp;\n; +ss }; +} + + }} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/opencl/op_math.hxx b/sc/source/core/opencl/op_math.hxx index ed5a4e9..d7ce226 100644 --- a/sc/source/core/opencl/op_math.hxx +++ b/sc/source/core/opencl/op_math.hxx @@ -60,6 +60,14 @@ public: virtual std::string BinFuncName(void) const { return Tan; } }; +class OpTanH: public Normal +{ +public: +virtual void GenSlidingWindowFunction(std::stringstream ss, +const std::string sSymName, SubArguments vSubArguments); + +virtual std::string BinFuncName(void) const { return TanH; } +}; }} #endif commit e508d9ad054e9baf34e954f54e31046c90f80d2b Author: fengzeng fengz...@multicorewareinc.com Date: Mon Nov 4 16:47:01 2013 +0800 GPU Calc: unit test cases for TANH Need open macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test AMLOEXT-61 BUG Change-Id: I1db0693cdacdf437c413e56e3c97f0ff4d913211 Signed-off-by: haochen haoc...@multicorewareinc.com Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com diff --git a/sc/qa/unit/data/xls/opencl/math/tanh.xls b/sc/qa/unit/data/xls/opencl/math/tanh.xls new file mode 100644 index 000..a19efd3 Binary files /dev/null and b/sc/qa/unit/data/xls/opencl/math/tanh.xls differ diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index 21c839a..6085a78 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -129,6 +129,7 @@ public: void testFinacialPVFormula(); void testMathFormulaSin(); void testMathFormulaTan(); +void testMathFormulaTanH(); CPPUNIT_TEST_SUITE(ScOpenclTest); CPPUNIT_TEST(testSharedFormulaXLS); CPPUNIT_TEST(testFinacialFormula); @@ -187,6 +188,7 @@ public: CPPUNIT_TEST(testFinacialPVFormula); CPPUNIT_TEST(testMathFormulaSin); CPPUNIT_TEST(testMathFormulaTan); +CPPUNIT_TEST(testMathFormulaTanH); CPPUNIT_TEST_SUITE_END(); private: @@ -1223,6 +1225,28 @@ void ScOpenclTest::testMathFormulaTan() xDocSh-DoClose(); xDocShRes-DoClose(); } +//[AMLOEXT-61] +void ScOpenclTest::testMathFormulaTanH() +{ +if (!detectOpenCLDevice()) +return; +ScDocShellRef
[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - 2 commits - sc/qa sc/source
sc/qa/unit/data/xls/opencl/statistical/Standard.xls |binary sc/qa/unit/opencl-test.cxx | 27 + sc/source/core/opencl/formulagroupcl.cxx|4 sc/source/core/opencl/op_statistical.cxx| 107 sc/source/core/opencl/op_statistical.hxx|8 + sc/source/core/tool/token.cxx |1 6 files changed, 147 insertions(+) New commits: commit 8e7681325fe1ecb7b914566f31360520b1380a5d Author: shiming zhang shim...@multicorewareinc.com Date: Mon Nov 4 17:05:54 2013 +0800 GPU Calc: implemented STANDARDIZE AMLOEXT-77 FIX Change-Id: I5f91d497417e87a489728949a4436f33ed3da235 Signed-off-by: haochen haoc...@multicorewareinc.com Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index b2f403a..bb8d369 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1044,6 +1044,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments( mvSubArguments.push_back(SoPHelper(ts, ft-Children[i], new OpTanH)); break; +case ocStandard: +mvSubArguments.push_back(SoPHelper(ts, + ft-Children[i], new OpStandard)); +break; case ocExternal: if ( !(pChild-GetExternal().compareTo(OUString( com.sun.star.sheet.addin.Analysis.getEffect diff --git a/sc/source/core/opencl/op_statistical.cxx b/sc/source/core/opencl/op_statistical.cxx index 134a0ca..4128507 100644 --- a/sc/source/core/opencl/op_statistical.cxx +++ b/sc/source/core/opencl/op_statistical.cxx @@ -22,6 +22,113 @@ using namespace formula; namespace sc { namespace opencl { +void OpStandard::GenSlidingWindowFunction(std::stringstream ss, +const std::string sSymName, SubArguments vSubArguments) +{ +ss \ndouble sSymName; +ss _ BinFuncName() (; +for (unsigned i = 0; i vSubArguments.size(); i++) +{ +if (i) +ss ,; +vSubArguments[i]-GenSlidingWindowDecl(ss); +} +ss ) {\n; +ss double tmp = 0;\n; +ss int gid0 = get_global_id(0);\n; +ss double x,mu,sigma;\n; +if(vSubArguments.size() != 3) +{ +ss return DBL_MAX;\n }\n; +return ; +} +FormulaToken *tmpCur0 = vSubArguments[0]-GetFormulaToken(); +assert(tmpCur0); +if(tmpCur0-GetType() == formula::svSingleVectorRef) +{ +const formula::SingleVectorRefToken*tmpCurDVR0 = +dynamic_castconst formula::SingleVectorRefToken *(tmpCur0); +#ifdef ISNAN +ss int buffer_x_len = ; +ss tmpCurDVR0-GetArrayLength() ;\n; +ss if(gid0=buffer_x_len || isNan(; +ss vSubArguments[0]-GenSlidingWindowDeclRef() ))\n; +ss x = 0.0;\n; +ss else\n; +#endif +ss x = ; +ss vSubArguments[0]-GenSlidingWindowDeclRef() ;\n; +} +else if(tmpCur0-GetType() == formula::svDouble) +{ +ss x= tmpCur0-GetDouble() ;\n; +} +else +{ +ss return DBL_MAX;\n }\n; +return ; +} +FormulaToken *tmpCur1 = vSubArguments[1]-GetFormulaToken(); +assert(tmpCur1); +if(tmpCur1-GetType() == formula::svSingleVectorRef) +{ +const formula::SingleVectorRefToken*tmpCurDVR1 = +dynamic_castconst formula::SingleVectorRefToken *(tmpCur1); +#ifdef ISNAN +ss int buffer_mu_len = ; +ss tmpCurDVR1-GetArrayLength() ;\n; +ss if(gid0=buffer_mu_len || isNan(; +ss vSubArguments[1]-GenSlidingWindowDeclRef() ))\n; +ss mu = 0.0;\n; +ss else\n; +#endif +ss mu = ; +ss vSubArguments[1]-GenSlidingWindowDeclRef() ;\n; +} +else if(tmpCur1-GetType() == formula::svDouble) +{ +ss mu= tmpCur1-GetDouble() ;\n; +} +else +{ +ss return DBL_MAX;\n }\n; +return ; +} + +FormulaToken *tmpCur2 = vSubArguments[2]-GetFormulaToken(); +assert(tmpCur2); +if(tmpCur2-GetType() == formula::svSingleVectorRef) +{ +const formula::SingleVectorRefToken*tmpCurDVR2 = +dynamic_castconst formula::SingleVectorRefToken *(tmpCur2); +#ifdef ISNAN +ss int buffer_sigma_len = ; +ss tmpCurDVR2-GetArrayLength() ;\n; +ss if(gid0=buffer_sigma_len || isNan(; +ss vSubArguments[2]-GenSlidingWindowDeclRef() ))\n; +ss sigma = 0.0;\n; +ss else\n; +#endif +ss sigma = ; +ss vSubArguments[2]-GenSlidingWindowDeclRef() ;\n; +} +else if(tmpCur2-GetType() == formula::svDouble) +{ +ss sigma= tmpCur2-GetDouble() ;\n; +} +else +
[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - 2 commits - sc/qa sc/source
sc/qa/unit/data/xls/opencl/financial/ISPMT.xls |binary sc/qa/unit/opencl-test.cxx | 24 + sc/source/core/opencl/formulagroupcl.cxx |3 + sc/source/core/opencl/op_financial.cxx | 45 + sc/source/core/opencl/op_financial.hxx | 11 ++ sc/source/core/tool/token.cxx |1 6 files changed, 84 insertions(+) New commits: commit 2cfd2307ac641f251dc3276f12b32b5a617cef24 Author: xinjiang xinji...@multicorewareinc.com Date: Mon Nov 4 10:40:51 2013 +0800 GPU Calc: implemented ISPMT in GPU calc AMLOEXT-99 FIX Change-Id: I8cd9f130c190e6925873a00579cb7c334201f418 Signed-off-by: haochen haoc...@multicorewareinc.com Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index b4bb0f9..b47e192 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1013,6 +1013,9 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments( case ocCosecant: mvSubArguments.push_back(SoPHelper(ts, ft-Children[i], new OpCsc)); break; +case ocISPMT: +mvSubArguments.push_back(SoPHelper(ts, ft-Children[i], new OpISPMT)); +break; case ocExternal: if ( !(pChild-GetExternal().compareTo(OUString( com.sun.star.sheet.addin.Analysis.getEffect diff --git a/sc/source/core/opencl/op_financial.cxx b/sc/source/core/opencl/op_financial.cxx index 329dd77..503087b 100644 --- a/sc/source/core/opencl/op_financial.cxx +++ b/sc/source/core/opencl/op_financial.cxx @@ -487,6 +487,51 @@ void OpINTRATE::GenSlidingWindowFunction( ss }; } +void OpISPMT::GenSlidingWindowFunction(std::stringstream ss, +const std::string sSymName, SubArguments vSubArguments) +{ +ss \ndouble sSymName; +ss _ BinFuncName() (; +for (unsigned i = 0; i vSubArguments.size(); i++) +{ +if (i) +ss ,; +vSubArguments[i]-GenSlidingWindowDecl(ss); +} +ss ) {\n; +ss double tmp = GetBottom() ;\n; +ss int gid0 = get_global_id(0);\n; +ss double arg0 = GetBottom() ;\n; +ss double arg1 = GetBottom() ;\n; +ss double arg2 = GetBottom() ;\n; +ss double arg3 = GetBottom() ;\n; +unsigned i = vSubArguments.size(); +while (i--) +{ +FormulaToken* pCur = vSubArguments[i]-GetFormulaToken(); +assert(pCur); +if(pCur-GetType() == formula::svSingleVectorRef) +{ +#ifdef ISNAN +const formula::SingleVectorRefToken* pSVR = +dynamic_cast const formula::SingleVectorRefToken* (pCur); +ss if(gid0 = pSVR-GetArrayLength() || isNan(; +ss vSubArguments[i]-GenSlidingWindowDeclRef(); +ss ))\n; +ss arg i = GetBottom() ;\n; +ss else\n; +#endif +ss arg i = ; +ss vSubArguments[i]-GenSlidingWindowDeclRef(); +ss ;\n; +} +} +ss tmp = arg3 * arg0 * ( arg1 / arg2 - 1.0);\n; +ss return tmp;\n; +ss }; +} + + void Fvschedule::GenSlidingWindowFunction( std::stringstream ss, const std::string sSymName, SubArguments vSubArguments) { diff --git a/sc/source/core/opencl/op_financial.hxx b/sc/source/core/opencl/op_financial.hxx index 7a79dde..6add67f 100644 --- a/sc/source/core/opencl/op_financial.hxx +++ b/sc/source/core/opencl/op_financial.hxx @@ -86,6 +86,17 @@ public: virtual std::string BinFuncName(void) const { return INTRATE; } }; +class OpISPMT: public Normal +{ +public: +virtual std::string GetBottom(void) { return 0; } + +virtual void GenSlidingWindowFunction(std::stringstream ss, +const std::string sSymName, SubArguments vSubArguments); + +virtual std::string BinFuncName(void) const { return ISPMT; } +}; + class Fvschedule: public Normal { public: commit c7a6959004bcacc2d971b0697a57b08b7b3f9931 Author: xinjiang xinji...@multicorewareinc.com Date: Mon Nov 4 10:36:28 2013 +0800 GPU Calc: unit test cases for ISPMT in GPU calc AMLOEXT-99 BUG Change-Id: I4388b184b23cf616dacfb20c61d2295765925ede Signed-off-by: haochen haoc...@multicorewareinc.com Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com diff --git a/sc/qa/unit/data/xls/opencl/financial/ISPMT.xls b/sc/qa/unit/data/xls/opencl/financial/ISPMT.xls new file mode 100644 index 000..8759e7e Binary files /dev/null and b/sc/qa/unit/data/xls/opencl/financial/ISPMT.xls differ diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index 043c99f..dd3630e 100644 ---
[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - 2 commits - sc/qa sc/source
sc/qa/unit/data/ods/opencl/financial/Duration.ods |binary sc/qa/unit/opencl-test.cxx| 24 sc/source/core/opencl/formulagroupcl.cxx |4 ++ sc/source/core/opencl/op_financial.cxx| 42 ++ sc/source/core/opencl/op_financial.hxx| 12 ++ sc/source/core/tool/token.cxx |1 6 files changed, 83 insertions(+) New commits: commit 6f1aef5e9e3be786e6e841ad100d01a1a0744c8d Author: xinjiang xinji...@multicorewareinc.com Date: Mon Nov 4 11:18:04 2013 +0800 GPU Calc: implemented DURATION AMLOEXT-111 FIX Change-Id: I114e5b20326657f7fd3e0de7162a8ae190059b2a Signed-off-by: haochen haoc...@multicorewareinc.com Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 2362cba..bc758f4 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1016,6 +1016,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments( case ocISPMT: mvSubArguments.push_back(SoPHelper(ts, ft-Children[i], new OpISPMT)); break; +case ocLaufz: +mvSubArguments.push_back(SoPHelper(ts, + ft-Children[i], new OpDuration)); +break; case ocExternal: if ( !(pChild-GetExternal().compareTo(OUString( com.sun.star.sheet.addin.Analysis.getEffect diff --git a/sc/source/core/opencl/op_financial.cxx b/sc/source/core/opencl/op_financial.cxx index f9f1fa6..a40a113 100644 --- a/sc/source/core/opencl/op_financial.cxx +++ b/sc/source/core/opencl/op_financial.cxx @@ -531,6 +531,48 @@ void OpISPMT::GenSlidingWindowFunction(std::stringstream ss, ss }; } +void OpDuration::GenSlidingWindowFunction(std::stringstream ss, +const std::string sSymName, SubArguments vSubArguments) +{ +ss \ndouble sSymName; +ss _ BinFuncName() (; +for (unsigned i = 0; i vSubArguments.size(); i++) +{ +if (i) +ss ,; +vSubArguments[i]-GenSlidingWindowDecl(ss); +} +ss ) {\n; +ss double tmp = GetBottom() ;\n; +ss int gid0 = get_global_id(0);\n; +ss double arg0 = GetBottom() ;\n; +ss double arg1 = GetBottom() ;\n; +ss double arg2 = GetBottom() ;\n; +unsigned i = vSubArguments.size(); +while (i--) +{ +FormulaToken* pCur = vSubArguments[i]-GetFormulaToken(); +assert(pCur); +if(pCur-GetType() == formula::svSingleVectorRef) +{ +#ifdef ISNAN +const formula::SingleVectorRefToken* pSVR = +dynamic_cast const formula::SingleVectorRefToken* (pCur); +ss if(gid0 = pSVR-GetArrayLength() || isNan(; +ss vSubArguments[i]-GenSlidingWindowDeclRef(); +ss ))\n; +ss arg i = GetBottom() ;\n; +ss else\n; +#endif +ss arg i = ; +ss vSubArguments[i]-GenSlidingWindowDeclRef(); +ss ;\n; +} +} +ss tmp = log(arg2 / arg1) / log(arg0 + 1.0);\n; +ss return tmp;\n; +ss }; +} void Fvschedule::GenSlidingWindowFunction( std::stringstream ss, const std::string sSymName, SubArguments vSubArguments) diff --git a/sc/source/core/opencl/op_financial.hxx b/sc/source/core/opencl/op_financial.hxx index cd62f82..fc73076 100644 --- a/sc/source/core/opencl/op_financial.hxx +++ b/sc/source/core/opencl/op_financial.hxx @@ -97,6 +97,18 @@ public: virtual std::string BinFuncName(void) const { return ISPMT; } }; +class OpDuration: public Normal +{ +public: +virtual std::string GetBottom(void) { return 0; } + +virtual void GenSlidingWindowFunction(std::stringstream ss, +const std::string sSymName, SubArguments vSubArguments); + +virtual std::string BinFuncName(void) const { return Duration; } +}; + + class Fvschedule: public Normal { public: commit feb89290371033110c9a3a62426e716bfafc9778 Author: xinjiang xinji...@multicorewareinc.com Date: Mon Nov 4 11:12:17 2013 +0800 GPU Calc: unit test cases for DURATION AMLOEXT-111 BUG Change-Id: I1d206b0eda0dca8254f0491399d0a4679eb39ef8 Signed-off-by: haochen haoc...@multicorewareinc.com Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com diff --git a/sc/qa/unit/data/ods/opencl/financial/Duration.ods b/sc/qa/unit/data/ods/opencl/financial/Duration.ods new file mode 100644 index 000..d884dfe Binary files /dev/null and b/sc/qa/unit/data/ods/opencl/financial/Duration.ods differ diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index d41046b..6654517 100644
[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - 2 commits - sc/qa sc/source
sc/qa/unit/data/xls/opencl/financial/Coupnum.xls |binary sc/qa/unit/opencl-test.cxx | 25 + sc/source/core/opencl/formulagroupcl.cxx |6 + sc/source/core/opencl/op_financial.cxx | 97 ++- sc/source/core/opencl/op_financial.hxx |9 ++ 5 files changed, 136 insertions(+), 1 deletion(-) New commits: commit 9ab405788ef7dfc2ae0461eb7f31569c181671c5 Author: minwang m...@multicorewareinc.com Date: Mon Nov 4 11:32:43 2013 +0800 GPU Calc: implemented COUPNUM AMLOEXT-74 FIX Change-Id: Ic7f274f089f7f6cc6b767c4a07844014eeded61d Signed-off-by: haochen haoc...@multicorewareinc.com Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index bc758f4..07ea246 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1137,6 +1137,12 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments( mvSubArguments.push_back(SoPHelper(ts, ft-Children[i], new OpPrice)); } +else if ( !(pChild-GetExternal().compareTo(OUString( + com.sun.star.sheet.addin.Analysis.getCoupnum +{ +mvSubArguments.push_back(SoPHelper(ts, ft-Children[i], +new OpCoupnum)); +} break; default: throw UnhandledToken(pChild, unhandled opcode); diff --git a/sc/source/core/opencl/op_financial.cxx b/sc/source/core/opencl/op_financial.cxx index a40a113..b5b9a5c 100644 --- a/sc/source/core/opencl/op_financial.cxx +++ b/sc/source/core/opencl/op_financial.cxx @@ -2740,7 +2740,102 @@ void OpCoupdaysnc::GenSlidingWindowFunction( ss }; } - void OpReceived::BinInlineFun(std::setstd::string decls, +void OpCoupnum::BinInlineFun(std::setstd::string decls, +std::setstd::string funs) +{ +decls.insert(IsLeapYearDecl);decls.insert(DaysInMonthDecl); +decls.insert(DaysToDateDecl);decls.insert(DateToDaysDecl); +decls.insert(GetNullDateDecl);decls.insert(lcl_GetcoupnumDecl); +decls.insert(coupnumDecl); +funs.insert(IsLeapYear);funs.insert(DaysInMonth); +funs.insert(DaysToDate);funs.insert(DateToDays); +funs.insert(GetNullDate); +funs.insert(lcl_Getcoupnum); +funs.insert(coupnum); +} +void OpCoupnum::GenSlidingWindowFunction(std::stringstream ss, +const std::string sSymName, SubArguments vSubArguments) +{ +ss \ndouble sSymName; +ss _ BinFuncName() (; +for (unsigned i = 0; i vSubArguments.size(); i++) +{ + if (i) + ss ,; + vSubArguments[i]-GenSlidingWindowDecl(ss); +} +ss ) {\n; +ss double tmp = GetBottom() ;\n; +ss int gid0 = get_global_id(0);\n; +ss int nSettle,nMat,nFreq,nBase;\n; +#ifdef ISNAN +FormulaToken* tmpCur0 = vSubArguments[0]-GetFormulaToken(); +const formula::SingleVectorRefToken*tmpCurDVR0= dynamic_castconst +formula::SingleVectorRefToken *(tmpCur0); +FormulaToken* tmpCur1 = vSubArguments[1]-GetFormulaToken(); +const formula::SingleVectorRefToken*tmpCurDVR1= dynamic_castconst +formula::SingleVectorRefToken *(tmpCur1); +FormulaToken* tmpCur2 = vSubArguments[2]-GetFormulaToken(); +const formula::SingleVectorRefToken*tmpCurDVR2= dynamic_castconst +formula::SingleVectorRefToken *(tmpCur2); +FormulaToken* tmpCur3 = vSubArguments[3]-GetFormulaToken(); +const formula::SingleVectorRefToken*tmpCurDVR3= dynamic_castconst +formula::SingleVectorRefToken *(tmpCur3); +ss int buffer_nSettle_len = ; +ss tmpCurDVR0-GetArrayLength(); +ss ;\n; +ss int buffer_nMat_len = ; +ss tmpCurDVR1-GetArrayLength(); +ss ;\n; +ss int buffer_nFreq_len = ; +ss tmpCurDVR2-GetArrayLength(); +ss ;\n; +ss int buffer_nBase_len = ; +ss tmpCurDVR3-GetArrayLength(); +ss ;\n; +#endif +#ifdef ISNAN +ss if(gid0 = buffer_nSettle_len || isNan(; +ss vSubArguments[0]-GenSlidingWindowDeclRef(); +ss ))\n; +ss nSettle = 0;\nelse\n; +#endif +ss nSettle=(int); +ss vSubArguments[0]-GenSlidingWindowDeclRef(); +ss ;\n; +#ifdef ISNAN +ss if(gid0 = buffer_nMat_len || isNan(; +ss vSubArguments[1]-GenSlidingWindowDeclRef(); +ss ))\n; +ss nMat = 0;\nelse\n; +#endif +ss nMat=(int); +ss vSubArguments[1]-GenSlidingWindowDeclRef(); +ss ;\n; +#ifdef ISNAN +ss if(gid0 = buffer_nFreq_len || isNan(; +ss vSubArguments[2]-GenSlidingWindowDeclRef(); +ss ))\n; +ss nFreq = 0;\nelse\n; +#endif +ss nFreq=(int); +ss vSubArguments[2]-GenSlidingWindowDeclRef(); +ss ;\n; +#ifdef ISNAN +ss if(gid0 = buffer_nBase_len || isNan(; +ss
[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - 2 commits - sc/qa sc/source
sc/qa/unit/data/xls/opencl/financial/PMT.xls |binary sc/qa/unit/opencl-test.cxx | 25 + sc/source/core/opencl/op_financial.cxx | 130 +-- 3 files changed, 127 insertions(+), 28 deletions(-) New commits: commit c68b91a4b6ae7d3d37c181f6956c80738625c710 Author: mulei mu...@multicorewareinc.com Date: Fri Nov 1 12:02:35 2013 -0500 GPU Calc: implement NAN argument handling in PMT Change-Id: I1288a20652b4ceb66d90314f7acddb73506dfb43 Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com Signed-off-by: haochen haoc...@multicorewareinc.com diff --git a/sc/source/core/opencl/op_financial.cxx b/sc/source/core/opencl/op_financial.cxx index da4845c..69f7d02 100644 --- a/sc/source/core/opencl/op_financial.cxx +++ b/sc/source/core/opencl/op_financial.cxx @@ -1837,44 +1837,118 @@ void OpYieldmat::GenSlidingWindowFunction( ss }; } -void OpPMT::GenSlidingWindowFunction( -std::stringstream ss, const std::string sSymName, SubArguments vSubArguments) +void OpPMT::GenSlidingWindowFunction(std::stringstream ss, +const std::string sSymName, SubArguments vSubArguments) { ss \ndouble sSymName; ss _ BinFuncName() (; for (unsigned i = 0; i vSubArguments.size(); i++) { if (i) -ss ,; +ss , ; vSubArguments[i]-GenSlidingWindowDecl(ss); } -ss ) {\n\t; -ss double tmp = 0;\n\t; -ssdouble tFv=0,tType=0;\n\t; -ss int gid0 = get_global_id(0);\n\t; - if(vSubArguments.size()==4) -sstFv=vSubArguments[3]-GenSlidingWindowDeclRef();\n\t; -else if(vSubArguments.size()==5) +ss ) {\n; +ss double tmp = 0;\n; +ss int gid0 = get_global_id(0);\n; +ssdouble tmp0,tmp1,tmp2;\n; +ssdouble tmp3=0,tmp4=0;\n; +unsigned i = vSubArguments.size(); +size_t nItems = 0; +ss \n; +//while (i-- 1) +for (size_t i = 0; i vSubArguments.size(); i++) { -sstType=vSubArguments[4]-GenSlidingWindowDeclRef(); -ss;\n\t; -sstFv=vSubArguments[3]-GenSlidingWindowDeclRef(); -ss;\n\t; +FormulaToken *pCur = vSubArguments[i]-GetFormulaToken(); +assert(pCur); +if (pCur-GetType() == formula::svDoubleVectorRef) +{ +const formula::DoubleVectorRefToken* pDVR = +dynamic_castconst formula::DoubleVectorRefToken *(pCur); +size_t nCurWindowSize = pDVR-GetRefRowSize(); +ss for (int i = ; +if (!pDVR-IsStartFixed() pDVR-IsEndFixed()) { +#ifdef ISNAN +ss gid0; ipDVR-GetArrayLength(); +ssinCurWindowSize ; i++){\n; +#else +ss gid0; i nCurWindowSize ; i++)\n; +#endif +} else if (pDVR-IsStartFixed() !pDVR-IsEndFixed()) { +#ifdef ISNAN +ss 0; ipDVR-GetArrayLength(); +ssi gid0+ nCurWindowSize ; i++){\n; +#else +ss 0; i gid0+ nCurWindowSize ; i++)\n; +#endif +} else if (!pDVR-IsStartFixed() !pDVR-IsEndFixed()){ +#ifdef ISNAN +ss 0; i + gid0pDVR-GetArrayLength(); +ss i nCurWindowSize ; i++){\n; +#else +ss 0; i nCurWindowSize ; i++)\n; +#endif +} +else { +#ifdef ISNAN +ss 0; i nCurWindowSize ; i++){\n; +#else +ss 0; i nCurWindowSize ; i++)\n; +#endif +} +nItems += nCurWindowSize; +} +else if (pCur-GetType() == formula::svSingleVectorRef) +{ +#ifdef ISNAN +const formula::SingleVectorRefToken* pSVR = +dynamic_cast const formula::SingleVectorRefToken* (pCur); +ss if (gid0pSVR-GetArrayLength() ){\n; +#else +nItems += 1; +#endif +} +else if (pCur-GetType() == formula::svDouble) +{ +#ifdef ISNAN +ss {\n; +#endif +nItems += 1; +} +else +{ +#ifdef ISNAN +#endif +nItems += 1; +} +#ifdef ISNAN +if(ocPush==vSubArguments[i]-GetFormulaToken()-GetOpCode()) +{ +ss if (isNan(; +ss vSubArguments[i]-GenSlidingWindowDeclRef(); +ss ))\n; +ss tmpi= 0;\n; +ss else\n; +ss tmpi=vSubArguments[i]-GenSlidingWindowDeclRef(); +ss ;\n}\n; +} +else +{ +ss tmpi=vSubArguments[i]-GenSlidingWindowDeclRef(); +ss ;\n; +} +#else +ss tmpi=vSubArguments[i]-GenSlidingWindowDeclRef(); +ss ;\n; + +#endif } -ssif(vSubArguments[0]-GenSlidingWindowDeclRef()==0.0)\n\t; -ss\treturn (vSubArguments[2]-GenSlidingWindowDeclRef(); -ss+tFv)/; -