Subversion Repositories programming

Rev

Rev 325 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 325 Rev 326
Line 109... Line 109...
109
    /* Get all of the necessary info for each process */
109
    /* Get all of the necessary info for each process */
110
    MPI_Init (&argc, &argv);
110
    MPI_Init (&argc, &argv);
111
    MPI_Comm_rank (MPI_COMM_WORLD, &myid);
111
    MPI_Comm_rank (MPI_COMM_WORLD, &myid);
112
    MPI_Comm_size (MPI_COMM_WORLD, &numprocs);
112
    MPI_Comm_size (MPI_COMM_WORLD, &numprocs);
113
 
113
 
-
 
114
    /* Do a quick sanity check for the correct number of processors */
-
 
115
    if (n % numprocs != 0)
-
 
116
    {
-
 
117
        if (myid == 0)
-
 
118
        {
-
 
119
            printf ("%d mod %d must be zero!\n", n, numprocs);
-
 
120
            printf ("You should probably change the -np parameter\n");
-
 
121
        }
-
 
122
 
-
 
123
        MPI_Finalize ();
-
 
124
        return 1;
-
 
125
    }
-
 
126
 
114
    /* Allocate all of b for each process, since we'll need it */
127
    /* Allocate all of b for each process, since we'll need it */
115
    b = allocate (n, n);
128
    b = allocate (n, n);
116
 
129
 
117
    if (myid == ROOT_NODE)
130
    if (myid == ROOT_NODE)
118
    {
131
    {