當前位置: 首頁>>代碼示例>>Golang>>正文


Golang C.clGetDeviceInfo函數代碼示例

本文整理匯總了Golang中C.clGetDeviceInfo函數的典型用法代碼示例。如果您正苦於以下問題:Golang clGetDeviceInfo函數的具體用法?Golang clGetDeviceInfo怎麽用?Golang clGetDeviceInfo使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了clGetDeviceInfo函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: HalfFPConfig

// Describes the OPTIONAL half precision floating-point capability of the OpenCL device
func (d *Device) HalfFPConfig() FPConfig {
	var fpConfig C.cl_device_fp_config
	if err := C.clGetDeviceInfo(d.id, C.CL_DEVICE_HALF_FP_CONFIG, C.size_t(unsafe.Sizeof(fpConfig)), unsafe.Pointer(&fpConfig), nil); err != C.CL_SUCCESS {
		return FPConfig(0)
	}
	return FPConfig(fpConfig)
}
開發者ID:jackscan,項目名稱:go-opencl,代碼行數:8,代碼來源:device.go

示例2: Platform

func (d *Device) Platform() *Platform {
	var devicePlatform C.cl_platform_id
	if err := C.clGetDeviceInfo(d.nullableId(), C.CL_DEVICE_PLATFORM, C.size_t(unsafe.Sizeof(devicePlatform)), unsafe.Pointer(&devicePlatform), nil); err != C.CL_SUCCESS {
		panic("Failed to get device platform")
	}
	return &Platform{id: devicePlatform}
}
開發者ID:xfong,項目名稱:tmpCL,代碼行數:7,代碼來源:device.go

示例3: DoubleFPConfig

// Describes double precision floating-point capability of the OpenCL device
func (d *Device) DoubleFPConfig() FPConfig {
	var fpConfig C.cl_device_fp_config
	if err := C.clGetDeviceInfo(d.id, C.CL_DEVICE_DOUBLE_FP_CONFIG, C.size_t(unsafe.Sizeof(fpConfig)), unsafe.Pointer(&fpConfig), nil); err != C.CL_SUCCESS {
		panic("Failed to get double FP config")
	}
	return FPConfig(fpConfig)
}
開發者ID:jackscan,項目名稱:go-opencl,代碼行數:8,代碼來源:device.go

示例4: ExecutionCapabilities

// Describes the execution capabilities of the device. The mandated minimum capability is CL_EXEC_KERNEL.
func (d *Device) ExecutionCapabilities() ExecCapability {
	var execCap C.cl_device_exec_capabilities
	if err := C.clGetDeviceInfo(d.id, C.CL_DEVICE_EXECUTION_CAPABILITIES, C.size_t(unsafe.Sizeof(execCap)), unsafe.Pointer(&execCap), nil); err != C.CL_SUCCESS {
		panic("Failed to get execution capabilities")
	}
	return ExecCapability(execCap)
}
開發者ID:jackscan,項目名稱:go-opencl,代碼行數:8,代碼來源:device.go

示例5: LocalMemType

// Type of local memory supported. This can be set to CL_LOCAL implying dedicated
// local memory storage such as SRAM, or CL_GLOBAL. For custom devices, CL_NONE
// can also be returned indicating no local memory support.
func (d *Device) LocalMemType() LocalMemType {
	var memType C.cl_device_local_mem_type
	if err := C.clGetDeviceInfo(d.id, C.CL_DEVICE_LOCAL_MEM_TYPE, C.size_t(unsafe.Sizeof(memType)), unsafe.Pointer(&memType), nil); err != C.CL_SUCCESS {
		return LocalMemType(C.CL_NONE)
	}
	return LocalMemType(memType)
}
開發者ID:jackscan,項目名稱:go-opencl,代碼行數:10,代碼來源:device.go

示例6: GlobalMemCacheType

func (d *Device) GlobalMemCacheType() MemCacheType {
	var memType C.cl_device_mem_cache_type
	if err := C.clGetDeviceInfo(d.id, C.CL_DEVICE_GLOBAL_MEM_CACHE_TYPE, C.size_t(unsafe.Sizeof(memType)), unsafe.Pointer(&memType), nil); err != C.CL_SUCCESS {
		return MemCacheType(C.CL_NONE)
	}
	return MemCacheType(memType)
}
開發者ID:jackscan,項目名稱:go-opencl,代碼行數:7,代碼來源:device.go

示例7: SingleFPConfig

// Describes single precision floating-point capability of the OpenCL device
func (d *Device) SingleFPConfig() FPConfig {
	var fpConfig C.cl_device_fp_config
	if err := C.clGetDeviceInfo(d.nullableId(), C.CL_DEVICE_SINGLE_FP_CONFIG, C.size_t(unsafe.Sizeof(fpConfig)), unsafe.Pointer(&fpConfig), nil); err != C.CL_SUCCESS {
		panic("Failed to get single FP config")
	}
	return FPConfig(fpConfig)
}
開發者ID:xfong,項目名稱:tmpCL,代碼行數:8,代碼來源:device.go

示例8: Type

