diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | candle-pyo3/Cargo.toml | 3 | ||||
-rw-r--r-- | candle-pyo3/README.md | 10 | ||||
-rw-r--r-- | candle-pyo3/build.rs | 3 |
4 files changed, 15 insertions, 2 deletions
@@ -20,6 +20,7 @@ Cargo.lock perf.data flamegraph.svg +*.dylib *.so *.swp trace-*.json diff --git a/candle-pyo3/Cargo.toml b/candle-pyo3/Cargo.toml index e5ebe953..610a1733 100644 --- a/candle-pyo3/Cargo.toml +++ b/candle-pyo3/Cargo.toml @@ -19,6 +19,9 @@ candle = { path = "../candle-core", version = "0.1.0", package = "candle-core" } pyo3 = { version = "0.19.0", features = ["extension-module"] } half = { workspace = true } +[build-dependencies] +pyo3-build-config = "0.19" + [features] default = [] cuda = ["candle/cuda"] diff --git a/candle-pyo3/README.md b/candle-pyo3/README.md index 1887f269..f716b092 100644 --- a/candle-pyo3/README.md +++ b/candle-pyo3/README.md @@ -1,5 +1,11 @@ -From the top level directory run: +From the top level directory run the following for linux. ``` -cargo build --release --package candle-pyo3 && cp -f ./target/release/libcandle.so candle.so +cargo build --profile=release-with-debug --package candle-pyo3 && cp -f ./target/release-with-debug/libcandle.so candle.so +PYTHONPATH=. python3 candle-pyo3/test.py +```bash + + Or for macOS users: +```bash +cargo build --profile=release-with-debug --package candle-pyo3 && cp -f ./target/release-with-debug/libcandle.dylib candle.so PYTHONPATH=. python3 candle-pyo3/test.py ``` diff --git a/candle-pyo3/build.rs b/candle-pyo3/build.rs new file mode 100644 index 00000000..dace4a9b --- /dev/null +++ b/candle-pyo3/build.rs @@ -0,0 +1,3 @@ +fn main() { + pyo3_build_config::add_extension_module_link_args(); +} |