summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhongyu zhong <hongyu@multicorewareinc.com>2013-11-06 11:56:43 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-11-13 14:39:17 -0600
commit090a51f8ce0532fa9db4d6c24d2e3cafeb8436f7 (patch)
tree66bdd9d8dc01c0e4c59c91724b20626d6e4e3074
parent152f8d40c7d5acabe253abd22d1d6a099cfeab28 (diff)
GPU Calc: implemented for PERMUTATION
AMLOEXT-104 FIX Change-Id: I00b273c7995d0f34c7126d159d6d38b6b993f7c7 Signed-off-by: haochen <haochen@multicorewareinc.com> Signed-off-by: I-Jui (Ray) Sung <ray@multicorewareinc.com>
-rw-r--r--sc/source/core/opencl/formulagroupcl.cxx4
-rw-r--r--sc/source/core/opencl/op_statistical.cxx50
-rw-r--r--sc/source/core/opencl/op_statistical.hxx6
3 files changed, 60 insertions, 0 deletions
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 40fe93014c9b..67a4896bb654 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1116,6 +1116,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(
mvSubArguments.push_back(SoPHelper(ts,
ft->Children[i],new OpVariationen));
break;
+ case ocVariationen2:
+ mvSubArguments.push_back(SoPHelper(ts,
+ ft->Children[i],new OpVariationen2));
+ 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 cdd892bfeae5..2b77d2afdf27 100644
--- a/sc/source/core/opencl/op_statistical.cxx
+++ b/sc/source/core/opencl/op_statistical.cxx
@@ -1119,6 +1119,56 @@ void OpVariationen::GenSlidingWindowFunction(
ss << " return tmp;\n";
ss << "}\n";
}
+void OpVariationen2::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 inA;\n";
+ ss <<" double inB;\n";
+#ifdef ISNAN
+ FormulaToken *tmpCur0 = vSubArguments[0]->GetFormulaToken();
+ const formula::SingleVectorRefToken*tmpCurDVR0= dynamic_cast<const
+ formula::SingleVectorRefToken *>(tmpCur0);
+ FormulaToken *tmpCur1 = vSubArguments[1]->GetFormulaToken();
+ const formula::SingleVectorRefToken*tmpCurDVR1= dynamic_cast<const
+ formula::SingleVectorRefToken *>(tmpCur1);
+ ss << "int buffer_fIna_len = ";
+ ss << tmpCurDVR0->GetArrayLength();
+ ss << ";\n";
+ ss << " int buffer_fInb_len = ";
+ ss << tmpCurDVR1->GetArrayLength();
+ ss << ";\n";
+#endif
+#ifdef ISNAN
+ ss << " if((gid0)>=buffer_fIna_len || isNan(";
+ ss << vSubArguments[0]->GenSlidingWindowDeclRef();
+ ss << "))\n";
+ ss << " inA = 0;\nelse \n";
+#endif
+ ss << " inA = "<<vSubArguments[0]->GenSlidingWindowDeclRef();
+ ss << ";\n";
+#ifdef ISNAN
+ ss << "if((gid0)>=buffer_fInb_len || isNan(";
+ ss << vSubArguments[1]->GenSlidingWindowDeclRef();
+ ss << "))\n";
+ ss << "inB = 0;\nelse \n";
+#endif
+ ss << " inB = "<<vSubArguments[1]->GenSlidingWindowDeclRef();
+ ss << ";\n";
+ ss << " double tmp = pow(inA,inB);\n";
+ ss << " return tmp;\n";
+ ss << "}\n";
+}
void OpNorminv::GenSlidingWindowFunction(
std::stringstream &ss,const std::string sSymName,
SubArguments &vSubArguments)
diff --git a/sc/source/core/opencl/op_statistical.hxx b/sc/source/core/opencl/op_statistical.hxx
index 2491c6ddfa80..dc47fc190116 100644
--- a/sc/source/core/opencl/op_statistical.hxx
+++ b/sc/source/core/opencl/op_statistical.hxx
@@ -160,6 +160,12 @@ class OpVariationen:public Normal{
const std::string sSymName, SubArguments &vSubArguments);
virtual std::string BinFuncName(void) const { return "OpVariationen"; }
};
+class OpVariationen2:public Normal{
+ public:
+ virtual void GenSlidingWindowFunction(std::stringstream &ss,
+ const std::string sSymName, SubArguments &vSubArguments);
+ virtual std::string BinFuncName(void) const { return "OpVariationen2";}
+};
}}
#endif