simongog / sdsl-lite

Succinct Data Structure Library 2.0
Other
2.21k stars 350 forks source link

openmp for construction #9

Closed mpetri closed 11 years ago

mpetri commented 11 years ago

there would be quite a few places where we could speed things up using simple openmp primitives (similar to what libdivsufsort). for example:

        void construct_init_rank_select() {
            util::init_support(m_tree_rank, &m_tree);
            util::init_support(m_tree_select0, &m_tree);
            util::init_support(m_tree_select1, &m_tree);
        }

of course this would have to be disabled when you do "construction time experiments"

simongog commented 11 years ago

Yes, lets do this. In the example above we also don't have to worry about the working space, since its the same as in the serial version.

mpetri commented 11 years ago

I experimented with this and it seems to improve the construction time by a few percent. However, it required the memory manager (mm::add mm::remove) to be thread safe which it currently is not.

is there a way to only add mutexes to the mm::add mm::remove methods if we run in "multithreaded mode?" there is an openmp specific define but is there a define that we can check if sdsl code runs in multiple threads?

or should we make mm::add and mm::remove only do things if we enable it manually. like mm::enable = true; at the beginning of the program similar to the verbose flag.