Sabrina
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    ###### tags: `HPCAI` [TOC] # DLRM Lecture ### Co-designing with UCC ![](https://i.imgur.com/u9YoAu2.png =500x400) #### [Unified Collective Communications (UCC)](https://github.com/facebookresearch/ucc) - UCC is a collective communication operations API and library - Design Goals * 加速提供高性能和可擴展的集體操作 * Highly scalable and performant collectives for HPC, AI/ML and I/O workloads * Nonblocking collective operations that cover a variety of programming models * Flexible resource allocation model * Support for relaxed ordering model * Flexible synchronous model * Repetitive collective operations (init once and invoke multiple times) * Hardware collectives are a first-class citizen ### ML Growth and Scale at Facebook ![](https://i.imgur.com/nuJHxmf.png) - 這是用在Facebook AI training 標準的機器學習管線(ML pipeline) - compute workload 和 metrics 都有明顯的成長 - today 是 2019 ### Relative model importance ![](https://i.imgur.com/FfxL19f.png) ### Workload characteristics - CV and NLP models are smaller and compute intensive - Need high flops - Larger <font color="#ff5733">on-chip</font> memory helps - Recommender models are huge but lower compute intensity - Need high capacity, high bandwidth memory - Unstructured accesses benefit from <font color="#ff5733">caches</font> - High Network and IO requirements ![](https://i.imgur.com/3994ixW.png =300x300) :::info - **運算強度(arithmetic intensity)** - 運算強度越大,表示單位數據能支持更多次運算,也就是對記憶體帶寬的要求越低 - **On-chip** - GPU 的記憶體設計通常分成on-chip和off-chip,差別在於是否內建焊死 - On-chip內建記憶體有較好效能,off-chip是外接記憶體存取速度比較慢 - **Cache快取** - 存取快,但size小 - GPU沒有cache,但有bank存取資料 ::: ``` CV(Computer vision)電腦視覺 NLP(Natural Language Processing)自然語言處理 CNN(Convolutional Neural Network)卷積神經網路 NMT(Neural Machine Translation)神經機器翻譯 ``` ### Deep Learning Recommendation Models ![](https://i.imgur.com/clYSI49.png) ![](https://scontent.frmq4-1.fna.fbcdn.net/v/t39.2365-6/66324023_2056206621174067_2937830378620059648_n.gif?_nc_cat=111&ccb=1-5&_nc_sid=ad8a9d&_nc_ohc=cFGm0QLN_uAAX-_4y3x&_nc_oc=AQkXxnlKV-esBiVk4GvdN3Z13VQ3L1XmDurPo-h92k8ThXVJ8sPvAI8wWV5PpQp8ocaMP1q7hQExXMesGLiXlBpI&_nc_ht=scontent.frmq4-1.fna&oh=f4705c945cf3adbc57f8fe7da43dad0e&oe=611B40F6) :::info 使用embeddings處理分類特徵,而連續特徵使用底部MLP處理 最後 MLP 處理結果並給出點擊概率(a probability of a click) ::: ``` MLP(multilayer perceptron)多層感知器 MLP可以被看作是一個有向圖 主要優勢在於其快速解決複雜問題的能力 ``` - [Reference](https://ai.facebook.com/blog/dlrm-an-advanced-open-source-deep-learning-recommendation-model/) ## Distributed PyTorch ### PyTorch - **PyTorch**是一個開源的Python機器學習庫,基於Torch,底層由C++實現,應用於人工智慧領域,如自然語言處理 - Torch is an open-source machine learning library - 最初由Facebook的人工智慧研究團隊開發,並且被用於Uber的概率編程軟體Pyro。 - [What is PyTorch?](https://youtu.be/u7x8RXwLKcA) - Open source deep learning frameworks - It provides: - Fast - Flexible experimentation - Seamless transition - PyTorch is a Python-based scientific computing package serving two broad purposes: - 利用 GPU 進行更快的訓練 - An automatic differentiation library that is useful to implement neural networks. - PyTorch包括torch.nn、torch.optim等子模組 - Tensor:是一種特殊的數據結構,與數組和矩陣非常相似 ![](https://i.imgur.com/AcwQz5w.png) ### PyTorch Process Group #### PYTORCH DISTRIBUTED OVERVIEW - 功能torch.distributed可以分為三個主要組件: - Distributed Data-Parallel Training(DDP)分佈式數據並行訓練 - RPC-Based Distributed Training(RPC)基於 RPC 的分佈式訓練 - Collective Communication(c10d)集體通信 - [Reference1](https://github.com/pytorch/pytorch/blob/master/torch/distributed/CONTRIBUTING.md) - [Reference2](https://pytorch.org/tutorials//beginner/dist_overview.html) ![](https://github.com/pytorch/pytorch/raw/master/docs/source/_static/img/pt_distributed_arch.png) - 大部分都是用C++,然後綁定到 Python 前端 #### Process Group (PG) - 決定要如何進行,例如在同一個機器或是跨機器 - PG exposes a set of communication APIs, e.g., send, recv, broadcast, allgather, allreduce, etc. - Process Group backends - ProcessGroup==Gloo==.hpp - ProcessGroup==MPI==.hpp - ProcessGroup==NCCL==.hpp ![](https://i.imgur.com/zEG5k8Y.png) [![](https://i.imgur.com/geovqQc.png)](https://pytorch.org/docs/stable/distributed.html) - torch.distributed支持三個內置後端,每個後端都有不同的功能。下表顯示了哪些函數可用於 CPU / CUDA 張量。僅當用於構建 PyTorch 的實現支持 CUDA 時,MPI 才支持它 - 使用哪個後端? - 經驗法則 - 使用 NCCL 後端進行分佈式GPU訓練 - 使用 Gloo 後端進行分佈式CPU訓練 - 具有 InfiniBand 互連的 GPU 主機 - 使用 NCCL,因為它是目前唯一支持 InfiniBand 和 GPUDirect 的後端。 - 具有以太網互連的 GPU 主機 - 使用 NCCL,因為它目前提供了最好的分佈式GPU訓練性能。如果在使用NCCL時遇到問題,請使用 Gloo 作為後備選項。(對於GPU,Gloo目前的運行速度比NCCL 慢) - 具有 InfiniBand 互連的 CPU 主機 - 如果您的 InfiniBand 已啟用 IP over IB,請使用 Gloo,否則,請改用 MPI。我們計劃在即將發布的版本中添加對 Gloo 的 InfiniBand 支持。 - 具有以太網互連的 CPU 主機 - 使用 Gloo,除非您有使用 MPI 的特定原因。 ### PyTorch UCC Process Group ![](https://i.imgur.com/kTei7X1.png) - PyTorch UCC Process Group aka Torch-UCC - Out-of-box performance, portability, and robustness-across platforms - Deploy in FB AI-training systems in production - 多了一個UCC的通訊後端 - 跨平台的可移植性、穩健性 ### PARAM-Comms: AI training Comms benchmarks - PARAM Benchmarks 是一個用於評估訓練和推理平台的通信和計算微基準以及完整工作負載的存儲庫 ![](https://i.imgur.com/AKFDdi4.png) - [PARAM-Comms](https://github.com/facebookresearch/param) - Blocking vs.non-blocking, single collective-similar to NCCL-tests, OSU/Intel MPI benchmarks - Captures DLRM comms behavior - collective pattern+ message sizes + training loop - PARAM 補充了兩大類常用的基準: - 使用 cuDNN、MKL、NCCL、MPI 庫的基於 C++ 的獨立計算和通信基準測試,例如 NCCL 測試、OSU MPI 基準和DeepBench - 應用程序基準,例如 DLRM 和更廣泛的 MLPerf benchmarks #### [block vs non-block communication](https://chenhh.gitbooks.io/parallel_processing/content/mpi/mpich_p2p_prog.html#block-vs-non-block-communication)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully