【问题标题】:How to have Apache Spark running on GPU?如何让 Apache Spark 在 GPU 上运行?
【发布时间】:2017-07-08 18:19:07
【问题描述】:

我想将 apache spark 与 GPU 集成,但 spark 在 java 上工作,而 gpu 使用 CUDA/OpenCL 那么我们如何合并它们。

【问题讨论】:

    标签: apache-spark cuda opencl gpu cpu


    【解决方案1】:

    有一些库可以帮助解决这个难题。

    Databricks 正在使用 TensorFlow 开发 Spark 解决方案,该解决方案将允许您使用集群或机器的 GPU。

    如果您想了解更多关于 Spark Summit Europe 2016 的演示文稿,此演示文稿将展示 TensorFrames 的工作原理。

    这是一篇关于 TensoFrames 在 DataBricks 博客中的帖子。

    有关更多代码信息,请参阅Git of Tensorframes

    【讨论】:

      【解决方案2】:

      这取决于你想做什么。如果您想使用 spark 使用 GPU 分配计算,则不必使用 java。您可以将 python (pyspark) 与具有 cuda 模块的 numba 一起使用。

      例如,如果您希望工作节点在 RDD 的每个块上计算操作(此处为 gpu_function),则可以应用此代码。

      rdd = rdd.mapPartition(gpu_function)
      

      与:

      def gpu_function(x):
          ...
          input = f(x)
          output = ...
          gpu_cuda[grid_size,block_size](input,output)
          return output
      

      和:

      from numba import cuda
      @cuda.jit("(float32[:],float32[:])")
      def gpu_cuda(input,output)
          output = g(input)
      

      我建议你看一下幻灯片分享网址:https://fr.slideshare.net/continuumio/gpu-computing-with-apache-spark-and-python,特别是幻灯片 34。

      您只需要在每个工作节点上安装 numba 和 cuda 驱动程序。

      【讨论】:

        猜你喜欢
        • 2018-12-02
        • 1970-01-01
        • 1970-01-01
        • 2017-03-11
        • 2015-05-23
        • 2021-04-07
        • 2021-08-03
        • 2011-05-12
        • 2020-08-11
        相关资源
        最近更新 更多