Debian Codegraph @

test/mpi/f77/attr/baseattr2f.f

raw
1 C
2 C Copyright (C) by Argonne National Laboratory
3 C See COPYRIGHT in top-level directory
4 C
5
6 program main
7 implicit none
8 include 'mpif.h'
9 integer ierr, errs
10 logical flag
11 integer value, commsize, commrank
12
13 errs = 0
14 call mpi_init( ierr )
15
16 call mpi_comm_size( MPI_COMM_WORLD, commsize, ierr )
17 call mpi_comm_rank( MPI_COMM_WORLD, commrank, ierr )
18
19 call mpi_attr_get( MPI_COMM_WORLD, MPI_TAG_UB, value, flag, ierr
20 $ )
21 if (.not. flag) then
22 errs = errs + 1
23 print *, "Could not get TAG_UB"
24 else
25 if (value .lt. 32767) then
26 errs = errs + 1
27 print *, "Got too-small value (", value, ") for TAG_UB"
28 endif
29 endif
30
31 call mpi_attr_get( MPI_COMM_WORLD, MPI_HOST, value, flag, ierr )
32 if (.not. flag) then
33 errs = errs + 1
34 print *, "Could not get HOST"
35 else
36 if ((value .lt. 0 .or. value .ge. commsize) .and. value .ne.
37 $ MPI_PROC_NULL) then
38 errs = errs + 1
39 print *, "Got invalid value ", value, " for HOST"
40 endif
41 endif
42
43 call mpi_attr_get( MPI_COMM_WORLD, MPI_IO, value, flag, ierr )
44 if (.not. flag) then
45 errs = errs + 1
46 print *, "Could not get IO"
47 else
48 if ((value .lt. 0 .or. value .ge. commsize) .and. value .ne.
49 $ MPI_ANY_SOURCE .and. value .ne. MPI_PROC_NULL) then
50 errs = errs + 1
51 print *, "Got invalid value ", value, " for IO"
52 endif
53 endif
54
55 call mpi_attr_get( MPI_COMM_WORLD, MPI_WTIME_IS_GLOBAL, value,
56 $ flag, ierr )
57 if (flag) then
58 C Wtime need not be set
59 if (value .lt. 0 .or. value .gt. 1) then
60 errs = errs + 1
61 print *, "Invalid value for WTIME_IS_GLOBAL (got ", value,
62 $ ")"
63 endif
64 endif
65
66 call mpi_attr_get( MPI_COMM_WORLD, MPI_APPNUM, value, flag, ierr
67 $ )
68 C appnum need not be set
69 if (flag) then
70 if (value .lt. 0) then
71 errs = errs + 1
72 print *, "MPI_APPNUM is defined as ", value,
73 $ " but must be nonnegative"
74 endif
75 endif
76
77 call mpi_attr_get( MPI_COMM_WORLD, MPI_UNIVERSE_SIZE, value,
78 $ flag, ierr )
79 C MPI_UNIVERSE_SIZE need not be set
80 if (flag) then
81 if (value .lt. commsize) then
82 errs = errs + 1
83 print *, "MPI_UNIVERSE_SIZE = ", value,
84 $ ", less than comm world (", commsize, ")"
85 endif
86 endif
87
88 call mpi_attr_get( MPI_COMM_WORLD, MPI_LASTUSEDCODE, value, flag
89 $ , ierr )
90 C Last used code must be defined and >= MPI_ERR_LASTCODE
91 if (flag) then
92 if (value .lt. MPI_ERR_LASTCODE) then
93 errs = errs + 1
94 print *, "MPI_LASTUSEDCODE points to an integer (",
95 $ MPI_ERR_LASTCODE, ") smaller than MPI_ERR_LASTCODE (",
96 $ value, ")"
97 endif
98 else
99 errs = errs + 1
100 print *, "MPI_LASTUSECODE is not defined"
101 endif
102
103 C Check for errors
104 if (errs .eq. 0) then
105 print *, " No Errors"
106 else
107 print *, " Found ", errs, " errors"
108 endif
109
110 call MPI_Finalize( ierr )
111
112 end