Registered Member
|
As mentioned here: "custom allocator for sparse and dynamic-sized vecs/matrices?" it would be great to use custom allocators.
Passing an allocator as template parameter of Matrix would be great because one could implement so many great features: track info about who allocated what and when, use a memory pool, etc. But It might be long to implement... I am wondering if it would be a good and easy thing to slightly modify the following implementations: ei_matrix_array ei_conditional_aligned_realloc_new ei_conditional_aligned_delete and use an option to select a custom allocation/storage method. For example the declaration of ei_matrix_array could be:
And somewhere with the Eigen plugin mechanism already used here and there have a specialized template like that:
|
Registered Member
|
Just a few remarks as we really dont have much time to spend on that with the impending 3.0 release.
* bugzilla is a better place for discussion of feature development * dont hesitate to work on proofs of concept, you can use 'forks' on bitbucket.org to share your work * work off eigen3, not eigen2
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered Member
|
Ok, sorry. Just wanted to check if someone had already done something about that.
I'll switch to bugzilla. |
Registered Member
|
I just finished implementing a private allocator for Eigen. The allocator can be activated by defining EIGEN_USE_PRIVATE_ALLOC before including any Eigen headers. It replaces eigen_alinged_malloc / eigen_alinged_free in eigen_aligned_new / eigen_aligned_delete and should be transparent for the user.
I am happy to share the code. It's tested with OSX 10.6 (64bit) and with Linux (x86), but should also work with Linux amd64. There is some code for Windows, but this is not tested yet... What is the best way to contribute the code to Eigen? Markus |
Registered Member
|
* if you just want to share code, without necessarily pushing for it to be included in eigen, a fork on bitbucket.org is a good way
* if you want discussing including this into eigen, file a bug @ bugzilla. * if you want a more general discussion with more people interested in eigen, use the mailing list
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered Member
|
All right,
I created a new fork and tried to add my code. Please check https://bitbucket.org/MarkusS/eigen-private-alloc and see if my code works for you. (Haven't used hg before, so be gentle ). So only modification is a few lines in Memory.h and two new files, PrivateAlloc.h and Mutex.h (like Memory.h in src/Core/util). As I said before, just define EIGEN_USE_PRIVATE_ALLOC before including any Eigen headers and enjoy. Use valgrind to check for the numbers of malloc with and without the define, especially if you use Eigen in long loops. I'll also add a bug @ bugzilla... Thanks, Markus |
Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], ourcraft