Hi,
I am using RDataFrame Define with armadillo to define a column of type arma::SpMat. However, I get the error:
Error in <TStreamerInfo::Build>: arma::SpMat<double>, unknown type: const double*const values
Error in <TStreamerInfo::Build>: arma::SpMat<double>, unknown type: const ULong64_t*const row_indices
Error in <TStreamerInfo::Build>: arma::SpMat<double>, unknown type: const ULong64_t*const col_ptrs
Error in <TStreamerInfo::Build>: __mutex_base, unknown type: pthread_mutex_t _M_mutex
Reproducer:
#include “TROOT.h”
#include “ROOT/RDataFrame.hxx”
#include <armadillo>
#include “pthread.h”
#include “sys/types.h”
auto getSm = {arma::sp_mat A(1,1); A(0,0) = 1.; return A;};
int main() {
gInterpreter->GenerateDictionary(
“arma::SpMat<double>;”
“arma::SpBase_eval_SpMat<double,arma::SpMat<double>>;”
“arma::SpBase<double,arma::SpMat<double>>;”
“arma::MapMat<double>; map_ptr;”
“arma::state_type; atomic<int>; __atomic_base<int>;”
“mutex; __mutex_base; pthread_mutex_t”,“armadillo;mutex;pthread.h;sys/types.h”);
ROOT::RDataFrame df(10);
auto d = df.Define(“sm”, getSm);
d.Snapshot(“test”,“test.root”,{“sm”});
return 0;
}
I use LCG_95apython3.
Kind regards,
Molly
Where you ever able to generate a dictionary for arma::SpMat<double>
(i.e. outside of this example)?
Hi, thanks for you answer! What do you mean by ‘outside’? - I dunno in what other context I should use a dictionary … before I generate the dictionaries it gives an error that dictionaries are missing, so I generate them and that error disappears, which leads me to believe (maybe wrongly!) that that part works …
Often the dictionary are generated using rootcling or genreflex and compile as part of a shared library.
So this is the first time you try to generate a dictionary for those classes and we need to find a work-around the challenges. Can you provide the header file for arma::SpMat
?
Cheers,
Philippe.
Of course!
SpMat_meat.hpp (138.7 KB)
SpMat_bones.hpp (33.4 KB)
Error in <TStreamerInfo::Build>: arma::SpMat<double>, unknown type: const double*const values
Error in <TStreamerInfo::Build>: arma::SpMat<double>, unknown type: const ULong64_t*const row_indices
Error in <TStreamerInfo::Build>: arma::SpMat<double>, unknown type: const ULong64_t*const col_ptrs
Error in <TStreamerInfo::Build>: __mutex_base, unknown type: pthread_mutex_t _M_mutex
The mutex need to be marked transient:
arma_aligned mutable std::mutex cache_mutex; ///<! the trailing ! indicates it is transient.
The caches needs to be marked transient:
arma_aligned mutable MapMat<eT> cache; ///<!
arma_aligned mutable state_type sync_state; ///<!
I am not sure whether those are caches or not:
arma_aligned const eT* const values;
arma_aligned const uword* const row_indices;
arma_aligned const uword* const col_ptrs;
If they are they should be marked transient, is not you would need to both replace the type by something rootcling/genreflex can handle and hide a marker of the length …:
#ifdef __ROOTCLING__
arma_aligned eT* values; ///< [n_size_values_array]
arma_aligned uword* row_indices; ///< [n_rows]
arma_aligned uword* col_ptrs; ///< [n_columns]
#else
arma_aligned const eT* const values;
arma_aligned const uword* const row_indices;
arma_aligned const uword* const col_ptrs;
#endif
Cheers,
Philippe.
system
Closed
May 24, 2019, 8:06pm
7
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.