• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ MTest_Finalize函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中MTest_Finalize函数的典型用法代码示例。如果您正苦于以下问题:C++ MTest_Finalize函数的具体用法?C++ MTest_Finalize怎么用?C++ MTest_Finalize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了MTest_Finalize函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char *argv[])
{
    int ierr, i, size, rank;
    int cnt = 270000000;
    int stat_cnt = 0;
    MPI_Status status;
    long long *cols;
    int errs = 0;


    MTest_Init(&argc, &argv);

/* need large memory */
    if (sizeof(void *) < 8) {
        MTest_Finalize(errs);
        return MTestReturnValue(errs);
    }

    ierr = MPI_Comm_size(MPI_COMM_WORLD, &size);
    ierr = MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    if (size != 3) {
        fprintf(stderr, "[%d] usage: mpiexec -n 3 %s\n", rank, argv[0]);
        MPI_Abort(MPI_COMM_WORLD, 1);
    }

    cols = malloc(cnt * sizeof(long long));
    if (cols == NULL) {
        printf("malloc of >2GB array failed\n");
        errs++;
        MTest_Finalize(errs);
        return MTestReturnValue(errs);
    }

    if (rank == 0) {
        for (i = 0; i < cnt; i++)
            cols[i] = i;
        /* printf("[%d] sending...\n",rank); */
        ierr = MPI_Send(cols, cnt, MPI_LONG_LONG_INT, 1, 0, MPI_COMM_WORLD);
        ierr = MPI_Send(cols, cnt, MPI_LONG_LONG_INT, 2, 0, MPI_COMM_WORLD);
    } else {
        /* printf("[%d] receiving...\n",rank); */
        for (i = 0; i < cnt; i++)
            cols[i] = -1;
        ierr = MPI_Recv(cols, cnt, MPI_LONG_LONG_INT, 0, 0, MPI_COMM_WORLD, &status);
        ierr = MPI_Get_count(&status, MPI_LONG_LONG_INT, &stat_cnt);
        if (cnt != stat_cnt) {
            fprintf(stderr, "Output of MPI_Get_count (%d) does not match expected count (%d).\n",
                    stat_cnt, cnt);
            errs++;
        }
        for (i = 0; i < cnt; i++) {
            if (cols[i] != i) {
                /*printf("Rank %d, cols[i]=%lld, should be %d\n", rank, cols[i], i); */
                errs++;
            }
        }
    }
    MTest_Finalize(errs);
    return MTestReturnValue(errs);
}
开发者ID:ParaStation,项目名称:psmpi2,代码行数:60,代码来源:large_message.c


示例2: main

int main(int argc, char *argv[])
{
    int rank, size;
    int i, j;
    long *sendbuf = NULL;
    long *recvbuf = NULL;

    MPI_Init(&argc, &argv);
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    MPI_Comm_size(MPI_COMM_WORLD, &size);

    sendbuf = malloc(COUNT * sizeof(long));
    if (sendbuf == NULL) {
        fprintf(stderr, "PE %d:ERROR: malloc of sendbuf failed\n", rank);
    }
    for (i = 0; i < COUNT; i++) {
        sendbuf[i] = (long) i + (long) rank *VERIFY_CONST;
    }

    if (rank == ROOT) {
        recvbuf = malloc(COUNT * sizeof(long) * size);
        if (recvbuf == NULL) {
            fprintf(stderr, "PE %d:ERROR: malloc of recvbuf failed\n", rank);
        }
        for (i = 0; i < COUNT * size; i++) {
            recvbuf[i] = -456789L;
        }
    }

    MPI_Gather(sendbuf, COUNT, MPI_LONG, recvbuf, COUNT, MPI_LONG, ROOT, MPI_COMM_WORLD);

    int lerr = 0;
    if (rank == ROOT) {
        for (i = 0; i < size; i++) {
            for (j = 0; j < COUNT; j++) {
                if (recvbuf[i * COUNT + j] != i * VERIFY_CONST + j) {
                    printf("PE 0: mis-match error");
                    printf("  recbuf[%d * %d + %d] = ", i, COUNT, j);
                    printf("  %ld,", recvbuf[i * COUNT + j]);
                    printf("  should be %ld\n", i * VERIFY_CONST + j);
                    lerr++;
                    if (lerr > 10) {
                        j = COUNT;
                    }
                }
            }
        }
        MTest_Finalize(lerr);
        free(recvbuf);
    }
    else {
        MTest_Finalize(lerr);
    }

    MPI_Barrier(MPI_COMM_WORLD);
    MPI_Finalize();

    free(sendbuf);
    return 0;
}
开发者ID:Niharikareddy,项目名称:mpich,代码行数:60,代码来源:gather_big.c


