Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
opencl
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mastersthesis-philipp
opencl
Commits
5752ac88
Commit
5752ac88
authored
Feb 28, 2017
by
Philipp Adolf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable creating and releasing kernels
parent
d23f7968
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
1 deletion
+44
-1
README.md
README.md
+1
-1
kernel.go
kernel.go
+39
-0
program.go
program.go
+4
-0
No files found.
README.md
View file @
5752ac88
...
...
@@ -31,7 +31,7 @@ It is mainly developed and tested on Linux and with Intel and Nvidia GPUs. It sh
-
[
]
unloading the compiler
-
[
]
querying program (build) info
-
[
]
kernel objects
-
[
]
creating and releasing kernels
-
[
x
]
creating and releasing kernels
-
[
]
setting arguments
-
[
]
querying kernel, work group and argument info
-
[
]
executing kernels
...
...
kernel.go
0 → 100644
View file @
5752ac88
package
opencl
/*
#ifdef __APPLE__
#include <OpenCL/opencl.h>
#else
#include <CL/cl.h>
#endif
#include <stdlib.h>
*/
import
"C"
import
(
"fmt"
"unsafe"
)
type
Kernel
struct
{
kernel
C
.
cl_kernel
}
func
createKernel
(
program
Program
,
name
string
)
(
*
Kernel
,
error
)
{
clName
:=
C
.
CString
(
name
)
defer
C
.
free
(
unsafe
.
Pointer
(
clName
))
var
err
C
.
cl_int
kernel
:=
C
.
clCreateKernel
(
program
.
program
,
clName
,
&
err
)
if
err
!=
C
.
CL_SUCCESS
{
return
nil
,
fmt
.
Errorf
(
"failed to create kernel: %d"
,
err
)
}
return
&
Kernel
{
kernel
},
nil
}
func
(
k
Kernel
)
Release
()
error
{
err
:=
C
.
clReleaseKernel
(
k
.
kernel
)
if
err
!=
C
.
CL_SUCCESS
{
return
fmt
.
Errorf
(
"failed to release kernel: %d"
,
err
)
}
return
nil
}
program.go
View file @
5752ac88
...
...
@@ -56,3 +56,7 @@ func (p Program) BuildLog(device Device) (string, error) {
return
C
.
GoString
(
&
result
[
0
]),
nil
}
func
(
p
Program
)
CreateKernel
(
name
string
)
(
*
Kernel
,
error
)
{
return
createKernel
(
p
,
name
)
}
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