amypad / cuvec Goto Github PK
View Code? Open in Web Editor NEWUnifying Python/C++/CUDA memory: Python buffered array ↔️ `std::vector` ↔️ CUDA managed memory
Home Page: https://amypad.github.io/CuVec/
License: Other
Unifying Python/C++/CUDA memory: Python buffered array ↔️ `std::vector` ↔️ CUDA managed memory
Home Page: https://amypad.github.io/CuVec/
License: Other
Unsuccessful attempt to install this package on a WSL2 Ubuntu system as a (AmyPET) dependency. Some required libraries are missing, perhaps?
System details:
(amypet_dev) user@host:/.../AmyPET$ uname -r
5.10.60.1-microsoft-standard-WSL2
(amypet_dev) user@host:/.../AmyPET$ python -V
Python 3.7.13
(amypet_dev) user@host:/.../AmyPET$ pip -V
pip 22.0.4 from /home/user/venvs/amypet_dev/lib/python3.7/site-packages/pip (python 3.7)
pip
error trace:
(amypet_dev) user@host:/.../AmyPET$ pip install cuvec
Collecting cuvec
Using cached cuvec-2.11.1.tar.gz (37 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: cuvec
Building wheel for cuvec (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for cuvec (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [83 lines of output]
WARNING:cuvec.setup:Import or CUDA device detection error:
NVML Shared Library Not Found
Not searching for unused variables given on the command line.
-- The C compiler identification is GNU 7.5.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- The CXX compiler identification is GNU 7.5.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/pip-install-ty00gks4/cuvec_d337dca4039c4731a10fcf56a873fa80/_cmake_test_compile/build
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /tmp/pip-build-env-4csnmbpo/overlay/lib/python3.7/site-packages/cmake/data/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find Python3 (missing: Python3_INCLUDE_DIRS Python3_LIBRARIES
Development Development.Module Development.Embed) (found version "3.7.13")
Call Stack (most recent call first):
/tmp/pip-build-env-4csnmbpo/overlay/lib/python3.7/site-packages/cmake/data/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
/tmp/pip-build-env-4csnmbpo/overlay/lib/python3.7/site-packages/cmake/data/share/cmake-3.22/Modules/FindPython/Support.cmake:3166 (find_package_handle_standard_args)
/tmp/pip-build-env-4csnmbpo/overlay/lib/python3.7/site-packages/cmake/data/share/cmake-3.22/Modules/FindPython3.cmake:490 (include)
CMakeLists.txt:12 (find_package)
...
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for cuvec
Failed to build cuvec
ERROR: Could not build wheels for cuvec, which is required to install pyproject.toml-based projects
Use cibuildwheel setup + options (e.g. https://github.com/benfred/implicit/blob/main/pyproject.toml) to precompile C++/CUDA?
Improve support for https://github.com/xnd-project/arrayviews
cuvec.cuvec
: at compile time, use cudaMallocManaged/cudaFree
if available, otherwise use malloc/free
cuvec.cuvec_cpu
: uses malloc/free
cuvec.cuvec_cuda
: if available, use cudaMallocManaged/cudaFree
, otherwise ImportError
cuvec.cuvec
: point to one of the abovepybind11::buffer_protocol()
and .def_buffer([](NDCuVec &m) -> py::buffer_info { ... })
would simplify the pybind11
wrapping, vis. https://pybind11.readthedocs.io/en/stable/advanced/pycpp/numpy.html#buffer-protocol
This would allow easily adding to https://github.com/xnd-project/arrayviews (#23):
cupy
, numba
, pyarrow
, xnd
, cudf
, ...Other references:
Can check self.dtype
for inconsistency with requested type T
(safety/error catching)
ndarray
subclass
__array_function__
?__array_ufunc__
?SWIG provides std_vector.i. CuVec could provide similar (e.g. cuvec.i
) to support any language (not just Python) supported by SWIG
potential alternative to #27:
conda-forge (CUDA and non-CUDA) recipe for the
parallelproj
projectors (libparallelproj
) [...]: https://github.com/conda-forge/parallelproj-feedstockThe main things I learned/had to reali[s]e where:
- All your dependencies need to be on conda-forge
- For handling cuda in the
meta.yaml
, there is# [cuda_compiler_version != "None"]
"decorator" to describe cuda/non-cuda specific things- at runtime you need the virtual
__cuda
conda-forge package as dependency which helps the package manager to figure out which package version needs to be / can be installed on systems with and without cuda https://github.com/conda-forge/parallelproj-feedstock/blob/af55c92209af12cfad72f03078c24d0f0412045b/recipe/meta.yaml#L47- for the builds there are no physical GPUs available meaning that all tests requiring GPUs need to be skipped (this might change in the future)
- In the build scripts, you can test the
${cuda_compiler_version}
to trigger CUDA / non-cuda specific things https://github.com/conda-forge/parallelproj-feedstock/blob/af55c92209af12cfad72f03078c24d0f0412045b/recipe/build-parallelproj.sh#L7I think the recipe for
libparallelproj
is a good starting point. Note thatlibparallelproj
in themeta.yaml
I build two packages (libparallelproj
with CUDA and non-CUDA version, and alsoparallelproj
which is a minimal python interface to the libs).The conda-forge team on gitter.im also helped me a lot in the beginning.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.