OpenCL™规范 5.18. 查询支持与OpenGL共享的设备

5.18. Querying Devices That Support Sharing With OpenGL

5.18. 查询支持与OpenGL共享的设备

OpenCL device(s) corresponding to an OpenGL context may be queried. Such a device may not always exist (for example, if an OpenGL context is specified on a GPU not supporting OpenCL command-queues, but which does support shared OpenCL/OpenGL memory objects), and if it does exist, may change over time. When such a device does exist, acquiring and releasing shared OpenCL/OpenGL memory objects may be faster on a command-queue corresponding to this device than on command-queues corresponding to other devices available to an OpenCL context.

可以查询与OpenGL上下文对应的OpenCL设备。这样的设备可能并不总是存在(例如,如果在不支持OpenCL命令队列但支持共享OpenCL/OpenGL内存对象的GPU上指定了OpenGL上下文),如果确实存在,可能会随着时间的推移而变化。当这样的设备确实存在时,在与该设备对应的命令队列上获取和释放共享的OpenCL/OpenGL内存对象可能比在与OpenCL上下文可用的其他设备对应的指令队列上更快。

To query the OpenCL device corresponding to an OpenGL context, call the function

要查询与OpenGL上下文对应的OpenCL设备,请调用以下函数

// Provided by cl_khr_gl_sharing
cl_int clGetGLContextInfoKHR(
    const cl_context_properties* properties,
    cl_gl_context_info param_name,
    size_t param_value_size,
    void* param_value,
    size_t* param_value_size_ret);
  • properties points to an property list whose format and valid contents are identical to the properties argument of clCreateContextproperties must identify a single valid GL context or GL share group object.

  • ​properties指向一个属性列表,其格式和有效内容与clCreateContext的properties参数相同。properties必须标识单个有效的GL上下文或GL共享组对象。

  • param_name is a constant that specifies the device types to query, and must be one of the values shown in the Supported Device Types table below.

  • ​param_name是一个常数,指定要查询的设备类型,并且必须是下面“支持的设备类型”表中显示的值之一。

  • param_value is a pointer to memory where the result of the query is returned, as described in the Supported Device Types table. If param_value is NULL, it is ignored.

  • ​param_value是一个指向返回查询结果的内存的指针,如“支持的设备类型”表所述。如果param_value为NULL,则忽略它。

  • param_value_size specifies the size in bytes of memory pointed to by param_value. This size must be greater than or equal to the size of the return type specified in the Supported Device Types table. If param_value is NULL, it is ignored.

  • ​param_value_size指定param_value指向的内存大小(以字节为单位)。此大小必须大于或等于“支持的设备类型”表中指定的返回类型的大小。如果param_value为NULL,则忽略它。

  • param_value_size_ret returns the actual size in bytes of data being queried by param_value. If param_value_size_ret is NULL, it is ignored.

  • param_value_size_ret返回param_value查询的数据的实际大小(以字节为单位)。如果param_value_size_ret为NULL,则忽略它。

Table 62. Supported Device Types for clGetGLContextInfoKHR

​表62 clGetGLContextInfoKHR支持的设备类型

param_name

参数名称

Return Type

返回类型

Information returned in param_value

param_value中返回的信息

CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR

provided by the cl_khr_gl_sharing extension.

cl_device_id

Return the OpenCL device currently associated with the specified OpenGL context.

返回当前与指定OpenGL上下文关联的OpenCL设备。

CL_DEVICES_FOR_GL_CONTEXT_KHR

provided by the cl_khr_gl_sharing extension.

cl_device_id[]

Return all OpenCL devices which may be associated with the specified OpenGL context.

返回可能与指定OpenGL上下文关联的所有OpenCL设备。

clGetGLContextInfoKHR returns CL_SUCCESS if the function is executed successfully. If no device(s) exist corresponding to param_name, the call will not fail, but the value of param_value_size_ret will be zero. Otherwise, it returns one of the following errors:

