[Libreoffice-commits] core.git: Branch 'feature/calc-pluggable-opencl' - 3 commits - officecfg/registry sc/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Wed Sep 18 07:55:52 PDT 2013
officecfg/registry/schema/org/openoffice/Office/Calc.xcs | 4 ++--
sc/source/core/opencl/openclwrapper.cxx | 12 ++++++------
sc/source/core/tool/formulaopt.cxx | 5 ++++-
sc/source/ui/optdlg/calcoptionsdlg.cxx | 9 ++++++++-
4 files changed, 20 insertions(+), 10 deletions(-)
New commits:
commit a8614702368c746795e03503d0da16d241dfc4d0
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Sep 18 16:47:15 2013 +0200
fix storing of open cl device in configuration files
Change-Id: Icc343b55fe40c430b87d2e4c98701d78c61e3a96
diff --git a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
index 25fe724..4c583a4 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
@@ -1344,12 +1344,12 @@
</info>
<value>true</value>
</prop>
- <prop oor:name="OpenCLAutoDevice" oor:type="xs:string" oor:nillable="false">
+ <prop oor:name="OpenCLDevice" oor:type="xs:string" oor:nillable="false">
<!-- UIHints: Tools - Options Spreadsheet Formula -->
<info>
<desc>The Device ID of the OpenCL device selected if OpenCLAutoSelect is false</desc>
</info>
- <value></value>
+ <value/>
</prop>
</group>
<group oor:name="Syntax">
diff --git a/sc/source/core/tool/formulaopt.cxx b/sc/source/core/tool/formulaopt.cxx
index f649927..1ce5e09 100644
--- a/sc/source/core/tool/formulaopt.cxx
+++ b/sc/source/core/tool/formulaopt.cxx
@@ -216,7 +216,7 @@ Sequence<OUString> ScFormulaCfg::GetPropertyNames()
"Load/ODFRecalcMode", // SCFORMULAOPT_ODF_RECALC
"Calculation/OpenCL", // SCFORMULAOPT_OPENCL_ENABLED
"Calculation/OpenCLAutoSelect", // SCFORMULAOPT_OPENCL_AUTOSELECT
- "Calculation/OpenCLAutoDevice" // SCFORMULAOPT_OPENCL_DEVICE
+ "Calculation/OpenCLDevice" // SCFORMULAOPT_OPENCL_DEVICE
};
Sequence<OUString> aNames(SCFORMULAOPT_COUNT);
OUString* pNames = aNames.getArray();
@@ -428,6 +428,7 @@ void ScFormulaCfg::UpdateFromProperties( const Sequence<OUString>& aNames )
pValues[nProp] >>= aOpenCLDevice;
GetCalcConfig().maOpenCLDevice = aOpenCLDevice;
}
+ break;
default:
;
}
@@ -540,6 +541,8 @@ void ScFormulaCfg::Commit()
{
sal_Bool bVal = GetCalcConfig().mbOpenCLAutoSelect;
pValues[nProp] <<= bVal;
+ sc::FormulaGroupInterpreter::switchOpenCLDevice(
+ GetCalcConfig().maOpenCLDevice, bVal);
}
break;
case SCFORMULAOPT_OPENCL_DEVICE:
commit b86d547a02a0fa717e5df355ed5946acff19f71a
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Sep 18 16:26:08 2013 +0200
small fixes for broken code
Change-Id: I77afc818d5575523077328042ac9418f521edc9c
diff --git a/sc/source/core/opencl/openclwrapper.cxx b/sc/source/core/opencl/openclwrapper.cxx
index d4cf1b7..d273463 100644
--- a/sc/source/core/opencl/openclwrapper.cxx
+++ b/sc/source/core/opencl/openclwrapper.cxx
@@ -251,8 +251,8 @@ std::vector<boost::shared_ptr<osl::File> > OpenclDevice::binaryGenerated( const
}
}
}
- return aGeneratedFiles;
+ return aGeneratedFiles;
}
int OpenclDevice::writeBinaryToFile( const OString& rFileName, const char* binary, size_t numBytes )
@@ -270,7 +270,6 @@ int OpenclDevice::writeBinaryToFile( const OString& rFileName, const char* binar
assert(numBytes == nBytesWritten);
return 1;
-
}
int OpenclDevice::generatBinFromKernelSource( cl_program program, const char * clFileName )
@@ -414,9 +413,7 @@ int OpenclDevice::cachedOfKernerPrg( const GPUEnv *gpuEnvCached, const char * cl
int OpenclDevice::compileKernelFile( GPUEnv *gpuInfo, const char *buildOption )
{
cl_int clStatus = 0;
- size_t length;
int binary_status, idx;
- cl_uint numDevices;
const char* filename = "kernel.cl";
fprintf(stderr, "compileKernelFile ... \n");
if ( cachedOfKernerPrg(gpuInfo, filename) == 1 )
@@ -426,6 +423,7 @@ int OpenclDevice::compileKernelFile( GPUEnv *gpuInfo, const char *buildOption )
idx = gpuInfo->mnFileCount;
+ cl_uint numDevices;
clStatus = clGetContextInfo( gpuInfo->mpContext, CL_CONTEXT_NUM_DEVICES,
sizeof(numDevices), &numDevices, NULL );
CHECK_OPENCL( clStatus, "clGetContextInfo" );
@@ -437,6 +435,7 @@ int OpenclDevice::compileKernelFile( GPUEnv *gpuInfo, const char *buildOption )
if (aGeneratedFiles.size() == numDevices)
{
bBinaryExisted = true;
+ boost::scoped_array<size_t> length(new size_t[numDevices]);
boost::scoped_array<unsigned char*> pBinary(new unsigned char*[numDevices]);
for(size_t i = 0; i < numDevices; ++i)
{
@@ -448,7 +447,7 @@ int OpenclDevice::compileKernelFile( GPUEnv *gpuInfo, const char *buildOption )
if(nSize != nBytesRead)
assert(false);
- length = nBytesRead;
+ length[i] = nBytesRead;
pBinary[i] = binary;
}
@@ -469,7 +468,7 @@ int OpenclDevice::compileKernelFile( GPUEnv *gpuInfo, const char *buildOption )
fprintf(stderr, "Create kernel from binary\n");
gpuInfo->mpArryPrograms[idx] = clCreateProgramWithBinary( gpuInfo->mpContext,numDevices,
- mpArryDevsID.get(), &length, (const unsigned char**) pBinary.get(),
+ mpArryDevsID.get(), length.get(), (const unsigned char**) pBinary.get(),
&binary_status, &clStatus );
if(clStatus != CL_SUCCESS)
{
@@ -515,6 +514,7 @@ int OpenclDevice::compileKernelFile( GPUEnv *gpuInfo, const char *buildOption )
if ( clStatus != CL_SUCCESS )
{
+ size_t length;
printf ("BuildProgram error!\n");
if ( !gpuInfo->mnIsUserCreated )
{
commit 0d9a1ba985fca09eefaf505f43b34ebf7080e8c2
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Sep 18 16:21:43 2013 +0200
select maximum one opencl device
Change-Id: If06caaa6b39131359ffc81fadad200c8cf8fe24a
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index 9607fb6..eefb7f6 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -204,6 +204,8 @@ void ScCalcOptionsDialog::fillOpenclList()
OUString aStoredDevice = maConfig.maOpenCLDevice;
+ SvTreeListEntry* pSelectedEntry = NULL;
+
sc::FormulaGroupInterpreter::fillOpenCLInfo(maPlatformInfo);
for(std::vector<sc::OpenclPlatformInfo>::iterator it = maPlatformInfo.begin(),
itEnd = maPlatformInfo.end(); it != itEnd; ++it)
@@ -215,13 +217,18 @@ void ScCalcOptionsDialog::fillOpenclList()
SvTreeListEntry* pEntry = mpOpenclInfoList->InsertEntry(aDeviceId);
if(aDeviceId == aStoredDevice)
{
- mpOpenclInfoList->GetModel()->GetView(0)->Select(pEntry);
+ pSelectedEntry = pEntry;
}
pEntry->SetUserData(&(*itr));
}
}
mpOpenclInfoList->SetUpdateMode(true);
+ mpOpenclInfoList->GetModel()->GetView(0)->SelectAll(false, false);
+ if(pSelectedEntry)
+ {
+ mpOpenclInfoList->GetModel()->GetView(0)->Select(pSelectedEntry);
+ }
SelectedDeviceChanged();
}
More information about the Libreoffice-commits
mailing list