2 C Test that error handlers can be applied and used through Fortran
7 integer ierr, errorclass
8 integer buf, errors, request
12 C Try to set the errors-return handler
14 call mpi_errhandler_set(mpi_comm_world, mpi_errors_return, ierr)
17 C Activate the handler with a simple case
19 call mpi_send( buf, 1, MPI_INTEGER, -99, 0, MPI_COMM_WORLD, ierr )
20 if (IERR .eq. MPI_SUCCESS) then
22 print *, 'MPI_Send of negative rank did not return error'
25 C Check for a reasonable error message
26 call mpi_error_class(ierr, errorclass, err)
27 if (errorclass .ne. MPI_ERR_RANK) then
29 print *, 'Error class was not MPI_ERR_RANK, was ', errorclass
32 C Activate the handler with a simple case
34 call mpi_irecv( buf, 1, MPI_INTEGER, -100, 2, MPI_COMM_WORLD,
36 if (IERR .eq. MPI_SUCCESS) then
38 print *, 'MPI_Irecv of negative rank did not return error'
41 C Check for a reasonable error message
42 call mpi_error_class(ierr, errorclass, err)
43 if (errorclass .ne. MPI_ERR_RANK) then
45 print *, 'Error class was not MPI_ERR_RANK, was ', errorclass
48 if (errors .eq. 0) then
51 print *, ' Found ', errors, ' errors'
54 call mpi_finalize(ierr)