func (d *Device) Type() DeviceType {
	var deviceType C.cl_device_type
	if err := C.clGetDeviceInfo(d.id, C.CL_DEVICE_TYPE, C.size_t(unsafe.Sizeof(deviceType)), unsafe.Pointer(&deviceType), nil); err != C.CL_SUCCESS {
		panic("Failed to get device type")
	}
	return DeviceType(deviceType)
}
開發者ID:jackscan,項目名稱:go-opencl,代碼行數:7,代碼來源:device.go

示例9: QueueProperties

func (d *Device) QueueProperties() CommandQueueProperty {
	var val C.cl_command_queue_properties
	if err := C.clGetDeviceInfo(d.nullableId(), C.CL_DEVICE_QUEUE_PROPERTIES, C.size_t(unsafe.Sizeof(val)), unsafe.Pointer(&val), nil); err != C.CL_SUCCESS {
		panic("Should never fail")
		return 0
	}
	return CommandQueueProperty(val)
}
開發者ID:xfong,項目名稱:tmpCL,代碼行數:8,代碼來源:device.go

示例10: getInfoUlong

func (d *Device) getInfoUlong(param C.cl_device_info, panicOnError bool) (int64, error) {
	var val C.cl_ulong
	if err := C.clGetDeviceInfo(d.id, param, C.size_t(unsafe.Sizeof(val)), unsafe.Pointer(&val), nil); err != C.CL_SUCCESS {
		if panicOnError {
			panic("Should never fail")
		}
		return 0, toError(err)
	}
	return int64(val), nil
}
開發者ID:jackscan,項目名稱:go-opencl,代碼行數:10,代碼來源:device.go

示例11: getInfoBool

func (d *Device) getInfoBool(param C.cl_device_info, panicOnError bool) (bool, error) {
	var val C.cl_bool
	if err := C.clGetDeviceInfo(d.id, param, C.size_t(unsafe.Sizeof(val)), unsafe.Pointer(&val), nil); err != C.CL_SUCCESS {
		if panicOnError {
			panic("Should never fail")
		}
		return false, toError(err)
	}
	return val == C.CL_TRUE, nil
}
開發者ID:jackscan,項目名稱:go-opencl,代碼行數:10,代碼來源:device.go

示例12: getInfoUint

func (d *Device) getInfoUint(param C.cl_device_info, panicOnError bool) (uint, error) {
	var val C.cl_uint
	if err := C.clGetDeviceInfo(d.nullableId(), param, C.size_t(unsafe.Sizeof(val)), unsafe.Pointer(&val), nil); err != C.CL_SUCCESS {
		if panicOnError {
			panic("Should never fail")
		}
		return 0, toError(err)
	}
	return uint(val), nil
}
開發者ID:xfong,項目名稱:tmpCL,代碼行數:10,代碼來源:device.go

示例13: ParentDevice

func (d *Device) ParentDevice() *Device {
	var deviceId C.cl_device_id
	if err := C.clGetDeviceInfo(d.id, C.CL_DEVICE_PARENT_DEVICE, C.size_t(unsafe.Sizeof(deviceId)), unsafe.Pointer(&deviceId), nil); err != C.CL_SUCCESS {
		panic("ParentDevice failed")
	}
	if deviceId == nil {
		return nil
	}
	return &Device{id: deviceId}
}
開發者ID:jackscan,項目名稱:go-opencl,代碼行數:10,代碼來源:device.go

示例14: getInfoString

func (d *Device) getInfoString(param C.cl_device_info, panicOnError bool) (string, error) {
	var strC [1024]C.char
	var strN C.size_t
	if err := C.clGetDeviceInfo(d.id, param, 1024, unsafe.Pointer(&strC), &strN); err != C.CL_SUCCESS || strN < 1 {
		if panicOnError {
			panic("Should never fail")
		}
		return "", toError(err)
	}
	return C.GoStringN((*C.char)(unsafe.Pointer(&strC)), C.int(strN-1)), nil
}
開發者ID:jackscan,項目名稱:go-opencl,代碼行數:11,代碼來源:device.go

示例15: MaxWorkItemSizes

// Maximum number of work-items that can be specified in each dimension of the work-group to clEnqueueNDRangeKernel.
//
// Returns n size_t entries, where n is the value returned by the query for CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS.
//
// The minimum value is (1, 1, 1) for devices that are not of type CL_DEVICE_TYPE_CUSTOM.
func (d *Device) MaxWorkItemSizes() []int {
	dims := d.MaxWorkItemDimensions()
	sizes := make([]C.size_t, dims)
	if err := C.clGetDeviceInfo(d.id, C.CL_DEVICE_MAX_WORK_ITEM_SIZES, C.size_t(int(unsafe.Sizeof(sizes[0]))*dims), unsafe.Pointer(&sizes[0]), nil); err != C.CL_SUCCESS {
		panic("Failed to get max work item sizes")
	}
	intSizes := make([]int, dims)
	for i, s := range sizes {
		intSizes[i] = int(s)
	}
	return intSizes
}
開發者ID:jackscan,項目名稱:go-opencl,代碼行數:17,代碼來源:device.go


注:本文中的C.clGetDeviceInfo函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。