Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
ИНСАЙД ИНФА MPI.pdf
Скачиваний:
15
Добавлен:
15.04.2015
Размер:
3.3 Mб
Скачать

24

CHAPTER 2. MPI TERMS AND CONVENTIONS

1Note that this in no way prevents the creation of library routines that provide parallel

2services whose operation is collective. However, the following program is expected to com-

3plete in an ISO C environment regardless of the size of MPI_COMM_WORLD (assuming that

4

5

printf is available at the executing nodes).

6

7

8

9

10

11

int rank;

MPI_Init((void *)0, (void *)0); MPI_Comm_rank(MPI_COMM_WORLD, &rank);

if (rank == 0) printf("Starting program\n"); MPI_Finalize();

The corresponding Fortran and C++ programs are also expected to complete.

12

An example of what is not required is any particular ordering of the action of these

13

routines when called by several tasks. For example, MPI makes neither requirements nor

14

recommendations for the output from the following program (again assuming that I/O is

15

available at the executing nodes).

16

17MPI_Comm_rank(MPI_COMM_WORLD, &rank);

18printf("Output from task rank %d\n", rank);

19

20In addition, calls that fail because of resource exhaustion or other error are not con-

21sidered a violation of the requirements here (however, they are required to complete, just

22not to complete successfully).

23

 

 

24

2.9.2

Interaction with Signals

25

MPI does not specify the interaction of processes with signals and does not require that MPI

26

be signal safe. The implementation may reserve some signals for its own use. It is required

27

that the implementation document which signals it uses, and it is strongly recommended

28

that it not use SIGALRM, SIGFPE, or SIGIO. Implementations may also prohibit the use of

29

MPI calls from within signal handlers.

30

In multithreaded environments, users can avoid con icts between signals and the MPI

31

library by catching signals only on threads that do not execute MPI calls. High quality

32

single-threaded implementations will be signal safe: an MPI call suspended by a signal will

33

resume and complete normally after the signal is handled.

34

 

 

35

 

 

36

2.10

Examples

 

37

38The examples in this document are for illustration purposes only. They are not intended

39to specify the standard. Furthermore, the examples have not been carefully checked or

40veri ed.

41

42

43

44

45

46

47

48