title: Error with MPI_Bcast
body: <p>I am getting an error with MPI_Bcast (I think it is an old one) I am not sure why this is happening. The error is as follows:  </p>
  
  <pre class="lang-none prettyprint-override"><code>An error occurred in MPI_Bcast    
  on communicator MPI_COMM_WORLD  
  MPI_ERR_TRUNCATE: message truncated      
  MPI_ERRORS_ARE_FATAL: your MPI job will now abort
  </code></pre>
  
  <p>The code where it happens is:</p>
  
  <pre><code>for (int i = 0; i &lt; nbProcs; i++){
      for (int j = firstLocalGrainRegion; j &lt; lastLocalGrainRegion; j++){
          GrainRegion * grainRegion = microstructure-&gt;getGrainRegionAt(j);
          int grainSize = grainRegion-&gt;getBoxSize(nb);
          double * newValues;
          if (myId == i)
              newValues = grainRegion-&gt;getNewValues();
          else
              newValues = new double[grainSize]; 
          MPI_Bcast(newValues, grainSize, MPI_DOUBLE, i, MPI_COMM_WORLD);
          MPI_Barrier(MPI_COMM_WORLD);
  
          if (myId != i)
              grainRegion-&gt;setNewValues(newValues);
      }   
  }
  </code></pre>