title: Run perf with an MPI application
body: <p><code>perf</code> is a performance analysis tool which can report hardware and software events. I am trying to run it with an MPI application in order to learn how much time the application spends within each core on data transfers and compute operations.</p>
  
  <p>Normally, I would run my application with</p>
  
  <pre><code>mpirun -np $NUMBER_OF_CORES app_name
  </code></pre>
  
  <p>And it would spawn on several cores or possibly several nodes. Is it possible to add <code>perf</code> on top? I've tried</p>
  
  <pre><code>perf stat mpirun -np $NUMBER_OF_CORES app_name
  </code></pre>
  
  <p>But the output for this looks like some sort of aggregate of mpirun. Is there a way to collect perf type data from each core?</p>