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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
166 additions
and
178 deletions
+166
-178
deviceinfo.go
deviceinfo.go
+140
-152
infogen.go
infogen.go
+2
-1
platforminfo.go
platforminfo.go
+24
-25
No files found.
deviceinfo.go
View file @
73372c6d
...
@@ -12,383 +12,371 @@ package opencl
...
@@ -12,383 +12,371 @@ package opencl
*/
*/
import
"C"
import
"C"
import
(
import
(
"fmt"
"fmt"
"strings"
"strings"
"unsafe"
"unsafe"
)
)
func
(
d
Device
)
getInfoType
(
name
string
,
id
C
.
cl_device_info
)
(
DeviceType
,
error
)
{
func
(
d
Device
)
getInfoType
(
name
string
,
id
C
.
cl_device_info
)
(
DeviceType
,
error
)
{
var
buf
C
.
cl_device_type
var
buf
C
.
cl_device_type
if
err
:=
C
.
clGetDeviceInfo
(
d
.
id
,
id
,
C
.
size_t
(
unsafe
.
Sizeof
(
buf
)),
unsafe
.
Pointer
(
&
buf
),
nil
);
err
!=
C
.
CL_SUCCESS
{
if
err
:=
C
.
clGetDeviceInfo
(
d
.
id
,
id
,
C
.
size_t
(
unsafe
.
Sizeof
(
buf
)),
unsafe
.
Pointer
(
&
buf
),
nil
);
err
!=
C
.
CL_SUCCESS
{
return
0
,
fmt
.
Errorf
(
"error getting device info %s: %d"
,
name
,
err
)
return
0
,
fmt
.
Errorf
(
"error getting device info %s: %d"
,
name
,
err
)
}
}
return
DeviceType
(
buf
),
nil
return
DeviceType
(
buf
),
nil
}
}
func
(
d
Device
)
getInfoBool
(
name
string
,
id
C
.
cl_device_info
)
(
bool
,
error
)
{
func
(
d
Device
)
getInfoBool
(
name
string
,
id
C
.
cl_device_info
)
(
bool
,
error
)
{
var
buf
C
.
cl_bool
var
buf
C
.
cl_bool
if
err
:=
C
.
clGetDeviceInfo
(
d
.
id
,
id
,
C
.
size_t
(
unsafe
.
Sizeof
(
buf
)),
unsafe
.
Pointer
(
&
buf
),
nil
);
err
!=
C
.
CL_SUCCESS
{
if
err
:=
C
.
clGetDeviceInfo
(
d
.
id
,
id
,
C
.
size_t
(
unsafe
.
Sizeof
(
buf
)),
unsafe
.
Pointer
(
&
buf
),
nil
);
err
!=
C
.
CL_SUCCESS
{
return
false
,
fmt
.
Errorf
(
"error getting device info %s: %d"
,
name
,
err
)
return
false
,
fmt
.
Errorf
(
"error getting device info %s: %d"
,
name
,
err
)
}
}
return
buf
==
C
.
CL_TRUE
,
nil
return
buf
==
C
.
CL_TRUE
,
nil
}
}
func
(
d
Device
)
getInfoUint
(
name
string
,
id
C
.
cl_device_info
)
(
uint
,
error
)
{
func
(
d
Device
)
getInfoUint
(
name
string
,
id
C
.
cl_device_info
)
(
uint
,
error
)
{
var
buf
C
.
cl_uint
var
buf
C
.
cl_uint
if
err
:=
C
.
clGetDeviceInfo
(
d
.
id
,
id
,
C
.
size_t
(
unsafe
.
Sizeof
(
buf
)),
unsafe
.
Pointer
(
&
buf
),
nil
);
err
!=
C
.
CL_SUCCESS
{
if
err
:=
C
.
clGetDeviceInfo
(
d
.
id
,
id
,
C
.
size_t
(
unsafe
.
Sizeof
(
buf
)),
unsafe
.
Pointer
(
&
buf
),
nil
);
err
!=
C
.
CL_SUCCESS
{
return
0
,
fmt
.
Errorf
(
"error getting device info %s: %d"
,
name
,
err
)
return
0
,
fmt
.
Errorf
(
"error getting device info %s: %d"
,
name
,
err
)
}
}
return
uint
(
buf
),
nil
return
uint
(
buf
),
nil
}
}
func
(
d
Device
)
getInfoUlong
(
name
string
,
id
C
.
cl_device_info
)
(
uint64
,
error
)
{
func
(
d
Device
)
getInfoUlong
(
name
string
,
id
C
.
cl_device_info
)
(
uint64
,
error
)
{
var
buf
C
.
cl_long
var
buf
C
.
cl_long
if
err
:=
C
.
clGetDeviceInfo
(
d
.
id
,
id
,
C
.
size_t
(
unsafe
.
Sizeof
(
buf
)),
unsafe
.
Pointer
(
&
buf
),
nil
);
err
!=
C
.
CL_SUCCESS
{
if
err
:=
C
.
clGetDeviceInfo
(
d
.
id
,
id
,
C
.
size_t
(
unsafe
.
Sizeof
(
buf
)),
unsafe
.
Pointer
(
&
buf
),
nil
);
err
!=
C
.
CL_SUCCESS
{
return
0
,
fmt
.
Errorf
(
"error getting device info %s: %d"
,
name
,
err
)
return
0
,
fmt
.
Errorf
(
"error getting device info %s: %d"
,
name
,
err
)
}
}
return
uint64
(
buf
),
nil
return
uint64
(
buf
),
nil
}
}
func
(
d
Device
)
getInfoSize
(
name
string
,
id
C
.
cl_device_info
)
(
uintptr
,
error
)
{
func
(
d
Device
)
getInfoSize
(
name
string
,
id
C
.
cl_device_info
)
(
uintptr
,
error
)
{
var
buf
C
.
size_t
var
buf
C
.
size_t
if
err
:=
C
.
clGetDeviceInfo
(
d
.
id
,
id
,
C
.
size_t
(
unsafe
.
Sizeof
(
buf
)),
unsafe
.
Pointer
(
&
buf
),
nil
);
err
!=
C
.
CL_SUCCESS
{
if
err
:=
C
.
clGetDeviceInfo
(
d
.
id
,
id
,
C
.
size_t
(
unsafe
.
Sizeof
(
buf
)),
unsafe
.
Pointer
(
&
buf
),
nil
);
err
!=
C
.
CL_SUCCESS
{
return
0
,
fmt
.
Errorf
(
"error getting device info %s: %d"
,
name
,
err
)
return
0
,
fmt
.
Errorf
(
"error getting device info %s: %d"
,
name
,
err
)
}
}
return
uintptr
(
buf
),
nil
return
uintptr
(
buf
),
nil
}
}
func
(
d
Device
)
getInfoSizeArray
(
name
string
,
id
C
.
cl_device_info
)
([]
uintptr
,
error
)
{
func
(
d
Device
)
getInfoSizeArray
(
name
string
,
id
C
.
cl_device_info
)
([]
uintptr
,
error
)
{
var
bytes
C
.
size_t
var
bytes
C
.
size_t
if
err
:=
C
.
clGetDeviceInfo
(
d
.
id
,
id
,
0
,
nil
,
&
bytes
);
err
!=
C
.
CL_SUCCESS
{
if
err
:=
C
.
clGetDeviceInfo
(
d
.
id
,
id
,
0
,
nil
,
&
bytes
);
err
!=
C
.
CL_SUCCESS
{
return
nil
,
fmt
.
Errorf
(
"error getting length of device info %s: %d"
,
name
,
err
)
return
nil
,
fmt
.
Errorf
(
"error getting length of device info %s: %d"
,
name
,
err
)
}
}
n
:=
bytes
/
C
.
size_t
(
unsafe
.
Sizeof
(
C
.
size_t
(
0
)))
n
:=
bytes
/
C
.
size_t
(
unsafe
.
Sizeof
(
C
.
size_t
(
0
)))
bytes
=
n
*
C
.
size_t
(
unsafe
.
Sizeof
(
C
.
size_t
(
0
)))
bytes
=
n
*
C
.
size_t
(
unsafe
.
Sizeof
(
C
.
size_t
(
0
)))
buf
:=
make
([]
C
.
size_t
,
n
)
buf
:=
make
([]
C
.
size_t
,
n
)
if
err
:=
C
.
clGetDeviceInfo
(
d
.
id
,
id
,
bytes
,
unsafe
.
Pointer
(
&
buf
[
0
]),
nil
);
err
!=
C
.
CL_SUCCESS
{
if
err
:=
C
.
clGetDeviceInfo
(
d
.
id
,
id
,
bytes
,
unsafe
.
Pointer
(
&
buf
[
0
]),
nil
);
err
!=
C
.
CL_SUCCESS
{
return
nil
,
fmt
.
Errorf
(
"error getting device info %s: %d"
,
name
,
err
)
return
nil
,
fmt
.
Errorf
(
"error getting device info %s: %d"
,
name
,
err
)
}
}
result
:=
make
([]
uintptr
,
n
)
result
:=
make
([]
uintptr
,
n
)
for
i
,
v
:=
range
buf
{
for
i
,
v
:=
range
buf
{
result
[
i
]
=
uintptr
(
v
)
result
[
i
]
=
uintptr
(
v
)
}
}
return
result
,
nil
return
result
,
nil
}
}
func
(
d
Device
)
getInfoString
(
name
string
,
id
C
.
cl_device_info
)
(
string
,
error
)
{
func
(
d
Device
)
getInfoString
(
name
string
,
id
C
.
cl_device_info
)
(
string
,
error
)
{
var
n
C
.
size_t
var
n
C
.
size_t
if
err
:=
C
.
clGetDeviceInfo
(
d
.
id
,
id
,
0
,
nil
,
&
n
);
err
!=
C
.
CL_SUCCESS
{
if
err
:=
C
.
clGetDeviceInfo
(
d
.
id
,
id
,
0
,
nil
,
&
n
);
err
!=
C
.
CL_SUCCESS
{
return
""
,
fmt
.
Errorf
(
"error getting length of device info %s: %d"
,
name
,
err
)
return
""
,
fmt
.
Errorf
(
"error getting length of device info %s: %d"
,
name
,
err
)
}
}
buf
:=
make
([]
C
.
char
,
n
)
buf
:=
make
([]
C
.
char
,
n
)
if
err
:=
C
.
clGetDeviceInfo
(
d
.
id
,
id
,
n
,
unsafe
.
Pointer
(
&
buf
[
0
]),
nil
);
err
!=
C
.
CL_SUCCESS
{
if
err
:=
C
.
clGetDeviceInfo
(
d
.
id
,
id
,
n
,
unsafe
.
Pointer
(
&
buf
[
0
]),
nil
);
err
!=
C
.
CL_SUCCESS
{
return
""
,
fmt
.
Errorf
(
"error getting device info %s: %d"
,
name
,
err
)
return
""
,
fmt
.
Errorf
(
"error getting device info %s: %d"
,
name
,
err
)
}
}
return
C
.
GoString
(
&
buf
[
0
]),
nil
return
C
.
GoString
(
&
buf
[
0
]),
nil
}
}
func
(
d
Device
)
getInfoFPConfig
(
name
string
,
id
C
.
cl_device_info
)
(
FPConfig
,
error
)
{
func
(
d
Device
)
getInfoFPConfig
(
name
string
,
id
C
.
cl_device_info
)
(
FPConfig
,
error
)
{
var
buf
C
.
cl_device_fp_config
var
buf
C
.
cl_device_fp_config
var
result
FPConfig
var
result
FPConfig
if
err
:=
C
.
clGetDeviceInfo
(
d
.
id
,
id
,
C
.
size_t
(
unsafe
.
Sizeof
(
buf
)),
unsafe
.
Pointer
(
&
buf
),
nil
);
err
!=
C
.
CL_SUCCESS
{
if
err
:=
C
.
clGetDeviceInfo
(
d
.
id
,
id
,
C
.
size_t
(
unsafe
.
Sizeof
(
buf
)),
unsafe
.
Pointer
(
&
buf
),
nil
);
err
!=
C
.
CL_SUCCESS
{
return
result
,
fmt
.
Errorf
(
"error getting device info %s: %d"
,
name
,
err
)
return
result
,
fmt
.
Errorf
(
"error getting device info %s: %d"
,
name
,
err
)
}
}
result
.
config
=
buf
result
.
config
=
buf
return
result
,
nil
return
result
,
nil
}
}
func
(
d
Device
)
getInfoMemCacheType
(
name
string
,
id
C
.
cl_device_info
)
(
MemCacheType
,
error
)
{
func
(
d
Device
)
getInfoMemCacheType
(
name
string
,
id
C
.
cl_device_info
)
(
MemCacheType
,
error
)
{
var
buf
C
.
cl_device_mem_cache_type
var
buf
C
.
cl_device_mem_cache_type
if
err
:=
C
.
clGetDeviceInfo
(
d
.
id
,
id
,
C
.
size_t
(
unsafe
.
Sizeof
(
buf
)),
unsafe
.
Pointer
(
&
buf
),
nil
);
err
!=
C
.
CL_SUCCESS
{
if
err
:=
C
.
clGetDeviceInfo
(
d
.
id
,
id
,
C
.
size_t
(
unsafe
.
Sizeof
(
buf
)),
unsafe
.
Pointer
(
&
buf
),
nil
);
err
!=
C
.
CL_SUCCESS
{
return
CacheNone
,
fmt
.
Errorf
(
"error getting device inf %s: %d"
,
name
,
err
)
return
CacheNone
,
fmt
.
Errorf
(
"error getting device inf %s: %d"
,
name
,
err
)
}
}
return
memCacheType
(
buf
)
return
memCacheType
(
buf
)
}
}
func
(
d
Device
)
getInfoLocalMemType
(
name
string
,
id
C
.
cl_device_info
)
(
LocalMemType
,
error
)
{
func
(
d
Device
)
getInfoLocalMemType
(
name
string
,
id
C
.
cl_device_info
)
(
LocalMemType
,
error
)
{
var
buf
C
.
cl_device_local_mem_type
var
buf
C
.
cl_device_local_mem_type
if
err
:=
C
.
clGetDeviceInfo
(
d
.
id
,
id
,
C
.
size_t
(
unsafe
.
Sizeof
(
buf
)),
unsafe
.
Pointer
(
&
buf
),
nil
);
err
!=
C
.
CL_SUCCESS
{
if
err
:=
C
.
clGetDeviceInfo
(
d
.
id
,
id
,
C
.
size_t
(
unsafe
.
Sizeof
(
buf
)),
unsafe
.
Pointer
(
&
buf
),
nil
);
err
!=
C
.
CL_SUCCESS
{
return
LocalMemNone
,
fmt
.
Errorf
(
"error getting device inf %s: %d"
,
name
,
err
)
return
LocalMemNone
,
fmt
.
Errorf
(
"error getting device inf %s: %d"
,
name
,
err
)
}
}
return
localMemType
(
buf
)
return
localMemType
(
buf
)
}
}
func
(
d
Device
)
getInfoQueueProperties
(
name
string
,
id
C
.
cl_device_info
)
(
CommandQueueProperties
,
error
)
{
func
(
d
Device
)
getInfoQueueProperties
(
name
string
,
id
C
.
cl_device_info
)
(
CommandQueueProperties
,
error
)
{
var
buf
C
.
cl_command_queue_properties
var
buf
C
.
cl_command_queue_properties
if
err
:=
C
.
clGetDeviceInfo
(
d
.
id
,
id
,
C
.
size_t
(
unsafe
.
Sizeof
(
buf
)),
unsafe
.
Pointer
(
&
buf
),
nil
);
err
!=
C
.
CL_SUCCESS
{
if
err
:=
C
.
clGetDeviceInfo
(
d
.
id
,
id
,
C
.
size_t
(
unsafe
.
Sizeof
(
buf
)),
unsafe
.
Pointer
(
&
buf
),
nil
);
err
!=
C
.
CL_SUCCESS
{
return
CommandQueueProperties
{},
fmt
.
Errorf
(
"error getting device inf %s: %d"
,
name
,
err
)
return
CommandQueueProperties
{},
fmt
.
Errorf
(
"error getting device inf %s: %d"
,
name
,
err
)
}
}
return
fromCLProperties
(
buf
),
nil
return
fromCLProperties
(
buf
),
nil
}
}
func
(
d
Device
)
dummyUseStrings
()
([]
string
)
{
func
(
d
Device
)
dummyUseStrings
()
[]
string
{
// a dummy function so that strings is not unused even if template space-delim is not used
// a dummy function so that strings is not unused even if template space-delim is not used
return
strings
.
Split
(
""
,
""
)
return
strings
.
Split
(
""
,
""
)
}
}
func
(
d
Device
)
Type
()
(
DeviceType
,
error
)
{
func
(
d
Device
)
Type
()
(
DeviceType
,
error
)
{
return
d
.
getInfoType
(
"Type"
,
C
.
CL_DEVICE_TYPE
)
return
d
.
getInfoType
(
"Type"
,
C
.
CL_DEVICE_TYPE
)
}
}
func
(
d
Device
)
VendorID
()
(
uint
,
error
)
{
func
(
d
Device
)
VendorID
()
(
uint
,
error
)
{
return
d
.
getInfoUint
(
"VendorID"
,
C
.
CL_DEVICE_VENDOR_ID
)
return
d
.
getInfoUint
(
"VendorID"
,
C
.
CL_DEVICE_VENDOR_ID
)
}
}
func
(
d
Device
)
MaxComputeUnits
()
(
uint
,
error
)
{
func
(
d
Device
)
MaxComputeUnits
()
(
uint
,
error
)
{
return
d
.
getInfoUint
(
"MaxComputeUnits"
,
C
.
CL_DEVICE_MAX_COMPUTE_UNITS
)
return
d
.
getInfoUint
(
"MaxComputeUnits"
,
C
.
CL_DEVICE_MAX_COMPUTE_UNITS
)
}
}
func
(
d
Device
)
MaxWorkItemDimensions
()
(
uint
,
error
)
{
func
(
d
Device
)
MaxWorkItemDimensions
()
(
uint
,
error
)
{
return
d
.
getInfoUint
(
"MaxWorkItemDimensions"
,
C
.
CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS
)
return
d
.
getInfoUint
(
"MaxWorkItemDimensions"
,
C
.
CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS
)
}
}
func
(
d
Device
)
MaxWorkItemSizes
()
([]
uintptr
,
error
)
{
func
(
d
Device
)
MaxWorkItemSizes
()
([]
uintptr
,
error
)
{
return
d
.
getInfoSizeArray
(
"MaxWorkItemSizes"
,
C
.
CL_DEVICE_MAX_WORK_ITEM_SIZES
)
return
d
.
getInfoSizeArray
(
"MaxWorkItemSizes"
,
C
.
CL_DEVICE_MAX_WORK_ITEM_SIZES
)
}
}
func
(
d
Device
)
MaxWorkGroupSize
()
(
uintptr
,
error
)
{
func
(
d
Device
)
MaxWorkGroupSize
()
(
uintptr
,
error
)
{
return
d
.
getInfoSize
(
"MaxWorkGroupSize"
,
C
.
CL_DEVICE_MAX_WORK_GROUP_SIZE
)
return
d
.
getInfoSize
(
"MaxWorkGroupSize"
,
C
.
CL_DEVICE_MAX_WORK_GROUP_SIZE
)
}
}
func
(
d
Device
)
PreferredVectorWidthChar
()
(
uint
,
error
)
{
func
(
d
Device
)
PreferredVectorWidthChar
()
(
uint
,
error
)
{
return
d
.
getInfoUint
(
"PreferredVectorWidthChar"
,
C
.
CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR
)
return
d
.
getInfoUint
(
"PreferredVectorWidthChar"
,
C
.
CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR
)
}
}
func
(
d
Device
)
PreferredVectorWidthShort
()
(
uint
,
error
)
{
func
(
d
Device
)
PreferredVectorWidthShort
()
(
uint
,
error
)
{
return
d
.
getInfoUint
(
"PreferredVectorWidthShort"
,
C
.
CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT
)
return
d
.
getInfoUint
(
"PreferredVectorWidthShort"
,
C
.
CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT
)
}
}
func
(
d
Device
)
PreferredVectorWidthInt
()
(
uint
,
error
)
{
func
(
d
Device
)
PreferredVectorWidthInt
()
(
uint
,
error
)
{
return
d
.
getInfoUint
(
"PreferredVectorWidthInt"
,
C
.
CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT
)
return
d
.
getInfoUint
(
"PreferredVectorWidthInt"
,
C
.
CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT
)
}
}
func
(
d
Device
)
PreferredVectorWidthLong
()
(
uint
,
error
)
{
func
(
d
Device
)
PreferredVectorWidthLong
()
(
uint
,
error
)
{
return
d
.
getInfoUint
(
"PreferredVectorWidthLong"
,
C
.
CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG
)
return
d
.
getInfoUint
(
"PreferredVectorWidthLong"
,
C
.
CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG
)
}
}
func
(
d
Device
)
PreferredVectorWidthFloat
()
(
uint
,
error
)
{
func
(
d
Device
)
PreferredVectorWidthFloat
()
(
uint
,
error
)
{
return
d
.
getInfoUint
(
"PreferredVectorWidthFloat"
,
C
.
CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT
)
return
d
.
getInfoUint
(
"PreferredVectorWidthFloat"
,
C
.
CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT
)
}
}
func
(
d
Device
)
PreferredVectorWidthDouble
()
(
uint
,
error
)
{
func
(
d
Device
)
PreferredVectorWidthDouble
()
(
uint
,
error
)
{
return
d
.
getInfoUint
(
"PreferredVectorWidthDouble"
,
C
.
CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE
)
return
d
.
getInfoUint
(
"PreferredVectorWidthDouble"
,
C
.
CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE
)
}
}
func
(
d
Device
)
PreferredVectorWidthHalf
()
(
uint
,
error
)
{
func
(
d
Device
)
PreferredVectorWidthHalf
()
(
uint
,
error
)
{
return
d
.
getInfoUint
(
"PreferredVectorWidthHalf"
,
C
.
CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF
)
return
d
.
getInfoUint
(
"PreferredVectorWidthHalf"
,
C
.
CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF
)
}
}
func
(
d
Device
)
NativeVectorWidthChar
()
(
uint
,
error
)
{
func
(
d
Device
)
NativeVectorWidthChar
()
(
uint
,
error
)
{
return
d
.
getInfoUint
(
"NativeVectorWidthChar"
,
C
.
CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR
)
return
d
.
getInfoUint
(
"NativeVectorWidthChar"
,
C
.
CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR
)
}
}
func
(
d
Device
)
NativeVectorWidthShort
()
(
uint
,
error
)
{
func
(
d
Device
)
NativeVectorWidthShort
()
(
uint
,
error
)
{
return
d
.
getInfoUint
(
"NativeVectorWidthShort"
,
C
.
CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT
)
return
d
.
getInfoUint
(
"NativeVectorWidthShort"
,
C
.
CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT
)
}
}
func
(
d
Device
)
NativeVectorWidthInt
()
(
uint
,
error
)
{
func
(
d
Device
)
NativeVectorWidthInt
()
(
uint
,
error
)
{
return
d
.
getInfoUint
(
"NativeVectorWidthInt"
,
C
.
CL_DEVICE_NATIVE_VECTOR_WIDTH_INT
)
return
d
.
getInfoUint
(
"NativeVectorWidthInt"
,
C
.
CL_DEVICE_NATIVE_VECTOR_WIDTH_INT
)
}
}
func
(
d
Device
)
NativeVectorWidthLong
()
(
uint
,
error
)
{
func
(
d
Device
)
NativeVectorWidthLong
()
(
uint
,
error
)
{
return
d
.
getInfoUint
(
"NativeVectorWidthLong"
,
C
.
CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG
)
return
d
.
getInfoUint
(
"NativeVectorWidthLong"
,
C
.
CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG
)
}
}
func
(
d
Device
)
NativeVectorWidthFloat
()
(
uint
,
error
)
{
func
(
d
Device
)
NativeVectorWidthFloat
()
(
uint
,
error
)
{
return
d
.
getInfoUint
(
"NativeVectorWidthFloat"
,
C
.
CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT
)
return
d
.
getInfoUint
(
"NativeVectorWidthFloat"
,
C
.
CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT
)
}
}
func
(
d
Device
)
NativeVectorWidthDouble
()
(
uint
,
error
)
{
func
(
d
Device
)
NativeVectorWidthDouble
()
(
uint
,
error
)
{
return
d
.
getInfoUint
(
"NativeVectorWidthDouble"
,
C
.
CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE
)
return
d
.
getInfoUint
(
"NativeVectorWidthDouble"
,
C
.
CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE
)
}
}
func
(
d
Device
)
NativeVectorWidthHalf
()
(
uint
,
error
)
{
func
(
d
Device
)
NativeVectorWidthHalf
()
(
uint
,
error
)
{
return
d
.
getInfoUint
(
"NativeVectorWidthHalf"
,
C
.
CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF
)
return
d
.
getInfoUint
(
"NativeVectorWidthHalf"
,
C
.
CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF
)
}
}
func
(
d
Device
)
MaxClockFrequency
()
(
uint
,
error
)
{
func
(
d
Device
)
MaxClockFrequency
()
(
uint
,
error
)
{
return
d
.
getInfoUint
(
"MaxClockFrequency"
,
C
.
CL_DEVICE_MAX_CLOCK_FREQUENCY
)
return
d
.
getInfoUint
(
"MaxClockFrequency"
,
C
.
CL_DEVICE_MAX_CLOCK_FREQUENCY
)
}
}
func
(
d
Device
)
MaxMemAllocSize
()
(
uint64
,
error
)
{
func
(
d
Device
)
MaxMemAllocSize
()
(
uint64
,
error
)
{
return
d
.
getInfoUlong
(
"MaxMemAllocSize"
,
C
.
CL_DEVICE_MAX_MEM_ALLOC_SIZE
)
return
d
.
getInfoUlong
(
"MaxMemAllocSize"
,
C
.
CL_DEVICE_MAX_MEM_ALLOC_SIZE
)
}
}
func
(
d
Device
)
ImageSupport
()
(
bool
,
error
)
{
func
(
d
Device
)
ImageSupport
()
(
bool
,
error
)
{
return
d
.
getInfoBool
(
"ImageSupport"
,
C
.
CL_DEVICE_IMAGE_SUPPORT
)
return
d
.
getInfoBool
(
"ImageSupport"
,
C
.
CL_DEVICE_IMAGE_SUPPORT
)
}
}
func
(
d
Device
)
MaxReadImageArgs
()
(
uint
,
error
)
{
func
(
d
Device
)
MaxReadImageArgs
()
(
uint
,
error
)
{
return
d
.
getInfoUint
(
"MaxReadImageArgs"
,
C
.
CL_DEVICE_MAX_READ_IMAGE_ARGS
)
return
d
.
getInfoUint
(
"MaxReadImageArgs"
,
C
.
CL_DEVICE_MAX_READ_IMAGE_ARGS
)
}
}
func
(
d
Device
)
MaxWriteImageArgs
()
(
uint
,
error
)
{
func
(
d
Device
)
MaxWriteImageArgs
()
(
uint
,
error
)
{
return
d
.
getInfoUint
(
"MaxWriteImageArgs"
,
C
.
CL_DEVICE_MAX_WRITE_IMAGE_ARGS
)
return
d
.
getInfoUint
(
"MaxWriteImageArgs"
,
C
.
CL_DEVICE_MAX_WRITE_IMAGE_ARGS
)
}
}
func
(
d
Device
)
Image2DMaxWidth
()
(
uintptr
,
error
)
{
func
(
d
Device
)
Image2DMaxWidth
()
(
uintptr
,
error
)
{
return
d
.
getInfoSize
(
"Image2DMaxWidth"
,
C
.
CL_DEVICE_IMAGE2D_MAX_WIDTH
)
return
d
.
getInfoSize
(
"Image2DMaxWidth"
,
C
.
CL_DEVICE_IMAGE2D_MAX_WIDTH
)
}
}
func
(
d
Device
)
Image2DMaxHeight
()
(
uintptr
,
error
)
{
func
(
d
Device
)
Image2DMaxHeight
()
(
uintptr
,
error
)
{
return
d
.
getInfoSize
(
"Image2DMaxHeight"
,
C
.
CL_DEVICE_IMAGE2D_MAX_HEIGHT
)
return
d
.
getInfoSize
(
"Image2DMaxHeight"
,
C
.
CL_DEVICE_IMAGE2D_MAX_HEIGHT
)
}
}
func
(
d
Device
)
Image3DMaxWidth
()
(
uintptr
,
error
)
{
func
(
d
Device
)
Image3DMaxWidth
()
(
uintptr
,
error
)
{
return
d
.
getInfoSize
(
"Image3DMaxWidth"
,
C
.
CL_DEVICE_IMAGE3D_MAX_WIDTH
)
return
d
.
getInfoSize
(
"Image3DMaxWidth"
,
C
.
CL_DEVICE_IMAGE3D_MAX_WIDTH
)
}
}
func
(
d
Device
)
Image3DMaxHeight
()
(
uintptr
,
error
)
{
func
(
d
Device
)
Image3DMaxHeight
()
(
uintptr
,
error
)
{
return
d
.
getInfoSize
(
"Image3DMaxHeight"
,
C
.
CL_DEVICE_IMAGE3D_MAX_HEIGHT
)
return
d
.
getInfoSize
(
"Image3DMaxHeight"
,
C
.
CL_DEVICE_IMAGE3D_MAX_HEIGHT
)
}
}
func
(
d
Device
)
Image3DMaxDepth
()
(
uintptr
,
error
)
{
func
(
d
Device
)
Image3DMaxDepth
()
(
uintptr
,
error
)
{
return
d
.
getInfoSize
(
"Image3DMaxDepth"
,
C
.
CL_DEVICE_IMAGE3D_MAX_DEPTH
)
return
d
.
getInfoSize
(
"Image3DMaxDepth"
,
C
.
CL_DEVICE_IMAGE3D_MAX_DEPTH
)
}
}
func
(
d
Device
)
ImageMaxBufferSize
()
(
uintptr
,
error
)
{
func
(
d
Device
)
ImageMaxBufferSize
()
(
uintptr
,
error
)
{
return
d
.
getInfoSize
(
"ImageMaxBufferSize"
,
C
.
CL_DEVICE_IMAGE_MAX_BUFFER_SIZE
)
return
d
.
getInfoSize
(
"ImageMaxBufferSize"
,
C
.
CL_DEVICE_IMAGE_MAX_BUFFER_SIZE
)
}
}
func
(
d
Device
)
ImageMaxArraySize
()
(
uintptr
,
error
)
{
func
(
d
Device
)
ImageMaxArraySize
()
(
uintptr
,
error
)
{
return
d
.
getInfoSize
(
"ImageMaxArraySize"
,
C
.
CL_DEVICE_IMAGE_MAX_ARRAY_SIZE
)
return
d
.
getInfoSize
(
"ImageMaxArraySize"
,
C
.
CL_DEVICE_IMAGE_MAX_ARRAY_SIZE
)
}
}
func
(
d
Device
)
MaxSamplers
()
(
uint
,
error
)
{
func
(
d
Device
)
MaxSamplers
()
(
uint
,
error
)
{
return
d
.
getInfoUint
(
"MaxSamplers"
,
C
.
CL_DEVICE_MAX_SAMPLERS
)
return
d
.
getInfoUint
(
"MaxSamplers"
,
C
.
CL_DEVICE_MAX_SAMPLERS
)
}
}
func
(
d
Device
)
MaxParameterSize
()
(
uintptr
,
error
)
{
func
(
d
Device
)
MaxParameterSize
()
(
uintptr
,
error
)
{
return
d
.
getInfoSize
(
"MaxParameterSize"
,
C
.
CL_DEVICE_MAX_PARAMETER_SIZE
)
return
d
.
getInfoSize
(
"MaxParameterSize"
,
C
.
CL_DEVICE_MAX_PARAMETER_SIZE
)
}
}
func
(
d
Device
)
MemBaseAddrAlign
()
(
uint
,
error
)
{
func
(
d
Device
)
MemBaseAddrAlign
()
(
uint
,
error
)
{
return
d
.
getInfoUint
(
"MemBaseAddrAlign"
,
C
.
CL_DEVICE_MEM_BASE_ADDR_ALIGN
)
return
d
.
getInfoUint
(
"MemBaseAddrAlign"
,
C
.
CL_DEVICE_MEM_BASE_ADDR_ALIGN
)
}
}
func
(
d
Device
)
SingleFPConfig
()
(
FPConfig
,
error
)
{
func
(
d
Device
)
SingleFPConfig
()
(
FPConfig
,
error
)
{
return
d
.
getInfoFPConfig
(
"SingleFPConfig"
,
C
.
CL_DEVICE_SINGLE_FP_CONFIG
)
return
d
.
getInfoFPConfig
(
"SingleFPConfig"
,
C
.
CL_DEVICE_SINGLE_FP_CONFIG
)
}
}
func
(
d
Device
)
DoubleFPConfig
()
(
FPConfig
,
error
)
{
func
(
d
Device
)
DoubleFPConfig
()
(
FPConfig
,
error
)
{
return
d
.
getInfoFPConfig
(
"DoubleFPConfig"
,
C
.
CL_DEVICE_SINGLE_FP_CONFIG
)
return
d
.
getInfoFPConfig
(
"DoubleFPConfig"
,
C
.
CL_DEVICE_SINGLE_FP_CONFIG
)
}
}
func
(
d
Device
)
GlobalMemCacheType
()
(
MemCacheType
,
error
)
{
func
(
d
Device
)
GlobalMemCacheType
()
(
MemCacheType
,
error
)
{
return
d
.
getInfoMemCacheType
(
"GlobalMemCacheType"
,
C
.
CL_DEVICE_GLOBAL_MEM_CACHE_TYPE
)
return
d
.
getInfoMemCacheType
(
"GlobalMemCacheType"
,
C
.
CL_DEVICE_GLOBAL_MEM_CACHE_TYPE
)
}
}
func
(
d
Device
)
GlobalMemCachelineSize
()
(
uint
,
error
)
{
func
(
d
Device
)
GlobalMemCachelineSize
()
(
uint
,
error
)
{
return
d
.
getInfoUint
(
"GlobalMemCachelineSize"
,
C
.
CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE
)
return
d
.
getInfoUint
(
"GlobalMemCachelineSize"
,
C
.
CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE
)
}
}
func
(
d
Device
)
GlobalMemCacheSize
()
(
uint64
,
error
)
{
func
(
d
Device
)
GlobalMemCacheSize
()
(
uint64
,
error
)
{
return
d
.
getInfoUlong
(
"GlobalMemCacheSize"
,
C
.
CL_DEVICE_GLOBAL_MEM_CACHE_SIZE
)
return
d
.
getInfoUlong
(
"GlobalMemCacheSize"
,
C
.
CL_DEVICE_GLOBAL_MEM_CACHE_SIZE
)
}
}
func
(
d
Device
)
GlobalMemSize
()
(
uint64
,
error
)
{
func
(
d
Device
)
GlobalMemSize
()
(
uint64
,
error
)
{
return
d
.
getInfoUlong
(
"GlobalMemSize"
,
C
.
CL_DEVICE_GLOBAL_MEM_SIZE
)
return
d
.
getInfoUlong
(
"GlobalMemSize"
,
C
.
CL_DEVICE_GLOBAL_MEM_SIZE
)
}
}
func
(
d
Device
)
MaxConstantBufferSize
()
(
uint64
,
error
)
{
func
(
d
Device
)
MaxConstantBufferSize
()
(
uint64
,
error
)
{
return
d
.
getInfoUlong
(
"MaxConstantBufferSize"
,
C
.
CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE
)
return
d
.
getInfoUlong
(
"MaxConstantBufferSize"
,
C
.
CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE
)
}
}
func
(
d
Device
)
MaxConstantArgs
()
(
uint
,
error
)
{
func
(
d
Device
)
MaxConstantArgs
()
(
uint
,
error
)
{
return
d
.
getInfoUint
(
"MaxConstantArgs"
,
C
.
CL_DEVICE_MAX_CONSTANT_ARGS
)
return
d
.
getInfoUint
(
"MaxConstantArgs"
,
C
.
CL_DEVICE_MAX_CONSTANT_ARGS
)
}
}
func
(
d
Device
)
LocalMemType
()
(
LocalMemType
,
error
)
{
func
(
d
Device
)
LocalMemType
()
(
LocalMemType
,
error
)
{
return
d
.
getInfoLocalMemType
(
"LocalMemType"
,
C
.
CL_DEVICE_LOCAL_MEM_TYPE
)
return
d
.
getInfoLocalMemType
(
"LocalMemType"
,
C
.
CL_DEVICE_LOCAL_MEM_TYPE
)
}
}
func
(
d
Device
)
LocalMemSize
()
(
uint64
,
error
)
{
func
(
d
Device
)
LocalMemSize
()
(
uint64
,
error
)
{
return
d
.
getInfoUlong
(
"LocalMemSize"
,
C
.
CL_DEVICE_LOCAL_MEM_SIZE
)
return
d
.
getInfoUlong
(
"LocalMemSize"
,
C
.
CL_DEVICE_LOCAL_MEM_SIZE
)
}
}
func
(
d
Device
)
ErrorCorrectionSupport
()
(
bool
,
error
)
{
func
(
d
Device
)
ErrorCorrectionSupport
()
(
bool
,
error
)
{
return
d
.
getInfoBool
(
"ErrorCorrectionSupport"
,
C
.
CL_DEVICE_ERROR_CORRECTION_SUPPORT
)
return
d
.
getInfoBool
(
"ErrorCorrectionSupport"
,
C
.
CL_DEVICE_ERROR_CORRECTION_SUPPORT
)
}
}
func
(
d
Device
)
ProfilingTimerResolution
()
(
uintptr
,
error
)
{
func
(
d
Device
)
ProfilingTimerResolution
()
(
uintptr
,
error
)
{
return
d
.
getInfoSize
(
"ProfilingTimerResolution"
,
C
.
CL_DEVICE_PROFILING_TIMER_RESOLUTION
)
return
d
.
getInfoSize
(
"ProfilingTimerResolution"
,
C
.
CL_DEVICE_PROFILING_TIMER_RESOLUTION
)
}
}
func
(
d
Device
)
HostUnifiedMemory
()
(
bool
,
error
)
{
func
(
d
Device
)
HostUnifiedMemory
()
(
bool
,
error
)
{
return
d
.
getInfoBool
(
"HostUnifiedMemory"
,
C
.
CL_DEVICE_HOST_UNIFIED_MEMORY
)
return
d
.
getInfoBool
(
"HostUnifiedMemory"
,
C
.
CL_DEVICE_HOST_UNIFIED_MEMORY
)
}
}
func
(
d
Device
)
EndianLittle
()
(
bool
,
error
)
{
func
(
d
Device
)
EndianLittle
()
(
bool
,
error
)
{
return
d
.
getInfoBool
(
"EndianLittle"
,
C
.
CL_DEVICE_ENDIAN_LITTLE
)
return
d
.
getInfoBool
(
"EndianLittle"
,
C
.
CL_DEVICE_ENDIAN_LITTLE
)
}
}
func
(
d
Device
)
Available
()
(
bool
,
error
)
{
func
(
d
Device
)
Available
()
(
bool
,
error
)
{
return
d
.
getInfoBool
(
"Available"
,
C
.
CL_DEVICE_AVAILABLE
)
return
d
.
getInfoBool
(
"Available"
,
C
.
CL_DEVICE_AVAILABLE
)
}
}
func
(
d
Device
)
CompilerAvailable
()
(
bool
,
error
)
{
func
(
d
Device
)
CompilerAvailable
()
(
bool
,
error
)
{
return
d
.
getInfoBool
(
"CompilerAvailable"
,
C
.
CL_DEVICE_COMPILER_AVAILABLE
)
return
d
.
getInfoBool
(
"CompilerAvailable"
,
C
.
CL_DEVICE_COMPILER_AVAILABLE
)
}
}
func
(
d
Device
)
LinkerAvailable
()
(
bool
,
error
)
{
func
(
d
Device
)
LinkerAvailable
()
(
bool
,
error
)
{
return
d
.
getInfoBool
(
"LinkerAvailable"
,
C
.
CL_DEVICE_LINKER_AVAILABLE
)
return
d
.
getInfoBool
(
"LinkerAvailable"
,
C
.
CL_DEVICE_LINKER_AVAILABLE
)
}
}
func
(
d
Device
)
QueueProperties
()
(
CommandQueueProperties
,
error
)
{
func
(
d
Device
)
QueueProperties
()
(
CommandQueueProperties
,
error
)
{
return
d
.
getInfoQueueProperties
(
"QueueProperties"
,
C
.
CL_DEVICE_QUEUE_PROPERTIES
)
return
d
.
getInfoQueueProperties
(
"QueueProperties"
,
C
.
CL_DEVICE_QUEUE_PROPERTIES
)
}
}
func
(
d
Device
)
BuiltInKernels
()
([]
string
,
error
)
{
func
(
d
Device
)
BuiltInKernels
()
([]
string
,
error
)
{
str
,
err
:=
d
.
getInfoString
(
"BuiltInKernels"
,
C
.
CL_DEVICE_BUILT_IN_KERNELS
)
str
,
err
:=
d
.
getInfoString
(
"BuiltInKernels"
,
C
.
CL_DEVICE_BUILT_IN_KERNELS
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
return
strings
.
Split
(
str
,
";"
),
nil
return
strings
.
Split
(
str
,
";"
),
nil
}
}
func
(
d
Device
)
Name
()
(
string
,
error
)
{
func
(
d
Device
)
Name
()
(
string
,
error
)
{
return
d
.
getInfoString
(
"Name"
,
C
.
CL_DEVICE_NAME
)
return
d
.
getInfoString
(
"Name"
,
C
.
CL_DEVICE_NAME
)
}
}
func
(
d
Device
)
Vendor
()
(
string
,
error
)
{
func
(
d
Device
)
Vendor
()
(
string
,
error
)
{
return
d
.
getInfoString
(
"Vendor"
,
C
.
CL_DEVICE_VENDOR
)
return
d
.
getInfoString
(
"Vendor"
,
C
.
CL_DEVICE_VENDOR
)
}
}
func
(
d
Device
)
DriverVersion
()
(
string
,
error
)
{
func
(
d
Device
)
DriverVersion
()
(
string
,
error
)
{
return
d
.
getInfoString
(
"DriverVersion"
,
C
.
CL_DRIVER_VERSION
)
return
d
.
getInfoString
(
"DriverVersion"
,
C
.
CL_DRIVER_VERSION
)
}
}
func
(
d
Device
)
Profile
()
(
string
,
error
)
{
func
(
d
Device
)
Profile
()
(
string
,
error
)
{
return
d
.
getInfoString
(
"Profile"
,
C
.
CL_DEVICE_PROFILE
)
return
d
.
getInfoString
(
"Profile"
,
C
.
CL_DEVICE_PROFILE
)
}
}
func
(
d
Device
)
Version
()
(
string
,
error
)
{
func
(
d
Device
)
Version
()
(
string
,
error
)
{
return
d
.
getInfoString
(
"Version"
,
C
.
CL_DEVICE_VERSION
)
return
d
.
getInfoString
(
"Version"
,
C
.
CL_DEVICE_VERSION
)
}
}
infogen.go
View file @
73372c6d
...
@@ -12,6 +12,7 @@ package main
...
@@ -12,6 +12,7 @@ package main
import
"C"
import
"C"
import
(
import
(
"bytes"
"bytes"
"go/format"
"io/ioutil"
"io/ioutil"
"log"
"log"
"os"
"os"
...
@@ -116,7 +117,7 @@ func generate(tmpl *template.Template, data interface{}) ([]byte, error) {
...
@@ -116,7 +117,7 @@ func generate(tmpl *template.Template, data interface{}) ([]byte, error) {
return
nil
,
err
return
nil
,
err
}
}
return
buf
.
Bytes
(),
nil
return
format
.
Source
(
buf
.
Bytes
())
}
}
func
writeBytes
(
filename
string
,
data
[]
byte
)
error
{
func
writeBytes
(
filename
string
,
data
[]
byte
)
error
{
...
...
platforminfo.go
View file @
73372c6d
...
@@ -12,51 +12,50 @@ package opencl
...
@@ -12,51 +12,50 @@ package opencl
*/
*/
import
"C"
import
"C"
import
(
import
(
"fmt"
"fmt"
"strings"
"strings"
"unsafe"
"unsafe"
)
)
func
(
p
Platform
)
getInfoString
(
name
string
,
id
C
.
cl_platform_info
)
(
string
,
error
)
{
func
(
p
Platform
)
getInfoString
(
name
string
,
id
C
.
cl_platform_info
)
(
string
,
error
)
{
var
n
C
.
size_t
var
n
C
.
size_t
if
err
:=
C
.
clGetPlatformInfo
(
p
.
id
,
id
,
0
,
nil
,
&
n
);
err
!=
C
.
CL_SUCCESS
{
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
)
return
""
,
fmt
.
Errorf
(
"error getting length of platform info %s: %d"
,
name
,
err
)
}
}
buf
:=
make
([]
C
.
char
,
n
)
buf
:=
make
([]
C
.
char
,
n
)
if
err
:=
C
.
clGetPlatformInfo
(
p
.
id
,
id
,
n
,
unsafe
.
Pointer
(
&
buf
[
0
]),
nil
);
err
!=
C
.
CL_SUCCESS
{
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
""
,
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
)
{
func
(
p
Platform
)
dummyUseStrings
()
[]
string
{
// a dummy function so that strings is not unused even if template space-delim is not used
// a dummy function so that strings is not unused even if template space-delim is not used
return
strings
.
Split
(
""
,
""
)
return
strings
.
Split
(
""
,
""
)
}
}
func
(
p
Platform
)
Profile
()
(
string
,
error
)
{
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
)
{
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
)
{
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
)
{
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
)
{
func
(
p
Platform
)
Extension
()
([]
string
,
error
)
{
str
,
err
:=
p
.
getInfoString
(
"Extension"
,
C
.
CL_PLATFORM_EXTENSIONS
)
str
,
err
:=
p
.
getInfoString
(
"Extension"
,
C
.
CL_PLATFORM_EXTENSIONS
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
return
strings
.
Split
(
str
,
" "
),
nil
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