[gmx-developers] rvec structure

Nathan Moore nmoore at physics.umn.edu
Thu Jul 7 23:20:54 CEST 2005


Fellows,

Allright, I pulled the 1.8 version of mvxvf off of CVS, and copied teh
guts of move_x and move_f into the 3.2 version of mvxvf.c with the
following substitutions:
        replace "nsb->nprocs" with "nsb->nnodes"
        replace "nsb->pid" with "nsb->nodeid"
        include mpi.h library

Source is below.

At present the code still core dumps because of a segmentation fault in
the do_pbc_first->mk_mshift->mk_grey function chain.

Any idea why this is?  I've changed nothing excepte the source file below.

thanks again for all your help,

Nathan


from mvxvf.c:

#define TEST_MPI_X

/* NTM changes:
        replace "nsb->nprocs" with "nsb->nnodes"
        replace "nsb->pid" with "nsb->nodeid"
        include mpi.h library
*/
#ifdef TEST_MPI_X
#include <mpi.h>
#endif
void move_x(FILE * log,
            int left, int right, rvec x[], t_nsborder * nsb, t_nrnb * nrnb)
{
#ifdef TEST_MPI_X
    static int *recvcounts = NULL, *displs;
    int i;

    if (recvcounts == NULL) {
        snew(recvcounts, nsb->nnodes);
        snew(displs, nsb->nnodes);
        for (i = 0; i < nsb->nnodes; i++) {
            recvcounts[i] = nsb->homenr[i] * sizeof(x[0]);
            displs[i] = nsb->index[i] * sizeof(x[0]);
        }
    }
    MPI_Allgatherv(arrayp(x[nsb->index[nsb->nodeid]],
nsb->homenr[nsb->nodeid]),
                   MPI_BYTE, x, recvcounts, displs, MPI_BYTE,
                   MPI_COMM_WORLD);
#else

    move_rvecs(log, FALSE, FALSE, left, right, x, NULL, nsb->shift, nsb,
               nrnb);
    move_rvecs(log, TRUE, FALSE, left, right, x, NULL, nsb->bshift, nsb,
               nrnb);
#endif

    where();
}

void move_f(FILE * log,
            int left, int right, rvec f[], rvec fadd[],
            t_nsborder * nsb, t_nrnb * nrnb)
{

#ifdef MPI_TEST_F
#ifdef DOUBLE
#define mpi_type MPI_DOUBLE
#else
#define mpi_type MPI_FLOAT
#endif
  MPI_Allreduce(f,f,nsb->natoms*DIM,mpi_type,MPI_SUM,MPI_COMM_WORLD);

#else
    move_rvecs(log, TRUE, TRUE, left, right, f, fadd, nsb->shift, nsb,
               nrnb);
    move_rvecs(log, FALSE, TRUE, left, right, f, fadd, nsb->bshift, nsb,
               nrnb);
#endif
    where();
}




More information about the gromacs.org_gmx-developers mailing list