-
Notifications
You must be signed in to change notification settings - Fork 9
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
Multiple definitions at link time #38
Comments
I do not understand why you want to link to |
Do you have an |
Hi, I installed libkkokos-core as a submodule:
At the begining of th test script:
but then the test script will fail with:
So maybe I'm missing something in the instantiation chain. The py11bind based export code is:
with |
Hi |
Actually, v.data() returns a
Is there a way to get the list of registered types ? |
Ok so the problem is with the
If I change the code to return a Is this an expected behavior ? |
Yes, they are different types and bindings are not built for const data types. |
Is there a documented way to explicitly select/instantiate (with cmake help?) the type to instantiate ? |
Also, now, when in release mode on linux, pykokkos bulid fails with:
|
So, this one seems to be fixed be setting ENABLE_THIN_LTO to Off. What is the rationale for setting it On by default ? it is not the default for pybind11 in general. Does it really improve performances that much ? Also, I could not see it in the documentation. Thanks |
It's not.
Actually it is. Pybind11 enables LTO by default when you use
AFAIR, the real benefit is the reduced size of the binary. |
No. Providing instantiations for all possible const-qualified types would be a massively unnecessary compilation overhead. And Python doesn't have a concept of const data so having const data wouldn't even translate. You just need a simple template metaprogramming wrapper to provide you with the view type with the const remove and do a static cast. |
#include <KokkosExp_InterOp.hpp> // provides Kokkos::Experimental::python_view_type
// provide an additional layer which removes the const from the data type
template <typename ViewT>
struct python_view_type;
template <template <typename...> class ViewT, typename DataT, typename... ExtraT>
struct python_view_type<ViewT<DataT, ExtraT....>>
{
// key part:
// std::remove_const_t<DataT>
using type = Kokkos::Experimental::python_view_type_t<ViewT<std::remove_const_t<DataT>, ExtraT...>>;
};
template <typename ViewT>
using python_view_type_t = typename python_view_type<ViewT>::type;
template <typename ViewT>
inline auto as_python_type(ViewT _view)
{
return static_cast<python_view_type_t<ViewT>>(_view);
} whenever your bindings return a view to python, e.g. given m.def("foo", []() {
// does something and returns view
return myview;
}, "Returns a view"); you just wrap m.def("foo", []() {
// does something and returns view without const
return as_python_type(myview);
}, "Returns a view"); it is pretty much the same as doing a |
Hi,
I have an object model using Kokkos views I want to export to python using pybind11.
The export code is in fargOCApy library. So I added the following link directive in my CMake files:
fargoseqrt
contains the object model.If I do that, the link fails with:
A verbose build indicates that the pool.o object does indeed appears twice on the link command:
If I do not link with
libpykokkos-core
, the python test script will fail, as it won't find the Kokkos views binding.Am I doing something wrong ?
Thx
The text was updated successfully, but these errors were encountered: