Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Can LAM be used with multi-threaded user code?

code LAM multi-threaded Used user
0
Posted

Can LAM be used with multi-threaded user code?

0

Yes, but LAM is not thread safe. And unfortunately, it may take a while to make LAM thread safe. To do so will require a major redesign and overhaul of the LAM implementation. We’re working on it, but it will take a long time before it is ready. But LAM can be used in multi-threaded applications. The general rule of thumb in using a non-thread safe library in a multi-threaded application is to restrict all calls to the library in a single thread. That is, create an “MPI thread” that is the only thread that interacts with LAM. This approach has shown to work adequately well; it can be implemented with incoming and outgoing queues for the MPI thread — other threads can place messages on (and remove messages from) these queues while the MPI thread performs the actual message passing “in the background.” An alternative approach is to have a “global MPI mutex”. Have a single mutex that locks access to LAM; any thread that wishes to access LAM/MPI must first obtain this lock. This ensures t

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123