From 346b4116fc5d589e29e367b6c39d71272be43844 Mon Sep 17 00:00:00 2001
From: Thomas Ponweiser <thomas.ponweiser@risc-software.at>
Date: Mon, 25 Apr 2016 12:03:42 +0200
Subject: [PATCH] parallel io: added error handling for "read2shmem" example

---
 read2shmem/read2shmem.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/read2shmem/read2shmem.c b/read2shmem/read2shmem.c
index 28b4324..7016393 100644
--- a/read2shmem/read2shmem.c
+++ b/read2shmem/read2shmem.c
@@ -41,6 +41,13 @@ int main(int argc, char *argv[])
    MPI_Comm_size(MPI_COMM_WORLD, &world_size);
    master = world_rank == 0;
 
+   // We want the program to stop on I/O errors
+   // -> Change the default I/O error hander from MPI_ERRORS_RETURN to MPI_ERRORS_ARE_FATAL
+   // Notes:
+   //  * An individual I/O error handler can be associated to each file handle.
+   //  * The default I/O error handler is associated to the null file handle, i.e. MPI_FILE_NULL.
+   MPI_File_set_errhandler(MPI_FILE_NULL, MPI_ERRORS_ARE_FATAL);
+
    if(verbose) print_info_world();
 
    // Broadcast name of file to open
-- 
GitLab