1. <strong id="7actg"></strong>
    2. <table id="7actg"></table>

    3. <address id="7actg"></address>
      <address id="7actg"></address>
      1. <object id="7actg"><tt id="7actg"></tt></object>

        Futhark函數(shù)式編程語言

        聯(lián)合創(chuàng)作 · 2023-09-29 13:34

        Futhark 是一個小型全新的函數(shù)式編程語言,可編譯為高性能的 GPU 代碼。使用靜態(tài)類型、并行數(shù)據(jù)以及純函數(shù)數(shù)組語言。該語言對編譯器提前進行重度的優(yōu)化,通過 OpenCL 生成 GPU 代碼。Futhark 并非為圖形編程而設(shè)計,通過使用 GPU 來加速并行的數(shù)組計算,支持常規(guī)嵌套的數(shù)據(jù)并行化處理。

        Futhark 使用 Haskell 語言開發(fā)。

        示例代碼:

        fun int max(int x, int y) =
          if x > y then x else y
        
        fun {int,int,int,int} redOp({int,int,int,int} x,
                                    {int,int,int,int} y) =
          let {mssx, misx, mcsx, tsx} = x in
          let {mssy, misy, mcsy, tsy} = y in
          { max(mssx, max(mssy, mcsx + misy))
          , max(misx, tsx+misy)
          , max(mcsy, mcsx+tsy)
          , tsx + tsy }
        
        fun {int,int,int,int} mapOp(int x) =
          { max(x,0), max(x,0), max(x,0), x }
        
        fun int main([int] xs) =
          let {x, _, _, _} =
            reduce(redOp, {0,0,0,0}, map(mapOp, xs)) in
          x
        瀏覽 19
        點贊
        評論
        收藏
        分享

        手機掃一掃分享

        編輯 分享
        舉報
        評論
        圖片
        表情
        推薦
        點贊
        評論
        收藏
        分享

        手機掃一掃分享

        編輯 分享
        舉報
        1. <strong id="7actg"></strong>
        2. <table id="7actg"></table>

        3. <address id="7actg"></address>
          <address id="7actg"></address>
          1. <object id="7actg"><tt id="7actg"></tt></object>
            91美女图片黄在线观看 | 69久久久久久久 | 国产成人777777精品综合 | 婷婷五月色综合 | 中国乱伦一级大黄片 | 精品人妻一区二区免费蜜桃视频 | 少妇宾馆露脸高潮不断 | 国语自产少妇精品视频蜜桃 | 国产精品日日爽夜夜爽AV | 欧美成人777奇米影视91色 |