static cmplx_source_file * r_source_cmplx_fm_i(char *filename, int source_type) { /* Returns file descriptor for opened file */ cmplx_source_file *csf; cmplx_source_header *csh; int byterevflag; csf = setup_input_cmplx_source_file(filename, source_type); csh = csf->header; if(this_node==0){ csf->fp = g_open(filename,"rb"); if(csf->fp==NULL){ printf("Can't open source file %s, error %d\n",filename,errno); terminate(1); } byterevflag = read_cmplx_fm_source_hdr(csf, source_type); } else csf->fp = NULL; /* Broadcast the byterevflag from node 0 to all nodes */ broadcast_bytes((char *)&byterevflag,sizeof(byterevflag)); csf->byterevflag = byterevflag; /* Node 0 broadcasts the header structure to all nodes */ broadcast_bytes((char *)csh,sizeof(cmplx_source_header)); return csf; } /* r_source_cmplx_fm_i */
void setup() { /* Set up lattice */ broadcast_bytes((char *)&nx,sizeof(int)); broadcast_bytes((char *)&ny,sizeof(int)); broadcast_bytes((char *)&nz,sizeof(int)); broadcast_bytes((char *)&nt,sizeof(int)); setup_layout(); make_lattice(); }
// ----------------------------------------------------------------- // Return file descriptor for opened file gauge_file* r_serial_i(char *filename) { gauge_header *gh; gauge_file *gf; FILE *fp; int byterevflag; char editfilename[513]; /* All nodes set up a gauge file and gauge header structure for reading */ gf = setup_input_gauge_file(filename); gh = gf->header; /* Node 0 alone opens the file and reads the header */ g_sync(); if (this_node == 0) { fp = fopen(filename, "rb"); if (fp == NULL) { /* If this is a partition format SciDAC file the node0 name has an extension ".vol0000". So try again. */ printf("r_serial_i: Node %d can't open file %s, error %d\n", this_node,filename,errno);fflush(stdout); strncpy(editfilename,filename,504); editfilename[504] = '\0'; /* Just in case of truncation */ strcat(editfilename,".vol0000"); printf("r_serial_i: Trying SciDAC partition volume %s\n",editfilename); fp = fopen(editfilename, "rb"); if (fp == NULL) { printf("r_serial_i: Node %d can't open file %s, error %d\n", this_node,editfilename,errno);fflush(stdout);terminate(1); } printf("r_serial_i: Open succeeded\n"); } gf->fp = fp; byterevflag = read_gauge_hdr(gf); } else gf->fp = NULL; /* The other nodes don't know about this file */ // Broadcast the byterevflag and header structure from node0 to all nodes broadcast_bytes((char *)&byterevflag, sizeof(byterevflag)); gf->byterevflag = byterevflag; broadcast_bytes((char *)gh,sizeof(gauge_header)); // No further processing here if this is a SciDAC file if (gh->magic_number == LIME_MAGIC_NO) return gf; // Read site list and broadcast to all nodes read_site_list(gf); return gf; }
/* 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); }
// ----------------------------------------------------------------- // Subroutine for reading site list from gauge configuration file // Only node0 reads this list void read_site_list(gauge_file *gf) { /* All nodes allocate space for site list table, if file is not in natural order */ if (gf->header->order != NATURAL_ORDER) { gf->rank2rcv = malloc(volume * sizeof(int32type)); if (gf->rank2rcv == NULL) { printf("read_site_list: Can't malloc rank2rcv table\n"); terminate(1); } // Only node0 reads the site list if (this_node == 0) { /* Reads receiving site coordinate if file is not in natural order */ if ((int)fread(gf->rank2rcv,sizeof(int32type), volume,gf->fp) != volume) { printf("read_site_list: Node %d site list read error %d\n", this_node,errno); terminate(1); } if (gf->byterevflag == 1) byterevn(gf->rank2rcv, volume); } // Broadcast result to all nodes broadcast_bytes((char *)gf->rank2rcv, volume * sizeof(int32type)); } else gf->rank2rcv = NULL; // If no site list }
/* 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 */ 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); }
/* 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); }
/* For FNAL we base the detection on the number of elements per site */ int io_detect_fm(char *filename){ FILE *fp; int status, words; int32type magic_no, revmagic_no, gmtime_stamp, size_of_element, elem_per_site; int byterevflag = 0; /* Node 0 reads and checks */ if(this_node == 0){ fp = g_open(filename,"rb"); if(fp == NULL)status = -2; else { words = g_read(&magic_no, sizeof(int32type), 1, fp); if(words != 1)status = -3; else { revmagic_no = magic_no; byterevn(&revmagic_no, 1); status = -1; if(revmagic_no == IO_UNI_MAGIC)byterevflag = 1; if(magic_no == IO_UNI_MAGIC || revmagic_no == IO_UNI_MAGIC){ g_read(&gmtime_stamp, sizeof(gmtime_stamp), 1, fp); g_read(&size_of_element, sizeof(int32type), 1, fp); g_read(&elem_per_site, sizeof(int32type), 1, fp); if(byterevflag){ byterevn(&size_of_element, 1); byterevn(&elem_per_site, 1); } if(size_of_element != sizeof(float))status = -1; else if(elem_per_site == sizeof(fsu3_matrix)/sizeof(float)) status = FILE_TYPE_KS_FMPROP; else if(elem_per_site == sizeof(fwilson_propagator)/sizeof(float) || elem_per_site == sizeof(fwilson_vector)/sizeof(float)) status = FILE_TYPE_W_FMPROP; else if(elem_per_site == 4*sizeof(fsu3_matrix)/sizeof(float)) status = FILE_TYPE_GAUGE_FNAL; } } } g_close(fp); } /* Node 0 broadcasts the result */ broadcast_bytes((char *)&status, sizeof(int)); /* All nodes return the same value */ return status; }
// ----------------------------------------------------------------- // Set up the output gauge file and gauge header structure gauge_file* setup_output_gauge_file() { int i; gauge_file *gf = malloc(sizeof(*gf)); gauge_header *gh = malloc(sizeof(*gh)); time_t time_stamp; // Check that file structure and header structure were set up successfully if (gf == NULL) { printf("setup_output_gauge_file: Can't malloc gf\n"); terminate(1); } if (gh == NULL) { printf("setup_output_gauge_file: Can't malloc gh\n"); terminate(1); } /* Make sure compilation gave us a 32 bit integer type */ assert(sizeof(int32type) == 4); /* Load header pointer and file name */ gf->header = gh; /* Initialize */ gf->check.sum29 = 0; gf->check.sum31 = 0; /* Load header values */ gh->magic_number = GAUGE_VERSION_NUMBER; gh->dims[0] = nx; gh->dims[1] = ny; gh->dims[2] = nz; gh->dims[3] = nt; // Get date and time stamp using local time on node0 if (this_node == 0) { time(&time_stamp); strcpy(gh->time_stamp, ctime(&time_stamp)); /* For aesthetic reasons, don't leave trailing junk bytes here to be written to the file */ for (i = strlen(gh->time_stamp) + 1; i < (int)sizeof(gh->time_stamp); i++) gh->time_stamp[i] = '\0'; /* Remove trailing end-of-line character */ if (gh->time_stamp[strlen(gh->time_stamp) - 1] == '\n') gh->time_stamp[strlen(gh->time_stamp) - 1] = '\0'; } // Broadcast to all nodes broadcast_bytes(gh->time_stamp, sizeof(gh->time_stamp)); return gf; }
int file_exists_broadcast(char *file) { FILE *dummy_fp; int non_null_fp; /* Test whether file exists and is openable and broadcast result */ if(this_node==0){ dummy_fp = fopen(file,"rb"); non_null_fp = (dummy_fp != NULL); if(non_null_fp)fclose(dummy_fp); } broadcast_bytes((char *)&non_null_fp,sizeof(int)); return non_null_fp; }
int io_detect(char *filename, file_table ft[], int ntypes){ FILE *fp; int i, status, words; int32type magic_no; int32type revmagic_no; char editfilename[513]; /* Node 0 reads and checks */ if(this_node == 0){ fp = g_open(filename,"rb"); if(fp == NULL){ /* Special provision for partition or multifile format. Try adding the extension to the filename */ strncpy(editfilename,filename,504); editfilename[504] = '\0'; /* Just in case of truncation */ strcat(editfilename,".vol0000"); fp = g_open(editfilename,"rb"); } if(fp == NULL)status = -2; else { words = g_read(&magic_no, sizeof(int32type), 1, fp); g_close(fp); if(words != 1)status = -3; else { revmagic_no = magic_no; byterevn(&revmagic_no, 1); status = -1; for(i = 0; i < ntypes; i++){ if(ft[i].magic_no == magic_no || ft[i].magic_no == revmagic_no) { status = ft[i].type; break; } } } } } /* Node 0 broadcasts the result */ broadcast_bytes((char *)&status, sizeof(int)); /* All nodes return the same value */ return status; }
/* 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); }
// ----------------------------------------------------------------- // 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); }
/* read in parameters and coupling constants */ int readin(int prompt) { /* read in parameters for su3 monte carlo */ /* argument "prompt" is 1 if prompts are to be given for input */ int status, jflav; /* On node zero, read parameters and send to all other nodes */ if(this_node==0){ printf("\n\n"); status=0; IF_OK status += get_i(stdin, prompt, "number_of_random_sources", ¶m.nrand); if(param.nrand < 2){ fprintf(stderr, "ERROR: need more than 1 random source to compute correlations\n"); status++; } IF_OK status += get_i(stdin, prompt, "number_of_flavors", ¶m.nflav); for(jflav = 0; jflav < param.nflav; jflav++){ IF_OK status += get_f(stdin, prompt, "charge", ¶m.charges[jflav]); IF_OK status += get_s(stdin, prompt, "file", param.fname[jflav]); } IF_OK status += get_s(stdin, prompt, "save_corr", param.corrfile); /* End of input fields */ if( status > 0)param.stopflag=1; else param.stopflag=0; } /* end if(this_node==0) */ broadcast_bytes((char *)¶m,sizeof(param)); if( param.stopflag != 0 )return param.stopflag; if(prompt==2)return 0; } /* setup.c */
/* SETUP ROUTINES */ int initial_set() { int prompt, status; if(mynode()==0){ /* print banner */ printf("Wilson/Symanzik Flow application\n"); printf("MIMD version 7\n"); printf("Machine = %s, with %d nodes\n", machine_type(), numnodes()); /* Read prompt type and lattice dimensions */ 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); /* Update global variables with parameters */ 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 */ int initial_set(){ int prompt,status; /* On node zero, read lattice size, seed, and send to others */ if(mynode()==0){ /* print banner */ printf("U1 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()); 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); }
/* 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("Heavy-light spectroscpy with Kogut-Susskind light fermions\n"); printf("MIMD version 7\n"); printf("Machine = %s, with %d nodes\n",machine_type(),numnodes()); 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_s(stdin, prompt,"job_id",par_buf.job_id); 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; strcpy(job_id,par_buf.job_id); this_node = mynode(); number_of_nodes = numnodes(); volume=nx*ny*nz*nt; total_iters=0; return(prompt); }
/* SETUP ROUTINES */ int initial_set(void) { int prompt,status; /* On node zero, read lattice size, seed, nflavors and send to others */ if(mynode()==0) { /* print banner */ printf("SU3 Smoothing for Instantons\n"); printf("MIMD version 7\n"); printf("Machine = %s, with %d nodes\n", machine_type(), numnodes()); 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(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 */ int initial_set() { int prompt,status,i,tmporder; Real current_naik_mass; /* On node zero, read lattice size, seed, and send to others */ if(mynode()==0){ /* print banner */ printf("SU3 with improved KS action\n"); printf("Microcanonical simulation with refreshing\n"); printf("MIMD version 7 $Name: $\n"); printf("Machine = %s, with %d nodes\n",machine_type(),numnodes()); printf("Rational function hybrid Monte Carlo algorithm\n"); /* Print list of options selected */ node0_printf("Options selected...\n"); show_generic_opts(); show_generic_ks_opts(); #ifdef INT_ALG node0_printf("INT_ALG=%s\n",ks_int_alg_opt_chr()); #endif //#ifdef HISQ_NAIK_ADJUSTABLE // node0_printf("HISQ_NAIK_ADJUSTABLE (means Naik correction is full epsilon and not just mass)\n"); //#endif #ifdef HISQ_FORCE_FILTER node0_printf("HISQ_FORCE_FILTER=%f\n",HISQ_FORCE_FILTER); #endif #ifdef HISQ_REUNIT_ALLOW_SVD node0_printf("HISQ_REUNIT_ALLOW_SVD\n"); #endif #ifdef HISQ_REUNIT_SVD_ONLY node0_printf("HISQ_REUNIT_SVD_ONLY (used together with HISQ_REUNIT_ALLOW_SVD)\n"); #endif #ifdef MILC_GLOBAL_DEBUG node0_printf("MILC_GLOBAL_DEBUG ***********************\n"); #endif #ifdef HISQ_REUNITARIZATION_DEBUG node0_printf("HISQ_REUNITARIZATION_DEBUG is ON\n"); #endif #ifdef HISQ_FF_MULTI_WRAPPER node0_printf("HISQ_FF_MULTI_WRAPPER is ON\n"); #endif #ifdef HISQ_FF_DEBUG node0_printf("HISQ_FF_DEBUG is ON\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 ); #ifdef FIX_NODE_GEOM IF_OK status += get_vi(stdin, prompt, "node_geometry", par_buf.node_geometry, 4); #ifdef FIX_IONODE_GEOM IF_OK status += get_vi(stdin, prompt, "ionode_geometry", par_buf.ionode_geometry, 4); #endif #endif IF_OK status += get_i(stdin, prompt,"iseed", &par_buf.iseed ); /* Number of pseudofermions */ IF_OK status += get_i(stdin, prompt,"n_pseudo", &par_buf.n_pseudo ); if(par_buf.n_pseudo > MAX_N_PSEUDO){ printf("Error: Too many pseudofermion fields. Recompile. Current max is %d\n" ,MAX_N_PSEUDO); terminate(1); } /* get name of file containing rational function parameters */ IF_OK status += get_s(stdin, prompt, "load_rhmc_params", par_buf.rparamfile); /* beta, quark masses */ IF_OK status += get_f(stdin, prompt,"beta", &par_buf.beta ); IF_OK status += get_i(stdin, prompt,"n_dyn_masses", &par_buf.n_dyn_masses ); IF_OK status += get_vf(stdin, prompt, "dyn_mass", par_buf.dyn_mass, par_buf.n_dyn_masses); IF_OK status += get_vi(stdin, prompt, "dyn_flavors", par_buf.dyn_flavors, par_buf.n_dyn_masses); IF_OK status += get_f(stdin, prompt,"u0", &par_buf.u0 ); 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; #ifdef FIX_NODE_GEOM for(i = 0; i < 4; i++) node_geometry[i] = par_buf.node_geometry[i]; #ifdef FIX_IONODE_GEOM for(i = 0; i < 4; i++) ionode_geometry[i] = par_buf.ionode_geometry[i]; #endif #endif iseed = par_buf.iseed; n_pseudo = par_buf.n_pseudo; strcpy(rparamfile,par_buf.rparamfile); this_node = mynode(); number_of_nodes = numnodes(); volume=nx*ny*nz*nt; total_iters=0; /* Load rational function parameters */ rparam = load_rhmc_params(rparamfile, n_pseudo); if(rparam == NULL)terminate(1); /* Determine the maximum rational fcn order */ max_rat_order = 0; for(i = 0; i < n_pseudo; i++){ if(rparam[i].MD.order > max_rat_order)max_rat_order = rparam[i].MD.order; if(rparam[i].GR.order > max_rat_order)max_rat_order = rparam[i].GR.order; if(rparam[i].FA.order > max_rat_order)max_rat_order = rparam[i].FA.order; } node0_printf("Maximum rational func order is %d\n",max_rat_order); /* Determine the number of different Naik masses */ current_naik_mass = rparam[0].naik_term_epsilon; tmporder = 0; n_naiks = 0; n_order_naik_total = 0; for( i=0; i<n_pseudo; i++ ) { if( rparam[i].naik_term_epsilon != current_naik_mass ) { if( tmporder > 0 ) { n_orders_naik[n_naiks] = tmporder; masses_naik[n_naiks] = current_naik_mass; current_naik_mass = rparam[i].naik_term_epsilon; n_naiks++; n_order_naik_total += tmporder; tmporder = 0; } } tmporder += rparam[i].MD.order; n_pseudo_naik[n_naiks]++; } if( tmporder > 0 ) { n_orders_naik[n_naiks] = tmporder; masses_naik[n_naiks] = current_naik_mass; n_order_naik_total += tmporder; n_naiks++; } // calculate epsilon corrections for different Naik terms if( 0!=masses_naik[0] ) { node0_printf("IN HISQ ACTION FIRST SET OF PSEUDO FERMION FIELDS SHOULD HAVE EPSILON CORRECTION TO NAIK TERM ZERO.\n"); terminate(1); } eps_naik[0] = 0.0; // first set of X links always has 0 correction for( i=1; i<n_naiks; i++ ) { #ifdef HISQ //#ifdef HISQ_NAIK_ADJUSTABLE // value read from rational function file is considered full epsilon correction eps_naik[i] = masses_naik[i]; //#else // value read from rational function file is considered quark mass // and epsilon correction is calculated with the second order perturbation theory, // HISQ_NAIK_2ND_ORDER is set in the hisq_action.h // eps_naik[i] = HISQ_NAIK_2ND_ORDER*masses_naik[i]*masses_naik[i]; //#endif #else /* HISQ */ // IT IS ASSUMED THAT ACTIONS OTHER THAN HISQ DO NOT HAVE // ANY EPSILON CORRECTION TERMS eps_naik[i] = 0; #endif /* HISQ */ } node0_printf("Naik term correction structure of multi_x:\n"); node0_printf("n_naiks %d\n",n_naiks); for( i=0; i<n_naiks; i++ ) { node0_printf("n_pseudo_naik[%d]=%d\n",i,n_pseudo_naik[i]); node0_printf("n_orders_naik[%d]=%d\n",i,n_orders_naik[i]); node0_printf("masses_naik[%d]=%f\n",i,masses_naik[i]); node0_printf("eps_naik[%d]=%f\n",i,eps_naik[i]); } node0_printf("n_order_naik_total %d\n",n_order_naik_total); #ifdef HISQ if( n_naiks+1 > MAX_NAIK ) { node0_printf("MAX_NAIK=%d < n_naiks+1=%d\n", MAX_NAIK, n_naiks+1 ); node0_printf("Increase MAX_NAIK\n"); terminate(1); } #else /* HISQ */ if( n_naiks>1 ) { node0_printf("FOR ACTIONS OTHER THAN HISQ EPSILON CORRECTION IS NOT USED.\n"); node0_printf("ONLY ONE SET OF X LINKS IS USED.\n"); node0_printf("SET ALL naik_mass TO 0 IN RATIONAL FUNCTION FILE.\n"); terminate(1); } #endif /* HISQ */ beta = par_buf.beta; n_dyn_masses = par_buf.n_dyn_masses; for(i = 0; i < n_dyn_masses; i++){ dyn_mass[i] = par_buf.dyn_mass[i]; dyn_flavors[i] = par_buf.dyn_flavors[i]; } u0 = par_buf.u0; return(prompt); }
// ----------------------------------------------------------------- // Read in parameters for SU(3) eigenvalues int readin(int prompt) { // prompt=1 indicates prompts are to be given for input int status; // On node zero, read parameters and send to all other nodes if (this_node == 0) { printf("\n\n"); status = 0; // Always calculating massless eigenvalues IF_OK status += get_i(stdin, prompt, "nsmear", &par_buf.nsmear); IF_OK status += get_f(stdin, prompt, "alpha_hyp0", &par_buf.alpha_hyp0); IF_OK status += get_f(stdin, prompt, "alpha_hyp1", &par_buf.alpha_hyp1); IF_OK status += get_f(stdin, prompt, "alpha_hyp2", &par_buf.alpha_hyp2); IF_OK status += get_f(stdin, prompt, "start", &par_buf.start); IF_OK status += get_i(stdin, prompt, "Nvecs", &par_buf.Nvecs); IF_OK status += get_i(stdin, prompt, "block", &par_buf.block); IF_OK status += get_f(stdin, prompt, "eig_tol", &par_buf.eig_tol); IF_OK status += get_i(stdin, prompt, "maxIter", &par_buf.maxIter); // Find out what kind of starting lattice to use IF_OK status += ask_starting_lattice(stdin, prompt, &par_buf.startflag, par_buf.startfile); if (status > 0) par_buf.stopflag = 1; else par_buf.stopflag = 0; } // Broadcast parameter buffer from node0 to all other nodes broadcast_bytes((char *)&par_buf, sizeof(par_buf)); if (par_buf.stopflag != 0) normal_exit(0); nsmear = par_buf.nsmear; alpha_smear[0] = par_buf.alpha_hyp0; alpha_smear[1] = par_buf.alpha_hyp1; alpha_smear[2] = par_buf.alpha_hyp2; start = par_buf.start; Nvecs = par_buf.Nvecs; block = par_buf.block; eig_tol = par_buf.eig_tol; maxIter = par_buf.maxIter; startflag = par_buf.startflag; strcpy(startfile, par_buf.startfile); // Do whatever is needed to get lattice if (startflag == CONTINUE) rephase(OFF); startlat_p = reload_lattice(startflag, startfile); // If a lattice was read in, put in staggered phase factors // and antiperiodic boundary condition phases_in = OFF; rephase(ON); return 0; }
/* SETUP ROUTINES */ static int initial_set(void) { int prompt,status,i,tmporder; Real current_naik_epsilon; /* On node zero, read lattice size, seed, and send to others */ if(mynode()==0){ /* print banner */ printf("SU3 with improved KS action\n"); printf("Microcanonical simulation with refreshing\n"); printf("Rational function hybrid Monte Carlo algorithm\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"); /* Print list of options selected */ node0_printf("Options selected...\n"); show_generic_opts(); show_generic_ks_opts(); show_generic_ks_md_opts(); #ifdef INT_ALG node0_printf("INT_ALG=%s\n",ks_int_alg_opt_chr()); #endif #if FERM_ACTION == HISQ show_su3_mat_opts(); show_hisq_links_opts(); show_hisq_force_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 ); #ifdef FIX_NODE_GEOM IF_OK status += get_vi(stdin, prompt, "node_geometry", par_buf.node_geometry, 4); #ifdef FIX_IONODE_GEOM IF_OK status += get_vi(stdin, prompt, "ionode_geometry", par_buf.ionode_geometry, 4); #endif #endif IF_OK status += get_i(stdin, prompt,"iseed", &par_buf.iseed ); /* Number of pseudofermions */ IF_OK status += get_i(stdin, prompt,"n_pseudo", &par_buf.n_pseudo ); if(par_buf.n_pseudo > MAX_N_PSEUDO){ printf("Error: Too many pseudofermion fields. Recompile. Current max is %d\n" ,MAX_N_PSEUDO); terminate(1); } /* get name of file containing rational function parameters */ IF_OK status += get_s(stdin, prompt, "load_rhmc_params", par_buf.rparamfile); /* beta, quark masses */ IF_OK status += get_f(stdin, prompt,"beta", &par_buf.beta ); IF_OK status += get_i(stdin, prompt,"n_dyn_masses", &par_buf.n_dyn_masses ); IF_OK status += get_vf(stdin, prompt, "dyn_mass", par_buf.dyn_mass, par_buf.n_dyn_masses); IF_OK status += get_vi(stdin, prompt, "dyn_flavors", par_buf.dyn_flavors, par_buf.n_dyn_masses); IF_OK status += get_f(stdin, prompt,"u0", &par_buf.u0 ); 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; #ifdef FIX_NODE_GEOM for(i = 0; i < 4; i++) node_geometry[i] = par_buf.node_geometry[i]; #ifdef FIX_IONODE_GEOM for(i = 0; i < 4; i++) ionode_geometry[i] = par_buf.ionode_geometry[i]; #endif #endif iseed = par_buf.iseed; n_pseudo = par_buf.n_pseudo; strcpy(rparamfile,par_buf.rparamfile); this_node = mynode(); number_of_nodes = numnodes(); volume=nx*ny*nz*nt; total_iters=0; #ifdef HISQ_SVD_COUNTER hisq_svd_counter = 0; #endif #ifdef HISQ_FORCE_FILTER_COUNTER hisq_force_filter_counter = 0; #endif /* Load rational function parameters */ rparam = load_rhmc_params(rparamfile, n_pseudo); if(rparam == NULL)terminate(1); /* Determine the maximum rational fcn order */ max_rat_order = 0; for(i = 0; i < n_pseudo; i++){ if(rparam[i].MD.order > max_rat_order)max_rat_order = rparam[i].MD.order; if(rparam[i].GR.order > max_rat_order)max_rat_order = rparam[i].GR.order; if(rparam[i].FA.order > max_rat_order)max_rat_order = rparam[i].FA.order; } node0_printf("Maximum rational func order is %d\n",max_rat_order); /* Determine the number of different Naik masses and fill in n_orders_naik and n_pseudo_naik */ current_naik_epsilon = rparam[0].naik_term_epsilon; tmporder = 0; n_naiks = 0; n_order_naik_total = 0; for( i=0; i<n_pseudo; i++ ) { if( rparam[i].naik_term_epsilon != current_naik_epsilon ) { if( tmporder > 0 ) { n_orders_naik[n_naiks] = tmporder; eps_naik[n_naiks] = current_naik_epsilon; current_naik_epsilon = rparam[i].naik_term_epsilon; n_naiks++; n_order_naik_total += tmporder; tmporder = 0; } } tmporder += rparam[i].MD.order; n_pseudo_naik[n_naiks]++; } if( tmporder > 0 ) { n_orders_naik[n_naiks] = tmporder; eps_naik[n_naiks] = current_naik_epsilon; n_order_naik_total += tmporder; n_naiks++; } #if FERM_ACTION == HISQ // calculate epsilon corrections for different Naik terms if( 0 != eps_naik[0] ) { node0_printf("IN HISQ ACTION FIRST SET OF PSEUDO FERMION FIELDS SHOULD HAVE EPSILON CORRECTION TO NAIK TERM ZERO.\n"); terminate(1); } #endif node0_printf("Naik term correction structure of multi_x:\n"); node0_printf("n_naiks %d\n",n_naiks); for( i=0; i<n_naiks; i++ ) { node0_printf("n_pseudo_naik[%d]=%d\n", i, n_pseudo_naik[i]); node0_printf("n_orders_naik[%d]=%d\n", i, n_orders_naik[i]); #if FERM_ACTION == HISQ node0_printf("eps_naik[%d]=%f\n", i, eps_naik[i]); #endif } node0_printf("n_order_naik_total %d\n",n_order_naik_total); #if FERM_ACTION == HISQ if( n_naiks+1 > MAX_NAIK ) { node0_printf("MAX_NAIK=%d < n_naiks+1=%d\n", MAX_NAIK, n_naiks+1 ); node0_printf("Increase MAX_NAIK\n"); terminate(1); } #else /* HISQ */ if( n_naiks>1 ) { node0_printf("FOR ACTIONS OTHER THAN HISQ EPSILON CORRECTION IS NOT USED.\n"); node0_printf("ONLY ONE SET OF X LINKS IS USED.\n"); node0_printf("SET ALL naik_mass TO 0 IN RATIONAL FUNCTION FILE.\n"); terminate(1); } #endif /* HISQ */ beta = par_buf.beta; n_dyn_masses = par_buf.n_dyn_masses; for(i = 0; i < n_dyn_masses; i++){ dyn_mass[i] = par_buf.dyn_mass[i]; dyn_flavors[i] = par_buf.dyn_flavors[i]; } u0 = par_buf.u0; 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 staggered fermion measurements\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"); 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", ¶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_i(stdin, prompt,"iseed", ¶m.iseed ); 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); if(prompt==2)return prompt; 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); }
/* read in parameters and coupling constants */ int readin(int prompt) { /* read in parameters for U1 monte carlo */ /* argument "prompt" is 1 if prompts are to be given for input */ complex *temp_field; complex *temp_link; register int dir, j; register site *s; int status; Real x; /* On node zero, read parameters and send to all other nodes */ if(this_node==0){ printf("\n\n"); status=0; /* get couplings and broadcast to nodes */ /* beta, mass */ IF_OK status += get_f(stdin, prompt,"mass", &par_buf.mass ); IF_OK status += get_f(stdin, prompt,"u0_s", &par_buf.u0_s ); IF_OK status += get_f(stdin, prompt,"u0_t", &par_buf.u0_t ); IF_OK status += get_f(stdin, prompt,"v_Fermi", &par_buf.v_Fermi); printf("par_buf.v_Fermi = %f\n", par_buf.v_Fermi); /* maximum no. of conjugate gradient iterations */ IF_OK status += get_i(stdin, prompt,"max_cg_iterations", &par_buf.niter ); /* maximum no. of conjugate gradient restarts */ IF_OK status += get_i(stdin, prompt,"max_cg_restarts", &par_buf.nrestart ); /* error per site for conjugate gradient */ IF_OK status += get_f(stdin, prompt,"error_per_site", &x ); IF_OK par_buf.rsqmin = x*x; /* rsqmin is r**2 in conjugate gradient */ /* New conjugate gradient normalizes rsqmin by norm of source */ /* error for propagator conjugate gradient */ IF_OK status += get_f(stdin, prompt,"error_for_propagator", &x ); IF_OK par_buf.rsqprop = x*x; IF_OK status += get_i(stdin, prompt,"Number_of_eigenvals", &par_buf.Nvecs ); IF_OK status += get_i(stdin, prompt,"Max_Rayleigh_iters", &par_buf.MaxIter ); IF_OK status += get_i(stdin, prompt,"Restart_Rayleigh", &par_buf.Restart ); IF_OK status += get_i(stdin, prompt,"Kalkreuter_iters", &par_buf.Kiters ); IF_OK status += get_f(stdin, prompt,"eigenval_tolerance", &par_buf.eigenval_tol ); IF_OK status += get_f(stdin, prompt,"error_decrease", &par_buf.error_decr); /* find out what kind of starting lattice to use */ IF_OK status += ask_starting_lattice(stdin, prompt, &(par_buf.startflag), par_buf.startfile ); if( status > 0)par_buf.stopflag=1; else par_buf.stopflag=0; } /* end if(this_node==0) */ /* Node 0 broadcasts parameter buffer to all other nodes */ broadcast_bytes((char *)&par_buf,sizeof(par_buf)); if( par_buf.stopflag != 0 )return par_buf.stopflag; niter = par_buf.niter; nrestart = par_buf.nrestart; rsqmin = par_buf.rsqmin; rsqprop = par_buf.rsqprop; mass = par_buf.mass; u0_s = par_buf.u0_s; u0_t = par_buf.u0_t; v_Fermi = par_buf.v_Fermi; Nvecs = par_buf.Nvecs ; MaxIter = par_buf.MaxIter ; Restart = par_buf.Restart ; Kiters = par_buf.Kiters ; eigenval_tol = par_buf.eigenval_tol ; error_decr = par_buf.error_decr ; startflag = par_buf.startflag; strcpy(startfile,par_buf.startfile); /* Do whatever is needed to get lattice */ if( startflag == CONTINUE ){ rephase( OFF ); } if( startflag != CONTINUE ) { if(startflag == FRESH ) { coldlat_u1(); //funnylat_u1(); /*testing SciDAC routines and eigenvalues*/ } else { temp_field = (complex *)malloc(sites_on_node*4*sizeof(complex)); if(temp_field == NULL) { printf("Malloc failed to create temp_field in setup\n"); exit(1); } restore_complex_scidac_to_field( startfile, QIO_SERIAL, temp_field, 4); //put back into site structure FORALLSITES(j,s) { for(dir=XUP;dir<=TUP;dir++){ temp_link = temp_field + 4*j + dir; s->link[dir].real = temp_link->real; s->link[dir].imag = temp_link->imag; } } free(temp_field); }//else } //if /* if a lattice was read in, put in KS phases and AP boundary condition */ phases_in = OFF; rephase( ON ); node0_printf("Calling for path table\n");fflush(stdout); /* make table of coefficients and permutations of paths in quark action */ init_path_table(&ks_act_paths); make_path_table(&ks_act_paths, NULL); node0_printf("Done with path table\n");fflush(stdout); return(0); }
/* read in parameters and coupling constants */ int readin(int prompt) { /* read in parameters for su3 monte carlo */ /* argument "prompt" is 1 if prompts are to be given for input */ int status; int i; /* On node zero, read parameters and send to all other nodes */ if(this_node==0){ printf("\n\n"); status=0; /* Number of kappas */ IF_OK status += get_i(stdin, prompt,"number_of_kappas", &par_buf.num_kap ); if( par_buf.num_kap>MAX_KAP ){ printf("num_kap = %d must be <= %d!\n", par_buf.num_kap, MAX_KAP); status++; } /* boundary condition flag */ IF_OK status += get_i(stdin, prompt, "bc_flag", &par_buf.bc_flag); /* Number of APE smearings */ IF_OK status += get_i(stdin, prompt, "num_smear", &par_buf.num_smear); /* APE smearing parameter (Boulder convention) */ IF_OK status += get_f(stdin, prompt, "alpha", &par_buf.alpha); /* To be save initialize the following to zero */ for(i=0;i<MAX_KAP;i++){ kap[i] = 0.0; resid[i] = 0.0; } for(i=0;i<par_buf.num_kap;i++){ IF_OK status += get_f(stdin, prompt,"kappa", &par_buf.kap[i] ); } /* Clover coefficient */ IF_OK status += get_f(stdin, prompt,"clov_c", &par_buf.clov_c ); /* fermion phase factors */ IF_OK status += get_f(stdin, prompt,"ferm_phases[0]", &par_buf.ferm_phas[0] ); IF_OK status += get_f(stdin, prompt,"ferm_phases[1]", &par_buf.ferm_phas[1] ); IF_OK status += get_f(stdin, prompt,"ferm_phases[2]", &par_buf.ferm_phas[2] ); /* maximum no. of conjugate gradient iterations */ IF_OK status += get_i(stdin, prompt,"max_cg_iterations", &par_buf.niter ); /* maximum no. of conjugate gradient restarts */ IF_OK status += get_i(stdin, prompt,"max_cg_restarts", &par_buf.nrestart ); /* error for propagator conjugate gradient */ for(i=0;i<par_buf.num_kap;i++){ IF_OK status += get_f(stdin, prompt,"error_for_propagator", &par_buf.resid[i] ); } /* find out what kind of starting lattice to use */ IF_OK status += ask_starting_lattice(stdin, prompt, &par_buf.startflag, par_buf.startfile ); /* send parameter structure */ if( status > 0)par_buf.stopflag=1; else par_buf.stopflag=0; } /* end if(this_node==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); startflag = par_buf.startflag; bc_flag = par_buf.bc_flag; num_kap = par_buf.num_kap; clov_c = par_buf.clov_c; niter = par_buf.niter; nrestart = par_buf.nrestart; num_smear = par_buf.num_smear; alpha = par_buf.alpha; for(i=0;i<par_buf.num_kap;i++){ kap[i] = par_buf.kap[i]; resid[i] = par_buf.resid[i]; } for(i=0;i<3;i++){ ferm_phases[i] = par_buf.ferm_phas[i]; } strcpy(startfile,par_buf.startfile); for(i=0;i<par_buf.num_kap;i++){ wqs[i].c_src = NULL; wqs[i].wv_src = NULL; wqs[i].type = 0; wqs[i].x0 = 0; wqs[i].y0 = 0; wqs[i].z0 = 0; wqs[i].t0 = 0; strcpy(wqs[i].descrp,"Schroedinger wall source"); } beta = 1e20; /* Only needed in io_helpers for setting boundary fields */ c_t11 = 0; /* Only needed in io_helpers for setting boundary fields */ /* These boundary fields are actually never used here */ /* Do whatever is needed to get lattice */ if( startflag != CONTINUE ){ startlat_p = reload_lattice( startflag, startfile ); invalidate_this_clov(gen_clov); } /* put in fermion phases */ if( startflag != CONTINUE) do_phases(); return(0); }
/* SETUP ROUTINES */ int initial_set() { int prompt,status; int i; /* On node zero, read lattice size, seed, nflavors1, nflavors2, nflavors, and send to others */ if(mynode()==0){ /* print banner */ printf("SU3 gauge utility program\n"); printf("MIMD version 7\n"); printf("Machine = %s, with %d nodes\n",machine_type(),numnodes()); 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_i(stdin, prompt,"iseed", ¶m.iseed ); /* beta, quark masses */ IF_OK status += get_f(stdin, prompt,"beta", ¶m.beta ); IF_OK status += get_i(stdin, prompt,"n_dyn_masses", ¶m.n_dyn_masses ); IF_OK status += get_vf(stdin, prompt, "dyn_mass", param.dyn_mass, param.n_dyn_masses); IF_OK status += get_vi(stdin, prompt, "dyn_flavors", param.dyn_flavors, param.n_dyn_masses); /* Get tadpole factor */ IF_OK status += get_f(stdin, prompt, "u0", ¶m.u0); /* Get translation vector */ 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; #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 iseed=param.iseed; this_node = mynode(); number_of_nodes = numnodes(); volume=nx*ny*nz*nt; beta = param.beta; n_dyn_masses = param.n_dyn_masses; for(i = 0; i < n_dyn_masses; i++){ dyn_mass[i] = param.dyn_mass[i]; dyn_flavors[i] = param.dyn_flavors[i]; } u0 = param.u0; return prompt; }
/* read in parameters and coupling constants */ int readin(int prompt) { /* read in parameters for su3 monte carlo */ /* argument "prompt" is 1 if prompts are to be given for input */ int status; Real x; /* On node zero, read parameters and send to all other nodes */ if(this_node==0){ printf("\n\n"); status=0; /* get couplings and broadcast to nodes */ /* beta, mass */ IF_OK status += get_f(stdin, prompt,"mass", &par_buf.mass ); IF_OK status += get_f(stdin, prompt,"u0", &par_buf.u0 ); /* maximum no. of conjugate gradient iterations */ IF_OK status += get_i(stdin, prompt,"max_cg_iterations", &par_buf.niter ); /* maximum no. of conjugate gradient restarts */ IF_OK status += get_i(stdin, prompt,"max_cg_restarts", &par_buf.nrestart ); /* error per site for conjugate gradient */ IF_OK status += get_f(stdin, prompt,"error_per_site", &x ); IF_OK par_buf.rsqmin = x*x; /* rsqmin is r**2 in conjugate gradient */ /* New conjugate gradient normalizes rsqmin by norm of source */ /* error for propagator conjugate gradient */ IF_OK status += get_f(stdin, prompt,"error_for_propagator", &x ); IF_OK par_buf.rsqprop = x*x; IF_OK status += get_i(stdin, prompt,"Number_of_eigenvals", &par_buf.Nvecs ); IF_OK status += get_i(stdin, prompt,"Max_Rayleigh_iters", &par_buf.MaxIter ); IF_OK status += get_i(stdin, prompt,"Restart_Rayleigh", &par_buf.Restart ); IF_OK status += get_i(stdin, prompt,"Kalkreuter_iters", &par_buf.Kiters ); IF_OK status += get_f(stdin, prompt,"eigenval_tolerance", &par_buf.eigenval_tol ); IF_OK status += get_f(stdin, prompt,"error_decrease", &par_buf.error_decr); /* find out what kind of starting lattice to use */ IF_OK status += ask_starting_lattice(stdin, prompt, &(par_buf.startflag), par_buf.startfile ); if( status > 0)par_buf.stopflag=1; else par_buf.stopflag=0; } /* end if(this_node==0) */ /* Node 0 broadcasts parameter buffer to all other nodes */ broadcast_bytes((char *)&par_buf,sizeof(par_buf)); if( par_buf.stopflag != 0 )return par_buf.stopflag; niter = par_buf.niter; nrestart = par_buf.nrestart; rsqmin = par_buf.rsqmin; rsqprop = par_buf.rsqprop; mass = par_buf.mass; u0 = par_buf.u0; Nvecs = par_buf.Nvecs ; MaxIter = par_buf.MaxIter ; Restart = par_buf.Restart ; Kiters = par_buf.Kiters ; eigenval_tol = par_buf.eigenval_tol ; error_decr = par_buf.error_decr ; startflag = par_buf.startflag; strcpy(startfile,par_buf.startfile); #if ( FERM_ACTION == HISQ || FERM_ACTION == HYPISQ ) n_naiks = 1; eps_naik[0] = 0.0; #endif /* Do whatever is needed to get lattice */ if( startflag == CONTINUE ){ rephase( OFF ); } if( startflag != CONTINUE ) startlat_p = reload_lattice( startflag, startfile ); /* if a lattice was read in, put in KS phases and AP boundary condition */ phases_in = OFF; rephase( ON ); /* Set uptions for fermion links */ #ifdef DBLSTORE_FN /* We want to double-store the links for optimization */ fermion_links_want_back(1); #endif #if ( FERM_ACTION == HISQ || FERM_ACTION == HYPISQ ) fn_links = create_fermion_links_from_site(PRECISION, n_naiks, eps_naik); #else fn_links = create_fermion_links_from_site(PRECISION, 0, NULL); #endif // node0_printf("Calling for path table\n");fflush(stdout); // /* make table of coefficients and permutations of paths in quark action */ // init_path_table(fn_links.ap); // make_path_table(fn_links.ap, NULL); // node0_printf("Done with path table\n");fflush(stdout); return(0); }
/* read in parameters and coupling constants */ int readin(int prompt) { /* read in parameters for su3 monte carlo */ /* argument "prompt" is 1 if prompts are to be given for input */ int status; /* On node zero, read parameters and send to all other nodes */ if(this_node==0){ printf("\n\n"); status=0; /* warms, trajecs */ IF_OK status += get_i(stdin, prompt,"warms", &par_buf.warms ); IF_OK status += get_i(stdin, prompt,"trajecs", &par_buf.trajecs ); /* trajectories between propagator measurements */ IF_OK status += get_i(stdin, prompt,"traj_between_meas", &par_buf.propinterval ); /* get couplings and broadcast to nodes */ /* beta */ IF_OK status += get_f(stdin, prompt,"beta", &par_buf.beta ); /* boundary condition flag */ IF_OK status += get_i(stdin, prompt,"bc_flag", &par_buf.bc_flag ); #if ( defined HMC_ALGORITHM || defined RMD_ALGORITHM ) /* microcanonical time step */ IF_OK status += get_f(stdin, prompt,"microcanonical_time_step", &par_buf.epsilon ); #endif /*microcanonical steps per trajectory */ IF_OK status += get_i(stdin, prompt,"steps_per_trajectory", &par_buf.steps ); #ifdef ORA_ALGORITHM /*qhb steps per trajectory */ IF_OK status += get_i(stdin, prompt,"qhb_steps", &par_buf.stepsQ ); #endif /* find out what kind of starting lattice to use */ IF_OK status += ask_starting_lattice(stdin, prompt, &(par_buf.startflag), par_buf.startfile ); /* find out what to do with lattice at end */ IF_OK status += ask_ending_lattice(stdin, prompt, &(par_buf.saveflag), par_buf.savefile ); IF_OK status += ask_ildg_LFN(stdin, prompt, par_buf.saveflag, par_buf.stringLFN ); /* send parameter structure */ if( status > 0)par_buf.stopflag=1; else par_buf.stopflag=0; } /* end if(this_node==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); warms = par_buf.warms; trajecs = par_buf.trajecs; steps = par_buf.steps; stepsQ = par_buf.stepsQ; propinterval = par_buf.propinterval; startflag = par_buf.startflag; saveflag = par_buf.saveflag; epsilon = par_buf.epsilon; beta = par_buf.beta; bc_flag = par_buf.bc_flag; strcpy(startfile,par_buf.startfile); strcpy(savefile,par_buf.savefile); strcpy(stringLFN, par_buf.stringLFN); c_t11 = 0; /* Do whatever is needed to get lattice */ if( startflag != CONTINUE ) startlat_p = reload_lattice( startflag, startfile ); return(0); } /*readin()*/
/* SETUP ROUTINES */ int initial_set() { int prompt,status; #ifdef FIX_NODE_GEOM int i; #endif /* On node zero, read lattice size, seed and send to others */ if(mynode()==0){ /* print banner */ printf("SU3 with improved KS action\n"); printf("Inversion checking\n"); printf("MIMD version 7\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 ); #ifdef FIX_NODE_GEOM IF_OK status += get_vi(stdin, prompt, "node_geometry", par_buf.node_geometry, 4); #ifdef FIX_IONODE_GEOM IF_OK status += get_vi(stdin, prompt, "ionode_geometry", par_buf.ionode_geometry, 4); #endif #endif 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); if(prompt==2)return prompt; nx=par_buf.nx; ny=par_buf.ny; nz=par_buf.nz; nt=par_buf.nt; iseed=par_buf.iseed; #ifdef FIX_NODE_GEOM for(i = 0; i < 4; i++) node_geometry[i] = par_buf.node_geometry[i]; #ifdef FIX_IONODE_GEOM for(i = 0; i < 4; i++) ionode_geometry[i] = par_buf.ionode_geometry[i]; #endif #endif this_node = mynode(); number_of_nodes = numnodes(); volume=nx*ny*nz*nt; #ifdef HISQ_SVD_COUNTER hisq_svd_counter = 0; #endif #ifdef HISQ_FORCE_FILTER_COUNTER hisq_force_filter_counter = 0; #endif return(prompt); }
static gauge_file *file_scan_scidac(char *filename, int serpar){ QIO_Layout layout; QIO_Filesystem fs; QIO_Reader *infile; QIO_RecordInfo recinfo; QIO_String *recxml; int status; int typesize; su3_matrix *dest = NULL; gauge_file *gf; int ndim; int dims[4]; /* Read header to get lattice dimensions and close the file */ read_lat_dim_scidac(filename, &ndim, dims); nx = dims[0]; ny = dims[1]; nz = dims[2]; nt = dims[3]; volume = nx*ny*nz*nt; /* Finish setting up, now we know the dimensions */ broadcast_bytes((char *)&nx,sizeof(int)); broadcast_bytes((char *)&ny,sizeof(int)); broadcast_bytes((char *)&nz,sizeof(int)); broadcast_bytes((char *)&nt,sizeof(int)); setup_layout(); /* Build the layout structure */ build_qio_layout(&layout); /* Define the I/O nodes */ build_qio_filesystem(&fs); /* Make a dummy gauge file structure for MILC use */ gf = setup_input_gauge_file(filename); /* Set the filename in the gauge_file structure */ gf->filename = filename; /* Reopen file for reading */ QIO_verbose(QIO_VERB_OFF); infile = open_scidac_input(filename, &layout, &fs, serpar); if(infile == NULL)terminate(1); /* Check the record type (double or single precision) */ recxml = QIO_string_create(); status = QIO_read_record_info(infile, &recinfo, recxml); if(status)terminate(1); typesize = QIO_get_typesize(&recinfo); /* Read the lattice field as single or double precision according to the type size (bytes in a single SU(3) matrix) */ if(typesize == 72) status = read_F3_M_to_null(infile, recxml, dest, LATDIM); else if (typesize == 144) status = read_D3_M_to_null(infile, recxml, dest, LATDIM); else { node0_printf("file_scan_scidac: Bad typesize %d\n",typesize); terminate(1); } if(status){ node0_printf("ERROR scanning file\n"); } else { node0_printf("SUCCESS scanning file\n"); } /* Discard for now */ QIO_string_destroy(recxml); /* Close the file */ QIO_close_read(infile); return gf; }