Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
solverstack
ScalFMM
Commits
18c35280
Commit
18c35280
authored
Feb 25, 2015
by
BRAMAS Berenger
Browse files
Choose another way to parametrize the opencl source file
parent
090158ca
Changes
3
Hide whitespace changes
Inline
Side-by-side
Src/GroupTree/FGroupTaskStarpuAlgorithm.hpp
View file @
18c35280
...
...
@@ -43,7 +43,7 @@ template <class OctreeClass, class CellContainerClass, class CellClass, class Ke
class
CudaKernelClass
=
FCudaEmptyKernel
<>
#endif
#ifdef ScalFMM_ENABLE_OPENCL_KERNEL
,
class
OpenCLDeviceWrapperClass
=
FOpenCLDeviceWrapper
<
KernelClass
,
nullptr
>
,
class
OpenCLDeviceWrapperClass
=
FOpenCLDeviceWrapper
<
KernelClass
>
#endif
>
class
FGroupTaskStarPUAlgorithm
{
...
...
Src/GroupTree/OpenCl/FOpenCLDeviceWrapper.hpp
View file @
18c35280
...
...
@@ -16,7 +16,13 @@
#include
<starpu.h>
template
<
class
OriginalKernelClass
,
const
char
*
KernelFilename
>
struct
FEmptyOpenCLFilename
{
operator
const
char
*
(){
return
nullptr
;
}
};
template
<
class
OriginalKernelClass
,
class
KernelFilenameClass
=
FEmptyOpenCLFilename
>
class
FOpenCLDeviceWrapper
{
protected:
static
void
SetKernelArgs
(
cl_kernel
&
kernel
,
const
int
pos
){
...
...
@@ -69,10 +75,12 @@ public:
workerId
=
starpu_worker_get_id
();
workerDevid
=
starpu_worker_get_devid
(
workerId
);
if
(
KernelFilename
){
KernelFilenameClass
kernelFilename
;
const
char
*
filename
=
kernelFilename
;
if
(
filename
){
starpu_opencl_get_context
(
workerDevid
,
&
context
);
const
int
err
=
starpu_opencl_load_opencl_from_file
(
KernelF
ilename
,
&
opencl_code
,
NULL
);
const
int
err
=
starpu_opencl_load_opencl_from_file
(
f
ilename
,
&
opencl_code
,
NULL
);
if
(
err
!=
CL_SUCCESS
)
STARPU_OPENCL_REPORT_ERROR
(
err
);
FAssertLF
(
starpu_opencl_load_kernel
(
&
kernel_bottomPassPerform
,
&
queue_bottomPassPerform
,
&
opencl_code
,
"bottomPassPerform"
,
workerDevid
)
==
CL_SUCCESS
);
...
...
@@ -97,7 +105,9 @@ public:
virtual
~
FOpenCLDeviceWrapper
(){
// Release
releaseKernel
();
if
(
KernelFilename
){
KernelFilenameClass
kernelFilename
;
const
char
*
filename
=
kernelFilename
;
if
(
filename
){
const
int
err
=
starpu_opencl_unload_opencl
(
&
opencl_code
);
if
(
err
!=
CL_SUCCESS
)
STARPU_OPENCL_REPORT_ERROR
(
err
);
}
...
...
Tests/noDist/testBlockedWithOpenCLAlgorithm.cpp
View file @
18c35280
...
...
@@ -47,6 +47,13 @@ int main(int argc, char* argv[]){
FParameterDefinitions
::
OctreeHeight
,
FParameterDefinitions
::
NbThreads
,
FParameterDefinitions
::
NbParticles
,
LocalOptionBlocSize
);
// Initialize the types
struct
OpenCLSource
{
operator
const
char
*
(){
return
"../../Src/GroupTree/OpenCl/FEmptyKernel.cl"
;
}
};
typedef
FTestCell
GroupCellClass
;
typedef
FGroupTestParticleContainer
GroupContainerClass
;
typedef
FGroupTree
<
GroupCellClass
,
GroupContainerClass
,
2
,
long
long
int
>
GroupOctreeClass
;
...
...
@@ -55,7 +62,7 @@ int main(int argc, char* argv[]){
#ifdef ScalFMM_ENABLE_CUDA_KERNEL
,
FCudaGroupOfCells
<
0
>
,
FCudaGroupOfParticles
<
0
,
int
>
,
FCudaGroupAttachedLeaf
<
0
,
int
>
,
FCudaEmptyKernel
<>
#endif
,
FOpenCLDeviceWrapper
<
GroupKernelClass
,
nullptr
>
,
FOpenCLDeviceWrapper
<
GroupKernelClass
,
OpenCLSource
>
>
GroupAlgorithm
;
typedef
FTestCell
CellClass
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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