1 C -*- Mode: Fortran; -*-
3 C (C) 2003 by Argonne National Laboratory.
4 C See COPYRIGHT in top-level directory.
5 C This is a modified version of typeattrf.f that uses two of the
17 C The only difference between the MPI-2 and MPI-1 attribute caching
18 C routines in Fortran is that the take an address-sized integer
19 C instead of a simple integer. These still are not pointers,
20 C so the values are still just integers.
23 call mtest_init( ierr )
27 call mpi_type_create_keyval( MPI_TYPE_DUP_FN,
28 & MPI_TYPE_NULL_DELETE_FN, keyval,
31 call mpi_type_get_attr( type1, keyval, valout, flag, ierr )
34 print *, ' get attr returned true when no attr set'
38 call mpi_type_set_attr( type1, keyval, valin, ierr )
41 call mpi_type_get_attr( type1, keyval, valout, flag, ierr )
42 if (valout .ne. 2003) then
44 print *, 'Unexpected value (should be 2003)', valout,
49 call mpi_type_set_attr( type1, keyval, valin, ierr )
52 call mpi_type_get_attr( type1, keyval, valout, flag, ierr )
53 if (valout .ne. 2001) then
55 print *, 'Unexpected value (should be 2001)', valout,
60 C Test the copy function
62 call mpi_type_set_attr( type1, keyval, valin, ierr )
63 call mpi_type_dup( type1, type2, ierr )
65 call mpi_type_get_attr( type1, keyval, valout, flag, ierr )
66 if (valout .ne. 5001) then
68 print *, 'Unexpected output value in type ', valout
71 call mpi_type_get_attr( type2, keyval, valout, flag, ierr )
72 if (valout .ne. 5001) then
74 print *, 'Unexpected output value in type2 ', valout
76 C Test the delete function
77 call mpi_type_free( type2, ierr )
79 C Test the attr delete function
80 call mpi_type_dup( type1, type2, ierr )
83 call mpi_type_set_attr( type2, keyval, valin, ierr )
84 call mpi_type_delete_attr( type2, keyval, ierr )
86 call mpi_type_get_attr( type2, keyval, valout, flag, ierr )
89 print *, ' Delete_attr did not delete attribute'
91 call mpi_type_free( type2, ierr )
94 call mpi_type_free_keyval( keyval, ierr )
95 if (ierr .ne. MPI_SUCCESS) then
97 call mtestprinterror( ierr )
100 call mtest_finalize( errs )
101 call mpi_finalize( ierr )