NWChemEx / NWChemEx/TensorWrapper

Passing an MPI communicator

Open
#143 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
0
Forks
0
Avg merge
5h 33m
Merged PRs (30d)
6

Description

We should be able to pass an MPI communicator to NWChemEx runtime. I tested this for PluginPlay and TiledArray I didn't see any issue, but with TensorWrapper, I get:

Allocator<Scalar>
  allocate(rank 1 tensor)
-------------------------------------------------------------------------------
/home/keceli/soft/nwx/TensorWrapper/tests/tensor/allocators/allocator.cpp:63
...............................................................................

/home/keceli/soft/nwx/TensorWrapper/tests/tensor/allocators/allocator.cpp:63: FAILED:
due to a fatal error condition:
  SIGSEGV - Segmentation violation signal

Here is the only change I made to pass the already initialized communicator:

> diff --git a/tests/test_main.cpp b/tests/test_main.cpp
index bfd05e2..cd47124 100644
--- a/tests/test_main.cpp
+++ b/tests/test_main.cpp
@@ -20,7 +20,19 @@
 #include <parallelzone/runtime/runtime_view.hpp>

 int main(int argc, char* argv[]) {
-    auto rt = parallelzone::runtime::RuntimeView(argc, argv);
+    // Initialize MPI
+    int provided, rank, size;
+    MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided);
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    MPI_Comm_size(MPI_COMM_WORLD, &size);
+
+    // Create a new communicator for each rank
+    MPI_Comm new_comm;
+    MPI_Comm_split(MPI_COMM_WORLD, rank, 0, &new_comm);
+
+    auto rt = parallelzone::runtime::RuntimeView(argc, argv, new_comm);
+
+    //auto rt = parallelzone::runtime::RuntimeView(argc, argv);

     int res = Catch::Session().run(argc, argv);

Note that, it gives the seg fault even with a single rank, i.e. when I just run `./test_tensorwrapper. However, this issue still could be related to #142.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure using the change in tests/test_main.cpp, then inspect the allocator test at tests/tensor/allocators/allocator.cpp:63 and the RuntimeView constructor that receives new_comm. Compare this with issue #142 and verify that passing an already initialized communicator no longer causes the allocator test to terminate with SIGSEGV, including with a single rank.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.