Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge from taichi-dev #4

Merged
merged 35 commits into from
Feb 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
31e7e3a
use do-while-0 for check_cuda_error* (#476)
archibate Feb 16, 2020
71a8f5b
Allow `ti test_python` to take in individual test files (#479)
k-ye Feb 16, 2020
181fdb6
repeated deactivate test
Feb 6, 2020
bda103b
prepare for dense pointer snode type
Feb 13, 2020
cf0524c
dense pointer activation working
Feb 14, 2020
2cea329
try fix deactivate
Feb 14, 2020
cf8af7b
fix sparse benchmark syntax
Feb 14, 2020
d934399
reproduce benchmark_nested_struct_fill_and_clear failure; added SNode…
yuanming-hu Feb 14, 2020
a32bad5
update lower_access to handle pointers with indices
yuanming-hu Feb 14, 2020
9c9cf0b
fixed all tests in test_sparse_basics.py
yuanming-hu Feb 14, 2020
3c041c2
improved test_sparse_deactivate::test_dynamic; removed global indices…
yuanming-hu Feb 14, 2020
51585a2
fixed test_sparse_deactivate::test_dynamic
yuanming-hu Feb 14, 2020
1e2551a
change snode name pointer to dense_pointer
Feb 14, 2020
c49fa0c
fix merge
Feb 14, 2020
efd65ee
change one more pointer to dense_pointer
Feb 14, 2020
b12bf87
fixed test_sparse_parallel
yuanming-hu Feb 14, 2020
9c4bec4
temporary compatibility
yuanming-hu Feb 14, 2020
3230416
change dense_pointer back to pointer
Feb 14, 2020
4288b4d
recovered Deactivate
yuanming-hu Feb 16, 2020
759f259
fixed pointer (aka dense_pointer) (de)activation
yuanming-hu Feb 16, 2020
2c3bdc3
fixed taichi_sparse demo; fixed SNode.deactivate_all()
yuanming-hu Feb 16, 2020
6921164
Fixed linux build
yuanming-hu Feb 16, 2020
6355480
Support GUI key/mouse events on Mac OS X (#478)
k-ye Feb 16, 2020
f2792a6
restored GUI test
yuanming-hu Feb 16, 2020
97dbf64
Unify all Taichi macros: they should all start with TI_ instead of TC_
yuanming-hu Feb 16, 2020
4622adc
Unify CUDA guards by replacing all CUDA_FOUND with TI_WITH_CUDA. The …
yuanming-hu Feb 16, 2020
fd1dab4
removed cpp test irprinting; replace all .dense.pointer with .pointer
yuanming-hu Feb 17, 2020
3273b32
'for i in X' now iterates all child instances of 'X' instead of 'X' i…
yuanming-hu Feb 17, 2020
a6cd524
refactor test_sparse_deactivate.py
yuanming-hu Feb 17, 2020
83cf9c1
update appveyor.yml; added misc/appveyor_filter.py
yuanming-hu Feb 17, 2020
ca2c7b8
fixed demote_dense_struct_fors
yuanming-hu Feb 17, 2020
cb34aeb
[release] v0.5.1
yuanming-hu Feb 17, 2020
59307ba
README.md for v0.5.1
yuanming-hu Feb 17, 2020
588c83e
temporarily delete Python37/38 builds to prevent AppVeyor from queuing
yuanming-hu Feb 17, 2020
62aaaca
typo fix: print_processed->print_preprocessed
yuanming-hu Feb 17, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ project(taichi)

SET(TI_VERSION_MAJOR 0)
SET(TI_VERSION_MINOR 5)
SET(TI_VERSION_PATCH 0)
SET(TI_VERSION_PATCH 1)

execute_process(
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
Expand Down
33 changes: 21 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,13 @@ python3 -m pip install taichi-nightly-cuda-10-0
python3 -m pip install taichi-nightly-cuda-10-1
```

## [Contribution Guidelines](https://taichi.readthedocs.io/en/latest/contributor_guide.html)

|| **Linux (CUDA)** | **OS X (10.14+)** | **Windows** |
|:------|:-----|:-----|:-----|
|**Build**|[![Build Status](http://f11.csail.mit.edu:8080/job/taichi/badge/icon)](http://f11.csail.mit.edu:8080/job/taichi/)| [![Build Status](https://travis-ci.com/taichi-dev/taichi.svg?branch=master)](https://travis-ci.com/taichi-dev/taichi) | [![Build status](https://ci.appveyor.com/api/projects/status/yxm0uniin8xty4j7/branch/master?svg=true)](https://ci.appveyor.com/project/yuanming-hu/taichi/branch/master)|
|**PyPI**|[![Build Status](https://travis-ci.com/yuanming-hu/taichi-wheels-test.svg?branch=master)](https://travis-ci.com/yuanming-hu/taichi-wheels-test)|[![Build Status](https://travis-ci.com/yuanming-hu/taichi-wheels-test.svg?branch=master)](https://travis-ci.com/yuanming-hu/taichi-wheels-test)|[![Build status](https://ci.appveyor.com/api/projects/status/39ar9wa8yd49je7o?svg=true)](https://ci.appveyor.com/project/IteratorAdvance/taichi-wheels-test)|

## [Contribution Guidelines](https://taichi.readthedocs.io/en/latest/contributor_guide.html)

## Related papers
- [**(SIGGRAPH Asia 2019) High-Performance Computation on Sparse Data Structures**](http://taichi.graphics/wp-content/uploads/2019/09/taichi_lang.pdf) [[Video]](https://youtu.be/wKw8LMF3Djo) [[BibTex]](https://raw.githubusercontent.com/yuanming-hu/taichi/master/misc/taichi_bibtex.txt)
- by *Yuanming Hu, Tzu-Mao Li, Luke Anderson, Jonathan Ragan-Kelley, and Frédo Durand*
- [**(ICLR 2020) Differentiable Programming for Physical Simulation**](https://arxiv.org/abs/1910.00935) [[Video]](https://www.youtube.com/watch?v=Z1xvAZve9aE) [[BibTex]](https://raw.githubusercontent.com/yuanming-hu/taichi/master/misc/difftaichi_bibtex.txt) [[Code]](https://github.com/yuanming-hu/difftaichi)
- by *Yuanming Hu, Luke Anderson, Tzu-Mao Li, Qi Sun, Nathan Carr, Jonathan Ragan-Kelley, and Frédo Durand*

<div align="center">
<img width="800px" src="https://github.com/taichi-dev/taichi/blob/master/docs/life_of_kernel_lowres.jpg">
</div>

## Short-term goals
- (Done) Fully implement the LLVM backend to replace the legacy source-to-source C++/CUDA backends (By Dec 2019)
- The only missing features compared to the old source-to-source backends:
Expand All @@ -46,6 +36,14 @@ python3 -m pip install taichi-nightly-cuda-10-1
- (WIP) Tune the performance of the LLVM backend to match that of the legacy source-to-source backends (Hopefully by mid Feb, 2020. Current progress: setting up/tuning for final benchmarks)

## Updates
- (Feb 16, 2020) v0.5.1 released
- Keyboard and mouse events supported in the GUI system. Check out [mpm128.py](https://github.com/taichi-dev/taichi/blob/master/examples/mpm128.py) for a interactive demo! (by **Yubin Peng [archibate] and Ye Kuang [k-ye]**)
- Basic algebraic simplification passes (by **Mingkuan Xu [xumingkuan]**)
- (For developers) `ti` (`ti.exe`) command supported on Windows after setting `%PATH%` correctly (by **Mingkuan Xu [xumingkuan]**)
- General power operator `x ** y` now supported in Taichi kernels (by **Yubin Peng [archibate]**)
- `.dense(...).pointer()` now abbreviated as `.pointer(...)`. `pointer` now stands for a dense pointer array. This leads to cleaner code and better performance. (by **Kenneth Lozes [KLozes]**)
- (Advanced struct-fors only) `for i in X` now iterates all child instances of `X` instead of `X` itself. Skip this if you only use `X=leaf node` such as `ti.f32/i32/Vector/Matrix`.
- Fixed cuda random number generator racing conditions
- (Feb 14, 2020) **v0.5.0 released with a new Apple Metal GPU backend for Mac OS X users!** (by **Ye Kuang [k-ye]**)
- Just initialize your program with `ti.init(..., arch=ti.metal)` and run Taichi on your Mac GPUs!
- A few takeaways if you do want to use the Metal backend:
Expand Down Expand Up @@ -103,3 +101,14 @@ python3 -m pip install taichi-nightly-cuda-10-1
- Doc updated

- [Full changelog](changelog.md)


## Related papers
- [**(SIGGRAPH Asia 2019) High-Performance Computation on Sparse Data Structures**](http://taichi.graphics/wp-content/uploads/2019/09/taichi_lang.pdf) [[Video]](https://youtu.be/wKw8LMF3Djo) [[BibTex]](https://raw.githubusercontent.com/yuanming-hu/taichi/master/misc/taichi_bibtex.txt)
- by *Yuanming Hu, Tzu-Mao Li, Luke Anderson, Jonathan Ragan-Kelley, and Frédo Durand*
- [**(ICLR 2020) Differentiable Programming for Physical Simulation**](https://arxiv.org/abs/1910.00935) [[Video]](https://www.youtube.com/watch?v=Z1xvAZve9aE) [[BibTex]](https://raw.githubusercontent.com/yuanming-hu/taichi/master/misc/difftaichi_bibtex.txt) [[Code]](https://github.com/yuanming-hu/difftaichi)
- by *Yuanming Hu, Luke Anderson, Tzu-Mao Li, Qi Sun, Nathan Carr, Jonathan Ragan-Kelley, and Frédo Durand*

<div align="center">
<img width="800px" src="https://github.com/taichi-dev/taichi/blob/master/docs/life_of_kernel_lowres.jpg">
</div>
3 changes: 2 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ skip_commits:
- '.*'

build_script:
- set TAICHI_REPO_DIR=C:\taichi
# - 'if %PYTHON% %TAICHI_REPO_DIR%\misc\appveyor_filter.py; then exit 0; fi'
- cd C:\
- curl --retry 10 --retry-delay 5 https://github.com/yuanming-hu/taichi_assets/releases/download/llvm8/taichi-llvm-8.0.1-msvc2017.zip -LO
- 7z x taichi-llvm-8.0.1-msvc2017.zip -otaichi_llvm
- curl --retry 10 --retry-delay 5 https://github.com/yuanming-hu/taichi_assets/releases/download/llvm8/clang-7.0.1-win.zip -LO
- 7z x clang-7.0.1-win.zip -otaichi_clang
- set PATH=C:\taichi_llvm\bin;%PATH%;
- set PATH=C:\taichi_clang\bin;%PATH%
- set TAICHI_REPO_DIR=C:\taichi
- set PYTHONPATH=%TAICHI_REPO_DIR%/python
- set PATH=%TAICHI_REPO_DIR%\bin;%PATH%
- clang --version
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/fill_sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def benchmark_nested_struct():

@ti.layout
def place():
ti.root.dense(ti.ij, [N, N]).pointer().dense(ti.ij, [8, 8]).place(a)
ti.root.pointer(ti.ij, [N, N]).dense(ti.ij, [8, 8]).place(a)

@ti.kernel
def fill():
Expand All @@ -24,7 +24,7 @@ def benchmark_nested_struct_fill_and_clear():

@ti.layout
def place():
ti.root.dense(ti.ij, [N, N]).pointer().dense(ti.ij, [8, 8]).place(a)
ti.root.pointer(ti.ij, [N, N]).dense(ti.ij, [8, 8]).place(a)

@ti.kernel
def fill():
Expand Down
2 changes: 1 addition & 1 deletion ci_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def get_shell_rc_name():

def get_username():
if build_type == 'ci':
os.environ['TC_CI'] = '1'
os.environ['TI_CI'] = '1'
username = 'travis'
else:
assert get_os_name() != 'win'
Expand Down
14 changes: 7 additions & 7 deletions cmake/TaichiCXXFlags.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
message("Using C++ compiler: " ${CMAKE_CXX_COMPILER})

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTC_ISE_NONE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTI_ISE_NONE")

option(BUILD_WITH_ADDRESS_SANITIZER "Build with clang address sanitizer" OFF)

Expand Down Expand Up @@ -49,19 +49,19 @@ if (USE_STDCPP)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTC_PASS_EXCEPTION_TO_PYTHON")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTI_PASS_EXCEPTION_TO_PYTHON")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTC_INCLUDED")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTI_INCLUDED")

if ($ENV{TC_USE_DOUBLE})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTC_USE_DOUBLE")
if ($ENV{TI_USE_DOUBLE})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTI_USE_DOUBLE")
message("Using float64 (double) precision as real")
else()
message("Using float32 (single) precision as real")
endif()

if (TC_USE_MPI)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTC_USE_MPI")
if (TI_USE_MPI)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTI_USE_MPI")
message("Using MPI")
endif ()

Expand Down
4 changes: 2 additions & 2 deletions cmake/TaichiCore.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ if (TI_WITH_CUDA)
message("Building with CUDA ${CUDA_VERSION}")
set(CUDA_ARCH 61)
message("Found CUDA. Arch = ${CUDA_ARCH}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCUDA_FOUND -DTI_WITH_CUDA")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTI_WITH_CUDA")
if (MSVC)
include_directories(${CUDA_TOOLKIT_ROOT_DIR}/include)
target_link_libraries(${LIBRARY_NAME} ${CUDA_TOOLKIT_ROOT_DIR}/lib/x64/cudart.lib ${CUDA_TOOLKIT_ROOT_DIR}/lib/x64/cuda.lib)
Expand Down Expand Up @@ -83,7 +83,7 @@ llvm_map_components_to_libnames(llvm_libs
)
target_link_libraries(${LIBRARY_NAME} ${llvm_libs})

if (CUDA_FOUND)
if (TI_WITH_CUDA)
llvm_map_components_to_libnames(llvm_ptx_libs NVPTX)
target_link_libraries(${LIBRARY_NAME} ${llvm_ptx_libs})
endif()
Expand Down
2 changes: 1 addition & 1 deletion docs/cpp_style.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Naming
--------------------------------------------------------------------------
- Variable names should consist of lowercase words connected by underscores, e.g. ``llvm_context``.
- Class and struct names should consist of words with first letters capitalized, e.g. ``CodegenLLVM``.
- Macros should be capital start with ``TC``, such as ``TC_INFO``, ``TC_IMPLEMENTATION``.
- Macros should be capital start with ``TC``, such as ``TI_INFO``, ``TI_IMPLEMENTATION``.

- We do not encourage the use of macro, although there are cases where macros are inevitable.

Expand Down
24 changes: 12 additions & 12 deletions docs/utilities.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,45 +47,45 @@ Serialization

The serialization module of taichi allows you to serialize/deserialize objects into/from binary strings.

You can use ``TC_IO`` macros to explicit define fields necessary in Taichi.
You can use ``TI_IO`` macros to explicit define fields necessary in Taichi.

.. code-block:: cpp

// TC_IO_DEF
// TI_IO_DEF
struct Particle {
Vector3f position, velocity;
real mass;
string name;

TC_IO_DEF(position, velocity, mass, name);
TI_IO_DEF(position, velocity, mass, name);
}

// TC_IO_DECL
// TI_IO_DECL
struct Particle {
Vector3f position, velocity;
real mass;
bool has_name
string name;

TC_IO_DECL() {
TC_IO(position);
TC_IO(velocity);
TC_IO(mass);
TC_IO(has_name);
TI_IO_DECL() {
TI_IO(position);
TI_IO(velocity);
TI_IO(mass);
TI_IO(has_name);
// More flexibility:
if (has_name) {
TC_IO(name);
TI_IO(name);
}
}
}

// TC_IO_DEF_VIRT();
// TI_IO_DEF_VIRT();


Progress Notification
----------------------------------

The taichi messager can send an email to ``$TC_MONITOR_EMAIL`` when the task finished or crashed.
The taichi messager can send an email to ``$TI_MONITOR_EMAIL`` when the task finished or crashed.
To enable:

.. code-block:: python
Expand Down
2 changes: 1 addition & 1 deletion docs/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.0
0.5.1
12 changes: 6 additions & 6 deletions examples/cpp/cnn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <taichi/visual/gui.h>
#include <taichi/system/profiler.h>

TC_NAMESPACE_BEGIN
TI_NAMESPACE_BEGIN

using namespace Tlang;

Expand All @@ -12,10 +12,10 @@ constexpr int n = 256;
constexpr int num_ch1 = 16, num_ch2 = 16;

auto cnn = [](std::vector<std::string> cli_param) {
TC_WARN(
TI_WARN(
"After refactoring the Texture class from Taichi is removed. Need to "
"read from the raw bunny binary.");
TC_NOT_IMPLEMENTED
TI_NOT_IMPLEMENTED
#if (0)
CoreState::set_trigger_gdb_when_crash(true);
auto param = parse_param(cli_param);
Expand All @@ -24,7 +24,7 @@ auto cnn = [](std::vector<std::string> cli_param) {
auto cache_l1 = param.get("cache_l1", true);
auto use_dense = param.get("use_dense", false);
auto write_input_voxel = param.get("write_input", true);
TC_P(use_dense);
TI_P(use_dense);

Program prog(gpu ? Arch::gpu : Arch::x86_64);
prog.config.simplify_before_lower_access = opt;
Expand Down Expand Up @@ -228,6 +228,6 @@ auto cnn = [](std::vector<std::string> cli_param) {
#endif
#endif
};
TC_REGISTER_TASK(cnn);
TI_REGISTER_TASK(cnn);

TC_NAMESPACE_END
TI_NAMESPACE_END
34 changes: 17 additions & 17 deletions examples/cpp/diff_conv.cpp
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#include <taichi/util.h>

TC_NAMESPACE_BEGIN
TI_NAMESPACE_BEGIN

auto diff_conv = [](const std::vector<std::string> args) {
int grid_resolution = 254;
TC_ASSERT(args.size() == 3);
TI_ASSERT(args.size() == 3);
float th = std::stof(args[2]);
TC_P(th);
TI_P(th);
auto f = fopen(args[0].c_str(), "rb");

int n = pow<3>(grid_resolution);
TC_ASSERT(f);
TI_ASSERT(f);

std::vector<float32> ret1(n);
trash(std::fread(ret1.data(), sizeof(float32), ret1.size(), f));
std::fclose(f);

f = fopen(args[1].c_str(), "rb");
TC_ASSERT(f);
TI_ASSERT(f);
std::vector<float32> ret2(n);
trash(std::fread(ret2.data(), sizeof(float32), ret2.size(), f));
std::fclose(f);
Expand Down Expand Up @@ -53,19 +53,19 @@ auto diff_conv = [](const std::vector<std::string> args) {
// fprintf(stderr, "ret1:%f, ret2:%f\n", ret1[i], ret2[i]);
//}
}
TC_INFO("same {} {}%", counter[0], 100.0f * counter[0] / n);
TC_INFO("non zero same {} {}%", counter[0],
TI_INFO("same {} {}%", counter[0], 100.0f * counter[0] / n);
TI_INFO("non zero same {} {}%", counter[0],
100.0f * counter[1] / total_non_zero);
TC_P(sum1 / n);
TC_P(sum2 / n);
TC_P(sum1 / total_non_zero);
TC_P(sum2 / total_non_zero);
TC_P(max1);
TC_P(max2);
TC_P(non_zero1);
TC_P(non_zero2);
TI_P(sum1 / n);
TI_P(sum2 / n);
TI_P(sum1 / total_non_zero);
TI_P(sum2 / total_non_zero);
TI_P(max1);
TI_P(max2);
TI_P(non_zero1);
TI_P(non_zero2);
};

TC_REGISTER_TASK(diff_conv);
TI_REGISTER_TASK(diff_conv);

TC_NAMESPACE_END
TI_NAMESPACE_END
Loading