use #if to avoid gotchas, move header to include, make UI conditional.
This commit is contained in:
@@ -59,4 +59,11 @@
|
|||||||
|
|
||||||
#define HAVE_FEATURE_MULTIUSER_ENVIRONMENT 0
|
#define HAVE_FEATURE_MULTIUSER_ENVIRONMENT 0
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Whether we have the OpenCL headers and should compile in any
|
||||||
|
* support for that abstraction.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define HAVE_FEATURE_OPENCL 0
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -9854,6 +9854,7 @@ else
|
|||||||
OPENCL_CFLAGS="-I$with_opencl_sdk/include"
|
OPENCL_CFLAGS="-I$with_opencl_sdk/include"
|
||||||
OPENCL_LIBS="-L$with_opencl_sdk/lib/x86 -lOpenCL"
|
OPENCL_LIBS="-L$with_opencl_sdk/lib/x86 -lOpenCL"
|
||||||
AC_MSG_RESULT([found at path $with_opencl_sdk])
|
AC_MSG_RESULT([found at path $with_opencl_sdk])
|
||||||
|
AC_DEFINE(HAVE_FEATURE_OPENCL)
|
||||||
else
|
else
|
||||||
AC_MSG_ERROR([no headers found found at $with_opencl_sdk/include ])
|
AC_MSG_ERROR([no headers found found at $with_opencl_sdk/include ])
|
||||||
fi
|
fi
|
||||||
|
@@ -10,6 +10,8 @@
|
|||||||
#ifndef _OPENCL_WRAPPER_H_
|
#ifndef _OPENCL_WRAPPER_H_
|
||||||
#define _OPENCL_WRAPPER_H_
|
#define _OPENCL_WRAPPER_H_
|
||||||
|
|
||||||
|
#include <config_features.h>
|
||||||
|
|
||||||
#include <CL/cl.h>
|
#include <CL/cl.h>
|
||||||
|
|
||||||
#define MaxTextExtent 4096
|
#define MaxTextExtent 4096
|
||||||
@@ -22,7 +24,7 @@
|
|||||||
#define strcasecmp strcmp
|
#define strcasecmp strcmp
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#define ENABLE_OPENCL //dbg
|
|
||||||
typedef struct _KernelEnv {
|
typedef struct _KernelEnv {
|
||||||
cl_context context;
|
cl_context context;
|
||||||
cl_command_queue commandQueue;
|
cl_command_queue commandQueue;
|
@@ -7,6 +7,7 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <config_features.h>
|
||||||
#include "formulagroup.hxx"
|
#include "formulagroup.hxx"
|
||||||
#include "document.hxx"
|
#include "document.hxx"
|
||||||
#include "formulacell.hxx"
|
#include "formulacell.hxx"
|
||||||
@@ -15,8 +16,8 @@
|
|||||||
#include "interpre.hxx"
|
#include "interpre.hxx"
|
||||||
#include "formula/vectortoken.hxx"
|
#include "formula/vectortoken.hxx"
|
||||||
|
|
||||||
#ifdef ENABLE_OPENCL
|
#if HAVE_FEATURE_OPENCL
|
||||||
#include "openclwrapper.hxx"
|
# include "openclwrapper.hxx"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace sc {
|
namespace sc {
|
||||||
@@ -40,7 +41,7 @@ TimeValue aTimeBefore, aTimeAfter;
|
|||||||
|
|
||||||
bool FormulaGroupInterpreter::interpret()
|
bool FormulaGroupInterpreter::interpret()
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_OPENCL //dbg
|
#if HAVE_FEATURE_OPENCL
|
||||||
size_t rowSize = mxGroup->mnLength, srcSize = 0;
|
size_t rowSize = mxGroup->mnLength, srcSize = 0;
|
||||||
fprintf(stderr,"rowSize at begin is ...%ld.\n",rowSize);
|
fprintf(stderr,"rowSize at begin is ...%ld.\n",rowSize);
|
||||||
int *rangeStart =NULL; // The first position for calculation,for example,the A1 in (=MAX(A1:A100))
|
int *rangeStart =NULL; // The first position for calculation,for example,the A1 in (=MAX(A1:A100))
|
||||||
@@ -100,7 +101,7 @@ bool FormulaGroupInterpreter::interpret()
|
|||||||
nRowEnd += i;
|
nRowEnd += i;
|
||||||
size_t nRowSize = nRowEnd - nRowStart + 1;
|
size_t nRowSize = nRowEnd - nRowStart + 1;
|
||||||
ScMatrixRef pMat(new ScMatrix(nColSize, nRowSize, 0.0));
|
ScMatrixRef pMat(new ScMatrix(nColSize, nRowSize, 0.0));
|
||||||
#ifdef ENABLE_OPENCL
|
#if HAVE_FEATURE_OPENCL
|
||||||
//srcSize = rowSize+nRowSize-rowSize%nRowSize;//align as nRowSize
|
//srcSize = rowSize+nRowSize-rowSize%nRowSize;//align as nRowSize
|
||||||
//srcData = (double *)calloc(srcSize,sizeof(double));
|
//srcData = (double *)calloc(srcSize,sizeof(double));
|
||||||
rangeStart[i] = nRowStart;//record the start position
|
rangeStart[i] = nRowStart;//record the start position
|
||||||
@@ -109,7 +110,7 @@ bool FormulaGroupInterpreter::interpret()
|
|||||||
for (size_t nCol = 0; nCol < nColSize; ++nCol)
|
for (size_t nCol = 0; nCol < nColSize; ++nCol)
|
||||||
{
|
{
|
||||||
const double* pArray = rArrays[nCol];
|
const double* pArray = rArrays[nCol];
|
||||||
#ifdef ENABLE_OPENCL
|
#if HAVE_FEATURE_OPENCL
|
||||||
//printf("pArray is %p.\n",pArray);
|
//printf("pArray is %p.\n",pArray);
|
||||||
if( NULL==pArray )
|
if( NULL==pArray )
|
||||||
{
|
{
|
||||||
@@ -146,7 +147,7 @@ bool FormulaGroupInterpreter::interpret()
|
|||||||
if (!pDest)
|
if (!pDest)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#ifdef ENABLE_OPENCL
|
#if HAVE_FEATURE_OPENCL
|
||||||
const formula::FormulaToken *pCur = aCode2.First();
|
const formula::FormulaToken *pCur = aCode2.First();
|
||||||
aCode2.Reset();
|
aCode2.Reset();
|
||||||
while( ( pCur = aCode2.Next() ) != NULL )
|
while( ( pCur = aCode2.Next() ) != NULL )
|
||||||
@@ -187,7 +188,7 @@ bool FormulaGroupInterpreter::interpret()
|
|||||||
}
|
}
|
||||||
} // for loop end (mxGroup->mnLength)
|
} // for loop end (mxGroup->mnLength)
|
||||||
// For GPU calculation
|
// For GPU calculation
|
||||||
#ifdef ENABLE_OPENCL //dbg: Using "export SC_GPU=1" to open if{} in terminal
|
#if HAVE_FEATURE_OPENCL //dbg: Using "export SC_GPU=1" to open if{} in terminal
|
||||||
if(getenv("SC_GPU"))
|
if(getenv("SC_GPU"))
|
||||||
{
|
{
|
||||||
fprintf(stderr,"ggGPU flow...\n\n");
|
fprintf(stderr,"ggGPU flow...\n\n");
|
||||||
@@ -236,17 +237,20 @@ bool FormulaGroupInterpreter::interpret()
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// We want to stuff the double data, which in rResult[i] from GPU calculated well, to UI view for users
|
// We want to stuff the double data, which in rResult[i] from GPU calculated well, to UI view for users
|
||||||
for (sal_Int32 i = 0; i < mxGroup->mnLength; ++i)
|
ScAddress aInsertPos = maTopPos;
|
||||||
{
|
for (sal_Int32 i = 0; i < mxGroup->mnLength; ++i)
|
||||||
ScFormulaCell* pDestx = mrDoc.GetFormulaCell(aTmpPos);
|
{
|
||||||
if (!pDestx)
|
aInsertPos.SetRow(mxGroup->mnStart + i);
|
||||||
return false;
|
ScFormulaCell* pDestx = mrDoc.GetFormulaCell(aInsertPos);
|
||||||
formula::FormulaTokenRef xResult = new formula::FormulaDoubleToken(rResult[i]);
|
|
||||||
pDestx->SetResultToken(xResult.get());
|
SAL_DEBUG(" put value " << rResult[i] << " into formula at " << aInsertPos.Col() << " , " << aInsertPos.Row() );
|
||||||
pDestx->ResetDirty();
|
assert(pDestx);
|
||||||
pDestx->SetChanged(true);
|
|
||||||
aTmpPos.SetRow(mxGroup->mnStart + i + 1);
|
formula::FormulaTokenRef xResult = new formula::FormulaDoubleToken(rResult[i]);
|
||||||
}
|
pDestx->SetResultToken(xResult.get());
|
||||||
|
pDestx->ResetDirty();
|
||||||
|
pDestx->SetChanged(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(leftData)
|
if(leftData)
|
||||||
|
@@ -17,6 +17,8 @@
|
|||||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <config_features.h>
|
||||||
|
|
||||||
#include <com/sun/star/ui/dialogs/XSLTFilterDialog.hpp>
|
#include <com/sun/star/ui/dialogs/XSLTFilterDialog.hpp>
|
||||||
#include <comphelper/processfactory.hxx>
|
#include <comphelper/processfactory.hxx>
|
||||||
|
|
||||||
@@ -101,8 +103,8 @@
|
|||||||
#include "scabstdlg.hxx"
|
#include "scabstdlg.hxx"
|
||||||
#include "formula/errorcodes.hxx"
|
#include "formula/errorcodes.hxx"
|
||||||
|
|
||||||
#ifdef ENABLE_OPENCL
|
#if HAVE_FEATURE_OPENCL
|
||||||
#include "openclwrapper.hxx"
|
# include "openclwrapper.hxx"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SC_IDLE_MIN 150
|
#define SC_IDLE_MIN 150
|
||||||
@@ -152,7 +154,7 @@ ScModule::ScModule( SfxObjectFactory* pFact ) :
|
|||||||
mbIsInSharedDocLoading( false ),
|
mbIsInSharedDocLoading( false ),
|
||||||
mbIsInSharedDocSaving( false )
|
mbIsInSharedDocSaving( false )
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_OPENCL
|
#if HAVE_FEATURE_OPENCL
|
||||||
OclCalc::InitEnv();
|
OclCalc::InitEnv();
|
||||||
#endif
|
#endif
|
||||||
// im ctor ist der ResManager (DLL-Daten) noch nicht initialisiert!
|
// im ctor ist der ResManager (DLL-Daten) noch nicht initialisiert!
|
||||||
@@ -188,7 +190,7 @@ ScModule::ScModule( SfxObjectFactory* pFact ) :
|
|||||||
|
|
||||||
ScModule::~ScModule()
|
ScModule::~ScModule()
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_OPENCL
|
#if HAVE_FEATURE_OPENCL
|
||||||
OclCalc::ReleaseOpenclRunEnv();
|
OclCalc::ReleaseOpenclRunEnv();
|
||||||
#endif
|
#endif
|
||||||
OSL_ENSURE( !pSelTransfer, "Selection Transfer object not deleted" );
|
OSL_ENSURE( !pSelTransfer, "Selection Transfer object not deleted" );
|
||||||
|
@@ -10,6 +10,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <config_features.h>
|
||||||
|
|
||||||
#include "calcoptionsdlg.hxx"
|
#include "calcoptionsdlg.hxx"
|
||||||
#include "sc.hrc"
|
#include "sc.hrc"
|
||||||
#include "scresid.hxx"
|
#include "scresid.hxx"
|
||||||
@@ -197,7 +199,9 @@ void ScCalcOptionsDialog::FillOptionsList()
|
|||||||
}
|
}
|
||||||
|
|
||||||
pModel->Insert(createBoolItem(maCaptionEmptyStringAsZero,maConfig.mbEmptyStringAsZero));
|
pModel->Insert(createBoolItem(maCaptionEmptyStringAsZero,maConfig.mbEmptyStringAsZero));
|
||||||
|
#if HAVE_FEATURE_OPENCL
|
||||||
pModel->Insert(createBoolItem(maCaptionOpenCLEnabled,maConfig.mbOpenCLEnabled));
|
pModel->Insert(createBoolItem(maCaptionOpenCLEnabled,maConfig.mbOpenCLEnabled));
|
||||||
|
#endif
|
||||||
|
|
||||||
mpLbSettings->SetUpdateMode(true);
|
mpLbSettings->SetUpdateMode(true);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user