示例3: main

int main(int argc, char *argv[])
{
    MPI_Info i1, i2;
    int errs = 0;
    char value[64];
    int flag;

    MTest_Init(&argc, &argv);

    MPI_Info_create(&i1);
    MPI_Info_create(&i2);

    MPI_Info_set(i1, (char *) "key1", (char *) "value1");
    MPI_Info_set(i2, (char *) "key2", (char *) "value2");

    MPI_Info_get(i1, (char *) "key2", 64, value, &flag);
    if (flag) {
        printf("Found key2 in info1\n");
        errs++;
    }
    MPI_Info_get(i1, (char *) "key1", 64, value, &flag);
    if (!flag) {
        errs++;
        printf("Did not find key1 in info1\n");
    } else if (strcmp(value, "value1")) {
        errs++;
        printf("Found wrong value (%s), expected value1\n", value);
    }

    MPI_Info_free(&i1);
    MPI_Info_free(&i2);
    MTest_Finalize(errs);
    return MTestReturnValue(errs);
}
开发者ID:ParaStation,项目名称:psmpi2,代码行数:34,代码来源:infotest.c


示例4: main

int main(int argc, char **argv)
{
    int rank, nproc;
    int out_val, i, counter = 0;
    MPI_Win win;

    MTest_Init(&argc, &argv);

    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    MPI_Comm_size(MPI_COMM_WORLD, &nproc);

    MPI_Win_create(&counter, sizeof(int), sizeof(int), MPI_INFO_NULL, MPI_COMM_WORLD, &win);

    for (i = 0; i < NITER; i++) {
        MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, win);
        MPI_Get_accumulate(&acc_val, 1, MPI_INT, &out_val, 1, MPI_INT,
                           rank, 0, 1, MPI_INT, MPI_SUM, win);
        MPI_Win_unlock(rank, win);

        if (out_val != acc_val * i) {
            errs++;
            printf("Error: got %d, expected %d at iter %d\n", out_val, acc_val * i, i);
            break;
        }
    }

    MPI_Win_free(&win);

    MTest_Finalize(errs);

    return MTestReturnValue(errs);
}
开发者ID:jeffhammond,项目名称:mpich,代码行数:32,代码来源:get_acc_local.c


示例5: main

int main( int argc, char **argv )
{
    int              rank, size, i;
    int              data;
    int              errors=0;
    int              result = -100;
    int              correct_result;
    MPI_Op           op;

    MTest_Init( &argc, &argv );
    MPI_Comm_rank( MPI_COMM_WORLD, &rank );
    MPI_Comm_size( MPI_COMM_WORLD, &size );

    data = rank;
    MPI_Op_create( (MPI_User_function *)addem, 1, &op );
    MPI_Reduce ( &data, &result, 1, MPI_INT, op, 0, MPI_COMM_WORLD );
    MPI_Bcast  ( &result, 1, MPI_INT, 0, MPI_COMM_WORLD );
    MPI_Op_free( &op );
    correct_result = 0;
    for(i=0;i<size;i++) 
      correct_result += i;
    if (result != correct_result) errors++;

    MTest_Finalize( errors );
    MPI_Finalize();
    return MTestReturnValue( errors );
}
开发者ID:Julio-Anjos,项目名称:simgrid,代码行数:27,代码来源:coll9.c


示例6: main

int main(int argc, char *argv[])
{
    int errs = 0, err;
    int j, count;
    char *ap;

    MTest_Init(&argc, &argv);

    MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
    for (count = 1; count < 128000; count *= 2) {

        err = MPI_Alloc_mem(count, MPI_INFO_NULL, &ap);
        if (err) {
            int errclass;
            /* An error of  MPI_ERR_NO_MEM is allowed */
            MPI_Error_class(err, &errclass);
            if (errclass != MPI_ERR_NO_MEM) {
                errs++;
                MTestPrintError(err);
            }

        } else {
            /* Access all of this memory */
            for (j = 0; j < count; j++) {
                ap[j] = (char) (j & 0x7f);
            }
            MPI_Free_mem(ap);
        }
    }

    MTest_Finalize(errs);
    return MTestReturnValue(errs);
}
开发者ID:ParaStation,项目名称:psmpi2,代码行数:33,代码来源:allocmem.c


