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?
Problem
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()