taichi-dev / taichi
- пятница, 10 января 2020 г. в 00:18:32
C++
The Taichi programming language
| Documentations | Chat | taichi-nightly | taichi-nightly-cuda-10-0 | taichi-nightly-cuda-10-1 |
|---|---|---|---|---|
# Python 3.6/3.7 needed
# CPU only. No GPU/CUDA needed. (Linux, OS X and Windows)
python3 -m pip install taichi-nightly
# With GPU (CUDA 10.0) support (Linux only)
python3 -m pip install taichi-nightly-cuda-10-0
# With GPU (CUDA 10.1) support (Linux only)
python3 -m pip install taichi-nightly-cuda-10-1| Linux (CUDA) | OS X (10.14) | Windows | |
|---|---|---|---|
| Build | |||
| PyPI |
ti.static(ti.grouped(ti.ndrange(...)))ti.atan2(y, x)ti.GUI classti.Matrix.fillti.Matrix.T() for transposing a matrixti.static(ti.ndrange)ti.Matrix.identity()ti.Matrix.one() (create a matrix with 1 as all the entries)ir_printer on SNodesdynamic SNodes.
Struct-for's on dynamic nodes supportedti.length and ti.append to query and manipulate dynamic nodesti.ndrange: @ti.kernel
def fill_3d():
# Parallelized for all 3 <= i < 8, 1 <= j < 6, 0 <= k < 9
for i, j, k in ti.ndrange((3, 8), (1, 6), 9):
x[i, j, k] = i + j + kti and tid (debug mode) CLI commandsti.append now returns the list length before appendingti.get_runtime().set_verbose_kernel_launch(True) to log kernel launches/ and // following the Python conventiondynamic node support (ti.append, ti.length) in the new LLVM backendassert <condition> statement supported in Taichi kernels.1 < x <3) supported in Taichi kernels.ti.classfunc decorator for functions within a data_oriented class[Expr/Vector/Matrix].to_torch now has a extra argument device, which specifies the device placement for returned torch tensor, and should have type torch.device. Default=None.to_torch/from_torch.matrix size to 1)ti.data_oriented decorator introduced. Please decorate all your Taichi data-oriented objects using this decorator. To invoke the gradient versions of classmethod, for example, A.forward, simply use A.forward.grad() instead of A.forward(__gradient=True) (obsolete).R, S = ti.polar_decompose(A, ti.f32)) and svd (U, sigma, V = ti.svd(A, ti.f32)) support. Note that sigma is a 3x3 diagonal matrix.expr_init with ti.core.DataType as inputs, so that ti.core.DataType can be used as ti.func parameterDiffTaichi examples moved to a standalone repoVector.norm now comes with a parameter eps (=0 by default), and returns sqrt(\sum_i(x_i ^ 2) + eps). A non-zero eps safe guards the operator's gradient on zero vectors during differentiable programming.glibc 2.27break statements supported in while loopsti.GUI.set_image(np.ndarray/Taichi tensor)x[i] += j is equivalent to ti.atomic_add(x[i], j)ti.func arguments are forced to pass by valuemin/max can now take more than two arguments, e.g. max(a, b, c, d)transposed, trace, polar_decompose, determinant promoted to ti scope. I.e., users can now use ti.transposed(M) instead of ti.Matrix.transposed(M)ti.get_runtime().set_verbose(False) to eliminate verbose outputsti.random(ti.i32/i64/f32/f64)Taichi, numpy and PyTorch
taichi_scalar_tensor.to_numpy()/from_numpy(numpy_array)taichi_scalar_tensor.to_torch()/from_torch(torch_array)ti.ext_arr() now takes PyTorch tensorsmin/max supprtMatrix.to_numpy, Matrix.zero, Matrix.identity, Matrix.fillti.staticnumpy arrays passed as a ti.ext_arr() [examples]
i32/f32/i64/f64 data type support for numpyTensor.to_numpy() and Tensor.from_numpy(numpy.ndarray) supported [examples]ti.ext_arr(). Please use numpy arrays as intermediate buffers for nowTensor.dim() to retrieve the dimensionality of a global tensorTensor.shape() to retrieve the shape of a global tensorstruct-for (e.g. for i, j in x) now supports iterating over tensors with non power-of-two dimensionsTensor.fill(x) to set all entries to xMatrix.fill(x) to set all entries to x, where x can be a scalar or ti.Matrix of the same sizestruct-for with grouped indices for better metaprogramming, especially in writing dimensionality-independent code, in e.g. physical simulation: [examples]for I in ti.grouped(x): # I is a vector of size x.dim() and data type i32
x[I] = 0
# If tensor x is 2D
for I in ti.grouped(x): # I is a vector of size x.dim() and data type i32
y[I + ti.Vector([0, 1])] = I[0] + I[1]
# is equivalent to
for i, j in x:
y[i, j + 1] = i + j(Nov 27, 2019) v0.1.5 released.
ti.static outside Taichi kernels(Nov 22, 2019) v0.1.3 released.
print instead of ti.printint() instead of ti.cast(x, ti.i32) (or ti.cast(x, ti.i64) if your default integer precision is 64 bit)float() instead of ti.cast(x, ti.f32) (or ti.cast(x, ti.f64) if your default float-point precision is 64 bit)abs instead of ti.absti.static_print for compile-time printing(Nov 16, 2019) v0.1.0 released. Fixed PyTorch interface.
(Nov 12, 2019) v0.0.87 released.
(Nov 4, 2019) v0.0.85 released.
ti.stop_grad for stopping gradients during backpropagation. [Example];(Nov 1, 2019) v0.0.77 released.
gcc-7 or clang-7 anymore. To use legacy backends, export TI_LLVM=0;(Oct 30, 2019) v0.0.72 released.
export TI_LLVM=1;struct for list generation.(Oct 29, 2019) v0.0.71 released. LLVM GPU backend performance greatly improved. Frontend compiler now emits readable syntax error messages.
(Oct 28, 2019) v0.0.70 released. This version comes with experimental LLVM backends for x86_64 and CUDA (via NVVM/PTX). GPU kernel compilation speed is improved by 10x. To enable, update the taichi package and export TI_LLVM=1.
(Oct 24, 2019) Python wheels (v0.0.61) released for Python 3.6/3.7 and CUDA 10.0/10.1 on Ubuntu 16.04+. Contributors of this release include Yuanming Hu, robbertvc, Zhoutong Zhang, Tao Du, Srinivas Kaza, and Kenneth Lozes.
(Oct 22, 2019) Added support for kernel templates. Kernel templates allow users to pass in taichi tensors and compile-time constants as kernel parameters.
(Oct 9, 2019) Compatibility improvements. Added a basic PyTorch interface. [Example].
Notes:
examples. You do not need to execute install.py or dev_setup.py.
After installation using pip you can simply go to examples and execute, e.g., python3 mpm_fluid.py.TAICHI_REPO_DIR, and remove legacy taichi from PYTHONPATH) in your .bashrc or .zshrc. Or you can simply do this in your shell to temporarily clear them:export PYTHONPATH=
export TAICHI_REPO_DIR=
Taichi is an open-source computer graphics library that aims to provide easy-to-use infrastructures for computer graphics R&D. It's written in C++14 and wrapped friendly with Python.