<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<span class="x_elementToProof ContentPasted0" style="font-size: 12pt; margin: 0px; background-color: rgb(255, 255, 255);">Hello,</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<div class="x_elementToProof" style="font-size: 12pt; margin: 0px; background-color: rgb(255, 255, 255);">
<br class="ContentPasted0">
</div>
<div class="x_elementToProof x_ContentPasted0 ContentPasted0" style="font-size: 12pt; margin: 0px; background-color: rgb(255, 255, 255);">
Our library's autobuild (CTF, which uses MPI extensively and in relatively sophisticated ways) started failing on multiple architectures after github workflows moved to later OS versions (and so later MPI versions). I believe I have narrowed the issue to an
 MPI bug associated with very basic usage of MPI Reduce. The following test code runs into a segmentation fault inside MPI when running with 2 MPI processes with the latest Ubuntu MPI build and MPI 4.0. It works for smaller values of message size (n) or if
 the root is rank 0. The usage of MPI_IN_PLACE adheres with the MPI standard.</div>
<div class="x_elementToProof x_ContentPasted0" style="font-size: 12pt; margin: 0px; background-color: rgb(255, 255, 255);">
<br class="ContentPasted0">
</div>
<div class="x_elementToProof x_ContentPasted0 ContentPasted0" style="font-size: 12pt; margin: 0px; background-color: rgb(255, 255, 255);">
Best,</div>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<span class="x_elementToProof x_ContentPasted0 ContentPasted0" style="font-size: 12pt; margin: 0px; background-color: rgb(255, 255, 255);">Edgar Solomonik</span><br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<span class="x_elementToProof x_ContentPasted0 ContentPasted0" style="font-size: 12pt; margin: 0px; background-color: rgb(255, 255, 255);"><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<span class="x_elementToProof x_ContentPasted0 ContentPasted0 ContentPasted1" style="font-size: 12pt; margin: 0px; background-color: rgb(255, 255, 255);">#include <mpi.h>
<div class="ContentPasted1">#include <iostream></div>
<div><br class="ContentPasted1">
</div>
<div class="ContentPasted1">int main(int argc, char ** argv){</div>
<div class="ContentPasted1">  int64_t n = 257;</div>
<div><br class="ContentPasted1">
</div>
<div class="ContentPasted1">  MPI_Init(&argc, &argv);</div>
<div class="ContentPasted1">  int rank;</div>
<div class="ContentPasted1">  MPI_Comm_rank(MPI_COMM_WORLD, &rank);</div>
<div><br class="ContentPasted1">
</div>
<div class="ContentPasted1">  double * A = (double*)malloc(sizeof(double)*n);</div>
<div class="ContentPasted1">  for (int i=0; i<n; i++){</div>
<div class="ContentPasted1">    A[i] = (double)i;</div>
<div class="ContentPasted1">  }</div>
<div><br class="ContentPasted1">
</div>
<div class="ContentPasted1">  if (rank == 1){</div>
<div class="ContentPasted1">    MPI_Reduce(MPI_IN_PLACE, A, n, MPI_DOUBLE, MPI_SUM, 1, MPI_COMM_WORLD);</div>
<div class="ContentPasted1">  } else {</div>
<div class="ContentPasted1">    MPI_Reduce(A, NULL, n, MPI_DOUBLE, MPI_SUM, 1, MPI_COMM_WORLD);</div>
<div class="ContentPasted1">  }</div>
<div><br class="ContentPasted1">
</div>
<div class="ContentPasted1">  free(A);</div>
<div><br class="ContentPasted1">
</div>
<div class="ContentPasted1">  MPI_Finalize();</div>
<div><br class="ContentPasted1">
</div>
<div class="ContentPasted1">  return 0;</div>
<div class="ContentPasted1">}</div>
<br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<span class="x_elementToProof x_ContentPasted0 ContentPasted0" style="font-size: 12pt; margin: 0px; background-color: rgb(255, 255, 255);"><br>
</span></div>
</body>
</html>