Skip to content

dpctl should generate C headers for use of dpctl Python objects with Python C-API #171

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

Closed
oleksandr-pavlyk opened this issue Nov 6, 2020 · 9 comments
Assignees

Comments

@oleksandr-pavlyk
Copy link
Contributor

oleksandr-pavlyk commented Nov 6, 2020

Torch extensions are built in C++ with use of pybind11 (c.f. custom-c++-torch-extensions).

One may want to recognize and work with SyclQueue, SyclDevice, and SyclContext objects, which requires a header.

Cython allows for generation of such headers: https://stackoverflow.com/questions/5710441/call-cython-function-from-c

@oleksandr-pavlyk oleksandr-pavlyk changed the title DPCTL should generate C header for use of dpctl Python objects with Python C-API DPCTL should generate C headers for use of dpctl Python objects with Python C-API Nov 6, 2020
@oleksandr-pavlyk
Copy link
Contributor Author

Here is a discussion on SO: https://stackoverflow.com/questions/40572073/how-to-create-a-public-cython-function-that-can-receive-c-struct-instance-or-p

I adapted example written by @pelson based on suggestion in that SO post to Python3 and use in conda environment: https://github.com/oleksandr-pavlyk/calling_publicly_declared_cython_from_c

@oleksandr-pavlyk
Copy link
Contributor Author

Another useful repo: https://github.com/ashwinvis/cython_capi

@diptorupd diptorupd changed the title DPCTL should generate C headers for use of dpctl Python objects with Python C-API dpctl should generate C headers for use of dpctl Python objects with Python C-API Apr 15, 2021
@diptorupd
Copy link
Contributor

@oleksandr-pavlyk was this issue addressed by #218?

@diptorupd
Copy link
Contributor

@oleksandr-pavlyk is going to add an example and close the issue.

@diptorupd
Copy link
Contributor

@oleksandr-pavlyk ping!

@oleksandr-pavlyk
Copy link
Contributor Author

Will work on this next week. Changes in #218 should have been sufficient, but having an example is both a proof of that and a seed to promote adoption

@diptorupd
Copy link
Contributor

@oleksandr-pavlyk I believe the ticket can be closed?

@oleksandr-pavlyk
Copy link
Contributor Author

What is still missing is a single "dpctl.h" to include to work with Python C-API of dpctl classes.

I think we should also have the same single header "syclinterface.h".

@oleksandr-pavlyk
Copy link
Contributor Author

This has now been implemented in #685. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants