【问题标题】:How can I use tensorflow with Graphcore IPU [closed]如何在 Graphcore IPU 中使用 tensorflow [关闭]
【发布时间】:2020-06-29 12:14:25
【问题描述】:

我想用 graphcore IPU 测试性能,但我不知道如何使用 tensorflow。有人可以帮我做这件事吗?

【问题讨论】:

    标签: python tensorflow artificial-intelligence ipu


    【解决方案1】:

    Graphcore Poplar SDK 包含两个轮子文件,用于安装适用于 Python 3 的 v1.15 或 v2.1 TensorFlow 的 Graphcore 端口。您应该在虚拟环境中安装两个轮子文件之一,然后您需要再执行几个步骤即可在 IPU 设备上运行您的模型。

    根据应用程序,需要将一些特定于 IPU 的模块导入添加到您的程序中:

    from tensorflow.python.ipu import utils, ipu_compiler, scopes, loops, ipu_infeed_queue, ipu_outfeed_queue
    

    您必须确保通过将 TensorFlow 图形放置在 IPU 设备上来以 Graphcore IPU 硬件为目标,并删除代码中可能包含的任何 CPU/GPU/TPU 特定选项。然后,您可以使用自定义 IPU 编译器来编译 TensorFlow 图:

    with scopes.ipu_scope("/device:IPU:0"):
    compiled = ipu_compiler.compile(training_loop)
    

    下一步是配置 IPU 设备:基本配置将包括定义您希望模型在多少个 IPU 上运行。假设您只需要一个 IPU:

    config = utils.create_ipu_config()
    config = utils.auto_select_ipus(config, [1])
    utils.configure_ipu_system(config)
    

    我建议阅读相关参考指南 Targeting the IPU from TensorFlow 作为 TensorFlow-to-Poplar API 的主要介绍。您还可以参考 to this document 作为在 IPU 上移植 TensorFlow 模型的实用指南,并提供一些最佳实践指南。

    【讨论】:

      猜你喜欢
      • 2022-12-19
      • 1970-01-01
      • 2022-01-19
      • 1970-01-01
      • 2017-06-13
      • 1970-01-01
      • 2017-12-11
      • 1970-01-01
      • 2017-07-01
      相关资源
      最近更新 更多