Skip to content

Instantly share code, notes, and snippets.

@congqiao
Created September 12, 2014 21:03
Show Gist options
  • Save congqiao/f278dfcce7b0c3e1afe0 to your computer and use it in GitHub Desktop.
Save congqiao/f278dfcce7b0c3e1afe0 to your computer and use it in GitHub Desktop.
MPI segmentation fault on Stampede
#!/usr/bin/env bash
#SBATCH -J mpi_seg_fault
#SBATCH -n 16
#SBATCH -p normal
#SBATCH -t 48:00:00
ibrun ./a.out
#include <mpi.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
int num = 1;
int total;
unsigned long count = 0;
int rank;
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
for (;;) {
MPI_Allreduce(&num, &total, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
if (++count % 1000000 == 0 && rank == 0) {
printf("Count: %lu\n", count);
}
}
MPI_Finalize();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment