Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
bobcao3 committed Apr 28, 2022
2 parents 2158f20 + 6e055f0 commit 65dc483
Show file tree
Hide file tree
Showing 66 changed files with 591 additions and 585 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ assignees: ''

---

<!-- We've collected some common issue solutions in https://docs.taichi.graphics/lang/articles/misc/install. Make sure you've check them out first. Hopefully they could address your problem. -->
<!-- We've collected some common issue solutions in https://docs.taichi-lang.org/lang/articles/install. Make sure you've check them out first. Hopefully they could address your problem. -->

**Describe the bug**
A clear and concise description of what the bug is, ideally within 20 words.
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
blank_issues_enabled: true
contact_links:
- name: Contributor Guideline
url: https://docs.taichi.graphics/lang/articles/contributor_guide
url: https://docs.taichi-lang.org/lang/articles/contributor_guide
about: Please check this out if you'd like to contribute by opening a PR :)
- name: Taichi Forum
url: https://forum.taichi.graphics
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ Before asking a question, please first consider:
- Searching Google
- Searching [existing issues](https://github.com/taichi-dev/taichi/issues)
- Searching [Taichi Doc](https://docs.taichi.graphics/)
- Searching [Taichi Doc](https://docs.taichi-lang.org/)
- Searching [Taichi Forum](https://forum.taichi.graphics/)
-->
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ Related issue = #
Thank you for your contribution!
If it is your first time contributing to Taichi, please read our Contributor Guidelines:
https://docs.taichi.graphics/lang/articles/contribution/contributor_guide
https://docs.taichi-lang.org/lang/articles/contributor_guide
- Please always prepend your PR title with tags such as [CUDA], [Lang], [Doc], [Example]. For a complete list of valid PR tags, please check out https://github.com/taichi-dev/taichi/blob/master/misc/prtags.json.
- Use upper-case tags (e.g., [Metal]) for PRs that change public APIs. Otherwise, please use lower-case tags (e.g., [metal]).
- More details: https://docs.taichi.graphics/lang/articles/contribution/contributor_guide#pr-title-format-and-tags
- More details: https://docs.taichi-lang.org/lang/articles/contributor_guide#pr-title-format-and-tags
- Please fill in the issue number that this PR relates to.
- If your PR fixes the issue **completely**, use the `close` or `fixes` prefix so that GitHub automatically closes the issue when the PR is merged. For example,
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/scripts/check_clang_tidy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,5 @@ CI_SETUP_CMAKE_ARGS=$1
cd taichi
python3 -m pip install -r requirements_dev.txt

rm -rf build && mkdir build && cd build
cmake $CI_SETUP_CMAKE_ARGS ..

cd ..
python3 ./scripts/run_clang_tidy.py $PWD/taichi -clang-tidy-binary clang-tidy-10 -checks=-*,performance-inefficient-string-concatenation,readability-identifier-naming -header-filter=$PWD/taichi -p $PWD/build -j2
export CI_SETUP_CMAKE_ARGS
python3 ./scripts/run_clang_tidy.py $PWD/taichi -clang-tidy-binary clang-tidy-10 -checks=-*,performance-inefficient-string-concatenation,readability-identifier-naming -header-filter=$PWD/taichi -j2
19 changes: 14 additions & 5 deletions .github/workflows/scripts/unix_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ setup_python() {
python3 -m pip install -r requirements_dev.txt
}

build() {
build_taichi_wheel() {
git fetch origin master
PROJECT_TAGS=""
EXTRA_ARGS=""
Expand All @@ -69,12 +69,21 @@ build() {
sccache -s
}

build_libtaichi_export() {
git fetch origin master
python3 setup.py build_ext
}

setup_sccache
setup_python
build
cat "$SCCACHE_ERROR_LOG" || true
NUM_WHL=$(ls dist/*.whl | wc -l)
if [ $NUM_WHL -ne 1 ]; then echo "ERROR: created more than 1 whl." && exit 1; fi

if [ "$EXPORT_CORE" == "1" ]; then
build_libtaichi_export
else
build_taichi_wheel
NUM_WHL=$(ls dist/*.whl | wc -l)
if [ $NUM_WHL -ne 1 ]; then echo "ERROR: created more than 1 whl." && exit 1; fi
fi

chmod -R 777 "$SCCACHE_DIR"
rm -f python/CHANGELOG.md
1 change: 0 additions & 1 deletion .github/workflows/scripts/win_build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ python -m venv venv
. venv\Scripts\activate.ps1
python -m pip install wheel
python -m pip install -r requirements_dev.txt
python -m pip install -r requirements_test.txt
if (-not $?) { exit 1 }
WriteInfo("Building Taichi")
$env:TAICHI_CMAKE_ARGS += " -DCLANG_EXECUTABLE=$libsDir\\taichi_clang\\bin\\clang++.exe"
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -415,3 +415,57 @@ jobs:
PY: ${{ matrix.python }}
PLATFORM: 'm1'
TI_CI: 1

build_libtaichi_export:
name: Build libtaichi_export.so(GPU)
needs: check_files
runs-on: [self-hosted, cuda, vulkan, cn]
timeout-minutes: 60
strategy:
matrix:
include:
- os: ubuntu-latest
python: py39
with_cc: ON
permissions:
packages: read
contents: read
steps:
- uses: actions/checkout@v2
with:
submodules: "recursive"

- name: Get sccache cache
uses: actions/cache@v2
with:
path: sccache_cache
key: sccache-linux-${{matrix.with_cc}}-${{ github.sha }}
restore-keys: |
sccache-linux-${{matrix.with_cc}}-
- name: Build For Desktop
run: |
if [[ ${{needs.check_files.outputs.run_job}} == false ]]; then
exit 0
fi
docker create --user dev --name taichi_build_desktop --gpus all -v /tmp/.X11-unix:/tmp/.X11-unix \
-e PY -e GPU_BUILD -e PROJECT_NAME -e TAICHI_CMAKE_ARGS -e DISPLAY -e EXPORT_CORE\
registry.taichigraphics.com/taichidev-ubuntu18.04:v0.2.1 \
/home/dev/taichi/.github/workflows/scripts/unix_build.sh
# A tarball is needed because sccache needs some permissions that only the file owner has.
# 1000 is the uid and gid of user "dev" in the container.
# If the uid or gid of the user inside the docker changes, please change the uid and gid in the following line.
tar -cf - ../${{ github.event.repository.name }} --mode u=+rwx,g=+rwx,o=+rwx --owner 1000 --group 1000 | docker cp - taichi_build_desktop:/home/dev/
docker start -a taichi_build_desktop
env:
PY: ${{ matrix.python }}
GPU_BUILD: ON
PROJECT_NAME: taichi
TAICHI_CMAKE_ARGS: -DTI_WITH_VULKAN:BOOL=ON -DTI_WITH_CUDA:BOOL=OFF -DTI_WITH_OPENGL:BOOL=OFF -DTI_WITH_LLVM:BOOL=OFF -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DTI_EXPORT_CORE:BOOL=ON
EXPORT_CORE: 1
DISPLAY: :1

- name: clean docker container
if: always()
run: |
docker rm taichi_build_desktop -f
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,4 @@ _build
!docs/**/*.json
imgui.ini
/venv/
/_skbuild/
13 changes: 2 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 3.12)
project(taichi)

if (NOT DEFINED TI_VERSION_MAJOR)
message(WARNING "It seems that you are running cmake manually, which may cause issues. Please use setup.py to build taichi from source, see https://docs.taichi.graphics/lang/articles/dev_install for more details.")
message(WARNING "It seems that you are running cmake manually, which may cause issues. Please use setup.py to build taichi from source, see https://docs.taichi-lang.org/lang/articles/dev_install for more details.")
set(TI_VERSION_MAJOR 0)
set(TI_VERSION_MINOR 0)
set(TI_VERSION_PATCH 0)
Expand Down Expand Up @@ -49,7 +49,6 @@ else ()
endif ()

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/build")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/build")

find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
Expand Down Expand Up @@ -149,15 +148,7 @@ if (${CLANG_VERSION_MAJOR} VERSION_GREATER ${CLANG_HIGHEST_VERSION})
endif()
endif()

# Build llvm-runtime for host arch and cuda (if available)
foreach(arch IN LISTS HOST_ARCH CUDA_ARCH)
add_custom_target(
"generate_llvm_runtime_${arch}"
COMMAND ${CLANG_EXECUTABLE} ${CLANG_OSX_FLAGS} -c runtime.cpp -o "runtime_${arch}.bc" -fno-exceptions -emit-llvm -std=c++17 -D "ARCH_${arch}" -I ${PROJECT_SOURCE_DIR};
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/taichi/runtime/llvm"
)
add_dependencies(${CORE_LIBRARY_NAME} "generate_llvm_runtime_${arch}")
endforeach()
add_subdirectory(taichi/runtime/llvm)

configure_file(taichi/common/version.h.in ${CMAKE_SOURCE_DIR}/taichi/common/version.h)
configure_file(taichi/common/commit_hash.h.in ${CMAKE_SOURCE_DIR}/taichi/common/commit_hash.h)
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Contributing Guide

Thank you for your interest in contributing to Taichi! Please check out the [Contribution Guidelines](https://docs.taichi.graphics/lang/articles/contributor_guide) for how to make a contribution.
Thank you for your interest in contributing to Taichi! Please check out the [Contribution Guidelines](https://docs.taichi-lang.org/lang/articles/contributor_guide) for how to make a contribution.

All contributors are expected to follow the [code of conduct](https://github.com/taichi-dev/taichi/blob/master/CODE_OF_CONDUCT.md).

## Developer installation

Taichi is developed mainly in C++17 and Python3. Please check out the [Developer Installation](https://docs.taichi.graphics/lang/articles/dev_install) to build Taichi from source. Note that Taichi is LLVM-10.0.0 dependent and that we recommend installing [our pre-built LLVM libraries](https://docs.taichi.graphics/lang/articles/dev_install#install-llvm) for your platform.
Taichi is developed mainly in C++17 and Python3. Please check out the [Developer Installation](https://docs.taichi-lang.org/lang/articles/dev_install) to build Taichi from source. Note that Taichi is LLVM-10.0.0 dependent and that we recommend installing [our pre-built LLVM libraries](https://docs.taichi-lang.org/lang/articles/dev_install#install-llvm) for your platform.

## Contribution opportunities

Expand Down
5 changes: 0 additions & 5 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
include MANIFEST.in
include version.txt
include python/*.txt
include python/*.py
include *.cfg
include python/taichi/*.md
recursive-include python/taichi/assets *
recursive-include python/taichi/examples *.py
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ The language has broad applications spanning real-time physical simulation, numb
## Why Taichi?

- Built around Python: Taichi shares almost the same syntax with Python, allowing you to write algorithms with minimal language barrier. It is also well integrated into the Python ecosystem, including NumPy and PyTorch.
- Flexibility: Taichi provides a set of generic data containers known as *SNode* (/ˈsnoʊd/), an effective mechanism for composing hierarchical, multi-dimensional fields. This can cover many use patterns in numerical simulation (e.g. [spatially sparse computing](https://docs.taichi.graphics/lang/articles/sparse)).
- Flexibility: Taichi provides a set of generic data containers known as *SNode* (/ˈsnoʊd/), an effective mechanism for composing hierarchical, multi-dimensional fields. This can cover many use patterns in numerical simulation (e.g. [spatially sparse computing](https://docs.taichi-lang.org/lang/articles/sparse)).
- Performance: With the `@ti.kernel` decorator, Taichi's JIT compiler automatically compiles your Python functions into efficient GPU or CPU machine code for parallel execution.
- Portability: Write your code once and run it everywhere. Currently, Taichi supports most mainstream GPU APIs, such as CUDA and Vulkan.
- ... and many more features! A cross-platform, Vulkan-based 3D visualizer, [differentiable programming](https://docs.taichi.graphics/lang/articles/differentiable_programming), [quantized computation](https://github.com/taichi-dev/quantaichi) (experimental), etc.
- ... and many more features! A cross-platform, Vulkan-based 3D visualizer, [differentiable programming](https://docs.taichi-lang.org/lang/articles/differentiable_programming), [quantized computation](https://github.com/taichi-dev/quantaichi) (experimental), etc.

## Getting Started

Expand Down Expand Up @@ -120,17 +120,17 @@ for i in range(1000000):

<a href="https://github.com/taichi-dev/taichi/blob/master/python/taichi/examples/simulation/fractal.py#L1-L31"> </a><img src="https://raw.githubusercontent.com/taichi-dev/public_files/master/taichi/fractal_small.gif" height="270px">

See [Get started](https://docs.taichi.graphics) for more information.
See [Get started](https://docs.taichi-lang.org) for more information.

### Build from source

If you wish to try our our experimental features or build Taichi for your own environments, see [Developer installation](https://docs.taichi.graphics/lang/articles/dev_install).
If you wish to try our our experimental features or build Taichi for your own environments, see [Developer installation](https://docs.taichi-lang.org/lang/articles/dev_install).

## Documentation

- [Technical documents](https://docs.taichi.graphics/)
- [API Reference](https://docs.taichi.graphics/api/)
- [Blog](https://docs.taichi.graphics/blog)
- [Technical documents](https://docs.taichi-lang.org/)
- [API Reference](https://docs.taichi-lang.org/api/)
- [Blog](https://docs.taichi-lang.org/blog)

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/microbenchmarks/_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __init__(self):
class MathOps(BenchmarkItem):
name = 'math_op'

#reference: https://docs.taichi.graphics/lang/articles/operator
#reference: https://docs.taichi-lang.org/lang/articles/operator
def __init__(self):
self._items = {
# Trigonometric
Expand Down
99 changes: 11 additions & 88 deletions cmake/PythonNumpyPybind11.cmake
Original file line number Diff line number Diff line change
@@ -1,93 +1,16 @@
# Python, numpy, and pybind11
execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pybind11 --cmake
OUTPUT_VARIABLE pybind11_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import numpy;print(numpy.get_include())"
OUTPUT_VARIABLE NUMPY_INCLUDE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)

if (PYTHON_EXECUTABLE)
message("Using ${PYTHON_EXECUTABLE} as python executable.")
else ()
if (WIN32)
message("Using 'python' as python interpreter.")
set(PYTHON_EXECUTABLE python)
else ()
message("Using 'python3' as python interpreter.")
set(PYTHON_EXECUTABLE python3)
endif()
endif ()
message("-- Python: Using ${PYTHON_EXECUTABLE} as the interpreter")
message(" version: ${PYTHON_VERSION_STRING}")
message(" include: ${PYTHON_INCLUDE_DIR}")
message(" library: ${PYTHON_LIBRARY}")
message(" numpy include: ${NUMPY_INCLUDE_DIR}")

if (WIN32)
execute_process(COMMAND where ${PYTHON_EXECUTABLE}
OUTPUT_VARIABLE PYTHON_EXECUTABLE_PATHS)
if (${PYTHON_EXECUTABLE_PATHS})
string(FIND ${PYTHON_EXECUTABLE_PATHS} "\n" _LINE_BREAK_LOC)
string(SUBSTRING ${PYTHON_EXECUTABLE_PATHS} 0 ${_LINE_BREAK_LOC} PYTHON_EXECUTABLE_PATH)
else ()
set(PYTHON_EXECUTABLE_PATH ${PYTHON_EXECUTABLE})
endif ()
else ()
execute_process(COMMAND which ${PYTHON_EXECUTABLE}
OUTPUT_VARIABLE PYTHON_EXECUTABLE_PATH)
endif()
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c
"import sys;\
from distutils import sysconfig;\
sys.stdout.write(sysconfig.get_python_version())"
OUTPUT_VARIABLE PYTHON_VERSION)
execute_process(COMMAND ${PYTHON_EXECUTABLE} --version)
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c
"import sys;\
from distutils import sysconfig;\
sys.stdout.write(\
(sysconfig.get_config_var('INCLUDEPY')\
if sysconfig.get_config_var('INCLUDEDIR') is not None else None)\
or sysconfig.get_python_inc())"
OUTPUT_VARIABLE PYTHON_INCLUDE_DIRS)
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c
"import sys;\
from distutils import sysconfig;\
sys.stdout.write((sysconfig.get_config_var('LIBDIR') or sysconfig.get_python_lib()).replace('\\\\','/'))"
OUTPUT_VARIABLE PYTHON_LIBRARY_DIR)

include_directories(${NUMPY_INCLUDE_DIR})

execute_process(COMMAND ${PYTHON_EXECUTABLE} -c
"import sys;\
sys.stdout.write(str(sys.version_info[1]))"
OUTPUT_VARIABLE PYTHON_MINOR_VERSION)


if (WIN32)
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c
"import sys;sys.stdout.write(sys.base_prefix.replace('\\\\', '/'))"
OUTPUT_VARIABLE PYTHON_BASE_PREFIX)
link_directories(${PYTHON_BASE_PREFIX}/libs)
set(PYTHON_LIBRARIES ${PYTHON_BASE_PREFIX}/libs/python3.lib)
set(PYTHON_LIBRARIES ${PYTHON_BASE_PREFIX}/libs/python3${PYTHON_MINOR_VERSION}.lib)
else()
find_library(PYTHON_LIBRARY NAMES python${PYTHON_VERSION} python${PYTHON_VERSION}m PATHS ${PYTHON_LIBRARY_DIR}
NO_DEFAULT_PATH NO_SYSTEM_ENVIRONMENT_PATH PATH_SUFFIXES x86_64-linux-gnu)
set(PYTHON_LIBRARIES ${PYTHON_LIBRARY})
endif()


include_directories(${PYTHON_INCLUDE_DIRS})
message(" version: ${PYTHON_VERSION}")
message(" include: ${PYTHON_INCLUDE_DIRS}")
message(" library: ${PYTHON_LIBRARIES}")

execute_process(COMMAND ${PYTHON_EXECUTABLE} -c
"import numpy.distutils, sys;\
sys.stdout.write(':'.join(numpy.distutils.misc_util.get_numpy_include_dirs()))"
OUTPUT_VARIABLE PYTHON_NUMPY_INCLUDE_DIR)

message(" numpy include: ${PYTHON_NUMPY_INCLUDE_DIR}")
include_directories(${PYTHON_NUMPY_INCLUDE_DIR})

execute_process(COMMAND ${PYTHON_EXECUTABLE} -c
"import sys; import pybind11; sys.stdout.write(pybind11.get_include() + ';' + pybind11.get_include(True))"
OUTPUT_VARIABLE PYBIND11_INCLUDE_DIR
RESULT_VARIABLE PYBIND11_IMPORT_RET)
if (NOT PYBIND11_IMPORT_RET)
# returns zero if success
message(" pybind11 include: ${PYBIND11_INCLUDE_DIR}")
else ()
message(FATAL_ERROR "Cannot import pybind11. Please install. ([sudo] pip3 install --user pybind11)")
endif ()

include_directories(${PYBIND11_INCLUDE_DIR})
find_package(pybind11 CONFIG REQUIRED)
Loading

0 comments on commit 65dc483

Please sign in to comment.