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
73372c6d
Commit
73372c6d
authored
Feb 26, 2017
by
Philipp Adolf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Format autogenerated code
parent
1c5d3401
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
26 deletions
+26
-26
deviceinfo.go
deviceinfo.go
+0
-0
infogen.go
infogen.go
+2
-1
platforminfo.go
platforminfo.go
+24
-25
No files found.
deviceinfo.go
View file @
73372c6d
This diff is collapsed.
Click to expand it.
infogen.go
View file @
73372c6d
...
...
@@ -12,6 +12,7 @@ package main
import
"C"
import
(
"bytes"
"go/format"
"io/ioutil"
"log"
"os"
...
...
@@ -116,7 +117,7 @@ func generate(tmpl *template.Template, data interface{}) ([]byte, error) {
return
nil
,
err
}
return
buf
.
Bytes
(),
nil
return
format
.
Source
(
buf
.
Bytes
())
}
func
writeBytes
(
filename
string
,
data
[]
byte
)
error
{
...
...
platforminfo.go
View file @
73372c6d
...
...
@@ -12,51 +12,50 @@ package opencl
*/
import
"C"
import
(
"fmt"
"strings"
"unsafe"
"fmt"
"strings"
"unsafe"
)
func
(
p
Platform
)
getInfoString
(
name
string
,
id
C
.
cl_platform_info
)
(
string
,
error
)
{
var
n
C
.
size_t
if
err
:=
C
.
clGetPlatformInfo
(
p
.
id
,
id
,
0
,
nil
,
&
n
);
err
!=
C
.
CL_SUCCESS
{
return
""
,
fmt
.
Errorf
(
"error getting length of platform info %s: %d"
,
name
,
err
)
}
var
n
C
.
size_t
if
err
:=
C
.
clGetPlatformInfo
(
p
.
id
,
id
,
0
,
nil
,
&
n
);
err
!=
C
.
CL_SUCCESS
{
return
""
,
fmt
.
Errorf
(
"error getting length of platform info %s: %d"
,
name
,
err
)
}
buf
:=
make
([]
C
.
char
,
n
)
if
err
:=
C
.
clGetPlatformInfo
(
p
.
id
,
id
,
n
,
unsafe
.
Pointer
(
&
buf
[
0
]),
nil
);
err
!=
C
.
CL_SUCCESS
{
return
""
,
fmt
.
Errorf
(
"error getting platform info %s: %d"
,
name
,
err
)
}
buf
:=
make
([]
C
.
char
,
n
)
if
err
:=
C
.
clGetPlatformInfo
(
p
.
id
,
id
,
n
,
unsafe
.
Pointer
(
&
buf
[
0
]),
nil
);
err
!=
C
.
CL_SUCCESS
{
return
""
,
fmt
.
Errorf
(
"error getting platform info %s: %d"
,
name
,
err
)
}
return
C
.
GoString
(
&
buf
[
0
]),
nil
return
C
.
GoString
(
&
buf
[
0
]),
nil
}
func
(
p
Platform
)
dummyUseStrings
()
([]
string
)
{
// a dummy function so that strings is not unused even if template space-delim is not used
return
strings
.
Split
(
""
,
""
)
func
(
p
Platform
)
dummyUseStrings
()
[]
string
{
// a dummy function so that strings is not unused even if template space-delim is not used
return
strings
.
Split
(
""
,
""
)
}
func
(
p
Platform
)
Profile
()
(
string
,
error
)
{
return
p
.
getInfoString
(
"Profile"
,
C
.
CL_PLATFORM_PROFILE
)
return
p
.
getInfoString
(
"Profile"
,
C
.
CL_PLATFORM_PROFILE
)
}
func
(
p
Platform
)
Version
()
(
string
,
error
)
{
return
p
.
getInfoString
(
"Version"
,
C
.
CL_PLATFORM_VERSION
)
return
p
.
getInfoString
(
"Version"
,
C
.
CL_PLATFORM_VERSION
)
}
func
(
p
Platform
)
Name
()
(
string
,
error
)
{
return
p
.
getInfoString
(
"Name"
,
C
.
CL_PLATFORM_NAME
)
return
p
.
getInfoString
(
"Name"
,
C
.
CL_PLATFORM_NAME
)
}
func
(
p
Platform
)
Vendor
()
(
string
,
error
)
{
return
p
.
getInfoString
(
"Vendor"
,
C
.
CL_PLATFORM_VENDOR
)
return
p
.
getInfoString
(
"Vendor"
,
C
.
CL_PLATFORM_VENDOR
)
}
func
(
p
Platform
)
Extension
()
([]
string
,
error
)
{
str
,
err
:=
p
.
getInfoString
(
"Extension"
,
C
.
CL_PLATFORM_EXTENSIONS
)
if
err
!=
nil
{
return
nil
,
err
}
return
strings
.
Split
(
str
,
" "
),
nil
str
,
err
:=
p
.
getInfoString
(
"Extension"
,
C
.
CL_PLATFORM_EXTENSIONS
)
if
err
!=
nil
{
return
nil
,
err
}
return
strings
.
Split
(
str
,
" "
),
nil
}
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