示例7: main

int main(int argc, char *argv[])
{
    int rank, nprocs, A[SIZE2], B[SIZE2], i;
    MPI_Win win;
    int errs = 0;

    MTest_Init(&argc,&argv);
    MPI_Comm_size(MPI_COMM_WORLD,&nprocs);
    MPI_Comm_rank(MPI_COMM_WORLD,&rank);

    if (nprocs != 2) {
        printf("Run this program with 2 processes\n");
        MPI_Abort(MPI_COMM_WORLD,1);
    }

    if (rank == 0) {
        for (i=0; i<SIZE2; i++) A[i] = B[i] = i;
        MPI_Win_create(NULL, 0, 1, MPI_INFO_NULL, MPI_COMM_WORLD, &win);

        for (i=0; i<SIZE1; i++) {
            MPI_Win_lock(MPI_LOCK_SHARED, 1, 0, win);
            MPI_Put(A+i, 1, MPI_INT, 1, i, 1, MPI_INT, win);
            MPI_Win_unlock(1, win);
        }

        for (i=0; i<SIZE1; i++) {
            MPI_Win_lock(MPI_LOCK_SHARED, 1, 0, win);
            MPI_Get(B+i, 1, MPI_INT, 1, SIZE1+i, 1, MPI_INT, win);
            MPI_Win_unlock(1, win);
        }

        MPI_Win_free(&win);

        for (i=0; i<SIZE1; i++)
            if (B[i] != (-4)*(i+SIZE1)) {
                printf("Get Error: B[%d] is %d, should be %d\n", i, B[i], (-4)*(i+SIZE1));
                errs++;
            }
    }

    else {  /* rank=1 */
        for (i=0; i<SIZE2; i++) B[i] = (-4)*i;
        MPI_Win_create(B, SIZE2*sizeof(int), sizeof(int), MPI_INFO_NULL,
                       MPI_COMM_WORLD, &win);

        MPI_Win_free(&win);

        for (i=0; i<SIZE1; i++) {
            if (B[i] != i) {
                printf("Put Error: B[%d] is %d, should be %d\n", i, B[i], i);
                errs++;
            }
        }
    }

    /*    if (rank==0) printf("Done\n");*/
    MTest_Finalize(errs);
    MPI_Finalize();
    return 0;
}
开发者ID:huangjun-pg,项目名称:mpich2-yarn,代码行数:60,代码来源:test4.c


示例8: main

int main( int argc, char *argv[] )
{
    int buf[2];
    MPI_Win        win;
    MPI_Errhandler newerr;
    int            i;

    MTest_Init( &argc, &argv );

    /* Run this test multiple times to expose storage leaks (we found a leak
       of error handlers with this test) */
    for (i=0;i<1000; i++)  {
	calls = 0;
	
	MPI_Win_create( buf, 2*sizeof(int), sizeof(int), 
			MPI_INFO_NULL, MPI_COMM_WORLD, &win );
	mywin = win;
	
	MPI_Win_create_errhandler( eh, &newerr );
	
	MPI_Win_set_errhandler( win, newerr );
	MPI_Win_call_errhandler( win, MPI_ERR_OTHER );
	MPI_Errhandler_free( &newerr );
	if (calls != 1) {
	    errs++;
	    printf( "Error handler not called\n" );
	}
	MPI_Win_free( &win );
    }

    MTest_Finalize( errs );
    MPI_Finalize();
    return 0;
}
开发者ID:OngOngoing,项目名称:219351_homework,代码行数:34,代码来源:wincall.c


示例9: main

int main(int argc, char **argv)
{
    MPI_Group basegroup;
    MPI_Group g1;
    MPI_Comm comm, newcomm;
    int rank, size;
    int worldrank;
    int errs = 0, errclass, mpi_errno;

    MTest_Init(&argc, &argv);
    MPI_Comm_rank(MPI_COMM_WORLD, &worldrank);
    comm = MPI_COMM_WORLD;
    MPI_Comm_group(comm, &basegroup);
    MPI_Comm_rank(comm, &rank);
    MPI_Comm_size(comm, &size);
    MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_RETURN);

    MPI_Comm_split(comm, 0, size - rank, &newcomm);
    MPI_Comm_group(newcomm, &g1);

    /* Checking group_intersection for NULL variable */
    mpi_errno = MPI_Group_intersection(basegroup, g1, NULL);
    MPI_Error_class(mpi_errno, &errclass);
    if (errclass != MPI_ERR_ARG)
        ++errs;

    MPI_Comm_free(&comm);
    MPI_Comm_free(&newcomm);
    MPI_Group_free(&basegroup);
    MPI_Group_free(&g1);
    MTest_Finalize(errs);
    return 0;
}
开发者ID:ParaStation,项目名称:psmpi2,代码行数:33,代码来源:group_intersection_nullarg.c


