void restore_fermion_links_hisq(fermion_links_t *fl, int precision, int phases_in, su3_matrix *links){ char myname[] = "restore_fermion_links"; info_t info = INFO_ZERO; if(fl == NULL){ if(mynode() == 0)printf("%s: Called with a null pointer\n", myname); terminate(1); } if(precision != PRECISION) if(mynode() == 0)printf("%s: Warning. Precision request replaced by %d\n", myname, PRECISION); if( phases_in != 1){ if(mynode() == 0)printf("BOTCH: %s needs phases in\n",myname); terminate(1); } restore_milc_hisq_links_t(&info, fl->flg, links, &fl->options); #ifdef FLTIME if(mynode()==0)printf("FLTIME: time = %e (HISQ %s) mflops = %e\n", info.final_sec,milc_prec[PRECISION-1], info.final_flop/(1e6*info.final_sec) ); #endif }
/* SETUP ROUTINES */ int initial_set(){ int prompt,status; /* On node zero, read lattice size and send to others */ if(mynode()==0){ /* print banner */ printf("SU3 Wilson valence fermion Schroedinger functional\n"); printf("MIMD version 4\n"); printf("Machine = %s, with %d nodes\n",machine_type(),numnodes()); status=get_prompt(stdin, &prompt); IF_OK status += get_i(stdin, prompt,"nx", &par_buf.nx ); IF_OK status += get_i(stdin, prompt,"ny", &par_buf.ny ); IF_OK status += get_i(stdin, prompt,"nz", &par_buf.nz ); IF_OK status += get_i(stdin, prompt,"nt", &par_buf.nt ); if(status>0) par_buf.stopflag=1; else par_buf.stopflag=0; } /* end if(mynode()==0) */ /* Node 0 broadcasts parameter buffer to all other nodes */ broadcast_bytes((char *)&par_buf,sizeof(par_buf)); if( par_buf.stopflag != 0 ) normal_exit(0); nx=par_buf.nx; ny=par_buf.ny; nz=par_buf.nz; nt=par_buf.nt; this_node = mynode(); number_of_nodes = numnodes(); volume=nx*ny*nz*nt; return(prompt); }
/* SETUP ROUTINES */ static int initial_set(){ int prompt,status; #ifdef FIX_NODE_GEOM int i; #endif /* On node zero, read lattice size and send to others */ if(mynode()==0){ /* print banner */ printf("SU3 clover, staggered and naive valence fermions\n"); printf("MIMD version %s\n",MILC_CODE_VERSION); printf("Machine = %s, with %d nodes\n",machine_type(),numnodes()); gethostname(hostname, 128); printf("Host(0) = %s\n",hostname); printf("Username = %s\n", getenv("USER")); time_stamp("start"); status = get_prompt(stdin, &prompt ); IF_OK status += get_i(stdin,prompt,"nx", ¶m.nx ); IF_OK status += get_i(stdin,prompt,"ny", ¶m.ny ); IF_OK status += get_i(stdin,prompt,"nz", ¶m.nz ); IF_OK status += get_i(stdin,prompt,"nt", ¶m.nt ); #ifdef FIX_NODE_GEOM IF_OK status += get_vi(stdin, prompt, "node_geometry", param.node_geometry, 4); #ifdef FIX_IONODE_GEOM IF_OK status += get_vi(stdin, prompt, "ionode_geometry", param.ionode_geometry, 4); #endif #endif IF_OK status += get_s(stdin, prompt,"job_id",param.job_id); if(status>0) param.stopflag=1; else param.stopflag=0; } /* end if(mynode()==0) */ /* Node 0 broadcasts parameter buffer to all other nodes */ broadcast_bytes((char *)¶m,sizeof(param)); if( param.stopflag != 0 ) normal_exit(0); nx=param.nx; ny=param.ny; nz=param.nz; nt=param.nt; iseed=param.iseed; #ifdef FIX_NODE_GEOM for(i = 0; i < 4; i++) node_geometry[i] = param.node_geometry[i]; #ifdef FIX_IONODE_GEOM for(i = 0; i < 4; i++) ionode_geometry[i] = param.ionode_geometry[i]; #endif #endif this_node = mynode(); number_of_nodes = numnodes(); volume=nx*ny*nz*nt; return(prompt); }
// ----------------------------------------------------------------- void setup_layout() { int k = mynode(); if (k == 0) printf("LAYOUT = Hypercubes, options = "); setup_hyper_prime(); // Compute machine coordinates machine_coordinates[XUP] = k % squaresize[XUP]; k /= squaresize[XUP]; machine_coordinates[YUP] = k % squaresize[YUP]; k /= squaresize[YUP]; machine_coordinates[ZUP] = k % squaresize[ZUP]; k /= squaresize[ZUP]; machine_coordinates[TUP] = k % squaresize[TUP]; // Number of sites on node sites_on_node = squaresize[XUP] * squaresize[YUP] * squaresize[ZUP] * squaresize[TUP]; /* Need even number of sites per hypercube */ if (mynode() == 0) { if (sites_on_node % 2 != 0) { printf("SORRY, CAN'T LAY OUT THIS LATTICE\n"); terminate(0); } } node0_printf("ON EACH NODE %d x %d x %d x %d\n", squaresize[XUP], squaresize[YUP], squaresize[ZUP], squaresize[TUP]); if (mynode() == 0 && sites_on_node % 2 != 0) printf("WATCH OUT FOR EVEN/ODD SITES ON NODE BUG!!!\n"); even_sites_on_node = sites_on_node / 2; odd_sites_on_node = sites_on_node / 2; }
int remap_stdio_from_args(int argc, char *argv[]){ FILE *fp; /* stdin is remapped only on node 0 on any machine */ if(argc > 1 && mynode() == 0){ fp = freopen(argv[1],"r",stdin); if(fp == NULL){ node0_printf("Can't open stdin file %s for reading.\n",argv[1]); return 1; } } #ifdef QCDOC /* stdout and stderr are remapped only on node 0 on the QCDOC */ if(mynode() != 0)return 0; #endif if(argc > 2){ fp = freopen(argv[2],"w",stdout); if(fp == NULL){ node0_printf("Can't open stdout file %s for writing\n",argv[2]); return 1; } } if(argc > 3){ fp = freopen(argv[3],"w",stderr); if(fp == NULL){ node0_printf("Can't open stderr file %s for writing\n",argv[3]); return 1; } } return 0; }
void test_interface_mapping(Element *U, Element_List *Mesh){ /* MEMO */ /* pllinfo.ncprocs is the number of connecting processors to this partition pllinfo.cinfo[i] is the connecting face information (i is the number of the connecting partition) pllinfo.cinfo[i].nedges is the number of connecting faces pllinfo.cinfo[i].elmtid[j] is the local element of data in order of the connection pllinfo.cinfo[i].edgeid[j] is the local connecting face (it was originally written in 2D so refers to edges). */ int i_proc,i_face,gid; int ElementID_LOC, FaceID_LOC; int active_handle = get_active_handle(); Element *E; Face *f; FILE *pFile; char Fname[256]; static int FLAG_test_interface_mapping = 0; if (FLAG_test_interface_mapping == 0) sprintf(Fname,"Face_GID_PRESSURE_%d.dat",mynode()); else sprintf(Fname,"Face_GID_VELOCITY_%d.dat",mynode()); pFile = fopen(Fname,"w"); for (i_proc = 0; i_proc < pllinfo[active_handle].ncprocs; ++i_proc){ fprintf(pFile," Partner proc ID = %d \n", pllinfo[active_handle].cinfo[i_proc].cprocid); fprintf(pFile," Global IDs: \n"); for (i_face = 0; i_face < pllinfo[active_handle].cinfo[i_proc].nedges; ++i_face){ f = Mesh->flist[pllinfo[active_handle].cinfo[i_proc].elmtid[i_face]]->face + pllinfo[active_handle].cinfo[i_proc].edgeid[i_face]; gid = Mesh->flist[pllinfo[active_handle].eloop[f->eid]]->face[pllinfo[active_handle].cinfo[i_proc].edgeid[i_face]].gid; fprintf(pFile," gid = %d f->eid = %d, Eid = %f",gid,f->eid,Mesh->flist[pllinfo[active_handle].eloop[f->eid]]->id ); } fprintf(pFile," \n"); fprintf(pFile," Local IDs: \n"); for (i_face = 0; i_face < pllinfo[active_handle].cinfo[i_proc].nedges; ++i_face){ f = Mesh->flist[pllinfo[active_handle].cinfo[i_proc].elmtid[i_face]]->face + pllinfo[active_handle].cinfo[i_proc].edgeid[i_face]; ElementID_LOC = Mesh->flist[pllinfo[active_handle].cinfo[i_proc].elmtid[i_face]]->id; FaceID_LOC = pllinfo[active_handle].cinfo[i_proc].edgeid[i_face]; for(E = U; E; E= E->next){ if (E->id == ElementID_LOC){ fprintf(pFile," %d ( %d, %d ) ",f->eid, E->id,Mesh->flist[pllinfo[active_handle].eloop[f->eid]]->face[FaceID_LOC].gid); break; } } //fprintf(pFile," %d (%d, %d) ",f->gid, E->id,FaceID_LOC); //fprintf(pFile," %d (%d) ",f->gid, U[ElementID_LOC].face[FaceID_LOC].gid); } fprintf(pFile," \n"); } fclose(pFile); FLAG_test_interface_mapping = 1; }
int check_set_lock( int amode, /* R_OK | W_OK */ md_setkey_t *cl_sk, /* clients idea of set locked */ md_error_t *ep /* returned status */ ) { md_setkey_t *svc_sk; if (cl_sk == NULL) return (0); svc_sk = svc_get_setkey(cl_sk->sk_setno); /* The set is not locked */ if (svc_sk == NULL) { if ((amode & W_OK) == W_OK) { (void) mddserror(ep, MDE_DS_WRITEWITHSULK, cl_sk->sk_setno, mynode(), NULL, cl_sk->sk_setname); return (1); } return (0); } /* The set is locked, do we have the key? */ if (cl_sk->sk_key.tv_sec == svc_sk->sk_key.tv_sec && cl_sk->sk_key.tv_usec == svc_sk->sk_key.tv_usec) return (0); (void) mddserror(ep, MDE_DS_SETLOCKED, MD_SET_BAD, mynode(), svc_sk->sk_host, svc_sk->sk_setname); return (1); }
void test_face_on_interface(Element_List *Mesh){ /* this function works properly for pressure solver only */ int i_face,i_vert,nv_solve2,solve_mask; int nFaces_total = 0, nFaces_interface = 0; Element *E; int my_rank = mynode(); for(E=Mesh->fhead;E; E = E->next){ if (pllinfo[get_active_handle()].partition[E->id] != my_rank) continue; for(i_face = 0; i_face < E->Nfaces; ++i_face){ nFaces_total++; nv_solve2 = 0; for (i_vert = 0; i_vert < E->Nfverts(i_face); ++i_vert){ solve_mask = E->vert[E->vnum(i_face,i_vert)].solve; if (solve_mask == 2) nv_solve2++; } if (nv_solve2 == E->Nfverts(i_face) ) nFaces_interface++; } } fprintf(stderr,"rank = %d: nFaces_total = %d nFaces_interface = %d \n", mynode(), nFaces_total, nFaces_interface); }
void setup_layout(){ if(mynode()==0){ printf("LAYOUT = Timeslices, options = "); printf("EVENFIRST,"); printf("\n"); } if( nt%numnodes() !=0 ){ /* then maybe numnodes is a multiple of nt */ if (numnodes()%nt == 0 && nz%(numnodes()/nt) == 0 ) ;/* we can do the layout */ elseif(mynode()==0)printf( "LAYOUT: Can't lay out this lattice: nt not multiple of nummodes\n"); terminate(1); } if( nt >= numnodes() ) {/* we only have to divide in t-direction */ ntslices = nt / numnodes(); zcuts = 1; nzslices = nz; } else { ntslizes = 1; zcuts = numnodes()/nt; nzslices = nz/zcuts; } sites_on_node = nx*ny*nzslices*ntslices; /* Need even number of sites per hypercube */ if( mynode()==0)if( sites_on_node%2 != 0){ printf("SORRY, CAN'T LAY OUT THIS LATTICE\n"); terminate(0); } even_sites_on_node = odd_sites_on_node = sites_on_node/2; }
void setup_layout(void) { int c[4]; int i,n_mach; int d[4]; #ifdef FIX_NODE_GEOM int *geom = node_geometry; #else int *geom = NULL; #endif if(mynode()==0){ printf("LAYOUT = Hypercubes, options = "); printf("QDP"); printf("\n"); } /* Is there already a grid? This could be a grid architecture with a preset dimension, or a geometry could have been set by the -qmp-geom command line arg. In either case we have a nonzero allocated number of dimensions. */ if(QMP_get_allocated_number_of_dimensions() == 0) /* Set the geometry if requested */ set_qmp_layout_grid(geom, 4); c[0] = nx; c[1] = ny; c[2] = nz; c[3] = nt; QDP_set_latsize(4, c); QDP_create_layout(); sites_on_node = QDP_sites_on_node; even_sites_on_node = QDP_subset_len(QDP_even); odd_sites_on_node = QDP_subset_len(QDP_odd); n_mach = QMP_get_logical_number_of_dimensions(); dim_mach = QMP_get_logical_dimensions(); /* Initialize I/O node function */ #ifdef FIX_IONODE_GEOM init_io_node(); #endif /* Report sublattice dimensions */ for(i = 0; i < 4; i++){ /* Any extra machine dimensions are assumed to be 1 */ if(i < n_mach)d[i] = c[i]/dim_mach[i]; else d[i] = c[i]; } if( mynode()==0) printf("ON EACH NODE %d x %d x %d x %d\n",d[0],d[1],d[2],d[3]); #if 0 mpi_whoami(); /* Debug */ #endif }
/*--------------------------------------------------------------------*/ static void setup_qmp_grid(){ int ndim = 4; int len[4]; int ndim2, i; const int *nsquares2; len[0] = nx; len[1] = ny; len[2] = nz; len[3] = nt; if(mynode()==0){ printf("qmp_grid,"); printf("\n"); } ndim2 = QMP_get_allocated_number_of_dimensions(); nsquares2 = QMP_get_allocated_dimensions(); /* If the dimensions are not already allocated, use the node_geometry request. Otherwise a hardware or command line specification trumps the parameter input. */ #ifdef FIX_NODE_GEOM if(ndim2 == 0){ ndim2 = 4; nsquares2 = node_geometry; } else{ node0_printf("setup_qmp_grid: Preallocated machine geometry overrides request\n"); } #endif if(mynode()==0){ printf("Using machine geometry: "); for(i=0; i<ndim; i++){ printf("%d ",nsquares2[i]); if(i < ndim-1)printf("X "); } printf("\n"); } /* In principle, we could now rotate coordinate axes */ /* Save this for a future upgrade */ set_qmp_layout_grid(nsquares2, ndim2); ndim2 = QMP_get_logical_number_of_dimensions(); nsquares2 = QMP_get_logical_dimensions(); for(i=0; i<ndim; i++) { if(i<ndim2) nsquares[i] = nsquares2[i]; else nsquares[i] = 1; } for(i=0; i<ndim; i++) { if(len[i]%nsquares[i] != 0) { node0_printf("LATTICE SIZE DOESN'T FIT GRID\n"); QMP_abort(0); } squaresize[i] = len[i]/nsquares[i]; } }
/* SETUP ROUTINES */ int initial_set() { int prompt,status; /* On node zero, read lattice size, seed, nflavors and send to others */ if(mynode()==0) { /* print banner */ printf("SU3 with Wilson fermions\n"); printf("Microcanonical simulation with refreshing\n"); printf("MIMD version 6\n"); printf("Machine = %s, with %d nodes\n",machine_type(),numnodes()); #ifdef HMC_ALGORITHM printf("Hybrid Monte Carlo algorithm\n"); #endif #ifdef PHI_ALGORITHM printf("PHI algorithm\n"); #else printf("R algorithm\n"); #endif #ifdef SPECTRUM printf("With spectrum measurements\n"); #endif time_stamp("start"); status = get_prompt(stdin, &prompt); IF_OK status += get_i(stdin, prompt, "nflavors", &par_buf.nflavors ); #ifdef PHI_ALGORITHM if( par_buf.nflavors != 2) { printf("Dummy! Use phi algorithm only for two flavors\n"); terminate(-1); } #endif IF_OK status += get_i(stdin, prompt, "nx", &par_buf.nx ); IF_OK status += get_i(stdin, prompt, "ny", &par_buf.ny ); IF_OK status += get_i(stdin, prompt, "nz", &par_buf.nz ); IF_OK status += get_i(stdin, prompt, "nt", &par_buf.nt ); IF_OK status += get_i(stdin, prompt, "iseed", &par_buf.iseed ); if(status>0) par_buf.stopflag=1; else par_buf.stopflag=0; } /* end if(mynode()==0) */ /* Node 0 broadcasts parameter buffer to all other nodes */ broadcast_bytes((char *)&par_buf,sizeof(par_buf)); if( par_buf.stopflag != 0 ) normal_exit(0); nx=par_buf.nx; ny=par_buf.ny; nz=par_buf.nz; nt=par_buf.nt; iseed=par_buf.iseed; nflavors=par_buf.nflavors; this_node = mynode(); number_of_nodes = numnodes(); volume=nx*ny*nz*nt; total_iters=0; return(prompt); }
void setup_layout(){ register int i,j,k; if(mynode()==0){ printf("LAYOUT = 2d-squares, options = "); printf("EVENFIRST,"); printf("\n"); } /* sort directions with longest ones first */ dirs[0]=XUP; dirs[1]=YUP; dirs[2]=ZUP; dirs[3]=TUP; dims[XUP]=nx; dims[YUP]=ny; dims[ZUP]=nz; dims[TUP]=nt; for(i=3;i>0;i--)for(j=0;j<i;j++){ if(dims[dirs[j]]<dims[dirs[j+1]]){ k=dirs[j]; dirs[j]=dirs[j+1]; dirs[j+1]=k; } } nsites_per = dims[dirs[ZUP]]*dims[dirs[TUP]]; /* Figure out dimensions of rectangle */ i=1; /* current number of squares */ xsquaresize = dims[dirs[XUP]]; ysquaresize = dims[dirs[YUP]]; nxsquares = nysquares = 1; while(i<numnodes()){ if( dims[dirs[XUP]]/nxsquares >= dims[dirs[YUP]]/nysquares ){ if( (dims[dirs[XUP]]/nxsquares)%2 == 0){ /* decrease x size */ i*=2; xsquaresize /= 2; nxsquares *= 2; } else if( (dims[dirs[YUP]]/nysquares)%2 == 0){ /* dec.. y size */ i*=2; ysquaresize /= 2; nysquares *= 2; } else { if(mynode()==0)printf( "LAYOUT: Can't lay out this lattice, not enough factors of 2\n"); terminate(1); } } else { if( (dims[dirs[YUP]]/nysquares)%2 == 0){ /* decrease y size */ i*=2; ysquaresize /= 2; nysquares *= 2; } else if( (dims[dirs[XUP]]/nxsquares)%2 == 0){ /* dec. x size */ i*=2; xsquaresize /= 2; nxsquares *= 2; } else { if(mynode()==0)printf( "LAYOUT: Can't lay out this lattice, not enough factors of 2\n"); terminate(1); } } } if( mynode()==0)if( dims[dirs[ZUP]]%2 != 0 || dims[dirs[TUP]]%2 != 0){ printf("SORRY, CAN'T LAY OUT THIS LATTICE\n"); terminate(0); } sites_on_node = nsites_per*(xsquaresize*ysquaresize); even_sites_on_node = odd_sites_on_node = sites_on_node/2; }
/* SETUP ROUTINES */ int initial_set(){ int prompt,status; /* On node zero, read lattice size, seed, and send to others */ if(mynode()==0){ /* print banner */ printf("SU3 with improved KS action\n"); printf("Eigenvalues and eigenvectors\n"); printf("MIMD version 6\n"); printf("Machine = %s, with %d nodes\n",machine_type(),numnodes()); gethostname(hostname, 128); printf("Host(0) = %s\n",hostname); printf("Username = %s\n", getenv("USER")); time_stamp("start"); get_utc_datetime(utc_date_time); /* Print list of options selected */ node0_printf("Options selected...\n"); show_generic_opts(); show_generic_ks_opts(); #if FERM_ACTION == HISQ show_su3_mat_opts(); show_hisq_links_opts(); #elif FERM_ACTION == HYPISQ show_su3_mat_opts(); show_hypisq_links_opts(); #endif status=get_prompt(stdin, &prompt); IF_OK status += get_i(stdin, prompt,"nx", &par_buf.nx ); IF_OK status += get_i(stdin, prompt,"ny", &par_buf.ny ); IF_OK status += get_i(stdin, prompt,"nz", &par_buf.nz ); IF_OK status += get_i(stdin, prompt,"nt", &par_buf.nt ); IF_OK status += get_i(stdin, prompt,"iseed", &par_buf.iseed ); if(status>0) par_buf.stopflag=1; else par_buf.stopflag=0; } /* end if(mynode()==0) */ /* Node 0 broadcasts parameter buffer to all other nodes */ broadcast_bytes((char *)&par_buf,sizeof(par_buf)); if( par_buf.stopflag != 0 ) normal_exit(0); nx=par_buf.nx; ny=par_buf.ny; nz=par_buf.nz; nt=par_buf.nt; iseed=par_buf.iseed; this_node = mynode(); number_of_nodes = numnodes(); volume=nx*ny*nz*nt; total_iters=0; return(prompt); }
void setup_layout(){ register int i,j,k,dir; register int factor; if(mynode()==0){ printf("LAYOUT = Hypercubes, options = "); printf("EVENFIRST,"); printf("\n"); } /* Figure out dimensions of rectangle */ squaresize[XUP] = nx; squaresize[YUP] = ny; squaresize[ZUP] = nz; squaresize[TUP] = nt; nsquares[XUP] = nsquares[YUP] = nsquares[ZUP] = nsquares[TUP] = 1; i = 1; /* current number of hypercubes */ while(i<numnodes()){ /* decide whether to divide by three or two */ if( (numnodes()/i)%3 == 0 ) factor=3; else factor=2; /* figure out which direction to divide */ /* find largest even dimension of h-cubes */ for(j=1,dir=XUP;dir<=TUP;dir++) if( squaresize[dir]>j && squaresize[dir]%factor==0 ) j=squaresize[dir]; /* if one direction with largest dimension has already been divided, divide it again. Otherwise divide first direction with largest dimension. */ for(dir=XUP;dir<=TUP;dir++) if( squaresize[dir]==j && nsquares[dir]>1 )break; if( dir > TUP)for(dir=XUP;dir<=TUP;dir++) if( squaresize[dir]==j )break; /* This can fail if I run out of factors of 3 or 2 in the dimensions */ if(dir > TUP){ if(mynode()==0)printf( "LAYOUT: Can't lay out this lattice, not enough factors of %d\n" ,factor); terminate(1); } /* do the surgery */ i*=factor; squaresize[dir] /= factor; nsquares[dir] *= factor; } sites_on_node = squaresize[XUP]*squaresize[YUP]*squaresize[ZUP]*squaresize[TUP]; /* Need even number of sites per hypercube */ if( mynode()==0)if( sites_on_node%2 != 0){ printf("SORRY, CAN'T LAY OUT THIS LATTICE\n"); terminate(0); } if( mynode()==0) printf("ON EACH NODE %d x %d x %d x %d\n",squaresize[XUP],squaresize[YUP], squaresize[ZUP],squaresize[TUP]); if( mynode()==0 && sites_on_node%2 != 0) printf("WATCH OUT FOR EVEN/ODD SITES ON NODE BUG!!!\n"); even_sites_on_node = odd_sites_on_node = sites_on_node/2; }
void setup_layout(){ register int i,j,dir; if(mynode()==0){ printf("LAYOUT = Hypercubes, options = "); printf("EVENFIRST,"); printf("\n"); } /* Figure out dimensions of rectangle */ squaresize[XUP] = nx; squaresize[YUP] = ny; squaresize[ZUP] = nz; squaresize[TUP] = nt; nsquares[XUP] = nsquares[YUP] = nsquares[ZUP] = nsquares[TUP] = 1; i = 1; /* current number of hypercubes */ while(i<numnodes()){ /* figure out which direction to divide */ /* find largest dimension of h-cubes divisible by 4 */ for(j=1,dir=XUP;dir<=TUP;dir++) if( squaresize[dir]>j && squaresize[dir]%4==0 ) j=squaresize[dir]; /* if one direction with largest dimension has already been divided, divide it again. Otherwise divide first direction with largest dimension. */ for(dir=XUP;dir<=TUP;dir++) if( squaresize[dir]==j && nsquares[dir]>1 )break; if( dir > TUP)for(dir=XUP;dir<=TUP;dir++) if( squaresize[dir]==j )break; /* This can fail if I run out of factors of 2 in the dimensions */ if(dir > TUP){ if(mynode()==0)printf( "LAYOUT: Can't lay out this lattice, not enough factors of 2\n"); terminate(1); } /* do the surgery */ i*=2; squaresize[dir] /= 2; nsquares[dir] *= 2; } sites_on_node = squaresize[XUP]*squaresize[YUP]*squaresize[ZUP]*squaresize[TUP]; /* Need number of sites per hypercube divisible by 32 */ if( mynode()==0)if( sites_on_node%32 != 0){ printf("SORRY, CAN'T LAY OUT THIS LATTICE\n"); terminate(0); } subl_sites_on_node = sites_on_node/32; }
/*----------------------------------------------------------------------*/ void make_lattice(){ register int i; /* scratch */ int x,y,z,t; /* coordinates */ /* allocate space for lattice, fill in parity, coordinates and index. */ lattice = (site *)malloc( sites_on_node * sizeof(site) ); if(lattice==NULL){ printf("NODE %d: no room for lattice\n",this_node); terminate(1); } /* Allocate address vectors */ for(i=0;i<8;i++){ /**gen_pt[i] = (char **)malloc(sites_on_node*sizeof(char *) ); if(gen_pt[i]==NULL){ printf("NODE %d: no room for pointer vector\n",this_node); terminate(1); } **/ gen_pt[i] = NULL; } for(t=0;t<nt;t++)for(z=0;z<nz;z++)for(y=0;y<ny;y++)for(x=0;x<nx;x++){ if(node_number(x,y,z,t)==mynode()){ i=node_index(x,y,z,t); lattice[i].x=x; lattice[i].y=y; lattice[i].z=z; lattice[i].t=t; lattice[i].index = x+nx*(y+ny*(z+nz*t)); if( (x+y+z+t)%2 == 0)lattice[i].parity=EVEN; else lattice[i].parity=ODD; #ifdef SITERAND initialize_prn( &(lattice[i].site_prn) , iseed, lattice[i].index); #endif } } }
int setup() { int prompt; /* print banner, get volume */ prompt=initial_set(); if(prompt == 2)return prompt; /* initialize the node random number generator */ initialize_prn( &node_prn, param.iseed, volume+mynode() ); /* Initialize the layout functions, which decide where sites live */ setup_layout(); /* allocate space for lattice, set up coordinate fields */ make_lattice(); /* Initialize fermion links as unallocated */ // init_ferm_links(&fn_links, &ks_act_paths); // init_ferm_links(&fn_links_dmdu0, &ks_act_paths_dmdu0); /* set up nearest neighbor gathers */ make_nn_gathers(); /* set up 3rd nearest neighbor pointers and comlink structures code for this routine is below */ make_3n_gathers(); /* set up K-S phase vectors, boundary conditions */ phaseset(); return(prompt); }
int setup(void) { int prompt; /* print banner, get volume, seed */ prompt = initial_set(); /* initialize the node random number generator */ initialize_prn( &node_prn, iseed, volume+mynode() ); /* Initialize the layout functions, which decide where sites live */ setup_layout(); /* allocate space for lattice, set up coordinate fields */ make_lattice(); node0_printf("Made lattice\n"); fflush(stdout); /* set up neighbor pointers and comlink structures */ make_nn_gathers(); node0_printf("Made nn gathers\n"); fflush(stdout); /* set up 3rd nearest neighbor pointers and comlink structures code for this routine is below */ make_3n_gathers(); node0_printf("Made 3nn gathers\n"); fflush(stdout); /* set up K-S phase vectors, boundary conditions */ phaseset(); node0_printf("Finished setup\n"); fflush(stdout); return( prompt ); }
void SessionSummaryThr::run() { if ( mysqlpp::get_library_version() != MYSQLPP_HEADER_VERSION ) { cerr<< "Library/header version number mismatch" << endl; return; }; MyNode mynode(mpSession); //mynode.prevshotnum = startshot; SEVCHK(ca_context_create(ca_disable_preemptive_callback),"ca_context_create"); SEVCHK(ca_add_exception_event(exceptionCallback,NULL), "ca_add_exception_event"); //string pvnames[]={"CCS_SHOT_NUMBER","CCS_PERFORM_SHOT_SUMMARY"}; //Test.. //SEVCHK(ca_create_channel("DDS2_getState",connectionCallback, // &mynode,10,(oldChannelNotify**)&mynode.summary_chid), "ca_create_channel"); SEVCHK(ca_create_channel("CCS_PERFORM_SHOT_SUMMARY",connectionCallback, &mynode,10,(oldChannelNotify**)&mynode.summary_chid), "ca_create_channel"); SEVCHK(ca_replace_access_rights_event(mynode.summary_chid, accessRightsCallback), "ca_replace_access_rights_event"); ca_create_subscription (DBR_TIME_LONG, 0, mynode.summary_chid, DBE_VALUE|DBE_ALARM, eventCallback, (void*)&mynode, NULL); /*Should never return from following call*/ SEVCHK(ca_pend_event(0.0),"ca_pend_event"); }
int setup(void) { int prompt, dir; /* print banner, get volume */ prompt=initial_set(); if(prompt == 2)return prompt; /* initialize the node random number generator */ initialize_prn( &node_prn, param.iseed, volume+mynode() ); /* Initialize the layout functions, which decide where sites live */ setup_layout(); /* allocate space for lattice, set up coordinate fields */ make_lattice(); FORALLUPDIR(dir){ boundary_phase[dir] = 0.; } /* set up nearest neighbor gathers */ make_nn_gathers(); /* set up 3rd nearest neighbor pointers and comlink structures code for this routine is below */ make_3n_gathers(); /* set up K-S phase vectors, boundary conditions */ phaseset(); twist_in = OFF; /* Create clover structure */ gen_clov = create_clov(); return(prompt); }
void delta_prop(int c0,int c1,int c2,int perm,int t,double *delprop) /* Calculates the contribution to the delta propagator at time t */ /* With source colors c0, c1, c2 */ /* perm specifies the sign of the contribution to be calculated */ { register int i; register complex cc; int x,y,z; int c[3]; c[0] = c0; c[1] = c1; c[2] = c2; for(x=0;x<nx;x+=2)for(y=0;y<ny;y+=2)for(z=0;z<nz;z+=2) { if( node_number(x,y,z,t) != mynode() )continue; i=node_index(x,y,z,t); /* Calculate for the cube origin only */ accum_delta_prop(i,c); cc = det_su3( &lattice[i].tempmat1 ); if(perm>0)*delprop += cc.real; else *delprop -= cc.real; } }
int setup() { int initial_set(); int prompt; /* print banner, get initial parameters */ prompt = initial_set(); if(prompt == 2)return prompt; /* initialize the node random number generator */ initialize_prn( &node_prn, iseed, volume+mynode() ); /* Initialize the layout functions, which decide where sites live */ setup_layout(); /* allocate space for lattice, set up coordinate fields */ make_lattice(); node0_printf("Made lattice\n"); fflush(stdout); /* set up neighbor pointers and comlink structures code for this routine is in com_machine.c */ make_nn_gathers(); node0_printf("Made nn gathers\n"); fflush(stdout); node0_printf("Finished setup\n"); fflush(stdout); return prompt; }
/* * open RPC connection to rpc.metamhd */ static mhd_handle_t * open_metamhd( char *hostname, md_error_t *ep ) { CLIENT *clientp; mhd_handle_t *hp; /* default to local host */ if ((hostname == NULL) || (*hostname == '\0')) hostname = mynode(); /* open RPC connection */ assert(hostname != NULL); if ((clientp = meta_client_create(hostname, METAMHD, METAMHD_VERSION, "tcp")) == NULL) { clnt_pcreateerror(hostname); (void) mdrpccreateerror(ep, hostname, "metamhd clnt_create"); return (NULL); } else { auth_destroy(clientp->cl_auth); clientp->cl_auth = authsys_create_default(); assert(clientp->cl_auth != NULL); } /* return connection */ hp = Zalloc(sizeof (*hp)); hp->hostname = Strdup(hostname); hp->clientp = clientp; return (hp); }
int setup() { int prompt; /* print banner, get volume, nflavors1,nflavors2, seed */ prompt = initial_set(); if(prompt == 2)return prompt; /* initialize the node random number generator */ initialize_prn( &node_prn, iseed, volume+mynode() ); /* Initialize the layout functions, which decide where sites live */ setup_layout(); /* allocate space for lattice, set up coordinate fields */ make_lattice(); node0_printf("Made lattice\n"); fflush(stdout); /* Mark t_longlink and t_fatlink unallocted */ // init_ferm_links(&fn_links, &ks_act_paths); /* set up neighbor pointers and comlink structures code for this routine is in com_machine.c */ make_nn_gathers(); node0_printf("Made nn gathers\n"); fflush(stdout); /* set up 3rd nearest neighbor pointers and comlink structures code for this routine is below */ make_3n_gathers(); node0_printf("Made 3nn gathers\n"); fflush(stdout); /* set up K-S phase vectors, boundary conditions */ phaseset(); node0_printf("Finished setup\n"); fflush(stdout); return( prompt ); }
void reunit_report_problem_matrix(su3_matrix *mat, int i,int dir) { int ii,jj; union { Real fval; int ival; } ifval; printf("Unitarity problem on node %d, site %d, dir %d tolerance=%e\n", mynode(),i,dir,TOLERANCE); printf("SU3 matrix:\n"); for(ii=0;ii<=2;ii++){ for(jj=0;jj<=2;jj++){ printf("%f ",(*mat).e[ii][jj].real); printf("%f ",(*mat).e[ii][jj].imag); } printf("\n"); } printf("repeat in hex:\n"); for(ii=0;ii<=2;ii++){ for(jj=0;jj<=2;jj++){ ifval.fval = (*mat).e[ii][jj].real; printf("%08x ", ifval.ival); ifval.fval = (*mat).e[ii][jj].imag; printf("%08x ", ifval.ival); } printf("\n"); } printf(" \n \n"); fflush(stdout); } /* reunit_report_problem_matrix */
void reunit_report_problem_u1(complex *mat, int i,int dir) { int ii,jj; union { Real fval; int ival; } ifval; printf("Unitarity problem on node %d, site %d, dir %d tolerance=%e\n", mynode(),i,dir,TOLERANCE); printf("Complex number:\n"); printf("%f ",(*mat).real); printf("%f ",(*mat).imag); printf("\n"); printf("repeat in hex:\n"); ifval.fval = (*mat).real; printf("%08x ", ifval.ival); ifval.fval = (*mat).imag; printf("%08x ", ifval.ival); printf("\n"); printf(" \n \n"); fflush(stdout); } /* reunit_report_problem_u1 */
// ----------------------------------------------------------------- // On node zero, read and distribute lattice size and random number seed int initial_set() { int prompt, status; if (mynode() == 0) { // Print banner printf("SU3 Kogut--Susskind eigenvalue calculation\n"); printf("Machine = %s, with %d nodes\n", machine_type(), numnodes()); printf("nHYP links, reading alpha_smear parameters from infile\n"); printf(" IR_STAB = %.4g\n", (Real)IR_STAB); printf(" EPS_SQ = %.4g\n", (Real)EPS_SQ); #ifdef NHYP_DEBUG printf("NHYP_DEBUG turned on\n"); #endif #ifdef NO_UNIT_CHECK printf("NOT checking unitarity when loading lattice\n"); #endif time_stamp("start"); status = get_prompt(stdin, &prompt); IF_OK status += get_i(stdin, prompt, "nx", &par_buf.nx); IF_OK status += get_i(stdin, prompt, "ny", &par_buf.ny); IF_OK status += get_i(stdin, prompt, "nz", &par_buf.nz); IF_OK status += get_i(stdin, prompt, "nt", &par_buf.nt); IF_OK status += get_i(stdin, prompt, "iseed", &par_buf.iseed); if (status > 0) par_buf.stopflag = 1; else par_buf.stopflag = 0; } // Broadcast parameter buffer from node 0 to all other nodes broadcast_bytes((char *)&par_buf, sizeof(par_buf)); if (par_buf.stopflag != 0) normal_exit(0); nx = par_buf.nx; ny = par_buf.ny; nz = par_buf.nz; nt = par_buf.nt; iseed = par_buf.iseed; this_node = mynode(); number_of_nodes = numnodes(); volume = nx * ny * nz * nt; total_iters = 0; return(prompt); }
/* SETUP ROUTINES */ int initial_set(){ int prompt,status; /* On node zero, read lattice size, seed, nflavors and send to others */ if(mynode()==0){ /* print banner */ printf("Schroedinger functional for pure gauge SU3\n"); #ifdef RMD_ALGORITHM printf("Microcanonical simulation with refreshing\n"); #endif #ifdef HMC_ALGORITHM printf("Microcanonical simulation with refreshing\n"); #endif printf("MIMD version 6\n"); printf("Machine = %s, with %d nodes\n",machine_type(),numnodes()); #ifdef HMC_ALGORITHM printf("Hybrid Monte Carlo algorithm\n"); #endif #ifdef ORA_ALGORITHM printf("Overrelaxed/quasi-heat bath algorithm\n"); #endif status=get_prompt(stdin, &prompt); IF_OK status += get_i(stdin, prompt,"nx", &par_buf.nx ); IF_OK status += get_i(stdin, prompt,"ny", &par_buf.ny ); IF_OK status += get_i(stdin, prompt,"nz", &par_buf.nz ); IF_OK status += get_i(stdin, prompt,"nt", &par_buf.nt ); IF_OK status += get_i(stdin, prompt,"iseed", &par_buf.iseed ); if(status>0) par_buf.stopflag=1; else par_buf.stopflag=0; } /* end if(mynode()==0) */ /* Node 0 broadcasts parameter buffer to all other nodes */ broadcast_bytes((char *)&par_buf,sizeof(par_buf)); if( par_buf.stopflag != 0 ) normal_exit(0); nx=par_buf.nx; ny=par_buf.ny; nz=par_buf.nz; nt=par_buf.nt; iseed=par_buf.iseed; this_node = mynode(); number_of_nodes = numnodes(); volume=nx*ny*nz*nt; return(prompt); }
fermion_links_t * create_fermion_links(int precision, int phases_in, su3_matrix *links) { fermion_links_t *fl; ks_action_paths *ap, *ap_du0; info_t info = INFO_ZERO; char myname[] = "create_fermion_links"; /* Precision for MILC is ignored: use the prevailing precision */ if(precision != PRECISION) if(mynode() == 0)printf("%s: Warning. Precision request replaced by %d\n", myname, PRECISION); if( phases_in != 1) { if(mynode() == 0)printf("BOTCH: %s needs phases in\n",myname); terminate(1); } fl = create_fermion_links_t(); /* Create the path tables */ /* (We copy the pointers into the fm_ap_links_t objects and the responsibility for freeing space is handed over to "destroy_fm_ap_links_t") */ ap = create_path_table(); if(fl->options.want_du0) ap_du0 = create_path_table(); else ap_du0 = NULL; make_path_table(ap, ap_du0); /* Complete the structure */ fl->flg = create_milc_fm_links_t(&info, ap, ap_du0, links, &fl->options); #ifdef FLTIME if(mynode()==0)printf("FLTIME: time = %e (asqtad %s) mflops = %e\n", info.final_sec,milc_prec[PRECISION-1], info.final_flop/(1e6*info.final_sec) ); #endif return fl; }