-
-
Notifications
You must be signed in to change notification settings - Fork 214
Replace nb::any
with -1 and add argument to nb::ndarray
in preparation of next nanobind release
#3105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Is this merged in nanobind release yet? If not I would propose doing a backport at a later date. |
It's not in any nanobind release yet, we will have to backport it after 0.8.0. |
nb::any
with -1 in preparation of next nanobind releasenb::any
with -1 and add argument to nb::ndarray
in preparation of next nanobind release
3c7003f
to
6e3e564
Compare
1e172e6
to
e63a6c5
Compare
The fourth commit, to be dropped before merging this PR, upgrades nanobind from source. nanobind installation happens before basix is installed, to ensure that basix and dolfinx wrappers use a matching nanobind version. Will need to figure out at a later stage what is going on with the Red Hat build: those are the same errors that I used to get when there was a mismatch between basix and dolfinx wrappers, for instance basix wrappers were compiled with nanobind release version and dolfinx wrappers were compiled with nanobind main. |
For redhat Basix will be built with build isolation (pip will download nanobind), dolfinx without (system nanobind). |
I think all of our dolfinx basix builds should be without isolation - upstream Basix should do isolated build testing. |
e63a6c5
to
073f892
Compare
1bba58f
to
360dcb9
Compare
… have a default value. Assign the former defaul value everywhere in nb wrappers
0c0d8b5
to
181bd8d
Compare
181bd8d
to
aab5ba6
Compare
@garth-wells do revert aab5ba6 altogether now that nanobind 2.0 is out. |
Can we backport this to the latest release? Currently I would have to pin nanobind based on the dolfinx tag I want to test with. *** Building project with Ninja...
[1/24] Building CXX object CMakeFiles/cpp.dir/dolfinx/wrappers/dolfinx.cpp.o
[2/24] Building CXX object CMakeFiles/cpp.dir/dolfinx/wrappers/graph.cpp.o
FAILED: CMakeFiles/cpp.dir/dolfinx/wrappers/graph.cpp.o
/usr/bin/c++ -DADIOS2_USE_MPI -DBOOST_TIMER_DYN_LINK -DBOOST_TIMER_NO_LIB -DDOLFINX_VERSION=\"0.8.0\" -DHAS_ADIOS2 -DHAS_PETSC -DHAS_PTSCOTCH -DHAS_SLEPC -Dcpp_EXPORTS -I/usr/local/lib/python3.12/dist-packages/petsc4py/include -I/usr/local/lib/python3.12/dist-packages/mpi4py/include -I/usr/include/python3.12 -I/usr/local/lib/python3.12/dist-packages/nanobind/include -isystem /usr/local/lib/python3.12/dist-packages/ffcx/codegeneration -isystem /usr/local/petsc/linux-gnu-complex64-32/include -isystem /usr/local/petsc/include -isystem /usr/local/slepc/linux-gnu-complex64-32/include -isystem /usr/local/slepc/include -O3 -DNDEBUG -std=c++20 -fPIC -fvisibility=hidden -fno-stack-protector -ffunction-sections -fdata-sections -MD -MT CMakeFiles/cpp.dir/dolfinx/wrappers/graph.cpp.o -MF CMakeFiles/cpp.dir/dolfinx/wrappers/graph.cpp.o.d -o CMakeFiles/cpp.dir/dolfinx/wrappers/graph.cpp.o -c /__w/actions/actions/src/dolfinx/python/dolfinx/wrappers/graph.cpp
/__w/actions/actions/src/dolfinx/python/dolfinx/wrappers/graph.cpp: In instantiation of ‘void dolfinx_wrappers::declare_adjacency_list(nanobind::module_&, std::string) [with T = int; std::string = std::__cxx11::basic_string<char>]’:
/__w/actions/actions/src/dolfinx/python/dolfinx/wrappers/graph.cpp:115:39: required from here
/__w/actions/actions/src/dolfinx/python/dolfinx/wrappers/graph.cpp:85:24: error: no matching function for call to ‘nanobind::ndarray<const int, nanobind::numpy>::ndarray(std::span<const int>::pointer, <brace-enclosed initializer list>)’
85 | return nb::ndarray<const T, nb::numpy>(link.data(), {link.size()});
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
The simplest course of action would be to backport a pin of nanobind. |
- Also add some additional `create_connectivity(tdim, tdim)` calls prior to midpoint computations (consequence of FEniCS/dolfinx#3209) - Switch to spdlog and move some logging to debug mode (FEniCS/dolfinx#3216) - Support nanobind 2.0.0 (FEniCS/dolfinx#3105) - Replace `dolfinx.Function.vector` with `dolfinx.Function.x.petsc_vec` (FEniCS/dolfinx#3092)
Hi. Breaks the compatibility with the version v0.8.0, in which the python binding can't be installed from source with the nanobind v2.0.0. |
@efirvida That's the other way around. This change guarantees that dolfinx You'll have to downgrade your nanobind version if you are trying to install v0.8.0. |
@francesco-ballarin thanks for you answer, what I mean is that the released package of the v0.8.0 have this issue, so as it is a release I think this should be fixed on the package. without affecting the main branch. In my case for example I'm using it on a HPC cluste with easybuild package manager. When I try to use the release version it was imposible until I found this thread, and I use an older nanobind. was a quick fix but it take a while until I discovered. if it's helpful for the project I can share the easy configs. |
Indeed, this could be backported, or the alternative way discussed in #3105 (comment) could be followed. |
nb::any
changed meaning)nb::ndarray
constructor)This is not meant to be merged yet, because it will need to wait for a new nanobind release that includes that commit.
Furthermore, it will need to be preceded by :
pyproject.toml
because, as shown by the failure https://github.com/FEniCS/dolfinx/actions/runs/8308122378/job/22738016168 (nanobind current release, dolfinx from this PR) and announced by the wording in the upstream commit, the change is backward incompatibleRequires FEniCS/basix#799