[Libreoffice-commits] core.git: 2 commits - sc/source
Tor Lillqvist
tml at iki.fi
Thu Jul 11 02:06:34 PDT 2013
sc/source/core/opencl/openclwrapper.cxx | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
New commits:
commit 2812451c08ed222b57dd6e8d790ba4bada581719
Author: Tor Lillqvist <tml at iki.fi>
Date: Thu Jul 11 11:43:57 2013 +0300
Re-do 5dff961ba5fab6d451d9d993e076d190a93be495: Don't look for just GPUs
Surely we want to use any available device, not just a GPU? If what we
want is to *prefer* GPUs, the code need to be changed then to work
like that.
Change-Id: Ic689c3ab914de3cb77e5af686f0c330a9257d8fb
diff --git a/sc/source/core/opencl/openclwrapper.cxx b/sc/source/core/opencl/openclwrapper.cxx
index e377dc1..f767479 100644
--- a/sc/source/core/opencl/openclwrapper.cxx
+++ b/sc/source/core/opencl/openclwrapper.cxx
@@ -191,7 +191,7 @@ int OpenclDevice::BinaryGenerated(const char * clFileName, FILE ** fhandle)
FILE *fd = NULL;
cl_uint numDevices=0;
status = clGetDeviceIDs(gpuEnv.mpPlatformID, // platform
- CL_DEVICE_TYPE_GPU, // device_type
+ CL_DEVICE_TYPE_ALL, // device_type
0, // num_entries
NULL, // devices ID
&numDevices);
@@ -670,7 +670,7 @@ int OpenclDevice::InitOpenclRunEnv(GPUEnv *gpuInfo)
gpuInfo->mpPlatformID = platforms[i];
status = clGetDeviceIDs(gpuInfo->mpPlatformID, // platform
- CL_DEVICE_TYPE_GPU, // device_type
+ CL_DEVICE_TYPE_ALL, // device_type
0, // num_entries
NULL, // devices
&numDevices);
@@ -700,12 +700,15 @@ int OpenclDevice::InitOpenclRunEnv(GPUEnv *gpuInfo)
gpuInfo->mpContext = clCreateContextFromType(cps, gpuInfo->mDevType, NULL,
NULL, &status);
+ // If no GPU, check for CPU.
if ((gpuInfo->mpContext == (cl_context) NULL)
|| (status != CL_SUCCESS)) {
gpuInfo->mDevType = CL_DEVICE_TYPE_CPU;
gpuInfo->mpContext = clCreateContextFromType(cps, gpuInfo->mDevType,
NULL, NULL, &status);
}
+
+ // If no GPU or CPU, check for a "default" type.
if ((gpuInfo->mpContext == (cl_context) NULL)
|| (status != CL_SUCCESS)) {
gpuInfo->mDevType = CL_DEVICE_TYPE_DEFAULT;
commit ca3c7595221073315661458fbabc08850c2b4e58
Author: Tor Lillqvist <tml at iki.fi>
Date: Thu Jul 11 11:30:42 2013 +0300
Again: Use correct type for number of devices
The change from 7e00a3690edbf71d6c3e6c0670875485f65c567d was
(unintentionally, I hope) lost in a merge, it seems?
The number returned by clGetProgramInfo(..., CL_PROGRAM_NUM_DEVICES,
...) and clGetContextInfo(..., CL_CONTEXT_NUM_DEVICES, ...) is of type
cl_uint, not size_t. That makes a difference for 64-bit code.
Change-Id: I08257782ff70fbfecd5c74bde9c7b9597aed2105
diff --git a/sc/source/core/opencl/openclwrapper.cxx b/sc/source/core/opencl/openclwrapper.cxx
index 26c4c80..e377dc1 100644
--- a/sc/source/core/opencl/openclwrapper.cxx
+++ b/sc/source/core/opencl/openclwrapper.cxx
@@ -238,7 +238,8 @@ int OpenclDevice::GeneratBinFromKernelSource(cl_program program,
{
unsigned int i = 0;
cl_int status;
- size_t *binarySizes, numDevices;
+ size_t *binarySizes;
+ cl_uint numDevices;
cl_device_id *mpArryDevsID;
char **binaries, *str = NULL;
@@ -426,7 +427,7 @@ int OpenclDevice::CompileKernelFile(GPUEnv *gpuInfo, const char *buildOption) {
const char *source;
size_t source_size[1];
int b_error, binary_status, binaryExisted, idx;
- size_t numDevices;
+ cl_uint numDevices;
cl_device_id *mpArryDevsID;
FILE *fd, *fd1;
const char* filename = "kernel.cl";
More information about the Libreoffice-commits
mailing list