// Set up comlink structures needed by nearest neighbor gather routines // make_lattice() must be called first void make_nn_gathers() { int i, gather_parity; if (n_gathers != 0) { printf("error: make_nn_gathers must come before any make_gather\n"); terminate(1); } gather_array_len = 8; gather_array = malloc(sizeof *gather_array * gather_array_len); if (gather_array == NULL) { printf("make_nn_gathers: node%d can't malloc gather_array\n", this_node); terminate(1); } if ((nx&1) || (ny&1) || (nz&1) || (nt&1)) gather_parity = SCRAMBLE_PARITY; else gather_parity = SWITCH_PARITY; FORALLUPDIR(i) { make_gather(neighbor_coords_special, &i, WANT_INVERSE, ALLOW_EVEN_ODD, gather_parity); } /* Sort into the order we want for nearest neighbor gathers, so you can use XUP, XDOWN, etc. as argument in calling them. */ sort_eight_gathers(0); }
// Set up comlink structures needed by nearest neighbor gather routines // make_lattice() must be called first void make_nn_gathers() { int i, gather_parity; if (n_gathers != 0) { printf("error: make_nn_gathers must come before any make_gather\n"); terminate(1); } gather_array_len = 4; gather_array = malloc(gather_array_len * sizeof(*gather_array)); if (gather_array == NULL) { printf("error: not enough room for gather_array in make_nn_gathers\n"); terminate(1); } if ((nx&1) || (nt&1)) gather_parity = SCRAMBLE_PARITY; else gather_parity = SWITCH_PARITY; for (i = XUP; i <= TUP; i++) make_gather(neighbor_coords_special, &i, WANT_INVERSE, ALLOW_EVEN_ODD, gather_parity); /* Sort into the order we want for nearest neighbor gathers, so you can use XUP, XDOWN, etc. as argument in calling them. */ sort_four_gathers(0); }
static int ft_make_gather(ft_layout *ftl_dst, ft_layout *ftl_src){ ft_layout* ftl[2] = {ftl_dst, ftl_src}; int *args = (int *)ftl; int dir; dir = make_gather(ft_map_layouts, args, WANT_INVERSE, ALLOW_EVEN_ODD, SCRAMBLE_PARITY); return dir; }
/* Set up "comlink" structures needed by gather routines. make_lattice() must be called first. */ void make_nn_gathers(){ int i; void neighbor_coords_special( int x,int y,int z,int t, /* coordinates of site */ int *dirpt, /* direction (eg XUP) */ int fb, /* "forwards/backwards" */ int *x2p,int *y2p,int *z2p,int *t2p); /* pointers to coordinates of neighbor */ /* Allocate space for lists of pointers to neighbor sites. (NULL if neighbor not on this node) */ neighbor = (int **)calloc(NDIRS, sizeof(int *)); n_gathers=0; for(i=XUP;i<=TUP;i++) make_gather(neighbor_coords_special,&i,WANT_INVERSE, ALLOW_EVEN_ODD,SWITCH_PARITY); /* Sort into the order we want for nearest neighbor gathers, so you can use XUP, XDOWN, etc. as argument in calling them. */ sort_eight_special((void **) neighbor ); }
void make_3n_gathers(){ int i; //#ifdef HAVE_QDP // int disp[4]={0,0,0,0}; //#endif for(i=XUP;i<=TUP;i++) { make_gather(third_neighbor,&i,WANT_INVERSE, ALLOW_EVEN_ODD,SWITCH_PARITY); } /* Sort into the order we want for nearest neighbor gathers, so you can use X3UP, X3DOWN, etc. as argument in calling them. */ sort_eight_gathers(X3UP); //#ifdef HAVE_QDP // for(i=0; i<4; i++) { // disp[i] = 3; // neighbor3[i] = QDP_create_shift(disp); // disp[i] = 0; // } //#endif }
} else{ /* ignore this dimension */ logdim[dir]= -1; butterfly_dir[dir]=NULL; /* This will remind us to ignore it */ } if (key[dir]==2) { dmin[dir] = slice[dir]; dmax[dir] = slice[dir] + 1; } } /* Set up bit-reverse */ bitrev_dir = make_gather( bitrev_map, key, OWN_INVERSE, NO_EVEN_ODD, SCRAMBLE_PARITY ); /* Set up butterflies */ FORALLUPDIR(dir)if (key[dir]==1) { for (i=0;i<logdim[dir];i++) { arg[0] = dir; arg[1] = i; butterfly_dir[dir][i] = make_gather( butterfly_map, arg, OWN_INVERSE, NO_EVEN_ODD, SCRAMBLE_PARITY ); } } /* Set up base p cyclic gather */ if (notbase2)FORALLUPDIR(dir)if (key[dir]==1)if (pfactor[dir]!=1) { arg[0] = dir; pcyclic_dir[dir] = make_gather( pcyclic_map, arg,