lgarrison / cupy-nanobind-example Goto Github PK
View Code? Open in Web Editor NEWA tiny demo of calling nanobind with a cupy array
License: MIT License
A tiny demo of calling nanobind with a cupy array
License: MIT License
I've been playing around with it this morning and it is very convenient, thanks a lot!
Can you give me a hand with how to map my function sitting in a separate file?
Inside a pointing.cpp
I map to the function,
m.def("CUpointing_cparr",
&CUpointing_cparr<double>,
"thetas"_a.noconvert(),
"phi0"_a.noconvert(),
"nphis"_a.noconvert(),
"ringstarts"_a.noconvert(),
"synthmap"_a.noconvert(),
"outarr_pt"_a.noconvert(),
"outarr_pp"_a.noconvert()
);
where CUpointing_cparr
is in pointing.cu
Inside pointing.cpp
is #include "pointing.cuh"
, with "pointing.cuh" having the CUpointing_cparr
definition.
Compiler compiles, but importing in Python gives the error,
import pysht_interface.popy as popy
ImportError: /mnt/home/sbelkner/venv/pysht/lib/python3.10/site-packages/pysht_interface/popy.cpython-310-x86_64-linux-gnu.so:
undefined symbol:
_Z15Cpointing_cparrIdEvN8nanobind7ndarrayIJKT_NS0_5shapeIJLm18446744073709551615EEEENS0_6device4cudaEEEES8_NS1_IJKiS5_S7_EEESA_S8_NS1_IJS2_S5_S7_EEESB_
which tells me that it's ignoring the header file, and cannot find the function?
The CMakeLists.txt contains
nanobind_add_module(popy
pointing.cu
pointing.h
pointing.cpp
pointing.cuh
)
Note: everything works when CUpointing_cparr()
is in the same file as the m.def()
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.