![]()
Definition
MPI_THREAD_SERIALIZED represents a thread support level. It is used as part of the MPI_Init_thread initialisation. MPI_THREAD_SERIALIZED is the third level; it informs MPI that the application is multithreaded and that any thread may issue MPI calls, however different threads will never issue MPI calls at the same time. Other thread support levels are, in order, MPI_THREAD_SINGLE, MPI_THREAD_FUNNELED and MPI_THREAD_MULTIPLE.
#include <stdio.h>
#include <stdlib.h>
#include <mpi.h>
/**
* @brief Illustrates how to initialise the MPI environment with multithreading
* support and ask for the MPI_THREAD_SERIALIZED level.
* @details This application initialised MPI and asks for the
* MPI_THREAD_SERIALIZED thread support level. It then compares it with the
* thread support level provided by the MPI implementation.
**/
int main(int argc, char* argv[])
{
// Initilialise MPI and ask for thread support
int provided;
MPI_Init_thread(NULL, NULL, MPI_THREAD_SERIALIZED, &provided);
if(provided < MPI_THREAD_SERIALIZED)
{
printf("The threading support level is lesser than that demanded.\n");
MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE);
}
else
{
printf("The threading support level corresponds to that demanded.\n");
}
// Tell MPI to shut down.
MPI_Finalize();
return EXIT_SUCCESS;
}
![]()
Definition
MPI_THREAD_SERIALIZED represents a thread support level. It is used as part of the MPI_Init_thread initialisation. MPI_THREAD_SERIALIZED is the third level; it informs MPI that the application is multithreaded and that any thread may issue MPI calls, however different threads will never issue MPI calls at the same time. Other thread support levels are, in order, MPI_THREAD_SINGLE, MPI_THREAD_FUNNELED and MPI_THREAD_MULTIPLE.
!> @brief Illustrates how to initialise the MPI environment with multithreading
!> support and ask for the MPI_THREAD_SERIALIZED level.
!> @details This application initialised MPI and asks for the
!> MPI_THREAD_SERIALIZED thread support level. It then compares it with the
!> thread support level provided by the MPI implementation.
PROGRAM main
USE mpi
IMPLICIT NONE
INTEGER :: ierror
INTEGER :: provided
! Initilialise MPI and ask for thread support
CALL MPI_Init_thread(MPI_THREAD_SERIALIZED, provided, ierror)
IF (provided .LT. MPI_THREAD_SERIALIZED) THEN
WRITE(*,'(A)') 'The threading support level is lesser than that demanded.'
CALL MPI_Abort(MPI_COMM_WORLD, -1, ierror)
ELSE
WRITE(*,'(A)') 'The threading support level corresponds to that demanded.'
END IF
! Tell MPI to shut down.
CALL MPI_Finalize(ierror)
END PROGRAM main
![]()
Definition
MPI_THREAD_SERIALIZED represents a thread support level. It is used as part of the MPI_Init_thread initialisation. MPI_THREAD_SERIALIZED is the third level; it informs MPI that the application is multithreaded and that any thread may issue MPI calls, however different threads will never issue MPI calls at the same time. Other thread support levels are, in order, MPI_THREAD_SINGLE, MPI_THREAD_FUNNELED and MPI_THREAD_MULTIPLE.
!> @brief Illustrates how to initialise the MPI environment with multithreading
!> support and ask for the MPI_THREAD_SERIALIZED level.
!> @details This application initialised MPI and asks for the
!> MPI_THREAD_SERIALIZED thread support level. It then compares it with the
!> thread support level provided by the MPI implementation.
PROGRAM main
USE mpi_f08
IMPLICIT NONE
INTEGER :: provided
! Initilialise MPI and ask for thread support
CALL MPI_Init_thread(MPI_THREAD_SERIALIZED, provided)
IF (provided .LT. MPI_THREAD_SERIALIZED) THEN
WRITE(*,'(A)') 'The threading support level is lesser than that demanded.'
CALL MPI_Abort(MPI_COMM_WORLD, -1)
ELSE
WRITE(*,'(A)') 'The threading support level corresponds to that demanded.'
END IF
! Tell MPI to shut down.
CALL MPI_Finalize()
END PROGRAM main