summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorzhenyu yuan <zhenyuyuan@multicorewareinc.com>2013-11-12 15:35:15 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-11-15 11:54:28 -0600
commit0115152dacd10bc4029c585f6fe55bb7695f04ab (patch)
tree55d4e30720042b43113291909bd30771ba6dad72 /sc
parent9d98f56d956cb08e67c15a8d75ef1e5df4588ba5 (diff)
GPU Calc: implemented PI
AMLOEXT-196 FIX Change-Id: Ic9328d4cc7650bb2270e8b77969502bd3f4f49ba Signed-off-by: haochen <haochen@multicorewareinc.com> Signed-off-by: I-Jui (Ray) Sung <ray@multicorewareinc.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/opencl/formulagroupcl.cxx45
1 files changed, 45 insertions, 0 deletions
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 3666822539fd..51f68202d87d 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -193,6 +193,46 @@ public:
}
};
+class DynamicKernelPiArgument: public DynamicKernelArgument
+{
+public:
+ DynamicKernelPiArgument(const std::string &s,
+ FormulaTreeNodeRef ft):
+ DynamicKernelArgument(s, ft) {}
+ /// Generate declaration
+ virtual void GenDecl(std::stringstream &ss) const
+ {
+ ss << "double " << mSymName;
+ }
+ virtual void GenDeclRef(std::stringstream &ss) const
+ {
+ ss << "3.14159265358979";
+ }
+ virtual void GenSlidingWindowDecl(std::stringstream &ss) const
+ {
+ GenDecl(ss);
+ }
+ virtual std::string GenSlidingWindowDeclRef(bool=false) const
+ {
+ return mSymName;
+ }
+ virtual size_t GetWindowSize(void) const
+ {
+ return 1;
+ }
+ /// Create buffer and pass the buffer to a given kernel
+ virtual size_t Marshal(cl_kernel k, int argno, int)
+ {
+ double tmp = 0.0;
+ // Pass the scalar result back to the rest of the formula kernel
+ cl_int err = clSetKernelArg(k, argno, sizeof(double), (void*)&tmp);
+ if (CL_SUCCESS != err)
+ throw OpenCLError(err);
+ return 1;
+ }
+};
+
+
class DynamicKernelStringArgument: public DynamicKernelArgument
{
public:
@@ -1377,6 +1417,11 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(
mvSubArguments.push_back(SoPHelper(ts,
ft->Children[i], new OpZTest));
break;
+ case ocPi:
+ mvSubArguments.push_back(
+ SubArgument(new DynamicKernelPiArgument(ts,
+ ft->Children[i])));
+ break;
case ocExternal:
if ( !(pChild->GetExternal().compareTo(OUString(
"com.sun.star.sheet.addin.Analysis.getEffect"))))