Changeset 2365 in /cluster/svnroot


Ignore:
Timestamp:
Apr 22, 2010 6:13:10 PM (11 years ago)
Author:
fitz
Message:

Adding possible OpenMP (#502)

Location:
bccd-ng/branches/fitz-devel/trees/home/bccd/Life
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • bccd-ng/branches/fitz-devel/trees/home/bccd/Life/Life.c

    r2364 r2365  
    2626
    2727        // Set up MPI
     28        #ifdef MPI
    2829        MPI_Init(&argc,&argv);
    2930        MPI_Comm_rank(MPI_COMM_WORLD,&rank);
    3031        MPI_Comm_size(MPI_COMM_WORLD,&size);
     32        #endif
    3133
    3234        random_initByTime(rank);
     
    8082                free_video();
    8183
     84        #ifdef MPI
    8285        MPI_Finalize();
     86        #endif
    8387}
  • bccd-ng/branches/fitz-devel/trees/home/bccd/Life/Life.h

    r2364 r2365  
    77////////////////////////////////////////////
    88
     9#ifdef MPI
    910#include <mpi.h>
     11#endif
    1012#include <time.h>     // For seeding random
    1113#include <stdio.h>    // For sscanf
     
    2224                int ** next_grid) {
    2325        int i,j,k,l,neighbors;
     26        int omp_rank;
     27        #ifdef MPI
    2428        MPI_Status status;
     29        #endif
    2530
    2631        // side by side grid
     
    3439        int right_rank = (rank+1)%size;
    3540
     41        #ifdef MPI
    3642        // If we're only 1, no need to do the communication
    3743        if (size != 1) {
     
    4854                                MPI_COMM_WORLD, &status);
    4955        }
     56        #endif
    5057
    5158        // copy corners
     
    6269
    6370        // update
     71        #pragma omp parallel for private(neighbors)
    6472        for (i=1;i<=ncols;i++) {
    6573                for (j=1;j<=nrows;j++) {
  • bccd-ng/branches/fitz-devel/trees/home/bccd/Life/Makefile

    r2364 r2365  
    11
    2 CC        = mpicc
     2#CC        = mpicc
     3CC        = gcc
    34
    45#
     
    910
    1011
    11 CFLAGS    =
     12CFLAGS    = -fopenmp
    1213LDFLAGS   = -L/usr/X11R6/lib $(LIBS)
    1314
Note: See TracChangeset for help on using the changeset viewer.