diff options
author | Michael Meeks <michael.meeks@suse.com> | 2013-06-26 13:07:47 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2013-06-27 19:34:38 +0100 |
commit | b4be964fa2eece48e7ac1ae7c2c2690890ee899c (patch) | |
tree | 8f19412ad0dabaa572abf9851a9c187f1c53d1d2 /sc | |
parent | 4ca21e22bf90159228a5fa001dba9514cb0916c6 (diff) |
cleanup conditionals.
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/opencl/openclwrapper.cxx | 22 | ||||
-rw-r--r-- | sc/source/core/tool/formulagroup.cxx | 33 |
2 files changed, 31 insertions, 24 deletions
diff --git a/sc/source/core/opencl/openclwrapper.cxx b/sc/source/core/opencl/openclwrapper.cxx index b06af599ac9b..4790510ceaf8 100644 --- a/sc/source/core/opencl/openclwrapper.cxx +++ b/sc/source/core/opencl/openclwrapper.cxx @@ -10,10 +10,11 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include "sal/config.h" #include "random.hxx" #include "openclwrapper.hxx" #include "oclkernels.hxx" -#ifdef WIN32 +#ifdef SAL_WIN32 #include <Windows.h> #endif //#define USE_KERNEL_FILE @@ -21,7 +22,7 @@ using namespace std; GPUEnv OpenclDevice::gpuEnv; int OpenclDevice::isInited =0; -#ifdef WIN32 +#ifdef SAL_WIN32 #define OPENCL_DLL_NAME "opencllo.dll" #define OCLERR -1 @@ -54,8 +55,9 @@ void OpenclDevice::FreeOpenclDll() int OpenclDevice::InitEnv() { -#ifdef WIN32 - while(1){ +#ifdef SAL_WIN32 + while(1) + { if(1==LoadOpencl()) break; } @@ -66,7 +68,7 @@ int OpenclDevice::InitEnv() int OpenclDevice::ReleaseOpenclRunEnv() { ReleaseOpenclEnv(&gpuEnv); -#ifdef WIN32 +#ifdef SAL_WIN32 FreeOpenclDll(); #endif return 1; @@ -738,16 +740,18 @@ int OpenclDevice::RegisterKernelWrapper(const char *kernelName,cl_kernel_functio return (1); } } - return (0); + return (0); } -void OpenclDevice::SetOpenclState(int state) { +void OpenclDevice::SetOpenclState(int state) +{ //printf("OpenclDevice::setOpenclState...\n"); isInited = state; } -int OpenclDevice::GetOpenclState() { +int OpenclDevice::GetOpenclState() +{ return isInited; } //ocldbg @@ -886,6 +890,7 @@ int OclFormulaxDll(void ** usrdata, KernelEnv *env) { return 0; } + double OclCalc::OclProcess(cl_kernel_function function, double *data, formulax type) { fprintf(stderr, "\n OpenclDevice, proc...begin\n"); @@ -930,6 +935,7 @@ OclCalc::~OclCalc() OpenclDevice::SetOpenclState(0); fprintf(stderr,"OclCalc:: opencl end ok.\n"); } + ///////////////////////////////////////////////////////////////////////////// int OclCalc::OclHostFormulaMax(double *srcData,int *start,int *end,double *output,int size) { KernelEnv env; diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx index 88c33cf50050..43977edc6ccc 100644 --- a/sc/source/core/tool/formulagroup.cxx +++ b/sc/source/core/tool/formulagroup.cxx @@ -173,7 +173,8 @@ bool FormulaGroupInterpreter::interpret() // } } #endif - if(getenv("SC_FORMULAGROUP")&&(!getenv("SC_GPU"))){ + if(!getenv("SC_GPU")) + { fprintf(stderr,"ccCPU flow...\n\n"); ScCompiler aComp(&mrDoc, aTmpPos, aCode2); aComp.SetGrammar(mrDoc.GetGrammar()); @@ -186,11 +187,12 @@ bool FormulaGroupInterpreter::interpret() } } // for loop end (mxGroup->mnLength) // For GPU calculation -#ifdef ENABLE_OPENCL //dbg: Using "export SC_FORMULAGROUP=1;export SC_GPU=1" to open if{} in terminal - if(getenv("SC_FORMULAGROUP")&&(getenv("SC_GPU"))){ +#ifdef ENABLE_OPENCL //dbg: Using "export SC_GPU=1" to open if{} in terminal + if(getenv("SC_GPU")) + { fprintf(stderr,"ggGPU flow...\n\n"); printf(" oclOp is... %d\n",oclOp); -osl_getSystemTime(&aTimeBefore);//timer + osl_getSystemTime(&aTimeBefore); //timer static OclCalc ocl_calc; switch(oclOp) { @@ -219,14 +221,13 @@ osl_getSystemTime(&aTimeBefore);//timer fprintf(stderr,"No OpenCL function for this calculation.\n"); break; } -///////////////////////////////////////////////////// -osl_getSystemTime(&aTimeAfter); -double diff = getTimeDiff(aTimeAfter, aTimeBefore); -//if (diff >= 1.0) -{ - fprintf(stderr,"OpenCL,diff...%f.\n",diff); - -} + ///////////////////////////////////////////////////// + osl_getSystemTime(&aTimeAfter); + double diff = getTimeDiff(aTimeAfter, aTimeBefore); + //if (diff >= 1.0) + { + fprintf(stderr,"OpenCL,diff...%f.\n",diff); + } ///////////////////////////////////////////////////// //rResult[i]; @@ -261,10 +262,10 @@ double diff = getTimeDiff(aTimeAfter, aTimeBefore); if(srcData) free(srcData); -if(getenv("SC_GPUSAMPLE")){ - //fprintf(stderr,"FormulaGroupInterpreter::interpret(),iniflag...%d\n",ocl_calc.GetOpenclState()); - //ocl_calc.OclTest();//opencl test sample for debug -} + if(getenv("SC_GPUSAMPLE")){ + //fprintf(stderr,"FormulaGroupInterpreter::interpret(),iniflag...%d\n",ocl_calc.GetOpenclState()); + //ocl_calc.OclTest();//opencl test sample for debug + } #endif return true; |