Ejemplo n.º 1
0
int chkckeyvals_( int *comm_keyval, int *type_keyval, int *win_keyval )
{
    MPI_Comm_create_keyval( myCommCopyfn, myCommDelfn, comm_keyval, 0 );
    MPI_Type_create_keyval( myTypeCopyfn, myTypeDelfn, type_keyval, 0 );
    MPI_Win_create_keyval( myWinCopyfn, myWinDelfn, win_keyval, 0 );
    return 0;
}
Ejemplo n.º 2
0
FORT_DLL_SPEC void FORT_CALL mpi_type_create_keyval_ ( MPI_Type_copy_attr_function*v1, MPI_Type_delete_attr_function*v2, MPI_Fint *v3, void*v4, MPI_Fint *ierr ){
    *ierr = MPI_Type_create_keyval( v1, v2, v3, v4 );

    if (*ierr == MPI_SUCCESS) {
         MPIR_Keyval_set_proxy( (int)*v3, MPIR_Type_copy_attr_f90_proxy, MPIR_Type_delete_attr_f90_proxy );
    }
}
Ejemplo n.º 3
0
JNIEXPORT jint JNICALL Java_mpi_Datatype_createKeyval_1jni(
                       JNIEnv *env, jclass clazz)
{
    int rc, keyval;
    rc = MPI_Type_create_keyval(typeCopyAttr, typeDeleteAttr, &keyval, NULL);
    ompi_java_exceptionCheck(env, rc);
    return keyval;
}
Ejemplo n.º 4
0
int main( int argc, char *argv[] )
{
    int errs = 0;
    int attrval;
    int i, key[32], keyval, saveKeyval;
    MPI_Datatype type, duptype;
    MTestDatatype mstype, mrtype;
    char typename[MPI_MAX_OBJECT_NAME];
    int tnlen;

    MTest_Init( &argc, &argv );

    while (MTestGetDatatypes( &mstype, &mrtype, 1 )) {
        type = mstype.datatype;
        MPI_Type_create_keyval( copy_fn, delete_fn, &keyval, (void *)0 );
        saveKeyval = keyval;   /* in case we need to free explicitly */
        attrval = 1;
        MPI_Type_set_attr( type, keyval, (void*)&attrval );
        /* See MPI-1, 5.7.1.  Freeing the keyval does not remove it if it
           is in use in an attribute */
        MPI_Type_free_keyval( &keyval );

        /* We create some dummy keyvals here in case the same keyval
           is reused */
        for (i=0; i<32; i++) {
            MPI_Type_create_keyval( MPI_NULL_COPY_FN, MPI_NULL_DELETE_FN,
                                    &key[i], (void *)0 );
        }

        if (attrval != 1) {
            errs++;
            MPI_Type_get_name( type, typename, &tnlen );
            printf( "attrval is %d, should be 1, before dup in type %s\n",
                    attrval, typename );
        }
        MPI_Type_dup( type, &duptype );
        /* Check that the attribute was copied */
        if (attrval != 2) {
            errs++;
            MPI_Type_get_name( type, typename, &tnlen );
            printf( "Attribute not incremented when type dup'ed (%s)\n",
                    typename );
        }
Ejemplo n.º 5
0
int foo_initialize(void)
{
    int mpi_errno;

    /* create keyval for use later */
    mpi_errno = MPI_Type_create_keyval(foo_copy_attr_function,
                                       foo_delete_attr_function, &foo_keyval, NULL);
    if (verbose)
        printf("created keyval\n");

    return 0;
}
Ejemplo n.º 6
0
void ccreatekeys_( MPI_Fint *ccomm1_key, MPI_Fint *ccomm2_key, 
		   MPI_Fint *ctype2_key, MPI_Fint *cwin2_key )
{
    MPI_Keyval_create( CMPI1_COPY_FN, CMPI1_DELETE_FN, &ccomm1Key, 
		       &ccomm1Extra );
    *ccomm1_key = (MPI_Fint)ccomm1Key;
    
    MPI_Comm_create_keyval( CMPI1_COPY_FN, CMPI1_DELETE_FN, &ccomm2Key, 
			    &ccomm2Extra );
    *ccomm2_key = (MPI_Fint)ccomm2Key;

    MPI_Type_create_keyval( TYPE_COPY_FN, TYPE_DELETE_FN, &ctype2Key,
			     &ctype2Extra );
    *ctype2_key = (MPI_Fint)ctype2Key;

    MPI_Win_create_keyval( WIN_COPY_FN, WIN_DELETE_FN, &cwin2Key, 
			   &cwin2Extra );
    *cwin2_key = (MPI_Fint)cwin2Key;
}
Ejemplo n.º 7
0
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);
}
Ejemplo n.º 8
0
int main( int argc, char *argv[] )
{
    int errs = 0;
    int key[3], attrval[3];
    int i;
    MPI_Datatype type;

    MTest_Init( &argc, &argv );

    {
	type = MPI_INT;
	/* Create key values */
	for (i=0; i<3; i++) {
	    MPI_Type_create_keyval( MPI_NULL_COPY_FN, MPI_NULL_DELETE_FN,
			       &key[i], (void *)0 );
	    attrval[i] = 1024 * i;
	}
	
	/* Insert attribute in several orders.  Test after put with get,
	 then delete, then confirm delete with get. */

	MPI_Type_set_attr( type, key[2], &attrval[2] );
	MPI_Type_set_attr( type, key[1], &attrval[1] );
	MPI_Type_set_attr( type, key[0], &attrval[0] );

	errs += checkAttrs( type, 3, key, attrval );
	
	MPI_Type_delete_attr( type, key[0] );
	MPI_Type_delete_attr( type, key[1] );
	MPI_Type_delete_attr( type, key[2] );

	errs += checkNoAttrs( type, 3, key );
	
	MPI_Type_set_attr( type, key[1], &attrval[1] );
	MPI_Type_set_attr( type, key[2], &attrval[2] );
	MPI_Type_set_attr( type, key[0], &attrval[0] );

	errs += checkAttrs( type, 3, key, attrval );
	
	MPI_Type_delete_attr( type, key[2] );
	MPI_Type_delete_attr( type, key[1] );
	MPI_Type_delete_attr( type, key[0] );

	errs += checkNoAttrs( type, 3, key );

	MPI_Type_set_attr( type, key[0], &attrval[0] );
	MPI_Type_set_attr( type, key[1], &attrval[1] );
	MPI_Type_set_attr( type, key[2], &attrval[2] );

	errs += checkAttrs( type, 3, key, attrval );
	
	MPI_Type_delete_attr( type, key[1] );
	MPI_Type_delete_attr( type, key[2] );
	MPI_Type_delete_attr( type, key[0] );

	errs += checkNoAttrs( type, 3, key );
	
	for (i=0; i<3; i++) {
	    MPI_Type_free_keyval( &key[i] );
	}
    }
    
    MTest_Finalize( errs );
    MPI_Finalize();
    return 0;
  
}