mpiPi is a code to investigate the interaction of the MPI commands BCAST, ABORT & FINALIZE. ( source is in source/misc/mpiPi.F ) It is compiled with the command
>mpif90 mpiPi.F -o mpiPi Encountered 0 errors, 0 warnings in file mpiPi.F.
& can be executed ( using openMPI ) with the command
>mpirun -np 4 -host jac-123,jac-122,jac-121,jac-120 mpiPi
[ The interactive host should be listed first, to enable interaction with the program (?)]
Operation is controlled by two parameters -
- nintvl
- Number of intervals for Pi calculation,
or, termination flag- nerr
- Provokes various errors during the calculation, if set
( See Log ) For normal execution, nintvl = 1000000 (say) & nerr = 0. Pi is then calculated, The master process (id=0) returns to prompt for input, & the slaves call MPI_BCAST.
nintvl is then input as zero ; this value is broadcast, & all processes then call MPI_FINALISE, which returns with status zero in all cases
If nintvl < 0, then the slave processes return to MPI_BCAST.
- nintval == -1 : the master calls MPI_FINALISE. On our system ( OpenMpi 1.2.5 ) this leaves the processes suspended - see Log & process map [ Kill the mpirun process to terminate all processes ]
- nintval == -2 : master calls MPI_ABORT - this terminates all processes ( Log )
When i ( the integration loop iterator ) == + or -nerr, then an error or termination attempt is made. [ Note that process ip of NP will see values of i = ip + n*NP + 1 ]
- i = nerr
- This induces a seqmentation violation in some subprocess, which is detected by MPI ( Log )
- i = -nerr
- If Slave process, calls MPI_ABORT - this terminates the run ( Log )
If Master, calls MPI_FINALIZE - run hangs ( Log )
With this version of MPI, it is only safe to call MPI_FINALIZE at the end of a run, when it must be called by all processes. In any other case the only safe option is to call MPI_ABORT