如果函数执行成功,clGetGLContextInfoKHR将返回CL_SUCCESS。如果不存在与param_name对应的设备,则调用不会失败,但param_value_size_ret的值将为零。否则,它将返回以下错误之一:

  • CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR if a context was specified for an OpenGL or OpenGL ES implementation using the EGL, GLX, or WGL binding APIs, as described for clCreateContext; and any of the following conditions hold:

    CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR,如果使用EGL、GLX或WGL绑定API为OpenGL或OpenGL ES实现指定了上下文,如clCreateContext所述;并且满足以下任何条件:

    • The specified display and context properties do not identify a valid OpenGL or OpenGL ES context.

    • 指定的显示和上下文属性无法标识有效的OpenGL或OpenGL ES上下文。

    • The specified context does not support buffer and renderbuffer objects.

    • 指定的上下文不支持缓冲区和渲染缓冲区对象。

    • The specified context is not compatible with the OpenCL context being created (for example, it exists in a physically distinct address space, such as another hardware device; or it does not support sharing data with OpenCL due to implementation restrictions).

    • 指定的上下文与正在创建的OpenCL上下文不兼容(例如,它存在于物理上不同的地址空间中,如另一个硬件设备;或者由于实现限制,它不支持与OpenCL共享数据)。

  • CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR if a share group was specified for a CGL-based OpenGL implementation by setting the property CL_CGL_SHAREGROUP_KHR, and the specified share group does not identify a valid CGL share group object.

  • 如果通过设置属性CL_CGL_SHAREGROUP_KHR为基于CGL的OpenGL实现指定了共享组,并且指定的共享组没有标识有效的CGL共享组对象,则返回CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR。

  • CL_INVALID_OPERATION if a context was specified as described above and any of the following conditions hold:

    CL_INVALID_OPERATION,如果如上所述指定了上下文,并且满足以下任何条件:

    • A context or share group object was specified for one of CGL, EGL, GLX, or WGL and the OpenGL implementation does not support that window-system binding API.

    • 为CGL、EGL、GLX或WGL之一指定了上下文或共享组对象,并且OpenGL实现不支持该窗口系统绑定API。

    • More than one of the properties CL_CGL_SHAREGROUP_KHRCL_EGL_DISPLAY_KHRCL_GLX_DISPLAY_KHR, and CL_WGL_HDC_KHR is set to a non-default value.

    • ​属性CL_CGL_SHAREGROUP_KHR、CL_EGL_DISPLAY_KHR、CL_GLX_DISPLAY_KHR和CL_WGL_HDC_KHR中的多个设置为非默认值。

    • Both of the properties CL_CGL_SHAREGROUP_KHR and CL_GL_CONTEXT_KHR are set to non-default values.

    • ​属性CL_CGL_SHAREGROUP_KHR和CL_GL_CONTEXT_KHR都设置为非默认值。

  • CL_INVALID_VALUE if a property name specified in properties is invalid.

  • 如果properties中指定的属性名无效,则返回CL_INVALID_VALUE。

  • CL_INVALID_VALUE if param_name is not one of the supported values, or if the size in bytes specified by param_value_size is less than size of the return type specified in the Supported Device Types table and param_value is not NULL.

  • 如果param_name不是支持的值之一,或者param_value_size 指定的字节大小小于“支持的设备类型”表中指定的返回类型的大小,并且param_value 不为NULL,则返回CL_INVALID_VALUE。

  • CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device

  • CL_OUT_OF_RESOURCES(如果无法在设备上分配OpenCL实现所需的资源)

  • CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.

  • CL_OUT_OF_HOST_MEMORY,如果无法在主机上分配OpenCL实现所需的资源。

内容概要:本文系统阐述了Java Persistence API(JPA)的核心概念、技术架构、核心组件及实践应用,重点介绍了JPA作为Java官方定义的对象关系映射(ORM)规范,如何通过实体类、EntityManager、JPQL和persistence.xml配置文件实现Java对象数据库表之间的映射操作。文章详细说明了JPA解决的传统JDBC开发痛点,如代码冗余、对象映射繁琐、跨数据库兼容性差等问题,并解析了JPAHibernate、EclipseLink等实现框架的关系。同时提供了基于Hibernate和MySQL的完整实践案例,涵盖Maven依赖配置、实体类定义、CRUD操作实现等关键步骤,并列举了常用JPA注解及其用途。最后总结了JPA的标准化优势、开发效率提升能力及在Spring生态中的延伸应用。 适合人群:具备一定Java基础,熟悉基本数据库操作,工作1-3年的后端开发人员或正在学习ORM技术的中级开发者。 使用场景及目标:①理解JPA作为ORM规范的核心原理组件协作机制;②掌握基于JPA+Hibernate进行数据库操作的开发流程;③为技术选型、团队培训或向Spring Data JPA过渡提供理论实践基础。 阅读建议:此资源以理论结合实践的方式讲解JPA,建议读者在学习过程中同步搭建环境,动手实现文中示例代码,重点关注EntityManager的使用、JPQL语法特点以及注解配置规则,从而深入理解JPA的设计思想工程价值。
先看效果: https://pan.quark.cn/s/d787a05b82eb 西门子SCALANCE X系列交换机是西门子公司所提供的工业以太网交换机产品系列,其在工业自动化领域具有广泛的应用。 如果在应用期间遭遇固件升级失误或采用了不相容的固件版本,可能会导致交换机无法正常启动。 在这种情况下,通常能够借助FTP(文件传输协议)来恢复交换机的固件,从而使其恢复正常运作。 本文件详细阐述了利用FTP修复SCALANCE X系列交换机固件的方法,并具体说明了实施步骤。 当SCALANCE X系列交换机的固件出现故障时,设备在启动后会自动激活引导加载程序,并通过故障LED的闪烁来表明设备处于特殊情形。 在这种情形下,交换机能够充当FTP服务器,客户端建立联系,执行固件数据的传输。 需要特别强调的是,对于SCALANCE X200系列交换机,必须经由端口1来连接FTP客户端。 在实施步骤方面,首先需要为交换机指定一个IP地址。 这一步骤通常借助西门子公司提供的PST(Product Support Tools)软件来实施。 在成功配置IP地址之后,就可以通过FTP协议交换机内部的FTP服务器建立连接,并借助FTP客户端将固件文件传输到交换机。 需要留意的是,在传输固件文件之前,应当先从西门子技术支持网站获取对应订货号的固件版本文件。 一旦固件文件备妥,就可以开始FTP操作。 这通常涉及打开操作系统的DOS窗口,运用FTP指令连接到交换机的FTP服务器,并输入正确的用户名和密码进行身份验证。 在本案例中,用户名和密码均为“siemens”,并且传输模式设定为二进制。 随后,使用FTP的“put”指令将本地固件文件上传至交换机。 值得留意的是,固件文件名必须严格遵循大小写规则。 上传成功后,...
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值