Skip to content

Commit

Permalink
test windows build (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonz5288 authored Jun 17, 2021
1 parent d4d092b commit 26912f6
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 53 deletions.
104 changes: 52 additions & 52 deletions .github/workflows/persubmit.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
name: Persubmit Checks
on:
pull_request:
types: [opened, synchronize, reopened]


# test
jobs:
build_and_test_cpu_required:
# This job will be required to pass before merging to master branch.
name: Required Build and Test (CPU)
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip ci') }}
strategy:
matrix:
include:
- os: ubuntu-latest
python: 3.6
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- 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
run: |
export TAICHI_REPO_DIR=`pwd`
export PATH=$TAICHI_REPO_DIR/taichi-llvm/bin/:$PATH
export CXX=clang++
python misc/ci_setup.py ci
env:
CI_SETUP_CMAKE_ARGS: -DTI_WITH_OPENGL:BOOL=OFF -DTI_WITH_CC:BOOL=ON -DTI_BUILD_TESTS:BOOL=ON

- name: Test
run: |
export TAICHI_REPO_DIR=`pwd`
export PATH=$TAICHI_REPO_DIR/bin:$PATH
export PATH=$TAICHI_REPO_DIR/taichi-llvm/bin/:$PATH
export PYTHONPATH=$TAICHI_REPO_DIR/python
python examples/laplace.py
ti diagnose
./build/taichi_cpp_tests
ti test -vr2 -t2
##name: Persubmit Checks
##on:
## pull_request:
## types: [opened, synchronize, reopened]
##
##
### test
##jobs:
## build_and_test_cpu_required:
## # This job will be required to pass before merging to master branch.
## name: Required Build and Test (CPU)
## if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip ci') }}
## strategy:
## matrix:
## include:
## - os: ubuntu-latest
## python: 3.6
## runs-on: ${{ matrix.os }}
## steps:
## - uses: actions/checkout@v2
## - 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
## run: |
## export TAICHI_REPO_DIR=`pwd`
## export PATH=$TAICHI_REPO_DIR/taichi-llvm/bin/:$PATH
## export CXX=clang++
## python misc/ci_setup.py ci
## env:
## CI_SETUP_CMAKE_ARGS: -DTI_WITH_OPENGL:BOOL=OFF -DTI_WITH_CC:BOOL=ON -DTI_BUILD_TESTS:BOOL=ON
##
## - name: Test
## run: |
## export TAICHI_REPO_DIR=`pwd`
## export PATH=$TAICHI_REPO_DIR/bin:$PATH
## export PATH=$TAICHI_REPO_DIR/taichi-llvm/bin/:$PATH
## export PYTHONPATH=$TAICHI_REPO_DIR/python
## python examples/laplace.py
## ti diagnose
## ./build/taichi_cpp_tests
## ti test -vr2 -t2
53 changes: 53 additions & 0 deletions .github/workflows/win_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Windows Build

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
build_windows:
name: Build on Windows
runs-on: windows-latest

steps:
- name: Install 7Zip PowerShell
shell: powershell
run: Install-Module 7Zip4PowerShell -Force -Verbose

- uses: actions/checkout@v2

- name: Add msbuild to PATH
uses: microsoft/[email protected]

- name: Build
shell: powershell
run: |
$env:PYTHON = "C:\hostedtoolcache\windows\Python\3.7.9\x64\python.exe"
$env:TAICHI_REPO_DIR = "D:\a\test_actions\test_actions"
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"
$env:PATH += ";C:\taichi_clang\bin"
$env:PYTHONPATH = "$env:TAICHI_REPO_DIR\python"
$env:PATH += ";$env:TAICHI_REPO_DIR\bin"
echo $env:TAICHI_REPO_DIR
echo $env:PYTHONPATH
echo $env:PATH
clang --version
cd D:\a\test_actions\test_actions
python -m pip install numpy
python -m pip install pybind11
python misc/ci_setup.py ci
mkdir build
cd build
cmake .. -G"Visual Studio 16 2019" -A x64 -DPYTHON_EXECUTABLE="$env:PYTHON" -DLLVM_DIR="C:\taichi_llvm\lib\cmake\llvm"
msbuild /p:Configuration=RelWithDebInfo /p:Platform=x64 /m taichi.sln
cd ..
python -c "import taichi"
python examples/laplace.py
python bin/taichi diagnose
python bin/taichi test -Cvr2 -t2
5 changes: 5 additions & 0 deletions taichi/runtime/llvm/runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
// The generated bitcode will likely get inlined for performance.

#if !defined(TI_INCLUDED) || !defined(_WIN32)
// The latest MSVC uses llvm-11 as requirements. However, we use llvm-10
// for now and building will fail due to clang version mismatch. Therefore,
// we workaround this problem by define such flag to skip the version check.
#define _ALLOW_COMPILER_AND_STL_VERSION_MISMATCH

#include <atomic>
#include <cstdint>
Expand All @@ -15,6 +19,7 @@
#include "taichi/inc/constants.h"
#include "taichi/math/arithmetic.h"


struct Context;
using assert_failed_type = void (*)(const char *);
using host_printf_type = void (*)(const char *, ...);
Expand Down
2 changes: 1 addition & 1 deletion tests/python/test_indices_assert.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@ti.test(debug=True, gdb_trigger=False, arch=[ti.cpu])
def test_indices_assert():

overflow = ti.field(int, (334, 334, 334, 2 * 10))
overflow = ti.field(ti.i32, (334, 334, 334, 2 * 10))

@ti.kernel
def access_overflow():
Expand Down

0 comments on commit 26912f6

Please sign in to comment.