-
Notifications
You must be signed in to change notification settings - Fork 57
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
Nanobind #99
Nanobind #99
Conversation
>>> import lib.tapkee Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: /home/garcia/tapkee/tapkee/lib/tapkee.cpython-312-x86_64-linux-gnu.so: undefined symbol: dsaupd_ And go a bit too far with the renaming.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's an amazing thing there. It looks much simpler than I thought.
test_exception_unknown_method() | ||
parameters = tapkee.ParametersSet() | ||
method = parse_reduction_method('lle') | ||
parameters.add(tapkee.Parameter.create('dimension reduction method', method)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add some numeric parameter too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's one for target_dimension
now used from test_nanobind_extension.py
.
test/test_nanobind_extension.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactor to use e.g. pytest.
Running in the CI looking good too! I will update the workflow since it would be nice if the new job appears in the pull request too. |
We saw that it worked with nanobind and now know what to expect from it. It can be picked up at any moment when there's interest in having it with yesterday's new |
I quickly merged the upstream changes in |
Testing pending.
I started updating the extension and got to this one: src/python/nanobind_extension.cpp: In function ‘void nanobind_init_tapkee(nanobind::module_&)’:
src/python/nanobind_extension.cpp:38:10: error: no matching function for call to ‘nanobind::module_::def(const char [15], <unresolved overloaded function type>)’
38 | m.def("parse_multiple", &parse_multiple<DimensionReductionMethod>);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from venv-tapkee-nanobind/lib/python3.12/site-packages/nanobind/include/nanobind/nanobind.h:51:venv-tapkee-nanobind/lib/python3.12/site-packages/nanobind/include/nanobind/nb_func.h:255:10: note: candidate: ‘template<class Func, class ... Extra> nanobind::module_& nanobind::module_::def(const char*, Func&&, const Extra& ...)’
255 | module_ &module_::def(const char *name_, Func &&f, const Extra &...extra) {
| ^~~~~~~
venv-tapkee-nanobind/lib/python3.12/site-packages/nanobind/include/nanobind/nb_func.h:255:10: note: template argument deduction/substitution failed:
src/python/nanobind_extension.cpp:38:10: note: couldn’t deduce template parameter ‘Func’
38 | m.def("parse_multiple", &parse_multiple<DimensionReductionMethod>) |
I am still working on other build errors after this one. For this one the |
I'd suggest to introduce some currying so that there is an additional |
Yeah! I think that's a good idea. It'd also simplify the extension in avoiding to expose the maps. |
The extension is back: https://github.com/iglesias/tapkee/actions/runs/9535436521/job/26281156242 There was a funny interaction with the renaming from For next, it appears the branch cannot be rebased due to conflicts. I haven't looked into it yet. |
Ah, all right, I think I understand about the rebase now. It can be squashed at least, I think that's suitable for this one. |
Do you think we squash and merge or would you force-squash it? |
I can do it here right away. |
I thought next to be adding to this PR (1) a workflow to have the Python interface in the CI and (2) more of the parameters in nanobind_extension.cpp. I should also try using other of the DR methods from Python and consider if it could be nice (and easy) to have different combinations covered in the CI too.
And well also the bunch of TODO's I left ':-D
So, hmm, there could be a lot. I think I will continue pushing step by step and keep an eye how it can start getting integrated.