void cfreekeys_(void) { MPI_Keyval_free( &ccomm1Key ); MPI_Comm_free_keyval( &ccomm2Key ); MPI_Type_free_keyval( &ctype2Key ); MPI_Win_free_keyval( &cwin2Key ); }
void ompi_win_free_keyval_f(MPI_Fint *win_keyval, MPI_Fint *ierr) { int c_ierr; OMPI_SINGLE_NAME_DECL(win_keyval); c_ierr = MPI_Win_free_keyval(OMPI_SINGLE_NAME_CONVERT(win_keyval)); if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); if (MPI_SUCCESS == c_ierr) { OMPI_SINGLE_INT_2_FINT(win_keyval); } }
int main(int argc, char *argv[]) { int comm_keyval, win_keyval, type_keyval; int comm_aval; int err, errs = 0; int buf, flag; MPI_Win win; void *rval; MPI_Datatype dtype; MTest_Init(&argc, &argv); MPI_Comm_create_keyval(MPI_COMM_NULL_COPY_FN, MPI_COMM_NULL_DELETE_FN, &comm_keyval, 0); MPI_Win_create_keyval(MPI_WIN_NULL_COPY_FN, MPI_WIN_NULL_DELETE_FN, &win_keyval, 0); MPI_Type_create_keyval(MPI_TYPE_NULL_COPY_FN, MPI_TYPE_NULL_DELETE_FN, &type_keyval, 0); MPI_Type_contiguous(4, MPI_DOUBLE, &dtype); MPI_Win_create(&buf, sizeof(int), sizeof(int), MPI_INFO_NULL, MPI_COMM_WORLD, &win); MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_RETURN); err = MPI_Comm_set_attr(MPI_COMM_WORLD, win_keyval, &comm_aval); if (err == MPI_SUCCESS) { errs++; fprintf(stderr, "Comm_set_attr accepted win keyval\n"); } err = MPI_Comm_set_attr(MPI_COMM_WORLD, type_keyval, &comm_aval); if (err == MPI_SUCCESS) { errs++; fprintf(stderr, "Comm_set_attr accepted type keyval\n"); } err = MPI_Type_set_attr(dtype, win_keyval, &comm_aval); if (err == MPI_SUCCESS) { errs++; fprintf(stderr, "Type_set_attr accepted win keyval\n"); } err = MPI_Type_set_attr(dtype, comm_keyval, &comm_aval); if (err == MPI_SUCCESS) { errs++; fprintf(stderr, "Comm_set_attr accepted type keyval\n"); } err = MPI_Win_set_attr(win, comm_keyval, &comm_aval); if (err == MPI_SUCCESS) { errs++; fprintf(stderr, "Win_set_attr accepted comm keyval\n"); } err = MPI_Win_set_attr(win, type_keyval, &comm_aval); if (err == MPI_SUCCESS) { errs++; fprintf(stderr, "Win_set_attr accepted type keyval\n"); } err = MPI_Comm_get_attr(MPI_COMM_WORLD, win_keyval, &rval, &flag); if (err == MPI_SUCCESS) { errs++; fprintf(stderr, "Comm_get_attr accepted win keyval\n"); } err = MPI_Comm_get_attr(MPI_COMM_WORLD, type_keyval, &rval, &flag); if (err == MPI_SUCCESS) { errs++; fprintf(stderr, "Comm_get_attr accepted type keyval\n"); } err = MPI_Comm_free_keyval(&win_keyval); if (err == MPI_SUCCESS) { errs++; fprintf(stderr, "Comm_free_keyval accepted win keyval\n"); } err = MPI_Comm_free_keyval(&type_keyval); if (err == MPI_SUCCESS) { errs++; fprintf(stderr, "Comm_free_keyval accepted type keyval\n"); } if (win_keyval != MPI_KEYVAL_INVALID) { err = MPI_Type_free_keyval(&win_keyval); if (err == MPI_SUCCESS) { errs++; fprintf(stderr, "Type_free_keyval accepted win keyval\n"); } } err = MPI_Type_free_keyval(&comm_keyval); if (err == MPI_SUCCESS) { errs++; fprintf(stderr, "Type_free_keyval accepted comm keyval\n"); } if (type_keyval != MPI_KEYVAL_INVALID) { err = MPI_Win_free_keyval(&type_keyval); if (err == MPI_SUCCESS) { errs++; fprintf(stderr, "Win_free_keyval accepted type keyval\n"); } } if (comm_keyval != MPI_KEYVAL_INVALID) { err = MPI_Win_free_keyval(&comm_keyval); if (err == MPI_SUCCESS) { errs++; fprintf(stderr, "Win_free_keyval accepted comm keyval\n"); } } /* Now, free for real */ if (comm_keyval != MPI_KEYVAL_INVALID) { err = MPI_Comm_free_keyval(&comm_keyval); if (err != MPI_SUCCESS) { errs++; fprintf(stderr, "Could not free comm keyval\n"); } } if (type_keyval != MPI_KEYVAL_INVALID) { err = MPI_Type_free_keyval(&type_keyval); if (err != MPI_SUCCESS) { errs++; fprintf(stderr, "Could not free type keyval\n"); } } if (win_keyval != MPI_KEYVAL_INVALID) { err = MPI_Win_free_keyval(&win_keyval); if (err != MPI_SUCCESS) { errs++; fprintf(stderr, "Could not free win keyval\n"); } } MPI_Win_free(&win); MPI_Type_free(&dtype); MTest_Finalize(errs); return MTestReturnValue(errs); }
/* * Class: mpi_Win * Method: freeKeyval_jni * Signature: (I)V */ JNIEXPORT void JNICALL Java_mpi_Win_freeKeyval_1jni( JNIEnv *env, jclass clazz, jint keyval) { int rc = MPI_Win_free_keyval((int*)(&keyval)); ompi_java_exceptionCheck(env, rc); }
static void MTestRMACleanup(void) { if (mem_keyval != MPI_KEYVAL_INVALID) { MPI_Win_free_keyval(&mem_keyval); } }