/* 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); }
/* 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); }
// ----------------------------------------------------------------- // 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); }
/* 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); }
main_status end(const img_arr_t&, const sound_arr_t& sound, const config_info::lang_table_t& lang_table) { for (auto& s : sound) s.second.stop();//BGM全部停止 //フォントの定義 static const int font_title = CreateFontToHandle(nullptr, 100, 5, DX_FONTTYPE_EDGE);//タイトルロゴ static const int font_1 = CreateFontToHandle(nullptr, 30, 1, DX_FONTTYPE_ANTIALIASING);//「Xキーを押してね」の奴 keystate state; auto normal_con_f = []() -> bool { bool re = -1 != ProcessMessage() && 0 == ScreenFlip() && 0 == ClearDrawScreen(); if (!re) throw std::runtime_error("ProcessMessage() return -1."); return re; }; bool is_normal_state = normal_con_f(); DrawBox(0, 0, WINDOW.width, WINDOW.height, GetColor(200, 200, 100), TRUE); //背景 DrawStringToHandle(WINDOW.width * 37 / 320, WINDOW.height / 4, (L"- " + lang_table.at(L"I did it!") + L" -").c_str(), GetColor(250, 0, 0), font_title); DrawStringToHandle(WINDOW.width * 13 / 40, WINDOW.height / 4 + 250, (L"- " + lang_table.at(L"Press X") + L" -").c_str(), GetColor(0, 0, 0), font_1); is_normal_state = normal_con_f(); while ((is_normal_state = -1 != ProcessMessage()) && state.update() && !state[KEY_INPUT_X] && !state.esc()) { std::this_thread::sleep_for(std::chrono::milliseconds(50)); } if (!is_normal_state) throw std::runtime_error("ProcessMessage() return -1."); if (state.esc()) throw normal_exit(); return main_status::title; }
/* 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; }
/* 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()*/
int main(int argc, char *argv[]) { int ndim,dims[4]; gauge_file *gf; gauge_header *gh; FILE *fp; char *filename_milc,*filename_scidac; QIO_Layout layout; QIO_Reader *infile; QIO_RecordInfo rec_info; char *datatype; int status; int datum_size; int input_prec; int count = 4; int word_size; int typesize; w_serial_site_writer state; if(argc < 3) { fprintf(stderr,"Usage %s <SciDAC file> <MILC file>\n",argv[0]); exit(1); } filename_scidac = argv[1]; filename_milc = argv[2]; if(this_node == 0)printf("Converting file %s to MILC v5 file %s\n", filename_scidac, filename_milc); initialize_machine(&argc,&argv); #ifdef HAVE_QDP QDP_initialize(&argc, &argv); #endif this_node = mynode(); number_of_nodes = numnodes(); if(number_of_nodes != 1){ printf("This is single-processor code. Please rebuild as such.\n"); terminate(1); } /* Open the SciDAC file and discover the lattice dimensions. Then close. */ status = read_lat_dim_scidac(filename_scidac, &ndim, dims); if(status)terminate(1); if(ndim != 4){ printf("Wanted ndims = 4 in %s but got %d\n",filename_scidac,ndim); terminate(1); } 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 */ setup(); /* Build the QIO layout */ build_qio_layout(&layout); /* Open the SciDAC file for reading */ infile = open_scidac_input(filename_scidac, &layout, 0, QIO_SERIAL); if(infile == NULL)terminate(1); /* Open the MILC v5 file for writing */ fp = fopen(filename_milc, "wb"); if(fp == NULL) { printf("Can't open file %s, error %d\n", filename_milc,errno);fflush(stdout); terminate(1); } gf = setup_output_gauge_file(); gh = gf->header; /* Read the SciDAC record header. */ xml_record_in = QIO_string_create(); status = QIO_read_record_info(infile, &rec_info, xml_record_in); if(status != QIO_SUCCESS)terminate(1); node0_printf("Record info \n\"%s\"\n",QIO_string_ptr(xml_record_in)); /* Make sure this is a lattice field */ datatype = QIO_get_datatype(&rec_info); typesize = QIO_get_typesize(&rec_info); if(strcmp(datatype, "QDP_F3_ColorMatrix") == 0 || strcmp(datatype, "USQCD_F3_ColorMatrix") == 0 || typesize == 72){ datum_size = sizeof(fsu3_matrix); input_prec = 1; word_size = sizeof(float); } else if(strcmp(datatype, "QDP_D3_ColorMatrix") == 0 || strcmp(datatype, "USQCD_F3_ColorMatrix") == 0 || typesize == 144){ datum_size = sizeof(dsu3_matrix); input_prec = 2; word_size = sizeof(double); } else { printf("Unrecognized datatype %s\n",datatype); terminate(1); } /* Copy the time stamp from the SciDAC file */ strncpy(gh->time_stamp, QIO_get_record_date(&rec_info), MAX_TIME_STAMP); gh->time_stamp[MAX_TIME_STAMP-1] = '\0'; /* Write the MILC v5 header */ gh->order = NATURAL_ORDER; /* Node 0 writes the header */ swrite_gauge_hdr(fp,gh); /* Assign values to file structure */ gf->fp = fp; gf->filename = filename_milc; gf->byterevflag = 0; /* Not used for writing */ gf->rank2rcv = NULL; /* Not used for writing */ gf->parallel = 0; /* Initialize writing the lattice data */ w_serial_start_lattice(gf, &state, input_prec); /* Read the SciDAC record data. The factory function writes the site links to a file. */ status = QIO_read_record_data(infile, w_serial_site_links, datum_size*count, word_size, (void *)&state); if(status != QIO_SUCCESS)terminate(1); node0_printf("SciDAC checksums %x %x\n", QIO_get_reader_last_checksuma(infile), QIO_get_reader_last_checksumb(infile)); /* Close the SciDAC file */ QIO_close_read(infile); /* Finish the MILC v5 file */ w_serial_finish_lattice(&state); w_serial_f(gf); QIO_string_destroy(xml_record_in); #ifdef HAVE_QDP QDP_finalize(); #endif normal_exit(0); 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); }
int main(int argc, char *argv[]) { int prompt; complex **qin; Real *q; double starttime, endtime; int jflav, k; int key[4] = {1,1,1,1}; /* 4D Fourier transform */ initialize_machine(&argc,&argv); /* Remap standard I/O */ if(remap_stdio_from_args(argc, argv) == 1)terminate(1); g_sync(); starttime=dclock(); /* set up */ prompt = setup(); /* Set up for Fourier transform in all directions */ if(prompt != 2)setup_restrict_fourier(key, NULL); /* loop over input sets */ while( readin(prompt) == 0){ if(prompt == 2)continue; /* For testing */ /* Create qin array */ qin = (complex **)malloc(sizeof(complex *)*param.nrand); if(qin == NULL){ node0_printf("main: No room for qin\n"); terminate(1); } for(k = 0; k < param.nrand; k++){ qin[k] = create_c_array_field(NMU); if(qin[k] == NULL){ node0_printf("main: No room for qin[%d]\n",k); terminate(1); } } for(jflav = 0; jflav < param.nflav; jflav++){ /* Allocate space and read all the data for flavor "jflav" */ /* Accumulate the result in qin, weighted by the charge */ accumulate_current_density(param.fname[jflav], qin, param.charges[jflav], ¶m.mass[jflav], param.nrand); } /* Calculate the density-density correlator q */ q = rcorr(qin, param.nrand); /* Destroy qin array */ for(k = 0; k < param.nrand; k++) destroy_c_array_field(qin[k], NMU); free(qin); /* Symmetrize over hypercubic group transformations */ symmetrize(q); /* Write the results to the specified file */ print_result(q, param.nrand); destroy_r_field(q); } /* readin(prompt) */ node0_printf("RUNNING COMPLETED\n"); endtime=dclock(); node0_printf("Time = %e seconds\n",(double)(endtime-starttime)); normal_exit(0); return 0; }
int main( int argc, char **argv ) { int meascount,traj_done; int prompt; int s_iters, avs_iters, avspect_iters, avbcorr_iters; double dtime, dclock(); initialize_machine(&argc,&argv); #ifdef HAVE_QDP QDP_initialize(&argc, &argv); #endif /* Remap standard I/O */ if(remap_stdio_from_args(argc, argv) == 1)terminate(1); g_sync(); /* set up */ prompt = setup(); // restore_random_state_scidac_to_site("randsave", F_OFFSET(site_prn)); // restore_color_vector_scidac_to_site("xxx1save", F_OFFSET(xxx1),1); // restore_color_vector_scidac_to_site("xxx2save", F_OFFSET(xxx2),1); /* loop over input sets */ while( readin(prompt) == 0) { /* perform warmup trajectories */ dtime = -dclock(); for( traj_done=0; traj_done < warms; traj_done++ ){ update(); } node0_printf("WARMUPS COMPLETED\n"); fflush(stdout); /* perform measuring trajectories, reunitarizing and measuring */ meascount=0; /* number of measurements */ avspect_iters = avs_iters = avbcorr_iters = 0; for( traj_done=0; traj_done < trajecs; traj_done++ ){ /* do the trajectories */ s_iters=update(); /* measure every "propinterval" trajectories */ if( (traj_done%propinterval)==(propinterval-1) ){ /* call gauge_variable fermion_variable measuring routines */ /* results are printed in output file */ rephase(OFF); g_measure( ); rephase(ON); /* Load fat and long links for fermion measurements */ load_ferm_links(&fn_links, &ks_act_paths); #ifdef DM_DU0 load_ferm_links(&fn_links_dmdu0, &ks_act_paths_dmdu0); #endif /* Measure pbp, etc */ #ifdef ONEMASS f_meas_imp(F_OFFSET(phi),F_OFFSET(xxx),mass, &fn_links, &fn_links_dmdu0); #else f_meas_imp( F_OFFSET(phi1), F_OFFSET(xxx1), mass1, &fn_links, &fn_links_dmdu0); f_meas_imp( F_OFFSET(phi2), F_OFFSET(xxx2), mass2, &fn_links, &fn_links_dmdu0); #endif /* Measure derivatives wrto chemical potential */ #ifdef D_CHEM_POT #ifdef ONEMASS Deriv_O6( F_OFFSET(phi1), F_OFFSET(xxx1), F_OFFSET(xxx2), mass, &fn_links, &fn_links_dmdu0); #else Deriv_O6( F_OFFSET(phi1), F_OFFSET(xxx1), F_OFFSET(xxx2), mass1, &fn_links, &fn_links_dmdu0); Deriv_O6( F_OFFSET(phi1), F_OFFSET(xxx1), F_OFFSET(xxx2), mass2, &fn_links, &fn_links_dmdu0); #endif #endif #ifdef SPECTRUM /* Fix TUP Coulomb gauge - gauge links only*/ rephase( OFF ); gaugefix(TUP,(Real)1.8,500,(Real)GAUGE_FIX_TOL); rephase( ON ); #ifdef FN invalidate_all_ferm_links(&fn_links); #ifdef DM_DU0 invalidate_all_ferm_links(&fn_links_dmdu0); #endif #endif /* Load fat and long links for fermion measurements */ load_ferm_links(&fn_links, &ks_act_paths); #ifdef DM_DU0 load_ferm_links(&fn_links_dmdu0, &ks_act_paths_dmdu0); #endif if(strstr(spectrum_request,",spectrum,") != NULL){ #ifdef ONEMASS avspect_iters += spectrum2(mass,F_OFFSET(phi),F_OFFSET(xxx), &fn_links); #else avspect_iters += spectrum2( mass1, F_OFFSET(phi1), F_OFFSET(xxx1), &fn_links); avspect_iters += spectrum2( mass2, F_OFFSET(phi1), F_OFFSET(xxx1), &fn_links); #endif } if(strstr(spectrum_request,",spectrum_point,") != NULL){ #ifdef ONEMASS avspect_iters += spectrum_fzw(mass,F_OFFSET(phi),F_OFFSET(xxx), &fn_links); #else avspect_iters += spectrum_fzw( mass1, F_OFFSET(phi1), F_OFFSET(xxx1), &fn_links); avspect_iters += spectrum_fzw( mass2, F_OFFSET(phi1), F_OFFSET(xxx1), &fn_links); #endif } if(strstr(spectrum_request,",nl_spectrum,") != NULL){ #ifdef ONEMASS avspect_iters += nl_spectrum(mass,F_OFFSET(phi),F_OFFSET(xxx), F_OFFSET(tempmat1),F_OFFSET(staple), &fn_links); #else avspect_iters += nl_spectrum( mass1, F_OFFSET(phi1), F_OFFSET(xxx1), F_OFFSET(tempmat1),F_OFFSET(staple), &fn_links); #endif } if(strstr(spectrum_request,",spectrum_mom,") != NULL){ #ifdef ONEMASS avspect_iters += spectrum_mom(mass,mass,F_OFFSET(phi),5e-3, &fn_links); #else avspect_iters += spectrum_mom( mass1, mass1, F_OFFSET(phi1), 1e-1, &fn_links); #endif } if(strstr(spectrum_request,",spectrum_multimom,") != NULL){ #ifdef ONEMASS avspect_iters += spectrum_multimom(mass, spectrum_multimom_low_mass, spectrum_multimom_mass_step, spectrum_multimom_nmasses, 5e-3, &fn_links); #else avspect_iters += spectrum_multimom(mass1, spectrum_multimom_low_mass, spectrum_multimom_mass_step, spectrum_multimom_nmasses, 5e-3, &fn_links); #endif } #ifndef ONEMASS if(strstr(spectrum_request,",spectrum_nd,") != NULL){ avspect_iters += spectrum_nd( mass1, mass2, 1e-1, &fn_links); } #endif if(strstr(spectrum_request,",spectrum_nlpi2,") != NULL){ #ifdef ONEMASS avspect_iters += spectrum_nlpi2(mass,mass,F_OFFSET(phi),5e-3, &fn_links ); #else avspect_iters += spectrum_nlpi2( mass1, mass1, F_OFFSET(phi1),1e-1, &fn_links ); avspect_iters += spectrum_nlpi2( mass2, mass2, F_OFFSET(phi1),1e-1, &fn_links ); #endif } if(strstr(spectrum_request,",spectrum_singlets,") != NULL){ #ifdef ONEMASS avspect_iters += spectrum_singlets(mass, 5e-3, F_OFFSET(phi), &fn_links); #else avspect_iters += spectrum_singlets(mass1, 5e-3, F_OFFSET(phi1), &fn_links ); avspect_iters += spectrum_singlets(mass2, 5e-3, F_OFFSET(phi1), &fn_links ); #endif } if(strstr(spectrum_request,",fpi,") != NULL) { avspect_iters += fpi_2( fpi_mass, fpi_nmasses, 2e-3, &fn_links ); } #ifdef HYBRIDS if(strstr(spectrum_request,",spectrum_hybrids,") != NULL){ #ifdef ONEMASS avspect_iters += spectrum_hybrids( mass,F_OFFSET(phi),1e-1, &fn_links); #else avspect_iters += spectrum_hybrids( mass1, F_OFFSET(phi1), 5e-3, &fn_links); avspect_iters += spectrum_hybrids( mass2, F_OFFSET(phi1), 2e-3, &fn_links); #endif } #endif if(strstr(spectrum_request,",hvy_pot,") != NULL){ rephase( OFF ); hvy_pot( F_OFFSET(link[XUP]) ); rephase( ON ); } #endif /* SPECTRUM */ avs_iters += s_iters; ++meascount; fflush(stdout); } } /* end loop over trajectories */ node0_printf("RUNNING COMPLETED\n"); fflush(stdout); if(meascount>0) { node0_printf("average cg iters for step= %e\n", (double)avs_iters/meascount); #ifdef SPECTRUM node0_printf("average cg iters for spectrum = %e\n", (double)avspect_iters/meascount); #endif } dtime += dclock(); if(this_node==0){ printf("Time = %e seconds\n",dtime); printf("total_iters = %d\n",total_iters); } fflush(stdout); /* save lattice if requested */ if( saveflag != FORGET ){ rephase( OFF ); save_lattice( saveflag, savefile, stringLFN ); rephase( ON ); #ifdef HAVE_QIO // save_random_state_scidac_from_site("randsave", "Dummy file XML", // "Random number state", QIO_SINGLEFILE, F_OFFSET(site_prn)); // save_color_vector_scidac_from_site("xxx1save", "Dummy file XML", // "xxx vector", QIO_SINGLEFILE, F_OFFSET(xxx1),1); // save_color_vector_scidac_from_site("xxx2save", "Dummy file XML", // "xxx vector", QIO_SINGLEFILE, F_OFFSET(xxx2),1); #endif } } #ifdef HAVE_QDP QDP_finalize(); #endif normal_exit(0); return 0; }
int main( int argc, char **argv ) { int meascount,traj_done,i; int prompt; int s_iters, avs_iters, avspect_iters, avbcorr_iters; double dtime, dclock(); initialize_machine(&argc,&argv); #ifdef HAVE_QDP QDP_initialize(&argc, &argv); #ifndef QDP_PROFILE QDP_profcontrol(0); #endif #endif /* Remap standard I/O */ if(remap_stdio_from_args(argc, argv) == 1)terminate(1); g_sync(); /* set up */ prompt = setup(); /* loop over input sets */ while( readin(prompt) == 0) { /* perform warmup trajectories */ #ifdef MILC_GLOBAL_DEBUG global_current_time_step = 0; #endif /* MILC_GLOBAL_DEBUG */ dtime = -dclock(); for( traj_done=0; traj_done < warms; traj_done++ ){ update(); } node0_printf("WARMUPS COMPLETED\n"); fflush(stdout); /* perform measuring trajectories, reunitarizing and measuring */ meascount=0; /* number of measurements */ avspect_iters = avs_iters = avbcorr_iters = 0; for( traj_done=0; traj_done < trajecs; traj_done++ ){ #ifdef MILC_GLOBAL_DEBUG #ifdef HISQ_REUNITARIZATION_DEBUG { int isite, idir; site *s; FORALLSITES(isite,s) { for( idir=XUP;idir<=TUP;idir++ ) { lattice[isite].on_step_Y[idir] = 0; lattice[isite].on_step_W[idir] = 0; lattice[isite].on_step_V[idir] = 0; } } } #endif /* HISQ_REUNITARIZATION_DEBUG */ #endif /* MILC_GLOBAL_DEBUG */ /* do the trajectories */ s_iters=update(); /* measure every "propinterval" trajectories */ if( (traj_done%propinterval)==(propinterval-1) ){ /* call gauge_variable fermion_variable measuring routines */ /* results are printed in output file */ rephase(OFF); g_measure( ); rephase(ON); #ifdef MILC_GLOBAL_DEBUG #ifdef HISQ g_measure_plaq( ); #endif #ifdef MEASURE_AND_TUNE_HISQ g_measure_tune( ); #endif /* MEASURE_AND_TUNE_HISQ */ #endif /* MILC_GLOBAL_DEBUG */ /************************************************************/ /* WARNING: The spectrum code below is under revision */ /* It works only in special cases */ /* For the asqtad spectrum, please create the lattice first */ /* and then run the appropriate executable in ks_imp_dyn. */ /************************************************************/ /* Do some fermion measurements */ #ifdef SPECTRUM /* Fix TUP Coulomb gauge - gauge links only*/ rephase( OFF ); gaugefix(TUP,(Real)1.8,500,(Real)GAUGE_FIX_TOL); rephase( ON ); invalidate_all_ferm_links(&fn_links); #ifdef DM_DU0 invalidate_all_ferm_links(&fn_links_dmdu0); #endif #endif for(i=0;i<n_dyn_masses;i++){ // Remake the path table if the fermion coeffs change for this mass // DT IT CAN"T BE RIGHT TO CALL IT WITH dyn_mass //if(make_path_table(&ks_act_paths, &ks_act_paths_dmdu0,dyn_mass[i])) //AB: NOT SURE IF WE ARE DOING THIS RIGHT HERE // HAVE TO THINK THROUGH HOW LINKS ARE LOADED FOR MEASUREMENTS // AND WHERE NAIK CORRECTION CAN EVER POSSIBLY ENTER // if(make_path_table(&ks_act_paths, &ks_act_paths_dmdu0, 0.0/*TEMP*/ )) { // If they change, invalidate only fat and long links //node0_printf("INVALIDATE\n"); invalidate_all_ferm_links(&fn_links); #ifdef DM_DU0 invalidate_all_ferm_links(&fn_links_dmdu0); #endif } /* Load fat and long links for fermion measurements if needed */ #ifdef HISQ //AB: QUICK FIX TO USE NAIK EPSILON FOR SPECTRUM MEASUREMENTS, // WORKS ONLY IF IN THE RATIONAL FUNCTION FILE naik_term_epsilon IS NON-ZERO // FOR LAST PSEUDO-FIELD // IT IS ASSUMED THAT THIS CORRECTION CORRESPONDS TO LAST DYNAMICAL MASS //AB: OLD WAY OF INITIALIZING THE LINKS: fn_links.hl.current_X_set = 0; // INSTEAD WE DO: //// if(n_dyn_masses-1==i) { // last dynamical mass, assumed to be c-quark //// fn_links.hl.current_X_set = n_naiks-1; //DT CHARM QUARK NEEDS SMALLER RESIDUAL //// node0_printf("TEMP: reset rsqprop from %e to %e\n",rsqprop,1e-8*rsqprop); //// rsqprop *= 1e-8; //// } //// else { // light quarks fn_links.hl.current_X_set = 0; //// } #endif load_ferm_links(&fn_links, &ks_act_paths); #ifdef DM_DU0 #ifdef HISQ fn_links_dmdu0.hl.current_X_set = 0; #endif load_ferm_links(&fn_links_dmdu0, &ks_act_paths_dmdu0); #endif f_meas_imp( F_OFFSET(phi1), F_OFFSET(xxx1), dyn_mass[i], &fn_links, &fn_links_dmdu0); /* Measure derivatives wrto chemical potential */ #ifdef D_CHEM_POT Deriv_O6( F_OFFSET(phi1), F_OFFSET(xxx1), F_OFFSET(xxx2), dyn_mass[i], &fn_links, &fn_links_dmdu0); #endif #ifdef SPECTRUM // DT: At the moment spectrum_nd does only the first two masses // this only makes sense to get the kaon, and only works if // eps_naik is the same for both the first two quarks if( strstr(spectrum_request,",spectrum_nd,") != NULL && i==0 ) avspect_iters += spectrum_nd( dyn_mass[0], dyn_mass[1], 1e-2, &fn_links); // AB: spectrum() is used only for the charm quark, // i.e., last dynamical mass if(strstr(spectrum_request,",spectrum,") != NULL && n_dyn_masses-1==i) avspect_iters += spectrum2( dyn_mass[i], F_OFFSET(phi1), F_OFFSET(xxx1), &fn_links); if(strstr(spectrum_request,",spectrum_point,") != NULL) avspect_iters += spectrum_fzw( dyn_mass[i], F_OFFSET(phi1), F_OFFSET(xxx1), &fn_links); // AB: nl_spectrum is used only for strange, // i.e., second mass if(strstr(spectrum_request,",nl_spectrum,") != NULL && 1==i) avspect_iters += nl_spectrum( dyn_mass[i], F_OFFSET(phi1), F_OFFSET(xxx1), F_OFFSET(tempmat1), F_OFFSET(staple), &fn_links); // AB: spectrum_mom is used only for charm, // i.e., last mass if(strstr(spectrum_request,",spectrum_mom,") != NULL && n_dyn_masses-1==i) avspect_iters += spectrum_mom( dyn_mass[i], dyn_mass[i], F_OFFSET(phi1), 1e-1, &fn_links); // For now we can't do the off-diagonal spectrum if Dirac operators // depend on masses. We need two propagators // if(strstr(spectrum_request,",spectrum_multimom,") != NULL) // avspect_iters += spectrum_multimom(dyn_mass[i], // spectrum_multimom_low_mass, // spectrum_multimom_mass_step, // spectrum_multimom_nmasses, // 5e-3, &fn_links); // For now we can't do the off-diagonal spectrum if Dirac operators // depend on masses. We need two propagators // if(strstr(spectrum_request,",spectrum_nd,") != NULL){ // avspect_iters += spectrum_nd( mass1, mass2, 1e-1, // &fn_links); // AB: spectrum_nlpi2 is used only for up/down, // i.e., first mass if(strstr(spectrum_request,",spectrum_nlpi2,") != NULL && 0==i) avspect_iters += spectrum_nlpi2( dyn_mass[i], dyn_mass[i], F_OFFSET(phi1),1e-1, &fn_links ); if(strstr(spectrum_request,",spectrum_singlets,") != NULL) avspect_iters += spectrum_singlets(dyn_mass[i], 5e-3, F_OFFSET(phi1), &fn_links ); // For now we can't do the off-diagonal spectrum if Dirac operators // depend on masses. We need two propagators // if(strstr(spectrum_request,",fpi,") != NULL) // avspect_iters += fpi_2( fpi_mass, fpi_nmasses, 2e-3, // &fn_links ); #ifdef HYBRIDS if(strstr(spectrum_request,",spectrum_hybrids,") != NULL) avspect_iters += spectrum_hybrids( dyn_mass[i], F_OFFSET(phi1), 5e-3, &fn_links); #endif if(strstr(spectrum_request,",hvy_pot,") != NULL){ rephase( OFF ); hvy_pot( F_OFFSET(link[XUP]) ); rephase( ON ); } #endif // if(n_dyn_masses-1==i) { // last dynamical mass, assumed to be c-quark //DT CHARM QUARK NEEDS SMALLER RESIDUAL //AB NEED TO RETURN RESIDUAL TO THE ORIGINAL VALUE // node0_printf("TEMP: reset rsqprop from %e to %e\n",rsqprop,1e+8*rsqprop); // rsqprop *= 1e+8; // } } avs_iters += s_iters; ++meascount; fflush(stdout); } } /* end loop over trajectories */ node0_printf("RUNNING COMPLETED\n"); fflush(stdout); if(meascount>0) { node0_printf("average cg iters for step= %e\n", (double)avs_iters/meascount); } dtime += dclock(); if(this_node==0){ printf("Time = %e seconds\n",dtime); printf("total_iters = %d\n",total_iters); } fflush(stdout); /* save lattice if requested */ if( saveflag != FORGET ){ rephase( OFF ); save_lattice( saveflag, savefile, stringLFN ); rephase( ON ); } } #ifdef HAVE_QDP QDP_finalize(); #endif normal_exit(0); 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 */ 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); }
/* 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); }
/* 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; /* 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, kappa */ IF_OK status += get_f(stdin, prompt,"beta", &par_buf.beta ); IF_OK status += get_f(stdin, prompt,"kappa", &par_buf.kappa ); /* microcanonical time step */ IF_OK status += get_f(stdin, prompt,"microcanonical_time_step", &par_buf.epsilon ); /*microcanonical steps per trajectory */ IF_OK status += get_i(stdin, prompt,"steps_per_trajectory", &par_buf.steps ); /* maximum no. of conjugate gradient iterations */ IF_OK status += get_i(stdin, prompt,"max_cg_iterations", &par_buf.niter); /* 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 */ /* error for propagator conjugate gradient */ IF_OK status += get_f(stdin, prompt,"error_for_propagator", &x ); IF_OK par_buf.rsqprop = x*x; /* 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; propinterval = par_buf.propinterval; startflag = par_buf.startflag; saveflag = par_buf.saveflag; niter = par_buf.niter; rsqmin = par_buf.rsqmin; rsqprop = par_buf.rsqprop; epsilon = par_buf.epsilon; beta = par_buf.beta; kappa = par_buf.kappa; strcpy(startfile,par_buf.startfile); strcpy(savefile,par_buf.savefile); strcpy(stringLFN, par_buf.stringLFN); /* Do whatever is needed to get lattice */ if( startflag != CONTINUE ) startlat_p = reload_lattice( startflag, startfile ); return(0); }
/* 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); }
int main(int argc, char *argv[]) { int prompt; int i, j, iq0, iq1; #ifdef CLOV_LEAN int oldiq0, oldiq1, oldip0; #endif double starttime, endtime; #ifdef PRTIME double dtime; #endif wilson_prop_field *prop[MAX_PROP]; wilson_prop_field *quark[MAX_QK]; initialize_machine(&argc,&argv); /* Remap standard I/O */ if(remap_stdio_from_args(argc, argv) == 1)terminate(1); g_sync(); starttime=dclock(); /* set up */ STARTTIME; prompt = setup(); ENDTIME("setup"); /* loop over input sets */ while( readin(prompt) == 0){ if(prompt == 2)continue; total_iters=0; #ifdef HISQ_SVD_COUNTER hisq_svd_counter = 0; #endif /**************************************************************/ /* Set up gauge field */ if( param.fixflag == COULOMB_GAUGE_FIX) { if(this_node == 0) printf("Fixing to Coulomb gauge\n"); STARTTIME; gaugefix(TUP,(Real)1.5,500,GAUGE_FIX_TOL); ENDTIME("gauge fix"); /* (Re)construct APE smeared links after gauge fixing. No KS phases here! */ destroy_ape_links_3D(ape_links); ape_links = ape_smear_3D( param.staple_weight, param.ape_iter ); invalidate_this_clov(gen_clov); } else if(this_node == 0)printf("COULOMB GAUGE FIXING SKIPPED.\n"); /* save lattice if requested */ if( param.saveflag != FORGET ){ savelat_p = save_lattice( param.saveflag, param.savefile, param.stringLFN ); } else { savelat_p = NULL; } if(this_node==0)printf("END OF HEADER\n"); /**************************************************************/ /* Loop over the propagators */ STARTTIME; for(i=0; i<param.num_prop; i++){ node0_printf("******* Creating propagator %d ********\n",i);fflush(stdout); /**************************************************************/ /* Read and/or generate quark propagator */ if(param.prop_type[i] == CLOVER_TYPE) { int ncolor = convert_ksource_to_color(param.src_qs[i].nsource); prop[i] = create_wp_field(ncolor); node0_printf("Generate Dirac propagator\n"); node0_printf("Kappa= %g source %s residue= %g rel= %g\n", (double)param.dcp[i].Kappa, param.src_qs[i].descrp, (double)param.qic[i].resid, (double)param.qic[i].relresid); /* For clover_info */ wqstmp = param.src_qs[i]; dcptmp = param.dcp[i]; total_iters += get_wprop_to_wp_field(param.prop_type[i], param.startflag_w[i], param.startfile_w[i], param.saveflag_w[i], param.savefile_w[i], prop[i], ¶m.src_qs[i], ¶m.qic[i], (void *)¶m.dcp[i], param.bdry_phase[i], param.coord_origin, param.check[i]); #ifdef CLOV_LEAN /* Free clover prop memory if we have saved the prop to disk */ if(param.saveflag_w[i] != FORGET){ free_wp_field(prop[i]); clear_qs(¶m.src_qs[i]); node0_printf("destroy prop[%d]\n",i); } #endif } /* ------------------------------------------- */ else if(param.prop_type[i] == IFLA_TYPE) { int ncolor = convert_ksource_to_color(param.src_qs[i].nsource); prop[i] = create_wp_field(ncolor); node0_printf("Generate Dirac IFLA propagator\n"); if(this_node==0)printf("Kappa= %g source %s residue= %g rel= %g\n", (double)param.nap[i].kapifla, param.src_qs[i].descrp, (double)param.qic[i].resid, (double)param.qic[i].relresid); /* For clover_info */ wqstmp = param.src_qs[i]; naptmp = param.nap[i]; total_iters += get_wprop_to_wp_field(param.prop_type[i], param.startflag_w[i], param.startfile_w[i], param.saveflag_w[i], param.savefile_w[i], prop[i], ¶m.src_qs[i], ¶m.qic[i], (void *)¶m.nap[i], param.bdry_phase[i], param.coord_origin, param.check[i]); #ifdef CLOV_LEAN /* Free clover prop memory if we have saved the prop to disk */ if(param.saveflag_w[i] != FORGET){ free_wp_field(prop[i]); clear_qs(¶m.src_qs[i]); node0_printf("destroy prop[%d]\n",i); } #endif } else if(param.prop_type[i] == KS_TYPE || param.prop_type[i] == KS0_TYPE ) /* KS_TYPE */ { prop[i] = create_wp_field(param.src_qs[i].ncolor); if(this_node==0)printf("Mass= %g source %s residue= %g rel= %g\n", (double)param.ksp[i].mass, param.src_qs[i].descrp, (double)param.qic[i].resid, (double)param.qic[i].relresid); total_iters += get_ksprop_to_wp_field(param.startflag_ks[i], param.startfile_ks[i], param.saveflag_ks[i], param.savefile_ks[i], prop[i], ¶m.src_qs[i], ¶m.qic[i], ¶m.ksp[i], param.bdry_phase[i], param.coord_origin, param.check[i], param.prop_type[i] == KS0_TYPE); #ifdef CLOV_LEAN /* (We don't free naive prop memory, since we don't save it as a clover prop in get_ksprop_to_wp_field) */ #endif } else /* KS4_TYPE */ { prop[i] = create_wp_field(param.src_qs[i].ncolor); if(this_node==0)printf("Mass= %g source %s residue= %g rel= %g\n", (double)param.ksp[i].mass, param.src_qs[i].descrp, (double)param.qic[i].resid, (double)param.qic[i].relresid); total_iters += get_ksprop4_to_wp_field(param.startflag_w[i], param.startfile_w[i], param.saveflag_w[i], param.savefile_w[i], prop[i], ¶m.src_qs[i], ¶m.qic[i], ¶m.ksp[i], param.bdry_phase[i], param.coord_origin, param.check[i]); } } /* propagators */ ENDTIME("compute propagators"); /*****************************************************************/ /* Complete the quark propagators by applying the sink operators to either the raw propagator or by building on an existing quark propagator */ STARTTIME; #ifdef CLOV_LEAN oldip0 = -1; oldiq0 = -1; oldiq1 = -1; #endif for(j=0; j<param.num_qk; j++){ node0_printf("******* Creating quark %d ********\n",j); fflush(stdout); i = param.prop_for_qk[j]; if(param.parent_type[j] == PROP_TYPE){ #ifdef CLOV_LEAN /* Restore clover prop[i] from file. */ /* But first destroy the old one, unless we still need it */ if(oldip0 >= 0 && oldip0 != i) if(param.prop_type[oldip0] == CLOVER_TYPE && param.saveflag_w[oldip0] != FORGET){ free_wp_field(prop[oldip0]); node0_printf("destroy prop[%d]\n",oldip0); } /* In this case we won't need any old quarks */ if(oldiq0 >= 0) if(param.saveflag_q[oldiq0] != FORGET){ free_wp_field(quark[oldiq0]); node0_printf("destroy quark[%d]\n",oldiq0); } if(oldiq1 >= 0) if(param.saveflag_q[oldiq1] != FORGET){ free_wp_field(quark[oldiq1]); node0_printf("destroy quark[%d]\n",oldiq1); } if(prop[i]->swv[0] == NULL) reread_wprop_to_wp_field(param.saveflag_w[i], param.savefile_w[i], prop[i]); #endif /* Before applying operator, apply momentum twist to ape_links. Use the momentum twist of the parent propagator */ momentum_twist_ape_links(i, +1); /* Apply sink operator quark[j] <- Op[j] prop[i] */ quark[j] = create_wp_field_copy(prop[i]); wp_sink_op(¶m.snk_qs_op[j], quark[j]); /* Remove twist */ momentum_twist_ape_links(i, -1); #ifdef CLOV_LEAN oldip0 = i; oldiq0 = -1; #endif } else if(param.parent_type[j] == QUARK_TYPE) { /* QUARK_TYPE */ #ifdef CLOV_LEAN /* Restore quark[i] from file */ /* But first destroy the old ones, unless we still need one of them */ /* In this case we won't need the old prop */ if(oldip0 >= 0) if(param.prop_type[oldip0] == CLOVER_TYPE && param.saveflag_w[oldip0] != FORGET){ free_wp_field(prop[oldip0]); node0_printf("destroy prop[%d]\n",oldip0); } if(oldiq0 >= 0 && oldiq0 != i) if(param.saveflag_q[oldiq0] != FORGET){ free_wp_field(quark[oldiq0]); node0_printf("destroy quark[%d]\n",oldiq0); } if(oldiq1 >= 0 && oldiq1 != i) if(param.saveflag_q[oldiq1] != FORGET){ free_wp_field(quark[oldiq1]); node0_printf("destroy quark[%d]\n",oldiq1); } if(quark[i]->swv[0] == NULL) reread_wprop_to_wp_field(param.saveflag_q[i], param.savefile_q[i], quark[i]); #endif /* Apply sink operator quark[j] <- Op[j] quark[i] */ momentum_twist_ape_links(i, +1); quark[j] = create_wp_field_copy(quark[i]); wp_sink_op(¶m.snk_qs_op[j], quark[j]); momentum_twist_ape_links(i, -1); #ifdef CLOV_LEAN oldip0 = -1; oldiq0 = i; #endif } else { /* COMBO_TYPE */ int k; int nc = quark[param.combo_qk_index[j][0]]->nc; /* Create a zero field */ quark[j] = create_wp_field(nc); /* Compute the requested linear combination */ for(k = 0; k < param.num_combo[j]; k++){ wilson_prop_field *q = quark[param.combo_qk_index[j][k]]; if(nc != q->nc){ printf("Error: Attempting to combine an inconsistent number of colors: %d != %d\n",nc, q->nc); terminate(1); } scalar_mult_add_wprop_field(quark[j], q, param.combo_coeff[j][k], quark[j]); } } /* Save the resulting quark[j] if requested */ dump_wprop_from_wp_field( param.saveflag_q[j], param.savetype_q[j], param.savefile_q[j], quark[j]); /* Can we delete any props and quarks now? */ /* If nothing later depends on a prop or quark, free it up. */ for(i = 0; i < param.num_prop; i++) if( prop[i]->swv[0] != NULL && param.prop_dep_qkno[i] < j ){ free_wp_field(prop[i]); node0_printf("free prop[%d]\n",i); } for(i = 0; i < j; i++) if( quark[i]->swv[0] != NULL && param.quark_dep_qkno[i] < j ){ free_wp_field(quark[i]); node0_printf("free quark[%d]\n",i); } #ifdef CLOV_LEAN oldiq1 = j; #endif } #ifdef CLOV_LEAN /* Free remaining memory */ if(oldip0 >= 0) if(param.prop_type[oldip0] == CLOVER_TYPE && param.saveflag_w[oldip0] != FORGET){ free_wp_field(prop[oldip0]); node0_printf("destroy prop[%d]\n",oldip0); } if(oldiq0 >= 0) if(param.saveflag_q[oldiq0] != FORGET){ free_wp_field(quark[oldiq0]); node0_printf("destroy quark[%d]\n",oldiq0); } if(oldiq1 >= 0) if(param.saveflag_q[oldiq1] != FORGET){ free_wp_field(quark[oldiq1]); node0_printf("destroy quark[%d]\n",oldiq1); } #endif /* Now destroy all remaining propagator fields */ for(i = 0; i < param.num_prop; i++){ if(prop[i] != NULL)node0_printf("destroy prop[%d]\n",i); destroy_wp_field(prop[i]); prop[i] = NULL; } ENDTIME("generate quarks"); /****************************************************************/ /* Compute the meson propagators */ STARTTIME; for(i = 0; i < param.num_pair; i++){ /* Index for the quarks making up this meson */ iq0 = param.qkpair[i][0]; iq1 = param.qkpair[i][1]; node0_printf("Mesons for quarks %d and %d\n",iq0,iq1); #ifdef CLOV_LEAN /* Restore quarks from file and free old memory */ /* We try to reuse props that are already in memory, so we don't destroy them immediately, but wait to see if we need them again for the next pair. */ if(i > 0 && oldiq0 != iq0 && oldiq0 != iq1) if(param.saveflag_q[oldiq0] != FORGET){ free_wp_field(quark[oldiq0]); node0_printf("destroy quark[%d]\n",oldiq0); } if(i > 0 && oldiq1 != iq0 && oldiq1 != iq1) if(param.saveflag_q[oldiq1] != FORGET){ free_wp_field(quark[oldiq1]); node0_printf("destroy quark[%d]\n",oldiq1); } if(quark[iq0]->swv[0] == NULL) reread_wprop_to_wp_field(param.saveflag_q[iq0], param.savefile_q[iq0], quark[iq0]); if(quark[iq1]->swv[0] == NULL){ reread_wprop_to_wp_field(param.saveflag_q[iq1], param.savefile_q[iq1], quark[iq1]); } #endif /* Tie together to generate hadron spectrum */ spectrum_cl(quark[iq0], quark[iq1], i); /* Remember, in case we need to free memory */ #ifdef CLOV_LEAN oldiq0 = iq0; oldiq1 = iq1; #endif } #ifdef CLOV_LEAN /* Free any remaining quark prop memory */ if(quark[oldiq0]->swv[0] != NULL) if(param.saveflag_q[oldiq0] != FORGET){ free_wp_field(quark[oldiq0]); node0_printf("destroy quark[%d]\n",oldiq0); } if(quark[oldiq1]->swv[0] != NULL) if(param.saveflag_q[oldiq1] != FORGET){ free_wp_field(quark[oldiq1]); node0_printf("destroy quark[%d]\n",oldiq1); } #endif ENDTIME("tie hadron correlators"); node0_printf("RUNNING COMPLETED\n"); endtime=dclock(); node0_printf("Time = %e seconds\n",(double)(endtime-starttime)); node0_printf("total_iters = %d\n",total_iters); #ifdef HISQ_SVD_COUNTER printf("hisq_svd_counter = %d\n",hisq_svd_counter); #endif fflush(stdout); for(i = 0; i < param.num_qk; i++){ if(quark[i] != NULL)node0_printf("destroy quark[%d]\n",i); destroy_wp_field(quark[i]); quark[i] = NULL; } destroy_ape_links_3D(ape_links); /* Destroy fermion links (possibly created in make_prop()) */ #if FERM_ACTION == HISQ destroy_fermion_links_hisq(fn_links); #else destroy_fermion_links(fn_links); #endif fn_links = NULL; } /* readin(prompt) */ #ifdef HAVE_QUDA qudaFinalize(); #endif normal_exit(0); 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 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; }