Debian Codegraph @

test/mpi/f77/info/infocrenvf.f

raw
1 C
2 C Copyright (C) by Argonne National Laboratory
3 C See COPYRIGHT in top-level directory
4 C
5
6 C
7 C Testing MPI_Info_create_env.
8 C
9 subroutine test_info ( i1, i2, errs )
10 implicit none
11 include 'mpif.h'
12 integer ierr, i, i1, i2, vl, errs
13 character*(MPI_MAX_INFO_KEY) value1, value2
14 character*(MPI_MAX_INFO_KEY) keys(9)
15 logical f1, f2
16 C
17 keys(1) = "command"
18 keys(2) = "argv"
19 keys(3) = "maxprocs"
20 keys(4) = "soft"
21 keys(5) = "host"
22 keys(6) = "arch"
23 keys(7) = "wdir"
24 keys(8) = "file"
25 keys(9) = "thread_level"
26 C
27 do i = 1, 9
28 vl = MPI_MAX_INFO_KEY
29 call mpi_info_get_string( i1, keys(i), vl, value1, f1, ierr )
30 vl = MPI_MAX_INFO_KEY
31 call mpi_info_get_string( i2, keys(i), vl, value2, f2, ierr )
32 C
33 C if ( f1 ) then
34 C print *, "keys: ", trim(keys(i)), "value1: ", trim(value1)
35 C endif
36 C if ( f2 ) then
37 C print *, "keys: ", trim(keys(i)), "value2: ", trim(value1)
38 C endif
39 C
40 C i1 and i2 should return the same values.
41 C
42 if ( f1 .eqv. f2 ) then
43 if ( (f1 .eqv. .TRUE.) .and. value1 .ne. value2) then
44 errs = errs + 1
45 endif
46 else
47 errs = errs + 1
48 endif
49 enddo
50 end
51
52 program main
53 implicit none
54 include 'mpif.h'
55 integer i1, i2
56 integer ierr, errs
57 C
58 errs = 0
59
60 call mpi_info_create_env( i1, ierr )
61 call mpi_info_create_env( i2, ierr )
62
63 call test_info( i1, i2, errs )
64 call mpi_info_free( i1, ierr )
65 call mpi_info_create_env( i1, ierr )
66
67 call mpi_init( ierr )
68
69 call test_info( i1, i2, errs )
70 call mpi_info_free( i1, ierr )
71 call mpi_info_create_env( i1, ierr )
72
73 call mpi_finalize( ierr )
74
75 call test_info( i1, i2, errs )
76 call mpi_info_free( i1, ierr )
77 call mpi_info_create_env( i1, ierr )
78
79 call test_info( i1, i2, errs )
80 call mpi_info_free( i1, ierr )
81 call mpi_info_free( i2, ierr )
82
83 if ( errs .eq. 0 ) then
84 print *, " No Errors"
85 else
86 print *, " Found ", errs, " errors"
87 endif
88 end