示例10: main

int main(int argc, char **argv)
{
    int err, errs = 0;

    MTest_Init(&argc, &argv);
    parse_args(argc, argv);

    /* To improve reporting of problems about operations, we
     * change the error handler to errors return */
    MPI_Comm_set_errhandler(MPI_COMM_WORLD, MPI_ERRORS_RETURN);

    /* perform some tests */
    err = darray_2d_c_test1();
    if (err && verbose)
        fprintf(stderr, "%d errors in 2d darray c test 1.\n", err);
    errs += err;

    err = darray_4d_c_test1();
    if (err && verbose)
        fprintf(stderr, "%d errors in 4d darray c test 1.\n", err);
    errs += err;

    /* print message and exit */
    /* Allow the use of more than one process - some MPI implementations
     * (including IBM's) check that the number of processes given to
     * Type_create_darray is no larger than MPI_COMM_WORLD */

    MTest_Finalize(errs);
    MPI_Finalize();
    return 0;
}
开发者ID:NexMirror,项目名称:MPICH,代码行数:31,代码来源:darray-pack.c


示例11: main

int main(int argc, char *argv[])
{
    int errs = 0, err;
    int dims[2];
    int periods[2];
    int size, rank;
    MPI_Comm comm;

    MTest_Init(&argc, &argv);

    MPI_Comm_size(MPI_COMM_WORLD, &size);
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);

    dims[0] = size;
    dims[1] = size;
    periods[0] = 0;
    periods[1] = 0;

    MPI_Comm_set_errhandler(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
    err = MPI_Cart_create(MPI_COMM_WORLD, 2, dims, periods, 0, &comm);
    if (err == MPI_SUCCESS) {
        errs++;
        printf("Cart_create returned success when dims > size\n");
    } else if (comm != MPI_COMM_NULL) {
        errs++;
        printf("Expected a null comm from cart create\n");
    }

    MTest_Finalize(errs);


    return MTestReturnValue(errs);
}
开发者ID:ParaStation,项目名称:psmpi2,代码行数:33,代码来源:cartsmall.c


示例12: main

int main( int argc, char **argv )
{
    int              rank, size, i;
    int              data;
    int              errors=0;
    int              result = -100;
    int              correct_result;

    MTest_Init( &argc, &argv );
    MPI_Comm_rank( MPI_COMM_WORLD, &rank );
    MPI_Comm_size( MPI_COMM_WORLD, &size );

    data = rank;

    MPI_Reduce ( &data, &result, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD );
    MPI_Bcast  ( &result, 1, MPI_INT, 0, MPI_COMM_WORLD );
    correct_result = 0;
    for(i=0;i<size;i++) 
      correct_result += i;
    if (result != correct_result) errors++;

    MPI_Reduce ( &data, &result, 1, MPI_INT, MPI_MIN, 0, MPI_COMM_WORLD );
    MPI_Bcast  ( &result, 1, MPI_INT, 0, MPI_COMM_WORLD );
    if (result != 0) errors++;

    MPI_Reduce ( &data, &result, 1, MPI_INT, MPI_MAX, 0, MPI_COMM_WORLD );
    MPI_Bcast  ( &result, 1, MPI_INT, 0, MPI_COMM_WORLD );
    if (result != (size-1)) errors++;

    MTest_Finalize( errors );
    MPI_Finalize();
    return MTestReturnValue( errors );
}
开发者ID:Julio-Anjos,项目名称:simgrid,代码行数:33,代码来源:coll8.c


示例13: main

