- value = 9;
- MPI_Keyval_create(copy_fn, delete_fn, &key_1, &value );
- value = 8;
- value = 7;
- MPI_Keyval_create(MPI_NULL_COPY_FN, MPI_NULL_DELETE_FN,
- &key_3, &value );
-
- /* This may generate a compilation warning; it is, however, an
- easy way to cache a value instead of a pointer */
- /* printf( "key1 = %x key3 = %x\n", key_1, key_3 ); */
- MPI_Attr_put(lo_comm, key_1, (void *) (MPI_Aint) world_rank );
- MPI_Attr_put(lo_comm, key_3, (void *)0 );
-
- MPI_Comm_dup(lo_comm, &dup_comm );
-
- /* Note that if sizeof(int) < sizeof(void *), we can't use
- (void **)&value to get the value we passed into Attr_put. To avoid
- problems (e.g., alignment errors), we recover the value into
- a (void *) and cast to int. Note that this may generate warning
- messages from the compiler. */
- MPI_Attr_get(dup_comm, key_1, (void **)&vvalue, &flag );
- value = (MPI_Aint)vvalue;
-
- if (! flag) {
- errs++;
- printf( "dup_comm key_1 not found on %d\n", world_rank );
- fflush( stdout );
- MPI_Abort(MPI_COMM_WORLD, 3004 );
- }
-
- if (value != world_rank) {
- errs++;
- printf( "dup_comm key_1 value incorrect: %ld, expected %d\n",
- (long)value, world_rank );
- fflush( stdout );
- MPI_Abort(MPI_COMM_WORLD, 3005 );
- }
-
- MPI_Attr_get(dup_comm, key_3, (void **)&vvalue, &flag );
- value = (MPI_Aint)vvalue;
- if (flag) {
- errs++;
- printf( "dup_comm key_3 found!\n" );
- fflush( stdout );
- MPI_Abort(MPI_COMM_WORLD, 3008 );
- }
- MPI_Keyval_free(&key_1 );
- MPI_Keyval_free(&key_3 );
+ value = 9;
+ MPI_Keyval_create(copy_fn, delete_fn, &key_1, &value);
+ value = 8;
+ value = 7;
+ MPI_Keyval_create(MPI_NULL_COPY_FN, MPI_NULL_DELETE_FN, &key_3, &value);
+
+ /* This may generate a compilation warning; it is, however, an
+ * easy way to cache a value instead of a pointer */
+ /* printf("key1 = %x key3 = %x\n", key_1, key_3); */
+ MPI_Attr_put(lo_comm, key_1, (void *) (MPI_Aint) world_rank);
+ MPI_Attr_put(lo_comm, key_3, (void *) 0);
+
+ MPI_Comm_dup(lo_comm, &dup_comm);
+
+ /* Note that if sizeof(int) < sizeof(void *), we can't use
+ * (void **)&value to get the value we passed into Attr_put. To avoid
+ * problems (e.g., alignment errors), we recover the value into
+ * a (void *) and cast to int. Note that this may generate warning
+ * messages from the compiler. */
+ MPI_Attr_get(dup_comm, key_1, (void **) &vvalue, &flag);
+ value = (MPI_Aint) vvalue;
+
+ if (!flag) {
+ errs++;
+ printf("dup_comm key_1 not found on %d\n", world_rank);
+ fflush(stdout);
+ MPI_Abort(MPI_COMM_WORLD, 3004);
+ }
+
+ if (value != world_rank) {
+ errs++;
+ printf("dup_comm key_1 value incorrect: %ld, expected %d\n", (long) value, world_rank);
+ fflush(stdout);
+ MPI_Abort(MPI_COMM_WORLD, 3005);
+ }
+
+ MPI_Attr_get(dup_comm, key_3, (void **) &vvalue, &flag);
+ value = (MPI_Aint) vvalue;
+ if (flag) {
+ errs++;
+ printf("dup_comm key_3 found!\n");
+ fflush(stdout);
+ MPI_Abort(MPI_COMM_WORLD, 3008);
+ }
+ MPI_Keyval_free(&key_1);
+ MPI_Keyval_free(&key_3);