Aditya Kamath
    • 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 New
    • Engagement control
    • Make a copy
    • 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 Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy 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
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # iGUARD: <ins>I</ins>n-<ins>G</ins>P<ins>U</ins> <ins>A</ins>dvanced <ins>R</ins>ace <ins>D</ins>etection We provide the source code and the setup for iGUARD (SOSP AE submission #11), a tool to detect races in GPU programs. iGUARD instruments GPU programs to detect races in them. It uses NVIDIA's NVBit [[1]](#references), a GPU binary instrumenter, as the framework for instrumentation. We provide the application binaries used in the evaluation of iGUARD for ease of use. However, we also provide links to the source code of applications/benchmark suites toward the end of this README. This README is divided into three major parts. In the first part, we describe the system requirements and bash scripts for reproducing the main results in the SOSP paper. In the second part, we provide a Docker container if one wishes to avoid manually installing the dependencies. Finally, the README provides a peek into different parameters of the tool and a very high-level view of source code organization. ## Hardware and software requirements Benchmarks were tested on machines with the following specs: * Host CPU: x86\_64 (preferably Intel Xeon) * OS: Ubuntu 20.04 (Linux kernel v 5.4.0-72) * CUDA version: 11.0 * GPU: NVIDIA Turing architecture (preferably RTX Titan) * CUDA driver version: >= 450.00 Required software packages can be installed through apt using the following command: ``` sudo apt-get install -y wget bc gcc time gawk libtbb-dev ``` ## Steps to setup and replicate results The following are the steps required to reproduce the results, along with the expected run time. All commands should be run in the main repository folder. 1. **Downloading NVBit and compiling detector. [5 - 10 minutes]** 2. **Replicating Table 4. [~3 hours]** 3. **Replicating Figure 9. [~3 hours]** 4. **Replicating Figure 10. [~30 minutes]** ### Downloading NVBit and compiling detector [5 - 10 minutes] The following command downloads, extracts, sets up NVBit, and compiles our iGUARD tool: ``` make setup ``` The compiled race detector, iGUARD, can be found at: *nvbit_release/tools/detector/detector.so* To delete the installation, run the following command: ``` make clean_detector ``` ### Replicating primary results (Figures and Tables) The [benchmarks](benchmarks/) folder contains all the binaries and scripts required to generate the results contained in the paper. Each subfolder in this folder is dedicated to generating a single figure/table. During execution, you may get "Error 124" or "Error 134" from make. These are normal, caused when benchmarks time out, and can safely be ignored. The time-outs happen either due to the presence of races (bugs) in the applications or due to the slowness of another race detector, Barracuda [[2]](#references), that we quantitatively compare against. **Table 4 [~3 hours]** Run the following command in the main repository folder: ``` make table_4 ``` This will run the appropriate benchmarks on iGUARD and Barracuda and report the number of races detected by each. Barracuda is a prior work that we quantitatively compare against. A single race (bug) in a program can manifest multiple times and involve different load/store operations. This is particularly true because iGUARD does not stop its detection on detecting a race in the program. iGUARD notes down the races it observed but continues to execute the program. The outputs of the race detector are parsed to count the number of unique races caught. The scripts responsible for parsing can be found inside the respective subfolders in *[benchmarks/Table_4](benchmarks/Table_4/)*, called *extract.sh*. Raw outputs for iGUARD and Barracuda will be contained in *benchmarks/Table_4/iGUARD/results/* and *benchmarks/Table_4/Barracuda/results/* respectively. Files starting with IGUARD_ and BARR_ contain the outputs when iGUARD and Barracuda are used, respectively. Final parsed results will be outputted in the terminal and are also contained at *benchmarks/Table_4/results.txt* in tab-separated format. Races are non-deterministic by their very nature. Not all races will manifest in every execution. The happens-before race detection philosophy that iGUARD partially relies upon can catch races only if they manifest. The scripts are set up to run each program five times by default to step aside possible non-determinism in the total number of races reported. If any slight variance is observed between the number of races reported by the tool and that in the paper, rerunning it should resolve the difference. **Figure 9 [~3 hours]** Run the following command in the main repository folder: ``` make figure_9 ``` This will run the appropriate benchmarks on iGUARD and Barracuda and measure the run time. Raw outputs and run times for iGUARD and Barracuda will be contained in *benchmarks/Figure_9/iGUARD/results/* and *benchmarks/Figure_9/Barracuda/results/* respectively. Output files starting with NODET_ contain the outputs when no detection is run, while IGUARD_ and BARR_ are when iGUARD and Barracuda are used, respectively. Final normalized results will be outputted in the terminal and are also contained at *benchmarks/Figure_9/results.txt* in tab-separated format. This can be imported into a spreadsheet of your choice to generate the appropriate figure. **Figure 10 [~30 minutes]** Run the following command in the main repository folder: ``` make figure_10 ``` This will run the appropriate benchmarks on iGUARD with and without lock contention optimizations (Section 6.5 in the paper) and measure the run time. Raw outputs with and without contention optimizations will be kept in *benchmarks/Figure_10/results/*. Output files starting with NODET_ contain the outputs when no detection is run, while IGUARD_OPT_ and IGUARD_ are when iGUARD is run with and without the optimizations, respectively. Final normalized results will be outputted in the terminal and are also contained at *benchmarks/Figure_10/results.txt* in tab-separated format. This can be imported into a spreadsheet of your choice to generate the appropriate figure. ## Docker setup (alternative) For convenience, we also provided a Dockerfile that has all the required dependencies. This is useful if one does not wish to install the dependencies manually. The following are the steps required to use this file. 1. Install Docker: https://docs.docker.com/engine/install/ 2. Setup the appropriate repository for the nvidia-container-runtime: https://nvidia.github.io/nvidia-container-runtime/ 3. Install nvidia-container-runtime: `sudo apt-get install nvidia-container-runtime` 4. Restart Docker for the changes to take effect: `sudo systemctl restart docker` 5. Build the dockerfile: `sudo docker build -t test .` 6. Generate required results. **Table 4**: `sudo docker run --gpus all test make table_4` **Figure 9**: `sudo docker run --gpus all test make figure_9` **Figure 10**: `sudo docker run --gpus all test make figure_10` Results will be outputted in tab-separated format directly to the terminal. For figures, the output is the normalized run times used to generate the graphs. For the table, the output is the number of races caught by the different detectors for each benchmark. Due to software overheads by Docker, performance numbers may vary slightly from those reported in the paper, but relative trends should remain the same. ## Behind the scenes: iGUARD's parameters, setup, and source code This is an optional section that provides more details about the tool itself for those who want to extend the tool in the future. ### Compilation To download NVBit and compile the detector, run the following command: ``` make setup ``` The compiled detector can be found at *nvbit_release/tools/detector/detector.so*. ### Running the race detector (iGUARD) Once compiled, the detector can be run on binaries containing NVIDIA GPU code by setting the LD_PRELOAD environment variable. For example, to run the detector on an application binary called *app.exe* contained in the main repository folder, you would run the following command: ``` LD_PRELOAD=./nvbit_release/tools/detector/detector.so ./app.exe ``` Compiling the application binary with `-lineinfo` flag allows iGUARD to output line numbers when races are detected. Otherwise, SASS offsets are used. ### Race detection options (parameters) We provide several knobs that allow users to change how the detection works. The major ones are listed below: - BYTE_GRAN: The granularity of a single data item (in bytes) considered by the detector. (default = 4) - CONT_OPT: Whether to perform contention optimizations (exponential backoff and detection coalescing) during race detection. (default = 1) - EXIT: Whether to quit on encountering the first race. (default = 0) - TIMEOUT: Time-out in seconds after which the application is terminated. 0 means never. (default = 0) To use these knobs, set them as environment variables when performing race detection. For example, to time-out after 4 seconds when performing detection on app.exe, we run the following command: ``` TIMEOUT=4 LD_PRELOAD=./nvbit_release/tools/detetor/detector.so ./app.exe ``` ### Source code The source code for the iGUARD race detector is found in the *[detector/](detector/)* folder. The major files are as follows: - **[detector.cu](detector/detector.cu)**: This contains the CPU-side code for the detector. This includes allocating memory for metadata, the binary instrumentation process, and outputting caught races to the user. - **[inject_funcs.cu](detector/inject_funcs.cu)**: This contains the CUDA code run on the GPU after instrumentation. This includes incrementing relevant counters on synchronization operations, adding/removing locks from the lock table, and performing the in-GPU race detection. ## Workloads (GPU benchmark suites, libraries and applications) The following table lists the workloads used in the evaluation of the submission version of the paper. This repository contains pre-compiled binaries from the open-source benchmark suites listed below. If one wishes, she/he can compile the workloads from source too. | Suite | Information | Code | Description | | ---------- | -------- | -------- | - | | ScoR | [[Paper]](https://www.csa.iisc.ac.in/~arkapravab/papers/isca20_ScoRD.pdf) | [[Github]](https://github.com/csl-iisc/ScoR) | Racey applications using scopes. | | CG | [[Blog]](https://developer.nvidia.com/blog/cooperative-groups/) | [[Github]](https://github.com/NVIDIA/cuda-samples) | Sample applications using NVIDIA Cooperative Groups. | | Gunrock | [[Paper]](https://escholarship.org/uc/item/9gj6r1dj) | [[Github]](https://github.com/gunrock/gunrock) | Graph processing system for GPUs. | | LonestarGPU | [[Paper]](http://cs.txstate.edu/~mb92/papers/iiswc12.pdf) | [[Github]](https://github.com/IntelligentSoftwareSystems/Galois/tree/master/lonestar/analytics/gpu) | GPU applications with irregular behaviour. | Kilo-TM | [[Paper]](https://ieeexplore.ieee.org/document/6174995) | [[Github]](https://github.com/upenn-acg/barracuda/tree/master/benchmarks/gpu-tm) | GPU applications with fine-grained communication between threads. | | SHoC | [[Paper]](https://dl.acm.org/doi/10.1145/1735688.1735702) | [[Github]](https://github.com/vetter/shoc) | Applications with heterogeneous compute. | CUB | [[Website]](https://nvlabs.github.io/cub/) | [[Github]](https://github.com/NVIDIA/cub) | Parallel compute primitives for GPUs. | | Rodinia | [[Paper]](https://www.cs.virginia.edu/~skadron/Papers/rodinia_iiswc09.pdf) | [[Website]](http://lava.cs.virginia.edu/Rodinia/download.htm) | Benchmarks for heterogeneous compute. ## References **[1]** NVBit [[Paper]](https://github.com/NVlabs/NVBit/releases/download/v1.0/MICRO_19_NVBit.pdf) [[Repository]](https://github.com/NVlabs/NVBit) **[2]** Barracuda [[Paper]](https://www.cs.uic.edu/~mansky/barracuda.pdf) [[Repository]](https://github.com/upenn-acg/barracuda)

    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