You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am a poor man's c++ user, so please be patient with any ignorance I display here.
I use pybind11 to create bindings between Kokkos views (the details of Kokkos are not terribly important, but a view is an abstract data container for portable (CPU/GPU) programming). This has worked great in the past. However, before using any Kokkos functionality, a void returning initializer function in Kokkos must be called. Easy enough, I wrap the Kokkos::initialize() function with pybind11, call it from the beginning of my python program, and all is well.
Recently, the Kokkos devs changed many of the class members created/set by the Kokkos::initialize() function to inline static members, and this has broken my use case with pybind11. A more detailed example:
Kokkos::initialize() creates a Kokkos defined cuda implementation class; call it KokkosCudaImpl, with an inline static member m_maxThreadsPerSM which gets set from a cuda library call. In the class definition:
class KokkosCudaImpl{
// stuff
inline static int m_maxThreadsPerSM = 0;
// more stuff
};
When Kokkos::initialize() is called, I see that the value pulled from the CUDA library for m_maxThreadsPerSM is 1024, and is supposed to be used to set the m_maxThreadsPerSM member of the KokkosCudaImpl. However, when I go to use more features of Kokkos, like execute a compute kernel, the m_maxThreadsPerSM of the KokkosCudaImpl class is set back to 0, and the kernel aborts with an error.
My question is really, should this work? As in, I call a c++ function from python that returns nothing, and expect the static class members set within that function to be persistent throughout the program execution?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am a poor man's c++ user, so please be patient with any ignorance I display here.
I use pybind11 to create bindings between Kokkos views (the details of Kokkos are not terribly important, but a view is an abstract data container for portable (CPU/GPU) programming). This has worked great in the past. However, before using any Kokkos functionality, a void returning initializer function in Kokkos must be called. Easy enough, I wrap the
Kokkos::initialize()
function with pybind11, call it from the beginning of my python program, and all is well.Recently, the Kokkos devs changed many of the class members created/set by the
Kokkos::initialize()
function toinline static
members, and this has broken my use case with pybind11. A more detailed example:Kokkos::initialize()
creates a Kokkos defined cuda implementation class; call itKokkosCudaImpl
, with an inline static memberm_maxThreadsPerSM
which gets set from a cuda library call. In the class definition:When
Kokkos::initialize()
is called, I see that the value pulled from the CUDA library form_maxThreadsPerSM
is1024
, and is supposed to be used to set them_maxThreadsPerSM
member of theKokkosCudaImpl
. However, when I go to use more features of Kokkos, like execute a compute kernel, them_maxThreadsPerSM
of theKokkosCudaImpl
class is set back to0
, and the kernel aborts with an error.My question is really, should this work? As in, I call a c++ function from python that returns nothing, and expect the static class members set within that function to be persistent throughout the program execution?
Thanks for the help.
Beta Was this translation helpful? Give feedback.
All reactions