Note that there are some explanatory texts on larger screens.

plurals
  1. PONew communicator invalid MPI
    text
    copied!<p>I want to create a new communicator that holds on to only the ranks that are used in the processing, if I have 24 processors available and I only need 10 then the group should only hold those 10, otherwise it will hold all of them. For some reason, when I attempt to create a communicator everything executes, but as soon as I try something like getting the size or rank of the new communicator MPI stops with an error.</p> <pre><code> 80 float **matrix; 81 int *ranksArr; 82 MPI_Comm default_comm; 83 MPI_Group world_grp, new_grp; 84 MPI_Comm_rank(MPI_COMM_WORLD, &amp;proc_rank); 85 MPI_Comm_size(MPI_COMM_WORLD, &amp;proc_avail); 86 MPI_Comm_group(MPI_COMM_WORLD, &amp;world_grp); 91 compute_block_size(&amp;block, proc_avail); 92 93 if(block.procsUsed == proc_avail) 94 { 95 ranksArr = alloc_ranks_arr(proc_avail); 96 } 97 else 98 { 99 ranksArr = alloc_ranks_arr(block.procsUsed); 100 proc_avail = block.procsUsed; 101 } 102 103 MPI_Group_incl(world_grp, proc_avail, ranksArr, &amp;new_grp); 104 MPI_Comm_create(MPI_COMM_WORLD, new_grp, &amp;default_comm); 105 //MPI_Comm_size(default_comm, &amp;proc_avail); //ERROR, default_comm 106 107 MPI_Comm_rank(default_comm, &amp;proc_rank); 108 111 matrix = create_matrix_sub(&amp;block, proc_rank); 112 113 114 dealloc_matrix(matrix); 178 int* alloc_ranks_arr(int totalRanks) 179 { 180 int *ranksToGroup = malloc(totalRanks * sizeof(int)); 181 int i; 182 183 for(i = 0; i &lt; totalRanks ; i++) 184 { 185 ranksToGroup[i] = i; 186 } 187 188 return ranksToGroup; 189 } </code></pre> <blockquote> <p>[cluster-srv2:24701] <strong>* An error occurred in MPI_Comm_rank [cluster-srv2:24701] *</strong> on communicator MPI_COMM_WORLD [cluster-srv2:24701] <strong>* MPI_ERR_COMM: invalid communicator [cluster-srv2:24701] *</strong> MPI_ERRORS_ARE_FATAL (your MPI job will now abort)</p> </blockquote> <p>It says in the docs : </p> <blockquote> <p>MPI_ERR_COMM Invalid communicator. A common error is to use a null communicator in a call (not even allowed in MPI_Comm_rank).</p> </blockquote> <p>But I create the communicator right before calling Comm_rank and also the return value of MPI_Comm_create is giving me MPI_SUCCESS. So I have no idea why this is happening.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload