Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
645e09ff
Kaydet (Commit)
645e09ff
authored
Eyl 10, 2013
tarafından
Kohei Yoshida
Kaydeden (comit)
Markus Mohrhard
Eyl 19, 2013
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Put all opencl related code inside sc::opencl namespace.
Change-Id: Ia6c1fd88ed08022347c60af33a8620b9cf278c12
üst
6db34b6b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
75 additions
and
69 deletions
+75
-69
formulagroupcl.cxx
sc/source/core/opencl/formulagroupcl.cxx
+5
-9
oclkernels.hxx
sc/source/core/opencl/oclkernels.hxx
+5
-0
openclwrapper.cxx
sc/source/core/opencl/openclwrapper.cxx
+23
-16
openclwrapper.hxx
sc/source/core/opencl/openclwrapper.hxx
+41
-43
formulagroup.cxx
sc/source/core/tool/formulagroup.cxx
+1
-1
No files found.
sc/source/core/opencl/formulagroupcl.cxx
Dosyayı görüntüle @
645e09ff
...
@@ -7,7 +7,6 @@
...
@@ -7,7 +7,6 @@
* 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"
...
@@ -23,12 +22,11 @@
...
@@ -23,12 +22,11 @@
#define SINGLEARRAYLEN 100
#define SINGLEARRAYLEN 100
#define DOUBLEARRAYLEN 100
#define DOUBLEARRAYLEN 100
#define SVDOUBLELEN 100
#define SVDOUBLELEN 100
namespace
sc
{
namespace
sc
{
namespace
opencl
{
// A single public entry point for a factory function:
// A single public entry point for a factory function:
namespace
opencl
{
extern
sc
::
FormulaGroupInterpreter
*
createFormulaGroupInterpreter
();
extern
sc
::
FormulaGroupInterpreter
*
createFormulaGroupInterpreter
();
}
/////time test dbg
/////time test dbg
double
getTimeDiff
(
const
TimeValue
&
t1
,
const
TimeValue
&
t2
)
double
getTimeDiff
(
const
TimeValue
&
t1
,
const
TimeValue
&
t2
)
...
@@ -1063,17 +1061,15 @@ bool FormulaGroupInterpreterGroundwater::interpret(ScDocument& rDoc, const ScAdd
...
@@ -1063,17 +1061,15 @@ bool FormulaGroupInterpreterGroundwater::interpret(ScDocument& rDoc, const ScAdd
return
true
;
return
true
;
}
}
namespace
opencl
{
sc
::
FormulaGroupInterpreter
*
createFormulaGroupInterpreter
()
sc
::
FormulaGroupInterpreter
*
createFormulaGroupInterpreter
()
{
{
if
(
getenv
(
"SC_SOFTWARE"
))
if
(
getenv
(
"SC_SOFTWARE"
))
return
NULL
;
return
NULL
;
if
(
getenv
(
"SC_GROUNDWATER"
))
if
(
getenv
(
"SC_GROUNDWATER"
))
return
new
sc
::
FormulaGroupInterpreterGroundwater
();
return
new
FormulaGroupInterpreterGroundwater
();
return
new
sc
::
FormulaGroupInterpreterOpenCL
();
return
new
FormulaGroupInterpreterOpenCL
();
}
}
}
// namespace opencl
}
// namespace opencl
...
...
sc/source/core/opencl/oclkernels.hxx
Dosyayı görüntüle @
645e09ff
...
@@ -12,6 +12,9 @@
...
@@ -12,6 +12,9 @@
#ifndef USE_EXTERNAL_KERNEL
#ifndef USE_EXTERNAL_KERNEL
#define KERNEL( ... )# __VA_ARGS__
#define KERNEL( ... )# __VA_ARGS__
namespace
sc
{
namespace
opencl
{
// Double precision is a default of spreadsheets
// Double precision is a default of spreadsheets
// cl_khr_fp64: Khronos extension
// cl_khr_fp64: Khronos extension
// cl_amd_fp64: AMD extension
// cl_amd_fp64: AMD extension
...
@@ -380,6 +383,8 @@ __kernel void oclSub( fp_t ltData, __global fp_t *rtData, __global fp_t *outData
...
@@ -380,6 +383,8 @@ __kernel void oclSub( fp_t ltData, __global fp_t *rtData, __global fp_t *outData
}
}
);
);
}}
#endif // USE_EXTERNAL_KERNEL
#endif // USE_EXTERNAL_KERNEL
#endif //_OCL_KERNEL_H_
#endif //_OCL_KERNEL_H_
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sc/source/core/opencl/openclwrapper.cxx
Dosyayı görüntüle @
645e09ff
...
@@ -7,24 +7,19 @@
...
@@ -7,24 +7,19 @@
* 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 <stdio.h>
#include "openclwrapper.hxx"
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include "sal/config.h"
#include "sal/config.h"
#include "random.hxx"
#include "random.hxx"
#include "openclwrapper.hxx"
#include "oclkernels.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 OPENCL_DLL_NAME "opencllo.dll"
#define OCLERR -1
#define OCLERR -1
...
@@ -40,6 +35,16 @@ int OpenclDevice::isInited =0;
...
@@ -40,6 +35,16 @@ int OpenclDevice::isInited =0;
#define OCL_CHECK(value1,value2,str) \
#define OCL_CHECK(value1,value2,str) \
if(value1!=value2) \
if(value1!=value2) \
fprintf(stderr,"[OCL_ERROR] %s\n",str);
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
;
HINSTANCE
HOpenclDll
=
NULL
;
void
*
OpenclDll
=
NULL
;
void
*
OpenclDll
=
NULL
;
...
@@ -69,7 +74,7 @@ void OpenclDevice::freeOpenclDll()
...
@@ -69,7 +74,7 @@ void OpenclDevice::freeOpenclDll()
int
OpenclDevice
::
initEnv
()
int
OpenclDevice
::
initEnv
()
{
{
#ifdef
SAL_
WIN32
#ifdef WIN32
while
(
1
)
while
(
1
)
{
{
if
(
1
==
loadOpencl
()
)
if
(
1
==
loadOpencl
()
)
...
@@ -83,14 +88,14 @@ int OpenclDevice::initEnv()
...
@@ -83,14 +88,14 @@ int OpenclDevice::initEnv()
int
OpenclDevice
::
releaseOpenclRunEnv
()
int
OpenclDevice
::
releaseOpenclRunEnv
()
{
{
releaseOpenclEnv
(
&
gpuEnv
);
releaseOpenclEnv
(
&
gpuEnv
);
#ifdef
SAL_
WIN32
#ifdef WIN32
freeOpenclDll
();
freeOpenclDll
();
#endif
#endif
return
1
;
return
1
;
}
}
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
in
line
in
t
OpenclDevice
::
addKernelConfig
(
int
kCount
,
const
char
*
kName
)
int
OpenclDevice
::
addKernelConfig
(
int
kCount
,
const
char
*
kName
)
{
{
if
(
kCount
<
1
)
if
(
kCount
<
1
)
fprintf
(
stderr
,
"Error: ( KCount < 1 )"
SAL_DETAIL_WHERE
"addKernelConfig
\n
"
);
fprintf
(
stderr
,
"Error: ( KCount < 1 )"
SAL_DETAIL_WHERE
"addKernelConfig
\n
"
);
...
@@ -2660,4 +2665,6 @@ int OclCalc::oclHostMatrixInverse32Bits( const char* aKernelName, float *fpOclMa
...
@@ -2660,4 +2665,6 @@ int OclCalc::oclHostMatrixInverse32Bits( const char* aKernelName, float *fpOclMa
return
0
;
return
0
;
}
}
}}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sc/source/core/opencl/openclwrapper.hxx
Dosyayı görüntüle @
645e09ff
...
@@ -39,6 +39,32 @@
...
@@ -39,6 +39,32 @@
#define CL_QUEUE_THREAD_HANDLE_AMD 0x403E
#define CL_QUEUE_THREAD_HANDLE_AMD 0x403E
#define CL_MAP_WRITE_INVALIDATE_REGION (1 << 2)
#define CL_MAP_WRITE_INVALIDATE_REGION (1 << 2)
#define CHECK_OPENCL(status,name) \
if( status != CL_SUCCESS ) \
{ \
printf ("OpenCL error code is %d at " SAL_DETAIL_WHERE " when %s .\n", status, name); \
return 0; \
}
#define CHECK_OPENCL_VOID(status,name) \
if( status != CL_SUCCESS ) \
{ \
printf ("OpenCL error code is %d at " SAL_DETAIL_WHERE " when %s .\n", status, name); \
}
#define CHECK_OPENCL_RELEASE(status,name) \
if ( name != NULL ) \
clReleaseMemObject( name ); \
if( status != CL_SUCCESS ) \
{ \
printf ("OpenCL error code is %d at " SAL_DETAIL_WHERE " when clReleaseMemObject( %s ).\n", status, #name); \
}
#define MAX_KERNEL_STRING_LEN 64
#define MAX_CLFILE_NUM 50
#define MAX_CLKERNEL_NUM 200
#define MAX_KERNEL_NAME_LEN 64
#if defined(_MSC_VER)
#if defined(_MSC_VER)
#ifndef strcasecmp
#ifndef strcasecmp
#define strcasecmp strcmp
#define strcasecmp strcmp
...
@@ -48,8 +74,6 @@
...
@@ -48,8 +74,6 @@
#include <cstdio>
#include <cstdio>
#include <vector>
#include <vector>
typedef
unsigned
int
uint
;
typedef
struct
_KernelEnv
typedef
struct
_KernelEnv
{
{
cl_context
mpkContext
;
cl_context
mpkContext
;
...
@@ -59,52 +83,25 @@ typedef struct _KernelEnv
...
@@ -59,52 +83,25 @@ typedef struct _KernelEnv
char
mckKernelName
[
150
];
char
mckKernelName
[
150
];
}
KernelEnv
;
}
KernelEnv
;
typedef
struct
_OpenCLEnv
{
cl_platform_id
mpOclPlatformID
;
cl_context
mpOclContext
;
cl_device_id
mpOclDevsID
;
cl_command_queue
mpOclCmdQueue
;
}
OpenCLEnv
;
#if defined __cplusplus
extern
"C"
{
extern
"C"
{
#endif
//
user defined, this is function wrapper which is used to set the input parameters,
//
user defined, this is function wrapper which is used to set the input
//
lua
nch kernel and copy data from GPU to CPU or CPU to GPU.
//
parameters, lau
nch kernel and copy data from GPU to CPU or CPU to GPU.
typedef
int
(
*
cl_kernel_function
)(
void
**
userdata
,
KernelEnv
*
kenv
);
typedef
int
(
*
cl_kernel_function
)(
void
**
userdata
,
KernelEnv
*
kenv
);
#if defined __cplusplus
}
#endif
#define CHECK_OPENCL(status,name) \
if( status != CL_SUCCESS ) \
{ \
printf ("OpenCL error code is %d at " SAL_DETAIL_WHERE " when %s .\n", status, name); \
return 0; \
}
}
#define CHECK_OPENCL_VOID(status,name) \
namespace
sc
{
namespace
opencl
{
if( status != CL_SUCCESS ) \
{ \
printf ("OpenCL error code is %d at " SAL_DETAIL_WHERE " when %s .\n", status, name); \
}
#define CHECK_OPENCL_RELEASE(status,name) \
typedef
unsigned
int
uint
;
if ( name != NULL ) \
clReleaseMemObject( name ); \
if( status != CL_SUCCESS ) \
{ \
printf ("OpenCL error code is %d at " SAL_DETAIL_WHERE " when clReleaseMemObject( %s ).\n", status, #name); \
}
#define MAX_KERNEL_STRING_LEN 64
typedef
struct
_OpenCLEnv
#define MAX_CLFILE_NUM 50
{
#define MAX_CLKERNEL_NUM 200
cl_platform_id
mpOclPlatformID
;
#define MAX_KERNEL_NAME_LEN 64
cl_context
mpOclContext
;
cl_device_id
mpOclDevsID
;
cl_command_queue
mpOclCmdQueue
;
}
OpenCLEnv
;
typedef
struct
_GPUEnv
typedef
struct
_GPUEnv
{
{
...
@@ -214,14 +211,12 @@ public:
...
@@ -214,14 +211,12 @@ public:
#ifdef WIN32
#ifdef WIN32
static
int
loadOpencl
();
static
int
loadOpencl
();
static
int
openclInite
();
static
void
freeOpenclDll
();
static
void
freeOpenclDll
();
#endif
#endif
int
getOpenclState
();
int
getOpenclState
();
void
setOpenclState
(
int
state
);
void
setOpenclState
(
int
state
);
inline
static
int
addKernelConfig
(
int
kCount
,
const
char
*
kName
);
static
int
addKernelConfig
(
int
kCount
,
const
char
*
kName
);
};
};
class
OclCalc
:
public
OpenclDevice
,
OpenclCalcBase
class
OclCalc
:
public
OpenclDevice
,
OpenclCalcBase
...
@@ -293,5 +288,8 @@ public:
...
@@ -293,5 +288,8 @@ public:
friend
class
agency
;
friend
class
agency
;
};
};
}}
#endif
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sc/source/core/tool/formulagroup.cxx
Dosyayı görüntüle @
645e09ff
...
@@ -7,7 +7,6 @@
...
@@ -7,7 +7,6 @@
* 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"
...
@@ -17,6 +16,7 @@
...
@@ -17,6 +16,7 @@
#include "scmatrix.hxx"
#include "scmatrix.hxx"
#include "formula/vectortoken.hxx"
#include "formula/vectortoken.hxx"
#include "config_features.h"
#include <vector>
#include <vector>
#include <boost/unordered_map.hpp>
#include <boost/unordered_map.hpp>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment