diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..05e8dc3 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,34 @@ +name: build + +on: + push: + paths-ignore: + - '*.md' + + pull_request: + paths-ignore: + - '*.md' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: Install LLVM and Clang + uses: KyleMayes/install-llvm-action@v1 + with: + version: "10.0" + - name: Build project + run: | + mkdir build + cd build + cmake .. -DLLVM_CONFIG_PATH=`which llvm-config` + make + - name: Execute the test example + run: | + cd ${{ github.workspace }}/compilation/examples + bash run_example.sh diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..f9af12f --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,28 @@ +# copied from MMCV (github.com/open-mmlab/mmcv) +name: lint + +on: [push, pull_request] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + lint: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.7 + uses: actions/setup-python@v2 + with: + python-version: 3.7 + - name: Install pre-commit hook + run: | + # markdownlint requires ruby >= 2.7 + sudo apt-add-repository ppa:brightbox/ruby-ng -y + sudo apt-get update + sudo apt-get install -y ruby2.7 + pip install pre-commit + pre-commit install + - name: Linting + run: pre-commit run --all-files diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9795b88 --- /dev/null +++ b/.gitignore @@ -0,0 +1,43 @@ +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + +# LLVM files +*.bc + +# CMake temp files +Makefile +CMakeCache.txt +*.cmake + +# Log files +*.log diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..2c1037f --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,20 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.3.0 + hooks: + - id: end-of-file-fixer + - id: trailing-whitespace + - id: check-added-large-files +- repo: https://github.com/pre-commit/mirrors-clang-format + rev: v13.0.0 + hooks: + - id: clang-format +- repo: https://github.com/cheshirekow/cmake-format-precommit + rev: v0.6.13 + hooks: + - id: cmake-format + - id: cmake-lint +- repo: https://github.com/igorshubovych/markdownlint-cli + rev: v0.30.0 + hooks: + - id: markdownlint-fix diff --git a/README.md b/README.md index 34461f1..013d9f7 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# COX: CUDA on X86 +# CuPBoP: Cuda for Parallelized and Broad-range Processors ## Introduction -This project consists of two parts: a series of LLVM passes that -achieve a SPMD NVVM IR as input, and output the corresponding -MPMD+SIMD version of LLVM IR which can be execute on CPU devices. +CuPBoP (Cuda for parallelized and broad-range processors) is a framework +aims to execute CUDA source code on non-NVIDIA devices, +including CPU, GPU and other architectures. ## Install @@ -22,8 +22,8 @@ MPMD+SIMD version of LLVM IR which can be execute on CPU devices. 1. Clone from github ```bash - git clone https://github.com/drcut/open_source_template - cd open_source_template + git clone https://github.com/cupbop/CuPBoP + cd CuPBoP ``` 2. Build the transformer for NVVM IR to LLVM IR for X86 @@ -55,8 +55,12 @@ g++ ../compilation/examples/vecadd/host.cpp \ ./vecadd_example ``` +## Contribution + +We sincerely appreciate all kinds of contributions. +Please refer to [CONTRIBUTING](docs/CONTRIBUTING.md) for the contributing guideline. + ## Author -[Ruobing Han](https://drcut.github.io/) is a CS phd student in -Georgia Institute Technology, under the supervision -of Prof. [Hyesoon Kim](https://www.cc.gatech.edu/~hyesoon/). +* [Ruobing Han](https://drcut.github.io/) +* [Hyesoon Kim](https://www.cc.gatech.edu/~hyesoon/) diff --git a/CONTRIBUTING.md b/docs/CONTRIBUTING.md similarity index 72% rename from CONTRIBUTING.md rename to docs/CONTRIBUTING.md index 90d3f91..0284fbc 100644 --- a/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -1,6 +1,6 @@ -# Contributing to COX +# Contributing to CuPBoP -Thank you for your interest in contributing to COX! +Thank you for your interest in contributing to CuPBoP! We appreciate all contributions, including but not limited to: - Add documentation @@ -10,9 +10,9 @@ We appreciate all contributions, including but not limited to: ## How to contribute? 0. (Optional) Open an issue and discuss your idea before start -1. Fork the latest version COX +1. Fork the latest version CuPBoP 2. Commit to the forked repo -3. Create a Pull Request to COX main branch +3. Create a Pull Request to CuPBoP main branch ## Code style @@ -21,14 +21,15 @@ To make sure your contribution is following the correct style, we highly recommend you to install [pre-commit](https://pre-commit.com/) before development. ```bash -# Python environment is required +# Python3 environment is required pip install pre-commit ``` Then, from the repository folder, execute the following instruction: ```bash - pre-commit install +# execute in CuPBoP's root folder +pre-commit install ``` With pre-commit plugin, each local commit will be automatically checked. diff --git a/docs/figures/workflow.png b/docs/figures/workflow.png new file mode 100644 index 0000000..3019f92 Binary files /dev/null and b/docs/figures/workflow.png differ diff --git a/docs/workflow.md b/docs/workflow.md new file mode 100644 index 0000000..cef8328 --- /dev/null +++ b/docs/workflow.md @@ -0,0 +1,11 @@ +# The workflow of CuPBoP + +The workflow of CuPBoP is described as following: +![The workflow of executing CUDA applications on CuPBoP.](figures/workflow.png) +First, CuPBoP uses Clang to compile the CUDA source code into NVVM IR, +which consists of two parts: Host part and Kernel Part. +In the next step, CuPBoP-compilation parses and transforms these NVVM IRs +to make it suitable for executing on specific architectures. +The CuPBoP-runtime compiles the transformed Host IR and executes the generated programs, +which will compile the transformed Kernel IR and +upload the compiled kernel programs to specific architectures.