sc/source/core/opencl/formulagroupcl.cxx | 14 +
sc/source/core/opencl/oclkernels.hxx |5 +
sc/source/core/opencl/openclwrapper.cxx | 39 --
sc/source/core/opencl/openclwrapper.hxx | 84 +++
sc/source/core/tool/formulagroup.cxx |2
5 files changed, 75 insertions(+), 69 deletions(-)
New commits:
commit 3e8fab98560f1e0b250bc1478ce84bd8ad9a8d41
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date: Tue Sep 10 17:01:15 2013 -0400
Put all opencl related code inside sc::opencl namespace.
Change-Id: Ia6c1fd88ed08022347c60af33a8620b9cf278c12
diff --git a/sc/source/core/opencl/formulagroupcl.cxx
b/sc/source/core/opencl/formulagroupcl.cxx
index 33eb834..352d0bf 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -7,7 +7,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#include config_features.h
#include formulagroup.hxx
#include document.hxx
#include formulacell.hxx
@@ -23,12 +22,11 @@
#define SINGLEARRAYLEN 100
#define DOUBLEARRAYLEN 100
#define SVDOUBLELEN 100
-namespace sc {
+
+namespace sc { namespace opencl {
// A single public entry point for a factory function:
-namespace opencl {
-extern sc::FormulaGroupInterpreter *createFormulaGroupInterpreter();
-}
+extern sc::FormulaGroupInterpreter *createFormulaGroupInterpreter();
/time test dbg
double getTimeDiff(const TimeValue t1, const TimeValue t2)
@@ -1070,17 +1068,15 @@ bool
FormulaGroupInterpreterGroundwater::interpret(ScDocument rDoc, const ScAdd
return true;
}
-namespace opencl {
-
sc::FormulaGroupInterpreter *createFormulaGroupInterpreter()
{
if (getenv(SC_SOFTWARE))
return NULL;
if (getenv(SC_GROUNDWATER))
-return new sc::FormulaGroupInterpreterGroundwater();
+return new FormulaGroupInterpreterGroundwater();
-return new sc::FormulaGroupInterpreterOpenCL();
+return new FormulaGroupInterpreterOpenCL();
}
} // namespace opencl
diff --git a/sc/source/core/opencl/oclkernels.hxx
b/sc/source/core/opencl/oclkernels.hxx
index 53917b3..3e0af5b 100644
--- a/sc/source/core/opencl/oclkernels.hxx
+++ b/sc/source/core/opencl/oclkernels.hxx
@@ -12,6 +12,9 @@
#ifndef USE_EXTERNAL_KERNEL
#define KERNEL( ... )# __VA_ARGS__
+
+namespace sc { namespace opencl {
+
// Double precision is a default of spreadsheets
// cl_khr_fp64: Khronos extension
// cl_amd_fp64: AMD extension
@@ -380,6 +383,8 @@ __kernel void oclSub( fp_t ltData, __global fp_t *rtData,
__global fp_t *outData
}
);
+}}
+
#endif // USE_EXTERNAL_KERNEL
#endif //_OCL_KERNEL_H_
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/opencl/openclwrapper.cxx
b/sc/source/core/opencl/openclwrapper.cxx
index 6db498b..75e991b 100644
--- a/sc/source/core/opencl/openclwrapper.cxx
+++ b/sc/source/core/opencl/openclwrapper.cxx
@@ -7,24 +7,19 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#include stdio.h
-#include stdlib.h
-#include string.h
-#include cmath
+#include openclwrapper.hxx
+
#include sal/config.h
#include random.hxx
-#include openclwrapper.hxx
#include oclkernels.hxx
-#ifdef SAL_WIN32
-#include Windows.h
-#endif
-//#define USE_MAP_BUFFER
-using namespace std;
-GPUEnv OpenclDevice::gpuEnv;
-int OpenclDevice::isInited =0;
+#include stdio.h
+#include stdlib.h
+#include string.h
+#include cmath
-#ifdef SAL_WIN32
+#ifdef WIN32
+#include Windows.h
#define OPENCL_DLL_NAME opencllo.dll
#define OCLERR -1
@@ -40,6 +35,16 @@ int OpenclDevice::isInited =0;
#define OCL_CHECK(value1,value2,str) \
if(value1!=value2) \
fprintf(stderr,[OCL_ERROR] %s\n,str);
+#endif
+
+using namespace std;
+
+namespace sc { namespace opencl {
+
+GPUEnv OpenclDevice::gpuEnv;
+int OpenclDevice::isInited =0;
+
+#ifdef WIN32
HINSTANCE HOpenclDll = NULL;
void * OpenclDll = NULL;
@@ -69,7 +74,7 @@ void OpenclDevice::freeOpenclDll()
int OpenclDevice::initEnv()
{
-#ifdef SAL_WIN32
+#ifdef WIN32
while( 1 )
{
if( 1 == loadOpencl() )
@@ -83,14 +88,14 @@ int OpenclDevice::initEnv()
int OpenclDevice::releaseOpenclRunEnv()
{
releaseOpenclEnv( gpuEnv );
-#ifdef SAL_WIN32
+#ifdef WIN32
freeOpenclDll();
#endif
return 1;
}
///
///
-inline int OpenclDevice::addKernelConfig( int kCount, const char *kName )
+int OpenclDevice::addKernelConfig( int kCount, const char *kName )
{
if ( kCount 1 )
fprintf(stderr,Error: ( KCount 1 ) SAL_DETAIL_WHERE
addKernelConfig\n );
@@ -2660,4 +2665,6 @@ int OclCalc::oclHostMatrixInverse32Bits( const char*
aKernelName, float *fpOclMa
return 0;
}
+}}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/opencl/openclwrapper.hxx
b/sc/source/core/opencl/openclwrapper.hxx
index cf3b4f1..d1e8925