您现在的位置是:首页 > 文章详情

Taichi(太极)v1.6.0 发布

日期:2023-05-14点击:291

Taichi(太极)v1.6.0 现已发布。Taichi Lang 是一种开源的、命令式的、用于高性能数值计算的并行编程语言。它被嵌入到 Python 中,并使用即时编译器 (JIT) 框架,例如 LLVM,将计算密集型的 Python 代码 offload 到本地 GPU 或 CPU 指令中。

具体更新内容如下:

弃用通知

  • 删除了一些很久以前就弃用的 API。见下表:
Removed API Replace with
Using atomic operations like a.atomic_add(b) ti.atomic_add(a, b) or a += b
Using is and is not inside Taichi kernel and Taichi function Not supported
Ndrange for loop with the number of the loop variables not equal to the dimension of the ndrange Not supported
ti.ui.make_camera() ti.ui.Camera()
ti.ui.Window.write_image() ti.ui.Window.save_image()
ti.SOA ti.Layout.SOA
ti.AOS ti.Layout.AOS
ti.print_profile_info ti.profiler.print_scoped_profiler_info
ti.clear_profile_info ti.profiler.clear_scoped_profiler_info
ti.print_memory_profile_info ti.profiler.print_memory_profiler_info
ti.CuptiMetric ti.profiler.CuptiMetric
ti.get_predefined_cupti_metrics ti.profiler.get_predefined_cupti_metrics
ti.print_kernel_profile_info ti.profiler.print_kernel_profiler_info
ti.query_kernel_profile_info ti.profiler.query_kernel_profiler_info
ti.clear_kernel_profile_info ti.profiler.clear_kernel_profiler_info
ti.kernel_profiler_total_time ti.profiler.get_kernel_profiler_total_time
ti.set_kernel_profiler_toolkit ti.profiler.set_kernel_profiler_toolkit
ti.set_kernel_profile_metrics ti.profiler.set_kernel_profiler_metrics
ti.collect_kernel_profile_metrics ti.profiler.collect_kernel_profiler_metrics
ti.VideoManager ti.tools.VideoManager
ti.PLYWriter ti.tools.PLYWriter
ti.imread ti.tools.imread
ti.imresize ti.tools.imresize
ti.imshow ti.tools.imshow
ti.imwrite ti.tools.imwrite
ti.ext_arr ti.types.ndarray
ti.any_arr ti.types.ndarray
ti.Tape ti.ad.Tape
ti.clear_all_gradients ti.ad.clear_all_gradients
ti.linalg.sparse_matrix_builder ti.types.sparse_matrix_builder
  • 不再弃用 Taichi 内核中的内置 min/max 函数。
  • 弃用了计算图参数声明中的一些参数,它们将在 v1.7.0 中删除。包括:
    • scalar 和 ndarray 的element_shape参数
    • texture 的shapechannel_formatnum_channels参数
  • cc后端将在下一个版本中删除 ( v1.7.0)

新功能

Struct arguments

你现在可以在所有后端中使用结构参数。结构可以嵌套,并且可以包含矩阵和向量。示例:

 transform_type = ti.types.struct(R=ti.math.mat3, T=ti.math.vec3) pos_type = ti.types.struct(x=ti.math.vec3, trans=transform_type) @ti.kernel def kernel_with_nested_struct_arg(p: pos_type) -> ti.math.vec3: return p.trans.R @ p.x + p.trans.T trans = transform_type(ti.math.mat3(1), [1, 1, 1]) p = pos_type(x=[1, 1, 1], trans=trans) print(kernel_with_nested_struct_arg(p)) # [4., 4., 4.]

Ndarray

  • 在 python scope 内支持 0 dim ndarray 读写
  • 修复了从 Python scope 写入 ndarray 时的一个错误

Improvements

  • 支持 autodiff 中的 rsqrt operator
  • 为 CPU 后端添加了 assembly printer
  • 支持超过 48KiB 的 CUDA shared array 分配

Performance

  • 改进了 CPU 后端的矢量化支持,显着提高了特定应用程序的性能

New Examples

  • 2D 欧拉流体模拟示例

Misc

  • Python 3.11 支持
  • ti.frexp在 CUDA、Vulkan、Metal、OpenGL 后端都得到了支持。
  • ti.math.popcntintrinsic
  • 修复了 SNodeTree destruction 过程中的内存泄漏问题
  • 为 ti.Field finalization 添加验证和改进的错误报告
  • 修复了 C-API 中 Cuda 后端的内存泄漏问题
  • 增加了对使用 str.format() 和 f-strings 的格式化打印的支持
  • 将 Python 代码格式化程序从yapf更改为black

Developer Experience

  • 用于准备构建和测试环境的 build.py 脚本

更多详情可查看发布说明

原文链接:https://www.oschina.net/news/241052/taichi-1-6-0-released
关注公众号

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。

持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。

转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。

文章评论

共有0条评论来说两句吧...

文章二维码

扫描即可查看该文章

点击排行

推荐阅读

最新文章