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

[aot] Taichi Runtime Python language binding #8117

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

PENGUINLIONG
Copy link
Member

@PENGUINLIONG PENGUINLIONG commented Jun 1, 2023

Issue: #

Brief Summary

It can be helpful when you have already written some tests for your algorithm, and you want to reuse those tests for your AOT counterparts during the R&D process. So you don't have to rewrite all the tests again in C++ or other native languages.

🤖 Generated by Copilot at 7e70977

This pull request adds the taichi_runtime package, which provides Python bindings for the Taichi C API. The package supports different backends and interop features, and can load and execute compiled Taichi modules. The pull request also adds a script to generate test assets, and some unit tests to verify the functionality of the package.

Walkthrough

🤖 Generated by Copilot at 7e70977

  • Add a PowerShell script to generate test assets for the Python C API (link)
  • Add a setup.py file to install the taichi_runtime package, which contains the Python bindings for the Taichi C API (link)
  • Import the implementation module that contains the actual Python bindings in the taichi_runtime package (link)
  • Define a function to load the Taichi C API shared library from different possible locations in the taichi_runtime/sys subpackage (link)
  • Define a global variable that holds the ctypes.CDLL object of the loaded library in the taichi_runtime/sys subpackage (link)
  • Define the Python bindings for the Taichi C API functions and structures related to different backends in the taichi_runtime/sys subpackage, using ctypes and docstrings (link, link, link, link, link, link)
  • Define a docstring to explain the Vulkan backend features and requirements in the taichi_vulkan.py file (link)
  • Define a simple Taichi kernel that assigns the index value to each element of a 1D array in the tests/assets folder, using the ti.aot.export decorator and the ti.init function (link)
  • Ignore the .tcm files generated by the ti module build command in the tests/assets folder (link)
  • Add some unit tests for the taichi_runtime package using the pytest framework in the tests folder, testing different aspects of the package such as creating and destroying a runtime, allocating and freeing an ndarray, interoping with numpy arrays, and launching a kernel from a compiled module (link)

@netlify
Copy link

netlify bot commented Jun 1, 2023

Deploy Preview for docsite-preview ready!

Name Link
🔨 Latest commit a6d528f
🔍 Latest deploy log https://app.netlify.com/sites/docsite-preview/deploys/6479e483d1e0610008954e85
😎 Deploy Preview https://deploy-preview-8117--docsite-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@taichi-gardener taichi-gardener added this to In progress in AOT Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
AOT
In progress
Development

Successfully merging this pull request may close these issues.

None yet

1 participant