int main(int argc, char *argv[])
{
    MPI_Win win;
    int flag, tmp, rank;
    int base[1024], errs = 0;
    MPI_Request req;

    MTest_Init(&argc, &argv);
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);

    MPI_Win_create(base, 1024 * sizeof(int), sizeof(int), MPI_INFO_NULL, MPI_COMM_WORLD, &win);

    if (rank == 0) {
        MPI_Win_lock(MPI_LOCK_EXCLUSIVE, 0, 0, win);
        MPI_Barrier(MPI_COMM_WORLD);
        MPI_Barrier(MPI_COMM_WORLD);
        MPI_Win_unlock(0, win);
    } else {
        MPI_Barrier(MPI_COMM_WORLD);
        MPI_Win_lock(MPI_LOCK_EXCLUSIVE, 0, 0, win);
        MPI_Rput(&tmp, 1, MPI_INT, 0, 0, 1, MPI_INT, win, &req);
        MPI_Test(&req, &flag, MPI_STATUS_IGNORE);
        MPI_Barrier(MPI_COMM_WORLD);
        MPI_Win_unlock(0, win);
    }

    MPI_Win_free(&win);

    MTest_Finalize(errs);
    return MTestReturnValue(errs);
}
开发者ID:jeffhammond,项目名称:mpich,代码行数:31,代码来源:nb_test.c


示例14: main

int main(int argc, char *argv[])
{
    int wrank, wsize, rank, size, color;
    int tmp;
    MPI_Comm newcomm;

    MTest_Init(&argc, &argv);

    MPI_Comm_size(MPI_COMM_WORLD, &wsize);
    MPI_Comm_rank(MPI_COMM_WORLD, &wrank);

    /* Color is 0 or 1; 1 will be the processes that "fault" */
    color = (wrank > 0) && (wrank <= wsize / 2);
    MPI_Comm_split(MPI_COMM_WORLD, color, wrank, &newcomm);

    MPI_Barrier(MPI_COMM_WORLD);
    if (color) {
        /* Simulate a fault on some processes */
        exit(1);
    }

    /* Can we still use newcomm? */
    MPI_Comm_size(newcomm, &size);
    MPI_Comm_rank(newcomm, &rank);

    MPI_Allreduce(&rank, &tmp, 1, MPI_INT, MPI_SUM, newcomm);
    if (tmp != (size * (size + 1)) / 2) {
        printf("Allreduce gave %d but expected %d\n", tmp, (size * (size + 1)) / 2);
    }

    MPI_Comm_free(&newcomm);
    MTest_Finalize(0);

    return 0;
}
开发者ID:ParaStation,项目名称:psmpi2,代码行数:35,代码来源:collf1.c


示例15: main

int main(int argc, char *argv[])
{
    int errs = 0;
    MPI_Win win;
    int cnt, namelen;
    char name[MPI_MAX_OBJECT_NAME], nameout[MPI_MAX_OBJECT_NAME];

    MTest_Init(&argc, &argv);

    cnt = 0;
    while (MTestGetWin(&win, 1)) {
        if (win == MPI_WIN_NULL)
            continue;

        sprintf(name, "win-%d", cnt);
        cnt++;
        MPI_Win_set_name(win, name);
        nameout[0] = 0;
        MPI_Win_get_name(win, nameout, &namelen);
        if (strcmp(name, nameout)) {
            errs++;
            printf("Unexpected name, was %s but should be %s\n", nameout, name);
        }

        MTestFreeWin(&win);
    }

    MTest_Finalize(errs);
    return MTestReturnValue(errs);
}
开发者ID:jeffhammond,项目名称:mpich,代码行数:30,代码来源:winname.c


示例16: main

int main(int argc, char* argv[])
{
    MPI_Comm comm, newcomm, scomm;
    MPI_Group group;
    MPI_Info newinfo;
    int rank, size, color;
    int errs = 0, errclass, mpi_errno;

    MTest_Init(&argc, &argv);

    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    MPI_Comm_size(MPI_COMM_WORLD, &size);
    MPI_Comm_dup(MPI_COMM_WORLD, &comm);
    MPI_Comm_group(comm, &group);

    MPI_Comm_create(comm, group, &newcomm);
    color = rank % 2;
    MPI_Comm_split(MPI_COMM_WORLD, color, rank, &scomm);
    MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_RETURN);

    /*test comm_split_type for NULL variable */
    mpi_errno = MPI_Comm_split_type(scomm, 2, 4, newinfo, NULL);
    MPI_Error_class(mpi_errno, &errclass);
    if (errclass != MPI_ERR_ARG)
        ++errs;

    MPI_Comm_free(&comm);
    MPI_Comm_free(&newcomm);
    MPI_Comm_free(&scomm);
    MPI_Group_free(&group);
    MTest_Finalize(errs);
    MPI_Finalize();
    return 0;
}
开发者ID:NexMirror,项目名称:MPICH,代码行数:34,代码来源:comm_split_type_nullarg.c


示例17: main

