Created
September 12, 2014 21:03
-
-
Save congqiao/f278dfcce7b0c3e1afe0 to your computer and use it in GitHub Desktop.
MPI segmentation fault on Stampede
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#SBATCH -J mpi_seg_fault | |
#SBATCH -n 16 | |
#SBATCH -p normal | |
#SBATCH -t 48:00:00 | |
ibrun ./a.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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