Adapt tests for main to MPI
Fix some bugs in MPI. Add some tests
Add tests for MPI. Fix some bugs in DualThreadInvoker