gstaichi 0.1.23.dev0__cp310-cp310-macosx_15_0_arm64.whl → 0.1.25.dev0__cp310-cp310-macosx_15_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {taichi → gstaichi}/__init__.py +9 -13
- {taichi → gstaichi}/_funcs.py +8 -8
- {taichi → gstaichi}/_kernels.py +19 -19
- gstaichi/_lib/__init__.py +3 -0
- taichi/_lib/core/taichi_python.cpython-310-darwin.so → gstaichi/_lib/core/gstaichi_python.cpython-310-darwin.so +0 -0
- taichi/_lib/core/taichi_python.pyi → gstaichi/_lib/core/gstaichi_python.pyi +382 -520
- {taichi → gstaichi}/_lib/runtime/runtime_arm64.bc +0 -0
- {taichi → gstaichi}/_lib/utils.py +15 -15
- {taichi → gstaichi}/_logging.py +1 -1
- {taichi → gstaichi}/_main.py +24 -31
- gstaichi/_snode/__init__.py +5 -0
- {taichi → gstaichi}/_snode/fields_builder.py +27 -29
- {taichi → gstaichi}/_snode/snode_tree.py +5 -5
- gstaichi/_test_tools/__init__.py +0 -0
- gstaichi/_test_tools/load_kernel_string.py +30 -0
- gstaichi/_version.py +1 -0
- {taichi → gstaichi}/_version_check.py +8 -5
- gstaichi/ad/__init__.py +3 -0
- {taichi → gstaichi}/ad/_ad.py +26 -26
- {taichi → gstaichi}/algorithms/_algorithms.py +7 -7
- {taichi → gstaichi}/examples/minimal.py +1 -1
- {taichi → gstaichi}/experimental.py +1 -1
- gstaichi/lang/__init__.py +50 -0
- {taichi → gstaichi}/lang/_ndarray.py +30 -26
- {taichi → gstaichi}/lang/_ndrange.py +8 -8
- gstaichi/lang/_template_mapper.py +199 -0
- {taichi → gstaichi}/lang/_texture.py +19 -19
- {taichi → gstaichi}/lang/_wrap_inspect.py +7 -7
- {taichi → gstaichi}/lang/any_array.py +13 -13
- {taichi → gstaichi}/lang/argpack.py +29 -29
- gstaichi/lang/ast/__init__.py +5 -0
- {taichi → gstaichi}/lang/ast/ast_transformer.py +94 -582
- {taichi → gstaichi}/lang/ast/ast_transformer_utils.py +54 -41
- gstaichi/lang/ast/ast_transformers/__init__.py +0 -0
- gstaichi/lang/ast/ast_transformers/call_transformer.py +267 -0
- gstaichi/lang/ast/ast_transformers/function_def_transformer.py +320 -0
- {taichi → gstaichi}/lang/ast/checkers.py +5 -5
- gstaichi/lang/ast/transform.py +9 -0
- {taichi → gstaichi}/lang/common_ops.py +12 -12
- gstaichi/lang/exception.py +80 -0
- {taichi → gstaichi}/lang/expr.py +22 -22
- {taichi → gstaichi}/lang/field.py +29 -27
- {taichi → gstaichi}/lang/impl.py +116 -121
- {taichi → gstaichi}/lang/kernel_arguments.py +16 -16
- {taichi → gstaichi}/lang/kernel_impl.py +330 -363
- {taichi → gstaichi}/lang/matrix.py +119 -115
- {taichi → gstaichi}/lang/matrix_ops.py +6 -6
- {taichi → gstaichi}/lang/matrix_ops_utils.py +4 -4
- {taichi → gstaichi}/lang/mesh.py +22 -22
- {taichi → gstaichi}/lang/misc.py +39 -68
- {taichi → gstaichi}/lang/ops.py +146 -141
- {taichi → gstaichi}/lang/runtime_ops.py +2 -2
- {taichi → gstaichi}/lang/shell.py +3 -3
- {taichi → gstaichi}/lang/simt/__init__.py +1 -1
- {taichi → gstaichi}/lang/simt/block.py +7 -7
- {taichi → gstaichi}/lang/simt/grid.py +1 -1
- {taichi → gstaichi}/lang/simt/subgroup.py +1 -1
- {taichi → gstaichi}/lang/simt/warp.py +1 -1
- {taichi → gstaichi}/lang/snode.py +46 -44
- {taichi → gstaichi}/lang/source_builder.py +13 -13
- {taichi → gstaichi}/lang/struct.py +33 -33
- {taichi → gstaichi}/lang/util.py +24 -24
- gstaichi/linalg/__init__.py +8 -0
- {taichi → gstaichi}/linalg/matrixfree_cg.py +14 -14
- {taichi → gstaichi}/linalg/sparse_cg.py +10 -10
- {taichi → gstaichi}/linalg/sparse_matrix.py +23 -23
- {taichi → gstaichi}/linalg/sparse_solver.py +21 -21
- {taichi → gstaichi}/math/__init__.py +1 -1
- {taichi → gstaichi}/math/_complex.py +21 -20
- {taichi → gstaichi}/math/mathimpl.py +56 -56
- gstaichi/profiler/__init__.py +6 -0
- {taichi → gstaichi}/profiler/kernel_metrics.py +11 -11
- {taichi → gstaichi}/profiler/kernel_profiler.py +30 -36
- {taichi → gstaichi}/profiler/memory_profiler.py +1 -1
- {taichi → gstaichi}/profiler/scoped_profiler.py +2 -2
- {taichi → gstaichi}/sparse/_sparse_grid.py +7 -7
- {taichi → gstaichi}/tools/__init__.py +4 -4
- {taichi → gstaichi}/tools/diagnose.py +10 -17
- gstaichi/types/__init__.py +19 -0
- {taichi → gstaichi}/types/annotations.py +1 -1
- {taichi → gstaichi}/types/compound_types.py +8 -8
- {taichi → gstaichi}/types/enums.py +1 -1
- {taichi → gstaichi}/types/ndarray_type.py +7 -7
- {taichi → gstaichi}/types/primitive_types.py +17 -14
- {taichi → gstaichi}/types/quant.py +9 -9
- {taichi → gstaichi}/types/texture_type.py +5 -5
- {taichi → gstaichi}/types/utils.py +1 -1
- {gstaichi-0.1.23.dev0.dist-info → gstaichi-0.1.25.dev0.dist-info}/METADATA +13 -16
- gstaichi-0.1.25.dev0.dist-info/RECORD +168 -0
- gstaichi-0.1.25.dev0.dist-info/entry_points.txt +2 -0
- gstaichi-0.1.25.dev0.dist-info/top_level.txt +1 -0
- gstaichi-0.1.23.dev0.dist-info/RECORD +0 -219
- gstaichi-0.1.23.dev0.dist-info/entry_points.txt +0 -2
- gstaichi-0.1.23.dev0.dist-info/top_level.txt +0 -1
- taichi/_lib/__init__.py +0 -3
- taichi/_lib/c_api/include/taichi/cpp/taichi.hpp +0 -1401
- taichi/_lib/c_api/include/taichi/taichi.h +0 -29
- taichi/_lib/c_api/include/taichi/taichi_core.h +0 -1111
- taichi/_lib/c_api/include/taichi/taichi_cpu.h +0 -29
- taichi/_lib/c_api/include/taichi/taichi_metal.h +0 -72
- taichi/_lib/c_api/include/taichi/taichi_platform.h +0 -55
- taichi/_lib/c_api/include/taichi/taichi_unity.h +0 -64
- taichi/_lib/c_api/include/taichi/taichi_vulkan.h +0 -151
- taichi/_lib/c_api/lib/libtaichi_c_api.dylib +0 -0
- taichi/_lib/c_api/runtime/runtime_arm64.bc +0 -0
- taichi/_lib/c_api/taichi/lib/cmake/taichi/TaichiConfig.cmake +0 -29
- taichi/_lib/c_api/taichi/lib/cmake/taichi/TaichiConfigVersion.cmake +0 -65
- taichi/_lib/c_api/taichi/lib/cmake/taichi/TaichiTargets.cmake +0 -121
- taichi/_lib/runtime/libMoltenVK.dylib +0 -0
- taichi/_snode/__init__.py +0 -5
- taichi/_ti_module/__init__.py +0 -3
- taichi/_ti_module/cppgen.py +0 -309
- taichi/_ti_module/module.py +0 -145
- taichi/_version.py +0 -1
- taichi/ad/__init__.py +0 -3
- taichi/aot/__init__.py +0 -12
- taichi/aot/_export.py +0 -28
- taichi/aot/conventions/__init__.py +0 -3
- taichi/aot/conventions/gfxruntime140/__init__.py +0 -38
- taichi/aot/conventions/gfxruntime140/dr.py +0 -244
- taichi/aot/conventions/gfxruntime140/sr.py +0 -613
- taichi/aot/module.py +0 -253
- taichi/aot/utils.py +0 -151
- taichi/graph/__init__.py +0 -3
- taichi/graph/_graph.py +0 -292
- taichi/lang/__init__.py +0 -50
- taichi/lang/ast/__init__.py +0 -5
- taichi/lang/ast/transform.py +0 -9
- taichi/lang/exception.py +0 -80
- taichi/linalg/__init__.py +0 -8
- taichi/profiler/__init__.py +0 -6
- taichi/shaders/Circles_vk.frag +0 -29
- taichi/shaders/Circles_vk.vert +0 -45
- taichi/shaders/Circles_vk_frag.spv +0 -0
- taichi/shaders/Circles_vk_vert.spv +0 -0
- taichi/shaders/Lines_vk.frag +0 -9
- taichi/shaders/Lines_vk.vert +0 -11
- taichi/shaders/Lines_vk_frag.spv +0 -0
- taichi/shaders/Lines_vk_vert.spv +0 -0
- taichi/shaders/Mesh_vk.frag +0 -71
- taichi/shaders/Mesh_vk.vert +0 -68
- taichi/shaders/Mesh_vk_frag.spv +0 -0
- taichi/shaders/Mesh_vk_vert.spv +0 -0
- taichi/shaders/Particles_vk.frag +0 -95
- taichi/shaders/Particles_vk.vert +0 -73
- taichi/shaders/Particles_vk_frag.spv +0 -0
- taichi/shaders/Particles_vk_vert.spv +0 -0
- taichi/shaders/SceneLines2quad_vk_comp.spv +0 -0
- taichi/shaders/SceneLines_vk.frag +0 -9
- taichi/shaders/SceneLines_vk.vert +0 -12
- taichi/shaders/SceneLines_vk_frag.spv +0 -0
- taichi/shaders/SceneLines_vk_vert.spv +0 -0
- taichi/shaders/SetImage_vk.frag +0 -21
- taichi/shaders/SetImage_vk.vert +0 -15
- taichi/shaders/SetImage_vk_frag.spv +0 -0
- taichi/shaders/SetImage_vk_vert.spv +0 -0
- taichi/shaders/Triangles_vk.frag +0 -16
- taichi/shaders/Triangles_vk.vert +0 -29
- taichi/shaders/Triangles_vk_frag.spv +0 -0
- taichi/shaders/Triangles_vk_vert.spv +0 -0
- taichi/shaders/lines2quad_vk_comp.spv +0 -0
- taichi/types/__init__.py +0 -19
- {taichi → gstaichi}/__main__.py +0 -0
- {taichi → gstaichi}/_lib/core/__init__.py +0 -0
- {taichi → gstaichi}/_lib/core/py.typed +0 -0
- {taichi/_lib/c_api → gstaichi/_lib}/runtime/libMoltenVK.dylib +0 -0
- {taichi → gstaichi}/algorithms/__init__.py +0 -0
- {taichi → gstaichi}/assets/.git +0 -0
- {taichi → gstaichi}/assets/Go-Regular.ttf +0 -0
- {taichi → gstaichi}/assets/static/imgs/ti_gallery.png +0 -0
- {taichi → gstaichi}/lang/ast/symbol_resolver.py +0 -0
- {taichi → gstaichi}/sparse/__init__.py +0 -0
- {taichi → gstaichi}/tools/np2ply.py +0 -0
- {taichi → gstaichi}/tools/vtk.py +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/GLFW/glfw3.h +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/GLFW/glfw3native.h +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv-tools/instrument.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv-tools/libspirv.h +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv-tools/libspirv.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv-tools/linker.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv-tools/optimizer.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/GLSL.std.450.h +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv.h +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_cfg.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_common.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_cpp.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_cross.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_cross_c.h +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_cross_containers.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_cross_error_handling.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_cross_parsed_ir.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_cross_util.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_glsl.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_hlsl.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_msl.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_parser.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_reflect.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools/SPIRV-ToolsConfig.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools/SPIRV-ToolsTarget-release.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools/SPIRV-ToolsTarget.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-diff/SPIRV-Tools-diffConfig.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-diff/SPIRV-Tools-diffTargets-release.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-diff/SPIRV-Tools-diffTargets.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-link/SPIRV-Tools-linkConfig.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-link/SPIRV-Tools-linkTargets-release.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-link/SPIRV-Tools-linkTargets.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-lint/SPIRV-Tools-lintConfig.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-lint/SPIRV-Tools-lintTargets-release.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-lint/SPIRV-Tools-lintTargets.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-opt/SPIRV-Tools-optConfig.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-opt/SPIRV-Tools-optTargets-release.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-opt/SPIRV-Tools-optTargets.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-reduce/SPIRV-Tools-reduceConfig.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-reduce/SPIRV-Tools-reduceTarget-release.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-reduce/SPIRV-Tools-reduceTarget.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/glfw3/glfw3Config.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/glfw3/glfw3ConfigVersion.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/glfw3/glfw3Targets-release.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/glfw3/glfw3Targets.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/libSPIRV-Tools-shared.dylib +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_c/cmake/spirv_cross_cConfig-release.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_c/cmake/spirv_cross_cConfig.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_core/cmake/spirv_cross_coreConfig-release.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_core/cmake/spirv_cross_coreConfig.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_cpp/cmake/spirv_cross_cppConfig-release.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_cpp/cmake/spirv_cross_cppConfig.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_glsl/cmake/spirv_cross_glslConfig-release.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_glsl/cmake/spirv_cross_glslConfig.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_hlsl/cmake/spirv_cross_hlslConfig-release.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_hlsl/cmake/spirv_cross_hlslConfig.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_msl/cmake/spirv_cross_mslConfig-release.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_msl/cmake/spirv_cross_mslConfig.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_reflect/cmake/spirv_cross_reflectConfig-release.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_reflect/cmake/spirv_cross_reflectConfig.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_util/cmake/spirv_cross_utilConfig-release.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_util/cmake/spirv_cross_utilConfig.cmake +0 -0
- {gstaichi-0.1.23.dev0.dist-info → gstaichi-0.1.25.dev0.dist-info}/WHEEL +0 -0
- {gstaichi-0.1.23.dev0.dist-info → gstaichi-0.1.25.dev0.dist-info}/licenses/LICENSE +0 -0
@@ -6,11 +6,11 @@ Math functions for glsl-like functions and other stuff.
|
|
6
6
|
"""
|
7
7
|
import math
|
8
8
|
|
9
|
-
from
|
10
|
-
from
|
11
|
-
from
|
12
|
-
from
|
13
|
-
from
|
9
|
+
from gstaichi.lang import impl, ops
|
10
|
+
from gstaichi.lang.impl import static, zero
|
11
|
+
from gstaichi.lang.kernel_impl import func
|
12
|
+
from gstaichi.lang.matrix import Matrix
|
13
|
+
from gstaichi.lang.ops import (
|
14
14
|
acos,
|
15
15
|
asin,
|
16
16
|
atan2,
|
@@ -28,8 +28,8 @@ from taichi.lang.ops import (
|
|
28
28
|
tan,
|
29
29
|
tanh,
|
30
30
|
)
|
31
|
-
from
|
32
|
-
from
|
31
|
+
from gstaichi.types import matrix, template, vector
|
32
|
+
from gstaichi.types.primitive_types import f64, u32, u64
|
33
33
|
|
34
34
|
cfg = impl.default_cfg
|
35
35
|
|
@@ -108,21 +108,21 @@ def mix(x, y, a):
|
|
108
108
|
`a` to weight between them. The return value is computed as
|
109
109
|
`x * (1 - a) + a * y`.
|
110
110
|
|
111
|
-
The arguments can be scalars or :class:`~
|
111
|
+
The arguments can be scalars or :class:`~gstaichi.Matrix`,
|
112
112
|
as long as the operation can be performed.
|
113
113
|
|
114
114
|
This function is similar to the `mix` function in GLSL.
|
115
115
|
|
116
116
|
Args:
|
117
|
-
x (:mod:`~
|
117
|
+
x (:mod:`~gstaichi.types.primitive_types`, :class:`~gstaichi.Matrix`): Specify
|
118
118
|
the start of the range in which to interpolate.
|
119
|
-
y (:mod:`~
|
119
|
+
y (:mod:`~gstaichi.types.primitive_types`, :class:`~gstaichi.Matrix`): Specify
|
120
120
|
the end of the range in which to interpolate.
|
121
|
-
a (:mod:`~
|
121
|
+
a (:mod:`~gstaichi.types.primitive_types`, :class:`~gstaichi.Matrix`): Specify
|
122
122
|
the weight to use to interpolate between x and y.
|
123
123
|
|
124
124
|
Returns:
|
125
|
-
(:mod:`~
|
125
|
+
(:mod:`~gstaichi.types.primitive_types`, :class:`~gstaichi.Matrix`): The linear
|
126
126
|
interpolation of `x` and `y` by weight `a`.
|
127
127
|
|
128
128
|
Example::
|
@@ -146,15 +146,15 @@ def clamp(x, xmin, xmax):
|
|
146
146
|
"""Constrain a value to lie between two further values, element-wise.
|
147
147
|
The returned value is computed as `min(max(x, xmin), xmax)`.
|
148
148
|
|
149
|
-
The arguments can be scalars or :class:`~
|
149
|
+
The arguments can be scalars or :class:`~gstaichi.Matrix`,
|
150
150
|
as long as they can be broadcasted to a common shape.
|
151
151
|
|
152
152
|
Args:
|
153
|
-
x (:mod:`~
|
153
|
+
x (:mod:`~gstaichi.types.primitive_types`, :class:`~gstaichi.Matrix`): Specify
|
154
154
|
the value to constrain.
|
155
|
-
y (:mod:`~
|
155
|
+
y (:mod:`~gstaichi.types.primitive_types`, :class:`~gstaichi.Matrix`): Specify
|
156
156
|
the lower end of the range into which to constrain `x`.
|
157
|
-
a (:mod:`~
|
157
|
+
a (:mod:`~gstaichi.types.primitive_types`, :class:`~gstaichi.Matrix`): Specify
|
158
158
|
the upper end of the range into which to constrain `x`.
|
159
159
|
|
160
160
|
Returns:
|
@@ -181,13 +181,13 @@ def step(edge, x):
|
|
181
181
|
For element i of the return value, 0.0 is returned if x[i] < edge[i],
|
182
182
|
and 1.0 is returned otherwise.
|
183
183
|
|
184
|
-
The two arguments can be scalars or :class:`~
|
184
|
+
The two arguments can be scalars or :class:`~gstaichi.Matrix`,
|
185
185
|
as long as they can be broadcasted to a common shape.
|
186
186
|
|
187
187
|
Args:
|
188
|
-
edge (:mod:`~
|
188
|
+
edge (:mod:`~gstaichi.types.primitive_types`, :class:`~gstaichi.Matrix`): Specify
|
189
189
|
the location of the edge of the step function.
|
190
|
-
x (:mod:`~
|
190
|
+
x (:mod:`~gstaichi.types.primitive_types`, :class:`~gstaichi.Matrix`): Specify
|
191
191
|
the value to be used to generate the step function.
|
192
192
|
|
193
193
|
Returns:
|
@@ -209,7 +209,7 @@ def fract(x):
|
|
209
209
|
It's equivalent to `x - ti.floor(x)`.
|
210
210
|
|
211
211
|
Args:
|
212
|
-
x (:mod:`~
|
212
|
+
x (:mod:`~gstaichi.types.primitive_types`, :class:`~gstaichi.Matrix`): The
|
213
213
|
input value.
|
214
214
|
|
215
215
|
Returns:
|
@@ -229,17 +229,17 @@ def smoothstep(edge0, edge1, x):
|
|
229
229
|
"""Performs smooth Hermite interpolation between 0 and 1 when
|
230
230
|
`edge0 < x < edge1`, element-wise.
|
231
231
|
|
232
|
-
The arguments can be scalars or :class:`~
|
232
|
+
The arguments can be scalars or :class:`~gstaichi.Matrix`,
|
233
233
|
as long as they can be broadcasted to a common shape.
|
234
234
|
|
235
235
|
This function is equivalent to the `smoothstep` in GLSL.
|
236
236
|
|
237
237
|
Args:
|
238
|
-
edge0 (:mod:`~
|
238
|
+
edge0 (:mod:`~gstaichi.types.primitive_types`, :class:`~gstaichi.Matrix`): Specifies
|
239
239
|
the value of the lower edge of the Hermite function.
|
240
|
-
edge1 (:mod:`~
|
240
|
+
edge1 (:mod:`~gstaichi.types.primitive_types`, :class:`~gstaichi.Matrix`): Specifies
|
241
241
|
the value of the upper edge of the Hermite function.
|
242
|
-
x (:mod:`~
|
242
|
+
x (:mod:`~gstaichi.types.primitive_types`, :class:`~gstaichi.Matrix`): Specifies
|
243
243
|
the source value for interpolation.
|
244
244
|
|
245
245
|
Returns:
|
@@ -262,7 +262,7 @@ def sign(x):
|
|
262
262
|
"""Extract the sign of the parameter, element-wise.
|
263
263
|
|
264
264
|
Args:
|
265
|
-
x (:mod:`~
|
265
|
+
x (:mod:`~gstaichi.types.primitive_types`, :class:`~gstaichi.Matrix`): The
|
266
266
|
input value.
|
267
267
|
|
268
268
|
Returns:
|
@@ -286,7 +286,7 @@ def normalize(v):
|
|
286
286
|
It's equivalent to the `normalize` function is GLSL.
|
287
287
|
|
288
288
|
Args:
|
289
|
-
x (:class:`~
|
289
|
+
x (:class:`~gstaichi.Matrix`): The vector to normalize.
|
290
290
|
|
291
291
|
Returns:
|
292
292
|
The normalized vector :math:`v/|v|`.
|
@@ -308,7 +308,7 @@ def log2(x):
|
|
308
308
|
This is equivalent to the `log2` function is GLSL.
|
309
309
|
|
310
310
|
Args:
|
311
|
-
x (:class:`~
|
311
|
+
x (:class:`~gstaichi.Matrix`): The input value.
|
312
312
|
|
313
313
|
Returns:
|
314
314
|
The base 2 logarithm of `x`.
|
@@ -335,8 +335,8 @@ def reflect(x, n):
|
|
335
335
|
`n` should be normalized in order to achieve the desired result.
|
336
336
|
|
337
337
|
Args:
|
338
|
-
x (:class:`~
|
339
|
-
n (:class:`~
|
338
|
+
x (:class:`~gstaichi.Matrix`): The incident vector.
|
339
|
+
n (:class:`~gstaichi.Matrix`): The normal vector.
|
340
340
|
|
341
341
|
Returns:
|
342
342
|
The reflected vector.
|
@@ -357,7 +357,7 @@ def degrees(x):
|
|
357
357
|
"""Convert `x` in radians to degrees, element-wise.
|
358
358
|
|
359
359
|
Args:
|
360
|
-
x (:class:`~
|
360
|
+
x (:class:`~gstaichi.Matrix`): The input angle in radians.
|
361
361
|
|
362
362
|
Returns:
|
363
363
|
angle in degrees.
|
@@ -376,7 +376,7 @@ def radians(x):
|
|
376
376
|
"""Convert `x` in degrees to radians, element-wise.
|
377
377
|
|
378
378
|
Args:
|
379
|
-
x (:class:`~
|
379
|
+
x (:class:`~gstaichi.Matrix`): The input angle in degrees.
|
380
380
|
|
381
381
|
Returns:
|
382
382
|
angle in radians.
|
@@ -397,8 +397,8 @@ def distance(x, y):
|
|
397
397
|
This function is equivalent to the `distance` function is GLSL.
|
398
398
|
|
399
399
|
Args:
|
400
|
-
x (:mod:`~
|
401
|
-
y (:mod:`~
|
400
|
+
x (:mod:`~gstaichi.types.primitive_types`, :class:`~gstaichi.Matrix`): The first input point.
|
401
|
+
y (:mod:`~gstaichi.types.primitive_types`, :class:`~gstaichi.Matrix`): The second input point.
|
402
402
|
|
403
403
|
Returns:
|
404
404
|
The distance between the two points.
|
@@ -420,12 +420,12 @@ def refract(x, n, eta):
|
|
420
420
|
This function is equivalent to the `refract` function in GLSL.
|
421
421
|
|
422
422
|
Args:
|
423
|
-
x (:class:`~
|
424
|
-
n (:class:`~
|
423
|
+
x (:class:`~gstaichi.Matrix`): The incident vector.
|
424
|
+
n (:class:`~gstaichi.Matrix`): The normal vector.
|
425
425
|
eta (float): The ratio of indices of refraction.
|
426
426
|
|
427
427
|
Returns:
|
428
|
-
:class:`~
|
428
|
+
:class:`~gstaichi.Matrix`: The refraction direction vector.
|
429
429
|
|
430
430
|
Example::
|
431
431
|
|
@@ -447,8 +447,8 @@ def dot(x, y):
|
|
447
447
|
"""Calculate the dot product of two vectors.
|
448
448
|
|
449
449
|
Args:
|
450
|
-
x (:class:`~
|
451
|
-
y (:class:`~
|
450
|
+
x (:class:`~gstaichi.Matrix`): The first input vector.
|
451
|
+
y (:class:`~gstaichi.Matrix`): The second input vector.
|
452
452
|
|
453
453
|
Returns:
|
454
454
|
The dot product of two vectors.
|
@@ -469,11 +469,11 @@ def cross(x, y):
|
|
469
469
|
|
470
470
|
The two input vectors must have the same dimension :math:`d <= 3`.
|
471
471
|
|
472
|
-
This function calls the `cross` method of :class:`~
|
472
|
+
This function calls the `cross` method of :class:`~gstaichi.Vector`.
|
473
473
|
|
474
474
|
Args:
|
475
|
-
x (:class:`~
|
476
|
-
y (:class:`~
|
475
|
+
x (:class:`~gstaichi.Matrix`): The first input vector.
|
476
|
+
y (:class:`~gstaichi.Matrix`): The second input vector.
|
477
477
|
|
478
478
|
Returns:
|
479
479
|
The cross product of two vectors.
|
@@ -493,8 +493,8 @@ def mod(x, y):
|
|
493
493
|
"""Compute value of one parameter modulo another, element-wise.
|
494
494
|
|
495
495
|
Args:
|
496
|
-
x (:mod:`~
|
497
|
-
y (:mod:`~
|
496
|
+
x (:mod:`~gstaichi.types.primitive_types`, :class:`~gstaichi.Matrix`): The first input.
|
497
|
+
y (:mod:`~gstaichi.types.primitive_types`, :class:`~gstaichi.Matrix`): The second input.
|
498
498
|
|
499
499
|
Returns:
|
500
500
|
the value of `x` modulo `y`. This is computed as `x - y * floor(x/y)`.
|
@@ -519,7 +519,7 @@ def translate(dx, dy, dz):
|
|
519
519
|
dz (float): delta z.
|
520
520
|
|
521
521
|
Returns:
|
522
|
-
:class:`~
|
522
|
+
:class:`~gstaichi.math.mat4`: translation matrix.
|
523
523
|
|
524
524
|
Example::
|
525
525
|
|
@@ -549,7 +549,7 @@ def scale(sx, sy, sz):
|
|
549
549
|
sz (float): scale z.
|
550
550
|
|
551
551
|
Returns:
|
552
|
-
:class:`~
|
552
|
+
:class:`~gstaichi.math.mat4`: scale matrix.
|
553
553
|
|
554
554
|
Example::
|
555
555
|
|
@@ -578,7 +578,7 @@ def rot_by_axis(axis, ang):
|
|
578
578
|
ang (float): angle in radians unit
|
579
579
|
|
580
580
|
Returns:
|
581
|
-
:class:`~
|
581
|
+
:class:`~gstaichi.math.mat4`: rotation matrix
|
582
582
|
"""
|
583
583
|
c = ops.cos(ang)
|
584
584
|
s = ops.sin(ang)
|
@@ -620,7 +620,7 @@ def rot_yaw_pitch_roll(yaw, pitch, roll):
|
|
620
620
|
roll (float): roll angle in radians unit
|
621
621
|
|
622
622
|
Returns:
|
623
|
-
:class:`~
|
623
|
+
:class:`~gstaichi.math.mat4`: rotation matrix
|
624
624
|
"""
|
625
625
|
ch = ops.cos(yaw)
|
626
626
|
sh = ops.sin(yaw)
|
@@ -648,7 +648,7 @@ def rotation2d(ang):
|
|
648
648
|
ang (float): Angle of rotation in radians.
|
649
649
|
|
650
650
|
Returns:
|
651
|
-
:class:`~
|
651
|
+
:class:`~gstaichi.math.mat2`: 2x2 rotation matrix.
|
652
652
|
|
653
653
|
Example::
|
654
654
|
|
@@ -668,7 +668,7 @@ def rotation3d(ang_x, ang_y, ang_z):
|
|
668
668
|
ang_y (float): angle in radians unit around Y axis
|
669
669
|
ang_z (float): angle in radians unit around Z axis
|
670
670
|
Returns:
|
671
|
-
:class:`~
|
671
|
+
:class:`~gstaichi.math.mat4`: rotation matrix
|
672
672
|
Example:
|
673
673
|
|
674
674
|
>>> ti.math.rotation3d(0.52, -0.785, 1.046)
|
@@ -684,7 +684,7 @@ def rotation3d(ang_x, ang_y, ang_z):
|
|
684
684
|
def eye(n: template()):
|
685
685
|
"""Returns the nxn identity matrix.
|
686
686
|
|
687
|
-
Alias for :func:`~
|
687
|
+
Alias for :func:`~gstaichi.Matrix.identity`.
|
688
688
|
"""
|
689
689
|
return Matrix.identity(float, n)
|
690
690
|
|
@@ -695,7 +695,7 @@ def length(x):
|
|
695
695
|
|
696
696
|
This function is equivalent to the `length` function in GLSL.
|
697
697
|
Args:
|
698
|
-
x (:class:`~
|
698
|
+
x (:class:`~gstaichi.Matrix`): The vector of which to calculate the length.
|
699
699
|
|
700
700
|
Returns:
|
701
701
|
The Euclidean norm of the vector.
|
@@ -711,7 +711,7 @@ def length(x):
|
|
711
711
|
|
712
712
|
@func
|
713
713
|
def determinant(m):
|
714
|
-
"""Alias for :func:`
|
714
|
+
"""Alias for :func:`gstaichi.Matrix.determinant`."""
|
715
715
|
return m.determinant()
|
716
716
|
|
717
717
|
|
@@ -722,7 +722,7 @@ def inverse(mat): # pylint: disable=R1710
|
|
722
722
|
This function is equivalent to the `inverse` function in GLSL.
|
723
723
|
|
724
724
|
Args:
|
725
|
-
mat (:class:`
|
725
|
+
mat (:class:`gstaichi.Matrix`): The matrix of which to take the inverse. \
|
726
726
|
Supports only 2x2, 3x3 and 4x4 matrices.
|
727
727
|
|
728
728
|
Returns:
|
@@ -744,7 +744,7 @@ def isinf(x):
|
|
744
744
|
"""Determines whether the parameter is positive or negative infinity, element-wise.
|
745
745
|
|
746
746
|
Args:
|
747
|
-
x (:mod:`~
|
747
|
+
x (:mod:`~gstaichi.types.primitive_types`, :class:`gstaichi.Matrix`): The input.
|
748
748
|
|
749
749
|
Example:
|
750
750
|
|
@@ -770,7 +770,7 @@ def isnan(x):
|
|
770
770
|
"""Determines whether the parameter is a number, element-wise.
|
771
771
|
|
772
772
|
Args:
|
773
|
-
x (:mod:`~
|
773
|
+
x (:mod:`~gstaichi.types.primitive_types`, :class:`gstaichi.Matrix`): The input.
|
774
774
|
|
775
775
|
Example:
|
776
776
|
|
@@ -795,7 +795,7 @@ def isnan(x):
|
|
795
795
|
def vdir(ang):
|
796
796
|
"""Returns the 2d unit vector with argument equals `ang`.
|
797
797
|
|
798
|
-
x (:mod:`~
|
798
|
+
x (:mod:`~gstaichi.types.primitive_types`): The input angle in radians.
|
799
799
|
|
800
800
|
Example:
|
801
801
|
|
@@ -1,24 +1,24 @@
|
|
1
1
|
# type: ignore
|
2
2
|
|
3
|
-
from
|
3
|
+
from gstaichi._lib import core as _ti_core
|
4
4
|
|
5
5
|
|
6
6
|
class CuptiMetric:
|
7
|
-
"""A class to add CUPTI metric for :class:`~
|
7
|
+
"""A class to add CUPTI metric for :class:`~gstaichi.profiler.kernel_profiler.KernelProfiler`.
|
8
8
|
|
9
9
|
This class is designed to add user selected CUPTI metrics.
|
10
10
|
Only available for the CUDA backend now, i.e. you need ``ti.init(kernel_profiler=True, arch=ti.cuda)``.
|
11
|
-
For usage of this class, see examples in func :func:`~
|
11
|
+
For usage of this class, see examples in func :func:`~gstaichi.profiler.set_kernel_profiler_metrics` and :func:`~gstaichi.profiler.collect_kernel_profiler_metrics`.
|
12
12
|
|
13
13
|
Args:
|
14
|
-
name (str): name of metric that collected by CUPTI toolkit. used by :func:`~
|
15
|
-
header (str): column header of this metric, used by :func:`~
|
16
|
-
val_format (str): format for print metric value (and unit of this value), used by :func:`~
|
17
|
-
scale (float): scale of metric value, used by :func:`~
|
14
|
+
name (str): name of metric that collected by CUPTI toolkit. used by :func:`~gstaichi.profiler.set_kernel_profiler_metrics` and :func:`~gstaichi.profiler.collect_kernel_profiler_metrics`.
|
15
|
+
header (str): column header of this metric, used by :func:`~gstaichi.profiler.print_kernel_profiler_info`.
|
16
|
+
val_format (str): format for print metric value (and unit of this value), used by :func:`~gstaichi.profiler.print_kernel_profiler_info`.
|
17
|
+
scale (float): scale of metric value, used by :func:`~gstaichi.profiler.print_kernel_profiler_info`.
|
18
18
|
|
19
19
|
Example::
|
20
20
|
|
21
|
-
>>> import
|
21
|
+
>>> import gstaichi as ti
|
22
22
|
|
23
23
|
>>> ti.init(kernel_profiler=True, arch=ti.cuda)
|
24
24
|
>>> num_elements = 128*1024*1024
|
@@ -46,7 +46,7 @@ class CuptiMetric:
|
|
46
46
|
>>> ti.profiler.print_kernel_profiler_info('trace')
|
47
47
|
|
48
48
|
Note:
|
49
|
-
For details about using CUPTI in
|
49
|
+
For details about using CUPTI in GsTaichi, please visit https://docs.taichi-lang.org/docs/profiler#advanced-mode.
|
50
50
|
"""
|
51
51
|
|
52
52
|
def __init__(self, name="", header="unnamed_header", val_format=" {:8.0f} ", scale=1.0):
|
@@ -244,7 +244,7 @@ def get_predefined_cupti_metrics(name=""):
|
|
244
244
|
name (str): cupti metri name.
|
245
245
|
"""
|
246
246
|
if name not in predefined_cupti_metrics:
|
247
|
-
_ti_core.warn("Valid
|
247
|
+
_ti_core.warn("Valid GsTaichi predefined metrics list (str):")
|
248
248
|
for key in predefined_cupti_metrics:
|
249
249
|
_ti_core.warn(f" '{key}'")
|
250
250
|
return None
|
@@ -253,7 +253,7 @@ def get_predefined_cupti_metrics(name=""):
|
|
253
253
|
|
254
254
|
# Default metrics list
|
255
255
|
default_cupti_metrics = [dram_bytes_sum]
|
256
|
-
"""The metrics list, each is an instance of the :class:`~
|
256
|
+
"""The metrics list, each is an instance of the :class:`~gstaichi.profiler.CuptiMetric`.
|
257
257
|
Default to `dram_bytes_sum`.
|
258
258
|
"""
|
259
259
|
|
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
from contextlib import contextmanager
|
4
4
|
|
5
|
-
from
|
6
|
-
from
|
7
|
-
from
|
5
|
+
from gstaichi._lib import core as _ti_core
|
6
|
+
from gstaichi.lang import impl
|
7
|
+
from gstaichi.profiler.kernel_metrics import default_cupti_metrics
|
8
8
|
|
9
9
|
|
10
10
|
class StatisticalResult:
|
@@ -40,16 +40,16 @@ class StatisticalResult:
|
|
40
40
|
|
41
41
|
|
42
42
|
class KernelProfiler:
|
43
|
-
"""Kernel profiler of
|
43
|
+
"""Kernel profiler of GsTaichi.
|
44
44
|
|
45
45
|
Kernel profiler acquires kernel profiling records from backend, counts records in Python scope,
|
46
|
-
and prints the results to the console by :func:`~
|
46
|
+
and prints the results to the console by :func:`~gstaichi.profiler.kernel_profiler.KernelProfiler.print_info`.
|
47
47
|
|
48
48
|
``KernelProfiler`` now support detailed low-level performance metrics (such as memory bandwidth consumption) in its advanced mode.
|
49
49
|
This mode is only available for the CUDA backend with CUPTI toolkit, i.e. you need ``ti.init(kernel_profiler=True, arch=ti.cuda)``.
|
50
50
|
|
51
51
|
Note:
|
52
|
-
For details about using CUPTI in
|
52
|
+
For details about using CUPTI in GsTaichi, please visit https://docs.taichi-lang.org/docs/profiler#advanced-mode.
|
53
53
|
"""
|
54
54
|
|
55
55
|
def __init__(self):
|
@@ -63,14 +63,14 @@ class KernelProfiler:
|
|
63
63
|
# public methods
|
64
64
|
|
65
65
|
def set_kernel_profiler_mode(self, mode=False):
|
66
|
-
"""Turn on or off :class:`~
|
66
|
+
"""Turn on or off :class:`~gstaichi.profiler.kernel_profiler.KernelProfiler`."""
|
67
67
|
if type(mode) is bool:
|
68
68
|
self._profiling_mode = mode
|
69
69
|
else:
|
70
70
|
raise TypeError(f"Arg `mode` must be of type boolean. Type {type(mode)} is not supported.")
|
71
71
|
|
72
72
|
def get_kernel_profiler_mode(self):
|
73
|
-
"""Get status of :class:`~
|
73
|
+
"""Get status of :class:`~gstaichi.profiler.kernel_profiler.KernelProfiler`."""
|
74
74
|
return self._profiling_mode
|
75
75
|
|
76
76
|
def set_toolkit(self, toolkit_name="default"):
|
@@ -98,7 +98,7 @@ class KernelProfiler:
|
|
98
98
|
return self._total_time_ms / 1000 # ms to s
|
99
99
|
|
100
100
|
def clear_info(self):
|
101
|
-
"""Clear all records both in front-end :class:`~
|
101
|
+
"""Clear all records both in front-end :class:`~gstaichi.profiler.kernel_profiler.KernelProfiler` and back-end instance ``KernelProfilerBase``.
|
102
102
|
|
103
103
|
Note:
|
104
104
|
The values of ``self._profiling_mode`` and ``self._metric_list`` will not be cleared.
|
@@ -114,7 +114,7 @@ class KernelProfiler:
|
|
114
114
|
return None
|
115
115
|
|
116
116
|
def query_info(self, name):
|
117
|
-
"""For docstring of this function, see :func:`~
|
117
|
+
"""For docstring of this function, see :func:`~gstaichi.profiler.query_kernel_profiler_info`."""
|
118
118
|
if self._check_not_turned_on_with_warning_message():
|
119
119
|
return None
|
120
120
|
self._update_records() # kernel records
|
@@ -123,7 +123,7 @@ class KernelProfiler:
|
|
123
123
|
return impl.get_runtime().prog.query_kernel_profile_info(name)
|
124
124
|
|
125
125
|
def set_metrics(self, metric_list=default_cupti_metrics):
|
126
|
-
"""For docstring of this function, see :func:`~
|
126
|
+
"""For docstring of this function, see :func:`~gstaichi.profiler.set_kernel_profiler_metrics`."""
|
127
127
|
if self._check_not_turned_on_with_warning_message():
|
128
128
|
return None
|
129
129
|
self._metric_list = metric_list
|
@@ -137,7 +137,7 @@ class KernelProfiler:
|
|
137
137
|
def collect_metrics_in_context(self, metric_list=default_cupti_metrics):
|
138
138
|
"""This function is not exposed to user now.
|
139
139
|
|
140
|
-
For usage of this function, see :func:`~
|
140
|
+
For usage of this function, see :func:`~gstaichi.profiler.collect_kernel_profiler_metrics`.
|
141
141
|
"""
|
142
142
|
if self._check_not_turned_on_with_warning_message():
|
143
143
|
return None
|
@@ -148,13 +148,13 @@ class KernelProfiler:
|
|
148
148
|
return None
|
149
149
|
|
150
150
|
# mode of print_info
|
151
|
-
COUNT = "count" # print the statistical results (min,max,avg time) of
|
152
|
-
TRACE = "trace" # print the records of launched
|
151
|
+
COUNT = "count" # print the statistical results (min,max,avg time) of GsTaichi kernels.
|
152
|
+
TRACE = "trace" # print the records of launched GsTaichi kernels with specific profiling metrics (time, memory load/store and core utilization etc.)
|
153
153
|
|
154
154
|
def print_info(self, mode=COUNT):
|
155
|
-
"""Print the profiling results of
|
155
|
+
"""Print the profiling results of GsTaichi kernels.
|
156
156
|
|
157
|
-
For usage of this function, see :func:`~
|
157
|
+
For usage of this function, see :func:`~gstaichi.profiler.print_kernel_profiler_info`.
|
158
158
|
|
159
159
|
Args:
|
160
160
|
mode (str): the way to print profiling results.
|
@@ -183,7 +183,7 @@ class KernelProfiler:
|
|
183
183
|
return False
|
184
184
|
|
185
185
|
def _clear_frontend(self):
|
186
|
-
"""Clear member variables in :class:`~
|
186
|
+
"""Clear member variables in :class:`~gstaichi.profiler.kernel_profiler.KernelProfiler`.
|
187
187
|
|
188
188
|
Note:
|
189
189
|
The values of ``self._profiling_mode`` and ``self._metric_list`` will not be cleared.
|
@@ -340,7 +340,7 @@ _ti_kernel_profiler = KernelProfiler()
|
|
340
340
|
|
341
341
|
|
342
342
|
def get_default_kernel_profiler():
|
343
|
-
"""We have only one :class:`~
|
343
|
+
"""We have only one :class:`~gstaichi.profiler.kernelprofiler.KernelProfiler` instance(i.e. ``_ti_kernel_profiler``) now.
|
344
344
|
|
345
345
|
For ``KernelProfiler`` using ``CuptiToolkit``, GPU devices can only work in a certain configuration.
|
346
346
|
Profiling mode and metrics are configured by the host(CPU) via CUPTI APIs, and device(GPU) will use
|
@@ -353,7 +353,7 @@ def get_default_kernel_profiler():
|
|
353
353
|
|
354
354
|
|
355
355
|
def print_kernel_profiler_info(mode="count"):
|
356
|
-
"""Print the profiling results of
|
356
|
+
"""Print the profiling results of GsTaichi kernels.
|
357
357
|
|
358
358
|
To enable this profiler, set ``kernel_profiler=True`` in ``ti.init()``.
|
359
359
|
``'count'`` mode: print the statistics (min,max,avg time) of launched kernels,
|
@@ -365,7 +365,7 @@ def print_kernel_profiler_info(mode="count"):
|
|
365
365
|
|
366
366
|
Example::
|
367
367
|
|
368
|
-
>>> import
|
368
|
+
>>> import gstaichi as ti
|
369
369
|
|
370
370
|
>>> ti.init(ti.cpu, kernel_profiler=True)
|
371
371
|
>>> var = ti.field(ti.f32, shape=1)
|
@@ -382,9 +382,6 @@ def print_kernel_profiler_info(mode="count"):
|
|
382
382
|
>>> ti.profiler.print_kernel_profiler_info('trace')
|
383
383
|
|
384
384
|
Note:
|
385
|
-
Currently the result of `KernelProfiler` could be incorrect on OpenGL
|
386
|
-
backend due to its lack of support for `ti.sync()`.
|
387
|
-
|
388
385
|
For advanced mode of `KernelProfiler`, please visit https://docs.taichi-lang.org/docs/profiler#advanced-mode.
|
389
386
|
"""
|
390
387
|
get_default_kernel_profiler().print_info(mode)
|
@@ -403,7 +400,7 @@ def query_kernel_profiler_info(name):
|
|
403
400
|
|
404
401
|
Example::
|
405
402
|
|
406
|
-
>>> import
|
403
|
+
>>> import gstaichi as ti
|
407
404
|
|
408
405
|
>>> ti.init(ti.cpu, kernel_profiler=True)
|
409
406
|
>>> n = 1024*1024
|
@@ -427,9 +424,6 @@ def query_kernel_profiler_info(name):
|
|
427
424
|
Note:
|
428
425
|
[1] To get the correct result, query_kernel_profiler_info() must be used in conjunction with
|
429
426
|
clear_kernel_profiler_info().
|
430
|
-
|
431
|
-
[2] Currently the result of `KernelProfiler` could be incorrect on OpenGL
|
432
|
-
backend due to its lack of support for `ti.sync()`.
|
433
427
|
"""
|
434
428
|
return get_default_kernel_profiler().query_info(name)
|
435
429
|
|
@@ -461,7 +455,7 @@ def set_kernel_profiler_toolkit(toolkit_name="default"):
|
|
461
455
|
|
462
456
|
Example::
|
463
457
|
|
464
|
-
>>> import
|
458
|
+
>>> import gstaichi as ti
|
465
459
|
|
466
460
|
>>> ti.init(arch=ti.cuda, kernel_profiler=True)
|
467
461
|
>>> x = ti.field(ti.f32, shape=1024*1024)
|
@@ -488,11 +482,11 @@ def set_kernel_profiler_metrics(metric_list=default_cupti_metrics):
|
|
488
482
|
"""Set metrics that will be collected by the CUPTI toolkit.
|
489
483
|
|
490
484
|
Args:
|
491
|
-
metric_list (list): a list of :class:`~
|
485
|
+
metric_list (list): a list of :class:`~gstaichi.profiler.CuptiMetric()` instances, default value: :data:`~gstaichi.profiler.kernel_metrics.default_cupti_metrics`.
|
492
486
|
|
493
487
|
Example::
|
494
488
|
|
495
|
-
>>> import
|
489
|
+
>>> import gstaichi as ti
|
496
490
|
|
497
491
|
>>> ti.init(kernel_profiler=True, arch=ti.cuda)
|
498
492
|
>>> ti.profiler.set_kernel_profiler_toolkit('cupti')
|
@@ -507,9 +501,9 @@ def set_kernel_profiler_metrics(metric_list=default_cupti_metrics):
|
|
507
501
|
>>> for i in x:
|
508
502
|
>>> y[None] += x[i]
|
509
503
|
|
510
|
-
>>> # In the case of not parameter,
|
504
|
+
>>> # In the case of not parameter, GsTaichi will print its pre-defined metrics list
|
511
505
|
>>> ti.profiler.get_predefined_cupti_metrics()
|
512
|
-
>>> # get
|
506
|
+
>>> # get GsTaichi pre-defined metrics
|
513
507
|
>>> profiling_metrics = ti.profiler.get_predefined_cupti_metrics('shared_access')
|
514
508
|
|
515
509
|
>>> global_op_atom = ti.profiler.CuptiMetric(
|
@@ -536,11 +530,11 @@ def collect_kernel_profiler_metrics(metric_list=default_cupti_metrics):
|
|
536
530
|
"""Set temporary metrics that will be collected by the CUPTI toolkit within this context.
|
537
531
|
|
538
532
|
Args:
|
539
|
-
metric_list (list): a list of :class:`~
|
533
|
+
metric_list (list): a list of :class:`~gstaichi.profiler.CuptiMetric()` instances, default value: :data:`~gstaichi.profiler.kernel_metrics.default_cupti_metrics`.
|
540
534
|
|
541
535
|
Example::
|
542
536
|
|
543
|
-
>>> import
|
537
|
+
>>> import gstaichi as ti
|
544
538
|
|
545
539
|
>>> ti.init(kernel_profiler=True, arch=ti.cuda)
|
546
540
|
>>> ti.profiler.set_kernel_profiler_toolkit('cupti')
|
@@ -555,9 +549,9 @@ def collect_kernel_profiler_metrics(metric_list=default_cupti_metrics):
|
|
555
549
|
>>> for i in x:
|
556
550
|
>>> y[None] += x[i]
|
557
551
|
|
558
|
-
>>> # In the case of not parameter,
|
552
|
+
>>> # In the case of not parameter, GsTaichi will print its pre-defined metrics list
|
559
553
|
>>> ti.profiler.get_predefined_cupti_metrics()
|
560
|
-
>>> # get
|
554
|
+
>>> # get GsTaichi pre-defined metrics
|
561
555
|
>>> profiling_metrics = ti.profiler.get_predefined_cupti_metrics('device_utilization')
|
562
556
|
|
563
557
|
>>> global_op_atom = ti.profiler.CuptiMetric(
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# type: ignore
|
2
2
|
|
3
|
-
from
|
3
|
+
from gstaichi._lib import core as _ti_core
|
4
4
|
|
5
5
|
|
6
6
|
def print_scoped_profiler_info():
|
@@ -12,7 +12,7 @@ def print_scoped_profiler_info():
|
|
12
12
|
|
13
13
|
Example::
|
14
14
|
|
15
|
-
>>> import
|
15
|
+
>>> import gstaichi as ti
|
16
16
|
>>> ti.init(arch=ti.cpu)
|
17
17
|
>>> var = ti.field(ti.f32, shape=1)
|
18
18
|
>>> @ti.kernel
|