1 C -*- Mode: Fortran; -*-
3 C (C) 2004 by Argonne National Laboratory.
4 C See COPYRIGHT in top-level directory.
6 C This tests the null copy function (returns flag false; thus the
7 C attribute should not be propagated to a dup'ed communicator
8 C This is must like the test in commattr2f
19 C The only difference between the MPI-2 and MPI-1 attribute caching
20 C routines in Fortran is that the take an address-sized integer
21 C instead of a simple integer. These still are not pointers,
22 C so the values are still just integers.
25 call mtest_init( ierr )
26 call mpi_comm_dup( MPI_COMM_WORLD, comm1, ierr )
29 call mpi_comm_create_keyval( MPI_COMM_NULL_COPY_FN,
30 & MPI_COMM_NULL_DELETE_FN, keyval,
33 call mpi_comm_get_attr( comm1, keyval, valout, flag, ierr )
36 print *, ' get attr returned true when no attr set'
39 C Test the null copy function
41 call mpi_comm_set_attr( comm1, keyval, valin, ierr )
42 call mpi_comm_dup( comm1, comm2, ierr )
43 C Because we set NULL_COPY_FN, the attribute should not
44 C appear on the dup'ed communicator
46 call mpi_comm_get_attr( comm1, keyval, valout, flag, ierr )
47 if (valout .ne. 5001) then
49 print *, 'Unexpected output value in comm ', valout
52 call mpi_comm_get_attr( comm2, keyval, valout, flag, ierr )
55 print *, ' Attribute incorrectly present on dup communicator'
57 C Test the delete function
58 call mpi_comm_free( comm2, ierr )
60 C Test the attr delete function
61 call mpi_comm_dup( comm1, comm2, ierr )
64 call mpi_comm_set_attr( comm2, keyval, valin, ierr )
65 call mpi_comm_delete_attr( comm2, keyval, ierr )
67 call mpi_comm_get_attr( comm2, keyval, valout, flag, ierr )
70 print *, ' Delete_attr did not delete attribute'
72 call mpi_comm_free( comm2, ierr )
75 call mpi_comm_free_keyval( keyval, ierr )
76 if (ierr .ne. MPI_SUCCESS) then
78 call mtestprinterror( ierr )
80 call mpi_comm_free( comm1, ierr )
82 call mtest_finalize( errs )
83 call mpi_finalize( ierr )