Is it possible for MEX functions to share memory running in parallel?
3 views (last 30 days)
Show older comments
I created a binary search tree in C and wrote several MEX files to interface with it. The tree itself is read only and after construction its a static data structure which can be used for lookups. I need to do many millions of lookups in this tree in order to perform some computation, seeing as I have a 18 core machine I wanted to do these lookups in parallel using the parallel computing toolbox.
Unfortunately this doesn't work at all, the workers all immediately crash due to an Access violation (Segfault). I'm guessing this is since the Parallel compute toolbox doesn't have shared memory between workers. I'm wondering if there are any ways to get around this and have the threads share the same memory space? I'm guessing its not really possible without some pretty hacky stuff.
Just wondering if anyone knew of any magic tricks where you somehow have the cluster all map to the same memory space.
Also incase anyone is wondering the tree is actually fairly carefully designed so that it works well under concurrency and doesn't thrash in cache too much.
If there isn't any good solution I suppose I'll look into some kind of OpenMP distribution strategy.
0 Comments
Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!