From 9bb1465a044c0ed7d9244d571a957f86eafb5b92 Mon Sep 17 00:00:00 2001 From: yolo2themoon Date: Mon, 18 Oct 2021 20:18:32 +0800 Subject: [PATCH 01/15] [ci] Benchmark presubmit test --- .github/workflows/presubmit.yml | 23 +++++++++++++++++++++++ benchmarks/misc/membound.py | 2 +- benchmarks/misc/run.py | 21 +++++++++++++++++---- 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index 419820005..86c22401a 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -293,3 +293,26 @@ jobs: TI_LIB_DIR=`python3 -c "import taichi;print(taichi.__path__[0])" | tail -1` TI_LIB_DIR="$TI_LIB_DIR/lib" ./build/taichi_cpp_tests ti test -vr2 -t4 -x + + performance_monitoring: + name: Performance monitoring (NVGPU) + timeout-minutes: 60 + runs-on: [self-hosted, x64, cuda, linux, ubuntu20.04, rtx2060, benchmark] + steps: + - name: clone branch of PR + uses: actions/checkout@v2 + with: + token: ${{ secrets.GARDENER_PAT }} + ref: ${{ github.event.client_payload.pull_request.head.ref }} + repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }} + - name: Build + run: | + REPO_DIR=`pwd` + export TAICHI_REPO_DIR=$REPO_DIR + export PYTHONPATH=$TAICHI_REPO_DIR/python:$PYTHONPATH + export PATH=$TAICHI_REPO_DIR/bin:$PATH + git submodule update --init --recursive --depth=1 + TAICHI_CMAKE_ARGS="-DTI_WITH_CUDA_TOOLKIT:BOOL=ON" python3 setup.py develop --user + - name: Run benchmark + run: | + python3 benchmarks/misc/run.py \ No newline at end of file diff --git a/benchmarks/misc/membound.py b/benchmarks/misc/membound.py index 55bfd3c99..c2aedab9d 100644 --- a/benchmarks/misc/membound.py +++ b/benchmarks/misc/membound.py @@ -8,7 +8,7 @@ test_cases = [fill, saxpy, reduction] test_archs = [ti.cuda] test_dtype = [ti.i32, ti.i64, ti.f32, ti.f64] -test_dsize = [(4**i) * kibibyte for i in range(1, 11)] #[4KB,16KB...1GB] +test_dsize = [(4**i) * kibibyte for i in range(1, 10)] #[4KB,16KB...256MB] test_repeat = 10 results_evaluation = [geometric_mean] diff --git a/benchmarks/misc/run.py b/benchmarks/misc/run.py index 69fff53d8..50308fb4a 100644 --- a/benchmarks/misc/run.py +++ b/benchmarks/misc/run.py @@ -1,4 +1,7 @@ +import datetime + from membound import Membound +from taichi.core import ti_core as _ti_core import taichi as ti @@ -18,9 +21,19 @@ def run(self): for s in self.suites: s.run() - def write_md(self): - filename = f'performance_result.md' - with open(filename, 'w') as f: + def write_md(self,path='/home/benchmarkbot/benchmark/'): + current_time = datetime.datetime.now().strftime("%Y%m%dd%Hh%Mm%Ss") + commit_hash = _ti_core.get_commit_hash()[:8] + filename = f'perfresult_{current_time}_{commit_hash}.md' + #format like perfresult_20211013d20h46m03s_581fdac8.md + #TODO: get pr id and add to file name perfresult_pr3104_20211013d20h46m03s_581fdac8.md + with open(path+filename, 'w') as f: + for arch in test_archs: + for s in self.suites: + lines = s.mdlines(arch) + for line in lines: + print(line, file=f) + with open('performance_result.md', 'w') as f: # for /benchamark for arch in test_archs: for s in self.suites: lines = s.mdlines(arch) @@ -30,4 +43,4 @@ def write_md(self): p = PerformanceMonitoring() p.run() -p.write_md() +p.write_md() \ No newline at end of file From c190bbc40ab79c589952c73da5e952468b601f05 Mon Sep 17 00:00:00 2001 From: yolo2themoon Date: Mon, 18 Oct 2021 20:20:22 +0800 Subject: [PATCH 02/15] format --- benchmarks/misc/run.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/benchmarks/misc/run.py b/benchmarks/misc/run.py index 50308fb4a..0ecf36a28 100644 --- a/benchmarks/misc/run.py +++ b/benchmarks/misc/run.py @@ -21,19 +21,19 @@ def run(self): for s in self.suites: s.run() - def write_md(self,path='/home/benchmarkbot/benchmark/'): + def write_md(self, path='/home/benchmarkbot/benchmark/'): current_time = datetime.datetime.now().strftime("%Y%m%dd%Hh%Mm%Ss") commit_hash = _ti_core.get_commit_hash()[:8] filename = f'perfresult_{current_time}_{commit_hash}.md' #format like perfresult_20211013d20h46m03s_581fdac8.md #TODO: get pr id and add to file name perfresult_pr3104_20211013d20h46m03s_581fdac8.md - with open(path+filename, 'w') as f: + with open(path + filename, 'w') as f: for arch in test_archs: for s in self.suites: lines = s.mdlines(arch) for line in lines: print(line, file=f) - with open('performance_result.md', 'w') as f: # for /benchamark + with open('performance_result.md', 'w') as f: # for /benchamark for arch in test_archs: for s in self.suites: lines = s.mdlines(arch) @@ -43,4 +43,4 @@ def write_md(self,path='/home/benchmarkbot/benchmark/'): p = PerformanceMonitoring() p.run() -p.write_md() \ No newline at end of file +p.write_md() From 9361c5d7547ec229c97e268e0d9abc9c0348500b Mon Sep 17 00:00:00 2001 From: yolo2themoon Date: Mon, 18 Oct 2021 20:26:49 +0800 Subject: [PATCH 03/15] checkout --- .github/workflows/presubmit.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index 86c22401a..0c24ff9d9 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -296,15 +296,14 @@ jobs: performance_monitoring: name: Performance monitoring (NVGPU) + needs: check_code_format timeout-minutes: 60 runs-on: [self-hosted, x64, cuda, linux, ubuntu20.04, rtx2060, benchmark] steps: - - name: clone branch of PR uses: actions/checkout@v2 with: - token: ${{ secrets.GARDENER_PAT }} - ref: ${{ github.event.client_payload.pull_request.head.ref }} - repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }} + submodules: 'recursive' + - name: Build run: | REPO_DIR=`pwd` @@ -313,6 +312,7 @@ jobs: export PATH=$TAICHI_REPO_DIR/bin:$PATH git submodule update --init --recursive --depth=1 TAICHI_CMAKE_ARGS="-DTI_WITH_CUDA_TOOLKIT:BOOL=ON" python3 setup.py develop --user + - name: Run benchmark run: | python3 benchmarks/misc/run.py \ No newline at end of file From 5310751e31e8061137df4687ed1f7769121970f6 Mon Sep 17 00:00:00 2001 From: yolo2themoon Date: Mon, 18 Oct 2021 20:32:03 +0800 Subject: [PATCH 04/15] checkout --- .github/workflows/presubmit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index 0c24ff9d9..d8aa56905 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -300,7 +300,7 @@ jobs: timeout-minutes: 60 runs-on: [self-hosted, x64, cuda, linux, ubuntu20.04, rtx2060, benchmark] steps: - uses: actions/checkout@v2 + - uses: actions/checkout@v2 with: submodules: 'recursive' From b915b19641ea4d0bbce62e6f746bd54e8768a159 Mon Sep 17 00:00:00 2001 From: yolo2themoon Date: Mon, 18 Oct 2021 20:34:15 +0800 Subject: [PATCH 05/15] trigger ci --- benchmarks/misc/run.py | 1 - 1 file changed, 1 deletion(-) diff --git a/benchmarks/misc/run.py b/benchmarks/misc/run.py index 0ecf36a28..d9d20eaf6 100644 --- a/benchmarks/misc/run.py +++ b/benchmarks/misc/run.py @@ -26,7 +26,6 @@ def write_md(self, path='/home/benchmarkbot/benchmark/'): commit_hash = _ti_core.get_commit_hash()[:8] filename = f'perfresult_{current_time}_{commit_hash}.md' #format like perfresult_20211013d20h46m03s_581fdac8.md - #TODO: get pr id and add to file name perfresult_pr3104_20211013d20h46m03s_581fdac8.md with open(path + filename, 'w') as f: for arch in test_archs: for s in self.suites: From 92b98dd3f7106e2801a1bba7af99b309dc62227e Mon Sep 17 00:00:00 2001 From: yolo2themoon Date: Mon, 18 Oct 2021 21:12:32 +0800 Subject: [PATCH 06/15] sys.argv[1] path to store --- .github/workflows/presubmit.yml | 2 +- benchmarks/misc/run.py | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index d8aa56905..b0be3492a 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -315,4 +315,4 @@ jobs: - name: Run benchmark run: | - python3 benchmarks/misc/run.py \ No newline at end of file + python3 benchmarks/misc/run.py /home/benchmarkbot/benchmark/ \ No newline at end of file diff --git a/benchmarks/misc/run.py b/benchmarks/misc/run.py index d9d20eaf6..4ff0ef0eb 100644 --- a/benchmarks/misc/run.py +++ b/benchmarks/misc/run.py @@ -1,4 +1,5 @@ import datetime +import sys from membound import Membound from taichi.core import ti_core as _ti_core @@ -21,25 +22,24 @@ def run(self): for s in self.suites: s.run() - def write_md(self, path='/home/benchmarkbot/benchmark/'): - current_time = datetime.datetime.now().strftime("%Y%m%dd%Hh%Mm%Ss") - commit_hash = _ti_core.get_commit_hash()[:8] - filename = f'perfresult_{current_time}_{commit_hash}.md' - #format like perfresult_20211013d20h46m03s_581fdac8.md - with open(path + filename, 'w') as f: - for arch in test_archs: - for s in self.suites: - lines = s.mdlines(arch) - for line in lines: - print(line, file=f) - with open('performance_result.md', 'w') as f: # for /benchamark + def write_to_path(self, path_with_file_name='./performance_result.md'): + with open(path_with_file_name, 'w') as f: for arch in test_archs: for s in self.suites: lines = s.mdlines(arch) for line in lines: print(line, file=f) + def store_with_date_and_commit_hash(self, path='./'): + current_time = datetime.datetime.now().strftime("%Y%m%dd%Hh%Mm%Ss") + commit_hash = _ti_core.get_commit_hash()[:8] + filename = f'perfresult_{current_time}_{commit_hash}.md' + print('store to: ' + path + filename) + self.write_to_path(path + filename) + +path_to_store = sys.argv[1] if len(sys.argv) > 1 else './' p = PerformanceMonitoring() p.run() -p.write_md() +p.write_to_path() # for /benchamark +p.store_with_date_and_commit_hash(path_to_store) #for post-submit From 02700850f733f126e794a614e5d68cb1335e879d Mon Sep 17 00:00:00 2001 From: Jiasheng Zhang Date: Tue, 19 Oct 2021 14:35:39 +0800 Subject: [PATCH 07/15] use docker CI (#99) --- .github/workflows/presubmit.yml | 294 +------------------------------- 1 file changed, 9 insertions(+), 285 deletions(-) diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index 419820005..1c3b74f69 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -4,292 +4,16 @@ on: types: [opened, synchronize, reopened] jobs: - title_format: - name: Check PR Title - if: ${{ github.event.pull_request }} + docker_cpu_build: runs-on: ubuntu-latest + container: registry.taichigraphics.com/taichidev-ubuntu20.04-test:v0.1 steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - with: - python-version: 3.8 + - run: | + ti test - - name: Run PR Title Checker - run: | - pip install semver GitPython - python misc/ci_check_pr_title.py "$PR_TITLE" - env: - PR_TITLE: ${{ github.event.pull_request.title }} - - check_code_format: - name: Check Code Format - runs-on: ubuntu-latest - # This job will be required to pass before merging to master branch. - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - - name: Setup git & clang-format - run: | - git config user.email "taichigardener@gmail.com" - git config user.name "Taichi Gardener" - git checkout -b _fake_squash - git remote add upstream https://github.com/taichi-dev/taichi.git - git fetch upstream master - sudo apt install clang-format-10 - - - name: Cache PIP - uses: actions/cache@v2 - with: - path: ~/.cache/pip - key: ${{ hashFiles('setup.py') }}-${{ hashFiles('requirements_dev.txt') }} - - - name: Install requirements - run: | - python3 -m pip install --user -r requirements_dev.txt - - - name: Check code format - run: | - python3 misc/code_format.py - git checkout -b _enforced_format - git commit -am "enforce code format" || true - # exit with 1 if there were differences: - git diff _fake_squash _enforced_format --exit-code - - - name: Pylint - run: | - # Make sure pylint doesn't regress - pylint python/taichi/ --disable=all --enable=C0415 - if [ $? -eq 0 ] - then - echo "PASSED: pylint is happy" - exit 0 - else - echo "FAILED: please run the pylint command above and make sure it passes" - exit 1 - fi - - build_and_test_cpu_required: - # This job will be required to pass before merging to master branch. - name: Required Build and Test (CPU) - needs: check_code_format - timeout-minutes: 60 - strategy: - matrix: - include: - - os: ubuntu-latest - python: 3.6 - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v2 - with: - submodules: 'recursive' - - - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python }} - - - name: Download Pre-Built LLVM 10.0.0 - run: | - python misc/ci_download.py - mkdir taichi-llvm - cd taichi-llvm - unzip ../taichi-llvm.zip - env: - CI_PLATFORM: ${{ matrix.os }} - - - name: Build & Install - run: .github/workflows/scripts/unix_build.sh - env: - CI_SETUP_CMAKE_ARGS: -DTI_WITH_OPENGL:BOOL=OFF -DTI_WITH_CC:BOOL=ON -DTI_WITH_VULKAN:BOOL=OFF -DTI_BUILD_TESTS:BOOL=ON - CXX: clang++ - - - name: Test - run: .github/workflows/scripts/unix_test.sh - - build_and_test_cpu: - name: Build and Test (CPU) - needs: build_and_test_cpu_required - timeout-minutes: 60 - strategy: - matrix: - include: - - os: macos-latest - python: 3.7 - with_cc: OFF - with_cpp_tests: ON - - os: ubuntu-latest - python: 3.9 - with_cc: OFF - with_cpp_tests: OFF - - os: ubuntu-latest - python: 3.8 - with_cc: ON - with_cpp_tests: OFF - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v2 - with: - submodules: 'recursive' - - - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python }} - - - name: Download Pre-Built LLVM 10.0.0 - run: | - python misc/ci_download.py - mkdir taichi-llvm - cd taichi-llvm - unzip ../taichi-llvm.zip - env: - CI_PLATFORM: ${{ matrix.os }} - - - name: Build & Install - run: .github/workflows/scripts/unix_build.sh - env: - CI_SETUP_CMAKE_ARGS: -DTI_WITH_OPENGL:BOOL=OFF -DTI_WITH_CC:BOOL=${{ matrix.with_cc }} -DTI_WITH_VULKAN:BOOL=OFF -DTI_BUILD_TESTS:BOOL=${{ matrix.with_cpp_tests }} - CXX: clang++ - # [DEBUG] Copy this step around to enable debugging inside Github Action instances. - #- name: Setup tmate session - # uses: mxschmitt/action-tmate@v3 - # with: - # limit-access-to-actor: true - - - name: Test - run: .github/workflows/scripts/unix_test.sh - env: - RUN_CPP_TESTS: ${{ matrix.with_cpp_tests }} - - build_and_test_gpu_linux: - name: Build and Test (GPU) - needs: check_code_format - runs-on: [self-hosted, cuda, vulkan, cn] - timeout-minutes: 60 - steps: - - uses: actions/checkout@v2 - with: - submodules: 'recursive' - - - name: Build - run: | - export PATH=$PATH:/usr/local/cuda/bin - .github/workflows/scripts/unix_build.sh - env: - LLVM_LIB_ROOT_DIR: /opt/taichi-llvm-10.0.0 - CI_SETUP_CMAKE_ARGS: -DTI_WITH_OPENGL:BOOL=ON -DTI_WITH_CC:BOOL=OFF -DTI_WITH_VULKAN:BOOL=ON - BUILD_NUM_THREADS: 8 - LLVM_PATH: /opt/taichi-llvm-10.0.0/bin - LLVM_DIR: /opt/taichi-llvm-10.0.0/lib/cmake/llvm - CXX: clang++-8 - - - name: Test - run: .github/workflows/scripts/unix_test.sh - env: - DISPLAY: :1 - GPU_TEST: ON - - build_and_test_windows: - name: Build and Test (Windows) - needs: check_code_format - runs-on: windows-latest - timeout-minutes: 90 - steps: - - - name: Install 7Zip PowerShell - shell: powershell - run: Install-Module 7Zip4PowerShell -Force -Verbose - - - uses: actions/checkout@v2 - with: - submodules: 'recursive' - - - uses: actions/setup-python@v2 - with: - python-version: 3.7 - - - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v1.0.2 - - - name: Download And Install Vulkan - shell: powershell - run: | - Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/1.2.189.0/windows/VulkanSDK-1.2.189.0-Installer.exe" -OutFile VulkanSDK.exe - $installer = Start-Process -FilePath VulkanSDK.exe -Wait -PassThru -ArgumentList @("/S"); - $installer.WaitForExit(); - - - name: Build - shell: powershell - run: | - $env:Path += ";C:/VulkanSDK/1.2.189.0/Bin" - cd C:\ - Remove-item alias:curl - curl --retry 10 --retry-delay 5 https://github.com/taichi-dev/taichi_assets/releases/download/llvm10/taichi-llvm-10.0.0-msvc2019.zip -LO - 7z x taichi-llvm-10.0.0-msvc2019.zip -otaichi_llvm - curl --retry 10 --retry-delay 5 https://github.com/taichi-dev/taichi_assets/releases/download/llvm10/clang-10.0.0-win.zip -LO - 7z x clang-10.0.0-win.zip -otaichi_clang - $env:PATH = ";C:\taichi_llvm\bin;C:\taichi_clang\bin;" + $env:PATH - clang --version - cd D:\a\taichi\taichi - python -m pip install -r requirements_dev.txt - cd python - git fetch origin master - $env:TAICHI_CMAKE_ARGS = $env:CI_SETUP_CMAKE_ARGS - python build.py build - cd ..\dist - $env:WHL = $(dir *.whl) - python -m pip install $env:WHL - env: - PYTHON: C:\hostedtoolcache\windows\Python\3.7.9\x64\python.exe - CI_SETUP_CMAKE_ARGS: -G "Visual Studio 16 2019" -A x64 -DLLVM_DIR=C:\taichi_llvm\lib\cmake\llvm -DTI_WITH_VULKAN:BOOL=ON - VULKAN_SDK: C:/VulkanSDK/1.2.189.0 - - - name: Test - shell: powershell - run: | - $env:PATH = ";C:\taichi_llvm\bin;C:\taichi_clang\bin;" + $env:PATH - python -c "import taichi" - python examples/algorithm/laplace.py - python bin/taichi diagnose - python bin/taichi changelog - python bin/taichi test -vr2 -t2 - env: - PYTHON: C:\hostedtoolcache\windows\Python\3.7.9\x64\python.exe - - build_and_test_m1: - name: Build and Test (Apple M1) - needs: check_code_format - timeout-minutes: 60 - strategy: - matrix: - include: - - os: macos-latest - python: 3.8 - defaults: - run: - # https://github.com/actions/runner/issues/805#issuecomment-844426478 - shell: "/usr/bin/arch -arch arm64e /bin/bash --noprofile --norc -eo pipefail {0}" - runs-on: [self-hosted, m1] + docker_gpu_build: + runs-on: [self-hosted, cuda, vulkan] + container: registry.taichigraphics.com/taichidev-ubuntu20.04-test:v0.1 steps: - - uses: actions/checkout@v2 - with: - submodules: 'recursive' - - - name: Build - run: | - rm -rf $HOME/Library/Python/3.8/lib/python/site-packages/taichi - .github/workflows/scripts/unix_build.sh - env: - CI_SETUP_CMAKE_ARGS: -DTI_WITH_OPENGL:BOOL=OFF -DTI_WITH_CUDA:BOOL=OFF -DTI_WITH_CC:BOOL=OFF -DTI_WITH_VULKAN:BOOL=OFF -DTI_BUILD_TESTS:BOOL=ON - CXX: clang++ - - - name: Test - run: | - export PATH=$PATH:$HOME/Library/Python/3.8/bin - python3 examples/algorithm/laplace.py - TI_LIB_DIR=`python3 -c "import taichi;print(taichi.__path__[0])" | tail -1` - TI_LIB_DIR="$TI_LIB_DIR/lib" ./build/taichi_cpp_tests - ti test -vr2 -t4 -x + - run: | + ti test From edf92040e258b09bcdbef1bf9d182603e2a5d7a2 Mon Sep 17 00:00:00 2001 From: yolo2themoon Date: Thu, 21 Oct 2021 16:11:34 +0800 Subject: [PATCH 08/15] use unix_build.sh --- .github/workflows/presubmit.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index b0be3492a..a2a3a35fa 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -298,21 +298,25 @@ jobs: name: Performance monitoring (NVGPU) needs: check_code_format timeout-minutes: 60 - runs-on: [self-hosted, x64, cuda, linux, ubuntu20.04, rtx2060, benchmark] + runs-on: [self-hosted, x64, cuda, linux, benchmark] steps: - uses: actions/checkout@v2 with: submodules: 'recursive' - - name: Build + - name: Build & Install run: | - REPO_DIR=`pwd` - export TAICHI_REPO_DIR=$REPO_DIR - export PYTHONPATH=$TAICHI_REPO_DIR/python:$PYTHONPATH - export PATH=$TAICHI_REPO_DIR/bin:$PATH - git submodule update --init --recursive --depth=1 - TAICHI_CMAKE_ARGS="-DTI_WITH_CUDA_TOOLKIT:BOOL=ON" python3 setup.py develop --user - + export PATH=$PATH:/usr/local/cuda/bin + .github/workflows/scripts/unix_build.sh + env: + LLVM_LIB_ROOT_DIR: /opt/taichi-llvm-10.0.0 + LLVM_PATH: /opt/taichi-llvm-10.0.0/bin + LLVM_DIR: /opt/taichi-llvm-10.0.0/lib/cmake/llvm + CUDA_TOOLKIT_ROOT_DIR: /usr/local/cuda/ + CI_SETUP_CMAKE_ARGS: -DTI_WITH_CUDA_TOOLKIT:BOOL=ON + BUILD_NUM_THREADS: 8 + CXX: clang++-10 + - name: Run benchmark run: | python3 benchmarks/misc/run.py /home/benchmarkbot/benchmark/ \ No newline at end of file From 2cc7fabd98ad0c39dc980eb239cf0d728dc0ca98 Mon Sep 17 00:00:00 2001 From: yolo2themoon Date: Thu, 21 Oct 2021 16:16:42 +0800 Subject: [PATCH 09/15] remove needs --- .github/workflows/presubmit.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index 1f72c8234..d2cae167b 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -20,7 +20,6 @@ jobs: performance_monitoring: name: Performance monitoring (NVGPU) - needs: check_code_format timeout-minutes: 60 runs-on: [self-hosted, x64, cuda, linux, benchmark] steps: From e852fbdcff12f2406985b98cae49087b5e9afc91 Mon Sep 17 00:00:00 2001 From: yolo2themoon Date: Thu, 21 Oct 2021 16:21:13 +0800 Subject: [PATCH 10/15] revert --- .github/workflows/presubmit.yml | 70 ++++++++++++++++++++++++++++----- 1 file changed, 61 insertions(+), 9 deletions(-) diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index d2cae167b..6268113ae 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -4,22 +4,74 @@ on: types: [opened, synchronize, reopened] jobs: - docker_cpu_build: + title_format: + name: Check PR Title + if: ${{ github.event.pull_request }} runs-on: ubuntu-latest - container: registry.taichigraphics.com/taichidev-ubuntu20.04-test:v0.1 steps: - - run: | - ti test + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Run PR Title Checker + run: | + pip install semver GitPython + python misc/ci_check_pr_title.py "$PR_TITLE" + env: + PR_TITLE: ${{ github.event.pull_request.title }} - docker_gpu_build: - runs-on: [self-hosted, cuda, vulkan] - container: registry.taichigraphics.com/taichidev-ubuntu20.04-test:v0.1 + check_code_format: + name: Check Code Format + runs-on: ubuntu-latest + # This job will be required to pass before merging to master branch. steps: - - run: | - ti test + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Setup git & clang-format + run: | + git config user.email "taichigardener@gmail.com" + git config user.name "Taichi Gardener" + git checkout -b _fake_squash + git remote add upstream https://github.com/taichi-dev/taichi.git + git fetch upstream master + sudo apt install clang-format-10 + - name: Cache PIP + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ hashFiles('setup.py') }}-${{ hashFiles('requirements_dev.txt') }} + + - name: Install requirements + run: | + python3 -m pip install --user -r requirements_dev.txt + - name: Check code format + run: | + python3 misc/code_format.py + git checkout -b _enforced_format + git commit -am "enforce code format" || true + # exit with 1 if there were differences: + git diff _fake_squash _enforced_format --exit-code + - name: Pylint + run: | + # Make sure pylint doesn't regress + pylint python/taichi/ --disable=all --enable=C0121,C0415 + if [ $? -eq 0 ] + then + echo "PASSED: pylint is happy" + exit 0 + else + echo "FAILED: please run the pylint command above and make sure it passes" + exit 1 + fi performance_monitoring: name: Performance monitoring (NVGPU) + needs: check_code_format timeout-minutes: 60 runs-on: [self-hosted, x64, cuda, linux, benchmark] steps: From 6fd98949ac3139e5076d8ec8bbfd4916e76c6424 Mon Sep 17 00:00:00 2001 From: yolo2themoon Date: Thu, 21 Oct 2021 16:24:57 +0800 Subject: [PATCH 11/15] mute Pylint --- .github/workflows/presubmit.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index 6268113ae..4813b52c1 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -56,18 +56,6 @@ jobs: git commit -am "enforce code format" || true # exit with 1 if there were differences: git diff _fake_squash _enforced_format --exit-code - - name: Pylint - run: | - # Make sure pylint doesn't regress - pylint python/taichi/ --disable=all --enable=C0121,C0415 - if [ $? -eq 0 ] - then - echo "PASSED: pylint is happy" - exit 0 - else - echo "FAILED: please run the pylint command above and make sure it passes" - exit 1 - fi performance_monitoring: name: Performance monitoring (NVGPU) From 1001d7350763ee00286a524490852c7a7e09d12b Mon Sep 17 00:00:00 2001 From: yolo2themoon Date: Thu, 21 Oct 2021 17:16:10 +0800 Subject: [PATCH 12/15] trigger ci --- .github/workflows/presubmit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index 4813b52c1..ef36fb020 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -82,4 +82,4 @@ jobs: - name: Run benchmark run: | - python3 benchmarks/misc/run.py /home/benchmarkbot/benchmark/ \ No newline at end of file + python3 benchmarks/misc/run.py /home/benchmarkbot/benchmark/ From d47d0e7c9e55d88dde239689ac8ae464241175cf Mon Sep 17 00:00:00 2001 From: yolo2themoon Date: Thu, 21 Oct 2021 17:24:39 +0800 Subject: [PATCH 13/15] trigger ci again --- .github/workflows/presubmit.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index ef36fb020..754405c51 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -83,3 +83,4 @@ jobs: - name: Run benchmark run: | python3 benchmarks/misc/run.py /home/benchmarkbot/benchmark/ + From a53792a710aafb8461df74a7b2dcb809a80ba224 Mon Sep 17 00:00:00 2001 From: Jiasheng Zhang Date: Thu, 21 Oct 2021 17:43:01 +0800 Subject: [PATCH 14/15] use docker CI (#100) --- .github/workflows/presubmit.yml | 34 +++++++++++++------ .../workflows/scripts/unix_docker_build.sh | 29 ++++++++++++++++ 2 files changed, 53 insertions(+), 10 deletions(-) create mode 100755 .github/workflows/scripts/unix_docker_build.sh diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index 1c3b74f69..60c95486a 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -4,16 +4,30 @@ on: types: [opened, synchronize, reopened] jobs: - docker_cpu_build: - runs-on: ubuntu-latest - container: registry.taichigraphics.com/taichidev-ubuntu20.04-test:v0.1 - steps: - - run: | - ti test - docker_gpu_build: - runs-on: [self-hosted, cuda, vulkan] - container: registry.taichigraphics.com/taichidev-ubuntu20.04-test:v0.1 + docker_cpu_test: + runs-on: [self-hosted, cn, cuda, vulkan] steps: + - uses: actions/checkout@v2 + with: + submodules: 'recursive' + - run: | - ti test + docker create --user dev --name taichi --gpus all -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix registry.taichigraphics.com/taichidev-ubuntu20.04:v0.1.0 /home/dev/taichi/.github/workflows/scripts/unix_docker_build.sh CI_SETUP_CMAKE_ARGS=$CI_SETUP_CMAKE_ARGS PY=$PY + docker cp ./taichi taichi:/home/dev/taichi + docker start -a taichi + env: + DISPLAY: :1 + CI_SETUP_CMAKE_ARGS: -DTI_WITH_OPENGL:BOOL=ON -DTI_WITH_CC:BOOL=OFF -DTI_WITH_VULKAN:BOOL=ON -DTI_BUILD_TESTS:BOOL=ON + PY: py38 + + - name: clean docker container + if: always() + run: docker rm taichi -f + + ##- uses: addnab/docker-run-action@v3 + ## with: + ## username: admin + + #- uses: docker://registry.taichigraphics.com/taichidev-ubuntu20.04-test:v0.1 + diff --git a/.github/workflows/scripts/unix_docker_build.sh b/.github/workflows/scripts/unix_docker_build.sh new file mode 100755 index 000000000..d4b284bba --- /dev/null +++ b/.github/workflows/scripts/unix_docker_build.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +set -ex + +# Parse ARGs +for ARGUMENT in "$@" +do + KEY=$(echo $ARGUMENT | cut -f1 -d=) + VALUE=$(echo $ARGUMENT | cut -f2 -d=) + case "$KEY" in + CI_SETUP_CMAKE_ARGS) SHA=${VALUE} ;; + PY) PY=${VALUE} ;; + *) + esac +done + +source /home/dev/miniconda/etc/profile.d/conda.sh +conda activate $PY + +cd taichi +python3 -m pip install --user -r requirements_dev.txt +python3 -m pip install torch==1.9.0+cu111 -f https://download.pytorch.org/whl/torch_stable.html +TAICHI_CMAKE_ARGS=$CI_SETUP_CMAKE_ARGS python3 setup.py install --user + +export TI_IN_DOCKER=true + +ti diagnose +ti test -vr2 -t2 -k "not ndarray and not torch" +ti test -vr2 -t1 -k "ndarray or torch" From cebf2b9058d8ad2cf7856a49be5cff32749b2b8f Mon Sep 17 00:00:00 2001 From: yolo2themoon Date: Thu, 21 Oct 2021 17:57:37 +0800 Subject: [PATCH 15/15] run.py --- benchmarks/misc/run.py | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/benchmarks/misc/run.py b/benchmarks/misc/run.py index 4ff0ef0eb..06406c9fd 100644 --- a/benchmarks/misc/run.py +++ b/benchmarks/misc/run.py @@ -1,4 +1,5 @@ import datetime +import os import sys from membound import Membound @@ -22,7 +23,7 @@ def run(self): for s in self.suites: s.run() - def write_to_path(self, path_with_file_name='./performance_result.md'): + def store_to_path(self, path_with_file_name='./performance_result.md'): with open(path_with_file_name, 'w') as f: for arch in test_archs: for s in self.suites: @@ -30,16 +31,22 @@ def write_to_path(self, path_with_file_name='./performance_result.md'): for line in lines: print(line, file=f) - def store_with_date_and_commit_hash(self, path='./'): + def store_with_date_and_commit_id(self, file_dir='./'): current_time = datetime.datetime.now().strftime("%Y%m%dd%Hh%Mm%Ss") commit_hash = _ti_core.get_commit_hash()[:8] - filename = f'perfresult_{current_time}_{commit_hash}.md' - print('store to: ' + path + filename) - self.write_to_path(path + filename) + file_name = f'perfresult_{current_time}_{commit_hash}.md' + path = os.path.join(file_dir, file_name) + print('Storing benchmark result to: ' + path) + self.store_to_path(path) -path_to_store = sys.argv[1] if len(sys.argv) > 1 else './' -p = PerformanceMonitoring() -p.run() -p.write_to_path() # for /benchamark -p.store_with_date_and_commit_hash(path_to_store) #for post-submit +def main(): + file_dir = sys.argv[1] if len(sys.argv) > 1 else './' + p = PerformanceMonitoring() + p.run() + p.store_to_path() # for /benchmark + p.store_with_date_and_commit_id(file_dir) #for postsubmit + + +if __name__ == '__main__': + main()