-
Notifications
You must be signed in to change notification settings - Fork 13
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
Expand the number of types that can cross the Python-Chapel divide #8
Comments
User request for supporting sending JSON as an argument to Chapel |
And that user was ME! Additional question, since we can send in call.py
And now I need to describe the argument of the function to accept that array type.
I tried this, but got an undefined error. I guess that's because I need to import the type, but from where?
|
So pyChapel has an extern record defined to understand what the pych_array type is. The extern record declaration is in modules/templates/prefix.chpl, with the C definition in modules/include/pych.h. However, prefix.chpl also has a function pych_to_chpl1D (and one for 2D but that isn't used anywhere) which translates a pych_array into a bit of the undercover magic for arrays and is used for the argument conversion of inline functions only. You might be able to Even if that works, that seems like a work around when pyChapel should really do the conversion of pych_array argument to actual array argument itself, though. |
Summary, here are some issues with transferring data that I have run into.
|
At the moment, the types that can be passed to and returned from a Chapel function by Python code are limited to primitives (such as (Python)int->(Chapel)int and float->real(64)) and a single instantiation of the NumPy array type. To make a broader claim of usability and usefulness, this issue must be addressed.
Only NumPy arrays of reals with stride equal to their itemsize are supported, and those are not currently returnable from a Chapel function.
List of types that can theoretically be translated for arguments:
Python: Chapel
List of types that can theoretically be translated for returns:
Chapel: Python
The text was updated successfully, but these errors were encountered: