[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - 2 commits - sc/qa sc/source
I-Jui Sung (Ray)
ray at multicorewareinc.com
Sun Nov 24 23:21:31 PST 2013
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 4e90af55242f59f6050611efd2b849a1e3a679e3
Author: I-Jui (Ray) Sung <ray at 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 0000000..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 faf2ddb..833d9c0 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -242,6 +242,7 @@ public:
void testStatisticalFormulaCovar();
void testLogicalFormulaAnd();
void testMathFormulaSumProduct();
+ void testMathFormulaSumProduct2();
void testStatisticalParallelCountBug();
CPPUNIT_TEST_SUITE(ScOpenclTest);
CPPUNIT_TEST(testSharedFormulaXLS);
@@ -416,6 +417,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 70cb6b4f6a417527998b33b2d5a407434495651a
Author: I-Jui (Ray) Sung <ray at 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 3405459..bee159b 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1103,10 +1103,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)
@@ -1149,10 +1169,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 = i+gid0+1;\n\t";
- temp4 << "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())
+ {
+ temp4 << " currentCount";
+ temp4 << i;
+ temp4 <<" =i+gid0+1;\n";
+ }
+ else
+ {
+ temp4 << " currentCount";
+ temp4 << i;
+ temp4 << " =i+1;\n";
+ }
+ }
+ }
+
temp4 << "tmp = fsum(";
for (unsigned i = 0; i < vSubArguments.size(); i++)
{
More information about the Libreoffice-commits
mailing list