int main( int argc, char *argv[] )
{
    int errs = 0;
    int topo_type, size, dims[1], periods[1];
    MPI_Comm comm;

    MTest_Init( &argc, &argv );

    /* Check that topo test returns the correct type, including 
       MPI_UNDEFINED */

    MPI_Topo_test( MPI_COMM_WORLD, &topo_type );
    if (topo_type != MPI_UNDEFINED) {
	errs++;
	printf( "Topo type of comm world is not UNDEFINED\n" );
    }

    MPI_Comm_size( MPI_COMM_WORLD, &size );
    dims[0] = size;
    periods[0] = 0;
    MPI_Cart_create( MPI_COMM_WORLD, 1, dims, periods, 0, &comm );
    MPI_Topo_test( comm, &topo_type );
    if (topo_type != MPI_CART) {
	errs++;
	printf( "Topo type of cart comm is not CART\n" );
    }

    MPI_Comm_free( &comm );
    /* FIXME: still need graph example */

    MTest_Finalize( errs );
    MPI_Finalize();
    return 0;
  
}
开发者ID:OngOngoing,项目名称:219351_homework,代码行数:35,代码来源:topotest.c


示例18: main

int main(int argc, char **argv)
{
    int thread_args[NUM_THREADS];
    int i, provided;
    int errs = 0;

    MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided);

    check(provided == MPI_THREAD_MULTIPLE);

    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    MPI_Comm_size(MPI_COMM_WORLD, &size);

    for (i = 0; i < NUM_THREADS; i++) {
        MPI_Comm_dup(MPI_COMM_WORLD, &comms[i]);
    }

    for (i = 0; i < NUM_THREADS; i++) {
        thread_args[i] = i;
        MTest_Start_thread(test_iallred, (void *) &thread_args[i]);
    }

    errs = MTest_Join_threads();

    for (i = 0; i < NUM_THREADS; i++) {
        MPI_Comm_free(&comms[i]);
    }

    MTest_Finalize(errs);
    MPI_Finalize();

    return 0;
}
开发者ID:NexMirror,项目名称:MPICH,代码行数:33,代码来源:allred.c


示例19: main

int main(int argc, char *argv[])
{
    int nprocs, i, pmode;
    char *win_buf;

    MTest_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &pmode);
    if (pmode != MPI_THREAD_MULTIPLE) {
	fprintf(stderr, "Thread Multiple not supported by the MPI implementation\n");
        MPI_Abort(MPI_COMM_WORLD, -1);
    }

    MPI_Comm_size(MPI_COMM_WORLD, &nprocs);

    if (nprocs < 2) {
        printf("Run this program with 2 or more processes\n");
        MPI_Abort(MPI_COMM_WORLD, 1);
    }

    errs += MPI_Win_allocate(COUNT * sizeof(int), sizeof(int), MPI_INFO_NULL, MPI_COMM_WORLD, &win_buf, &win);
    errs += MPI_Win_lock_all(0, win);

    for (i = 0; i < NUM_THREADS; i++)
        errs += MTest_Start_thread(run_test, NULL);
    errs += MTest_Join_threads();

    errs += MPI_Win_unlock_all(win);

    errs += MPI_Win_free(&win);

    MTest_Finalize(errs);
    MPI_Finalize();

    return 0;
}
开发者ID:adevress,项目名称:MPICH-BlueGene,代码行数:34,代码来源:multirma.c


示例20: main

int main( int argc, char *argv[] )
{
    int rank, size;
    int provided;
    char buffer[100];
    MPI_Status status;

    MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided);

    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    MPI_Comm_size(MPI_COMM_WORLD, &size);

    if (provided != MPI_THREAD_MULTIPLE)
    {
	if (rank == 0)
	{
	    printf("MPI_Init_thread must return MPI_THREAD_MULTIPLE in order for this test to run.\n");
	    fflush(stdout);
	}
	MPI_Finalize();
	return -1;
    }

    MTest_Start_thread(send_thread, NULL);

    MPI_Probe(MPI_ANY_SOURCE,MPI_ANY_TAG,MPI_COMM_WORLD,&status);

    MPI_Recv(buffer, sizeof(buffer), MPI_CHAR, rank, 0, MPI_COMM_WORLD, &status);

    MTest_Join_threads();

    MTest_Finalize(0);
    MPI_Finalize();
    return 0;
}
开发者ID:abhinavvishnu,项目名称:matex,代码行数:35,代码来源:sendselfth.c



注:本文中的MTest_Finalize函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MTest_Init函数代码示例发布时间:2022-05-30
下一篇:
C++ MTestPrintError函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap