OpenACC:设备类型
OpenACC: DEVICE TYPE
我看到很多功能,例如 acc_get_num_devices()
,需要输入 设备类型。我用 int devtype=acc_get_device_type()
那 returns devtype=2.
(在文档中:
acc_get_num_devices(设备类型)
Returns指定类型的设备数量)
这2是什么意思?有哪些设备类型?设备类型是整数吗?
(我觉得很荒谬,我在文档中找不到这些信息)
有关device_type
用法的一般说明,请参阅specification 的第2.4 节。另请参阅附录 A(不是规范的正式部分),了解您可能会遇到的典型设备类型的建议。
device_type
用于指定特定的加速器类型,它是实现定义的。因此,可供选择的特定类型将由您使用的 OpenACC 感知编译器定义。
使用 PGI 编译器实现,device_type
的选择应对应于 -ta=...
编译器开关的可用选择。
OpenACC 指令中 device_type
子句的典型用途是(进一步)针对特定设备类型限制该指令的行为。例如,特定的优化(例如选择要使用的向量长度)可以在特定 device_type
.
上以 运行 为条件
is a particular (obsolete) example. The device_type is used to either parallelize a particular loop, or run it sequentially, depending on device type that you are actually running on. I say obsolete because I don't think -ta=radeon
is a supported configuration for the most recent versions of the PGI OpenACC compilers (after 17.x). You can see another example of usage of device_type
in this blog and in this blog
我相信C/C++,数据类型是枚举类型,而在 Fortran 中它可能形式上是整数。自然地,在 C/C++ 中,枚举可能具有底层整数关联。与其担心特定实现中特定整数值的含义,不如使用 enums/defines 来引用这些
可能更好
我看到很多功能,例如 acc_get_num_devices()
,需要输入 设备类型。我用 int devtype=acc_get_device_type()
那 returns devtype=2.
(在文档中: acc_get_num_devices(设备类型) Returns指定类型的设备数量)
这2是什么意思?有哪些设备类型?设备类型是整数吗?
(我觉得很荒谬,我在文档中找不到这些信息)
有关device_type
用法的一般说明,请参阅specification 的第2.4 节。另请参阅附录 A(不是规范的正式部分),了解您可能会遇到的典型设备类型的建议。
device_type
用于指定特定的加速器类型,它是实现定义的。因此,可供选择的特定类型将由您使用的 OpenACC 感知编译器定义。
使用 PGI 编译器实现,device_type
的选择应对应于 -ta=...
编译器开关的可用选择。
OpenACC 指令中 device_type
子句的典型用途是(进一步)针对特定设备类型限制该指令的行为。例如,特定的优化(例如选择要使用的向量长度)可以在特定 device_type
.
-ta=radeon
is a supported configuration for the most recent versions of the PGI OpenACC compilers (after 17.x). You can see another example of usage of device_type
in this blog and in this blog
我相信C/C++,数据类型是枚举类型,而在 Fortran 中它可能形式上是整数。自然地,在 C/C++ 中,枚举可能具有底层整数关联。与其担心特定实现中特定整数值的含义,不如使用 enums/defines 来引用这些
可能更好