Failed to execute the basic example #329
Replies: 5 comments 10 replies
-
The example has numpy as a rust-numpy/examples/parallel/Cargo.toml Line 13 in 19bfc9d You will need to update this to be the version of numpy you want to use. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the reply, but I'm not quite understand the writing way under |
Beta Was this translation helpful? Give feedback.
-
This is about the Rust-side dependency on the crate [dependencies]
numpy = "0.16" |
Beta Was this translation helpful? Give feedback.
-
I'd recommend read the cargo documentation about dependency management if you are new to Rust. |
Beta Was this translation helpful? Give feedback.
-
This crate only wraps NumPy ndarray instances, it does not copy or convert them. This also implies that if you Rust-side function expects e.g. All operations on these arrays are then typically performed in terms of
As written above, operating on the array contents is usually done by operating on |
Beta Was this translation helpful? Give feedback.
-
Hi everyone, love this project as it just meets my recent needs. As a 'hello world' test, however, I'm having problems running the
rust-parallel
example.According to the notes in the readme I need to first run nox to create a virtual environment. Since I am not familiar with
nox
I created the environment myself and installed the dependency manually.Then I created a new project using
marutin
and manually copied all the files inrust-numpy/examples/parallel/
to overwrite the original.When I try to run
maturin develop
, I got the following errorThe error message indicates that numpy is not installed, which is not the case, and also the pointing of
Cargo.toml
is not correct. I'm not quite sure which step is wrong, wondering if anyone can help, thanks.Besides, since this is the first time experience this project, I have a few other questions.
One is that, since it is not explicitly stated in the documentation, I would like to know if this project avoids type conversion and type copy overhead between py and rust. As we know, if you pass a two-dimensional array to rust with pyo3 way, you may need to go through a type conversion from
numpy.int
topython.int
then torust.usize
, which will consume a lot of resources when there is a lot of data, and I think it would be great if this was avoided in this project.Another point is that due to some kind of missing clarity I'm not quite sure what the
examples/parallel
project is aimed at. Since its project name is 'parallel', does it mean that this project can break theGIL
limit of python and get multiple cores used at the same time in one process for simultaneous computation (which is necessary in production environments). I' m interested in thepar_map_collect
function called in the example, which seems to serve such a role, but unfortunately I didn't find the relevant search results in the documentation.Beta Was this translation helpful? Give feedback.
All reactions