Skip to content

vyasr/cpp_bindings_demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

This repo contains an example of how to create Python bindings for a C++ library. The Python package is contained in the code/ directory, with the C++ library nested in code/bindings/cpp. The package is built using scikit-build-score to stitch together Python and CMake for the build. The C++ library implements saxpy (scalar multiplication followed by vector addition) using Thrust. The Python package exposes a simple binding that allows saxpy to be called on a pair of CuPy arrays.

This repo contains a docker-compose configuration and a Dockerfile that can be used to build the necessary container. It also contains a pair of (shell and Python) scripts that may be used to run the example. Assuming docker-compose is installed, the example may be run as follows:

# Clone the project
git clone --recurse-submodules https://github.com/vyasr/cpp_bindings_demo
cd cpp_bindings_demo

# Build and launch the Docker container
docker-compose build
docker-compose run cpp_bindings_demo

# Inside the container:
./demo.sh

About

Example of creating C++ bindings in Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors