-
Notifications
You must be signed in to change notification settings - Fork 6
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
Update/python binding api #185
Conversation
xinyuli1204
commented
Jan 6, 2024
•
edited
Loading
edited
- port binding api in python
- support python api in macOS
python/ionpy/native.py
Outdated
@@ -33,6 +37,7 @@ class c_builder_compile_option_t(ctypes.Structure): | |||
c_ion_buffer_t = ctypes.POINTER(ctypes.c_int) | |||
c_ion_port_map_t = ctypes.POINTER(ctypes.c_int) | |||
|
|||
c_ion_port_bind_t = ctypes.POINTER(ctypes.c_int) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused?
python/ionpy/Port.py
Outdated
|
||
|
||
# should use numpy type? | ||
def bind_i8(self, v: int): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better design to provide a generic bind
instead of type-specific method (e.g. bind_i8). The appropreate C-API can be determined by inspecting self.type
and self.dim
.
python/test/test_binding.py
Outdated
from ionpy import Node, Builder, Buffer, PortMap, Port, Param, Type, TypeCode | ||
import numpy as np # TODO: rewrite with pure python | ||
|
||
def test_binding(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test case for scalar parameter bind?
python/test/test_binding.py
Outdated
from ionpy import Node, Builder, Buffer, PortMap, Port, Param, Type, TypeCode | ||
import numpy as np # TODO: rewrite with pure python | ||
|
||
def test_binding(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you replicate the C++ testcase for port binding using Python API? I want to keep the same C++ and Python API semantics.
LGTM. |