int main(int argc, char *argv[]) { int i, j; QDP_initialize(&argc, &argv); QDP_profcontrol(0); seed = time(NULL); j = 0; for(i=1; i<argc; i++) { switch(argv[i][0]) { case 'c' : cgtype=atoi(&argv[i][1]); break; case 'k' : kappa=atof(&argv[i][1]); break; case 'n' : nit=atoi(&argv[i][1]); break; case 's' : seed=atoi(&argv[i][1]); break; case 'S' : style=atoi(&argv[i][1]); break; case 'x' : j=i; while((i+1<argc)&&(isdigit(argv[i+1][0]))) ++i; break; default : usage(argv[0]); } } lattice_size = (int *) malloc(ndim*sizeof(int)); if(j==0) { for(i=0; i<ndim; ++i) lattice_size[i] = 8; } else { if(!isdigit(argv[j][1])) usage(argv[0]); lattice_size[0] = atoi(&argv[j][1]); for(i=1; i<ndim; ++i) { if((++j<argc)&&(isdigit(argv[j][0]))) { lattice_size[i] = atoi(&argv[j][0]); } else { lattice_size[i] = lattice_size[i-1]; } } } if(QDP_this_node==0) { printf("size = %i", lattice_size[0]); for(i=1; i<ndim; i++) { printf(" %i", lattice_size[i]); } printf("\n"); printf("kappa = %g\n", kappa); printf("seed = %i\n", seed); } QDP_set_latsize(ndim, lattice_size); QDP_create_layout(); rs = QDP_create_S(); seed_rand(rs, seed); start(); QDP_finalize(); return 0; }
int main(int argc, char *argv[]) { int status = 1; int mu; const char *g_name; QDP_ColorMatrix *U[NDIM]; QLA_Real plaq; /* start QDP */ QDP_initialize(&argc, &argv); if (argc != 1 + NDIM + 1) { printf0("ERROR: usage: %s Lx ... gauge-file\n", argv[0]); goto end; } for (mu = 0; mu < NDIM; mu++) lattice[mu] = atoi(argv[1 + mu]); g_name = argv[1 + NDIM]; /* set lattice size and create layout */ QDP_set_latsize(NDIM, lattice); QDP_create_layout(); /* allocate the gauge field */ create_Mvector(U, NELEMS(U)); /* read gauge field */ if (read_gauge(U, g_name) != 0) { printf0("ERROR: read_gauge(%s)\n", g_name); goto end; } /* Compute plaquette */ plaq = plaquette(U); /* delete the gauge field */ destroy_Mvector(U, NELEMS(U)); /* Display the value */ printf0("plaquette{%s} = %g\n", argv[1], plaq / (QDP_volume() * QDP_Nc * NDIM * (NDIM - 1) / 2 )); status = 0; end: /* shutdown QDP */ QDP_finalize(); return status; }
int main(int argc, char *argv[]) { int fpos[NDIM]; int c, d, ri; int gamma; int status = 1; int mu; QDP_DiracFermion *f; QDP_DiracFermion *g; /* start QDP */ QDP_initialize(&argc, &argv); if (argc != 1 + 2 * NDIM + 4) { printf0("ERROR: usage: %s Lx ... x ... c d r/i gamma\n", argv[0]); goto end; } for (mu = 0; mu < NDIM; mu++) lattice[mu] = atoi(argv[1 + mu]); for (mu = 0; mu < NDIM; mu++) fpos[mu] = atoi(argv[1 + NDIM + mu]); c = atoi(argv[1 + 2 * NDIM]); d = atoi(argv[1 + 2 * NDIM + 1]); ri = atoi(argv[1 + 2 * NDIM + 2]); gamma = atoi(argv[1 + 2 * NDIM + 3]); /* set lattice size and create layout */ QDP_set_latsize(NDIM, lattice); QDP_create_layout(); f = QDP_create_D(); g = QDP_create_D(); point_fermion(f, fpos, c, d, ri); dump_fermion("check-gamma-f", f); QDP_D_eq_gamma_times_D(g, f, gamma, QDP_all); dump_fermion("check-gamma-g", g); QDP_destroy_D(g); QDP_destroy_D(f); status = 0; end: /* shutdown QDP */ QDP_finalize(); return status; }
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; }
int main(int argc, char *argv[]) { const char *msg; int status = 1; int mu, i; struct QOP_CLOVER_State *clover_state; QDP_Int *I_seed; int i_seed; QDP_RandomState *state; QLA_Real plaq; QLA_Real n[NELEMS(F)]; struct QOP_CLOVER_Gauge *c_g; struct QOP_CLOVER_Fermion *c_f[NELEMS(F)]; double kappa; double c_sw; double in_eps; int in_iter; int log_flag; double out_eps; int out_iter; int cg_status; double run_time; long long flops, sent, received; /* start QDP */ QDP_initialize(&argc, &argv); if (argc != 1 + NDIM + 6) { printf0("ERROR: usage: %s Lx ... seed kappa c_sw iter eps log?\n", argv[0]); goto end; } for (mu = 0; mu < NDIM; mu++) { lattice[mu] = atoi(argv[1 + mu]); } i_seed = atoi(argv[1 + NDIM]); kappa = atof(argv[2 + NDIM]); c_sw = atof(argv[3 + NDIM]); in_iter = atoi(argv[4 + NDIM]); in_eps = atof(argv[5 + NDIM]); log_flag = atoi(argv[6 + NDIM]) == 0? 0: QOP_CLOVER_LOG_EVERYTHING; /* set lattice size and create layout */ QDP_set_latsize(NDIM, lattice); QDP_create_layout(); primary = QMP_is_primary_node(); self = QMP_get_node_number(); get_vector(network, 1, QMP_get_logical_number_of_dimensions(), QMP_get_logical_dimensions()); get_vector(node, 0, QMP_get_logical_number_of_dimensions(), QMP_get_logical_coordinates()); printf0("network: "); for (i = 0; i < NDIM; i++) printf0(" %d", network[i]); printf0("\n"); printf0("node: "); for (i = 0; i < NDIM; i++) printf0(" %d", node[i]); printf0("\n"); printf0("kappa: %20.15f\n", kappa); printf0("c_sw: %20.15f\n", c_sw); printf0("in_iter: %d\n", in_iter); printf0("in_eps: %15.2e\n", in_eps); /* allocate the gauge field */ create_Mvector(U, NELEMS(U)); create_Mvector(C, NELEMS(C)); create_Dvector(F, NELEMS(F)); I_seed = QDP_create_I(); QDP_I_eq_funci(I_seed, icoord, QDP_all); state = QDP_create_S(); QDP_S_eq_seed_i_I(state, i_seed, I_seed, QDP_all); for (mu = 0; mu < NELEMS(U); mu++) { QDP_M_eq_gaussian_S(U[mu], state, QDP_all); } for (i = 0; i < NELEMS(F); i++) { QDP_D_eq_gaussian_S(F[i], state, QDP_all); } /* build the clovers */ clover(C, U); /* initialize CLOVER */ if (QOP_CLOVER_init(&clover_state, lattice, network, node, primary, sublattice, NULL)) { printf0("CLOVER_init() failed\n"); goto end; } if (QOP_CLOVER_import_fermion(&c_f[0], clover_state, f_reader, F[0])) { printf0("CLOVER_import_fermion(0) failed\n"); goto end; } if (QOP_CLOVER_allocate_fermion(&c_f[1], clover_state)) { printf0("CLOVER_allocate_fermion(1) failed\n"); goto end; } if (QOP_CLOVER_allocate_fermion(&c_f[2], clover_state)) { printf0("CLOVER_allocate_fermion(2) failed\n"); goto end; } if (QOP_CLOVER_allocate_fermion(&c_f[3], clover_state)) { printf0("CLOVER_allocate_fermion(3) failed\n"); goto end; } if (QOP_CLOVER_import_gauge(&c_g, clover_state, kappa, c_sw, u_reader, c_reader, NULL)) { printf("CLOVER_import_gauge() failed\n"); goto end; } QOP_CLOVER_D_operator(c_f[2], c_g, c_f[0]); cg_status = QOP_CLOVER_D_CG(c_f[3], &out_iter, &out_eps, c_f[2], c_g, c_f[2], in_iter, in_eps, log_flag); msg = QOP_CLOVER_error(clover_state); QOP_CLOVER_performance(&run_time, &flops, &sent, &received, clover_state); QOP_CLOVER_export_fermion(f_writer, F[3], c_f[3]); printf0("CG status: %d\n", cg_status); printf0("CG error message: %s\n", msg? msg: "<NONE>"); printf0("CG iter: %d\n", out_iter); printf0("CG eps: %20.10e\n", out_eps); printf0("CG performance: runtime %e sec\n", run_time); printf0("CG performance: flops %.3e MFlop/s (%lld)\n", flops * 1e-6 / run_time, flops); printf0("CG performance: snd %.3e MB/s (%lld)\n", sent * 1e-6 / run_time, sent); printf0("CG performance: rcv %.3e MB (%lld)/s\n", received * 1e-6 / run_time, received); /* free CLOVER */ QOP_CLOVER_free_gauge(&c_g); for (i = 0; i < NELEMS(c_f); i++) QOP_CLOVER_free_fermion(&c_f[i]); QOP_CLOVER_fini(&clover_state); /* Compute plaquette */ plaq = plaquette(U); /* field norms */ for (i = 0; i < NELEMS(F); i++) QDP_r_eq_norm2_D(&n[i], F[i], QDP_all); /* Display the values */ printf0("plaquette = %g\n", plaq / (QDP_volume() * QDP_Nc * NDIM * (NDIM - 1) / 2 )); for (i = 0; i < NELEMS(F); i++) printf0(" |f|^2 [%d] = %20.10e\n", i, (double)(n[i])); /* Compute and display <f[1] f[0]> */ show_dot("1|orig", F[1], F[0]); /* Compute and display <f[1] f[3]> */ show_dot("1|solv", F[1], F[3]); QDP_destroy_S(state); QDP_destroy_I(I_seed); destroy_Mvector(U, NELEMS(U)); destroy_Mvector(C, NELEMS(C)); destroy_Dvector(F, NELEMS(F)); status = 0; end: /* shutdown QDP */ printf0("end\n"); QDP_finalize(); return status; }
void qopWilsonDslashFini(void) { QDP_finalize(); }
int main(int argc, char *argv[]) { int status = 1; int mu, i; struct QOP_CLOVER_State *clover_state; QDP_Int *I_seed; int i_seed; QDP_RandomState *state; QLA_Real plaq; QLA_Real n[NELEMS(F)]; struct QOP_CLOVER_Gauge *c_g; struct QOP_CLOVER_Fermion *c_f[NELEMS(F)]; double kappa; double c_sw; /* start QDP */ QDP_initialize(&argc, &argv); if (argc != 1 + NDIM + 3) { printf0("ERROR: usage: %s Lx ... seed kappa c_sw\n", argv[0]); goto end; } for (mu = 0; mu < NDIM; mu++) { lattice[mu] = atoi(argv[1 + mu]); } i_seed = atoi(argv[1 + NDIM]); kappa = atof(argv[2 + NDIM]); c_sw = atof(argv[3 + NDIM]); /* set lattice size and create layout */ QDP_set_latsize(NDIM, lattice); QDP_create_layout(); primary = QMP_is_primary_node(); self = QMP_get_node_number(); get_vector(network, 1, QMP_get_logical_number_of_dimensions(), QMP_get_logical_dimensions()); get_vector(node, 0, QMP_get_logical_number_of_dimensions(), QMP_get_logical_coordinates()); printf0("network: "); for (i = 0; i < NDIM; i++) printf0(" %d", network[i]); printf0("\n"); printf0("node: "); for (i = 0; i < NDIM; i++) printf0(" %d", node[i]); printf0("\n"); printf0("kappa: %20.15f\n", kappa); printf0("c_sw: %20.15f\n", c_sw); /* allocate the gauge field */ create_Mvector(U, NELEMS(U)); create_Mvector(C, NELEMS(C)); create_Dvector(F, NELEMS(F)); I_seed = QDP_create_I(); QDP_I_eq_funci(I_seed, icoord, QDP_all); state = QDP_create_S(); QDP_S_eq_seed_i_I(state, i_seed, I_seed, QDP_all); for (mu = 0; mu < NELEMS(U); mu++) { QDP_M_eq_gaussian_S(U[mu], state, QDP_all); } for (i = 0; i < NELEMS(F); i++) { QDP_D_eq_gaussian_S(F[i], state, QDP_all); } /* build the clovers */ clover(C, U); /* initialize CLOVER */ if (QOP_CLOVER_init(&clover_state, lattice, network, node, primary, sublattice, NULL)) { printf0("CLOVER_init() failed\n"); goto end; } if (QOP_CLOVER_import_fermion(&c_f[0], clover_state, f_reader, F[0])) { printf0("CLOVER_import_fermion(0) failed\n"); goto end; } if (QOP_CLOVER_import_fermion(&c_f[1], clover_state, f_reader, F[1])) { printf0("CLOVER_import_fermion(1) failed\n"); goto end; } if (QOP_CLOVER_allocate_fermion(&c_f[2], clover_state)) { printf0("CLOVER_allocate_fermion(2) failed\n"); goto end; } if (QOP_CLOVER_allocate_fermion(&c_f[3], clover_state)) { printf0("CLOVER_allocate_fermion(3) failed\n"); goto end; } if (QOP_CLOVER_import_gauge(&c_g, clover_state, kappa, c_sw, u_reader, c_reader, NULL)) { printf("CLOVER_import_gauge() failed\n"); goto end; } QOP_CLOVER_D_operator(c_f[2], c_g, c_f[0]); QOP_CLOVER_export_fermion(f_writer, F[2], c_f[2]); QOP_CLOVER_D_operator_conjugated(c_f[3], c_g, c_f[1]); QOP_CLOVER_export_fermion(f_writer, F[3], c_f[3]); /* free CLOVER */ QOP_CLOVER_free_gauge(&c_g); for (i = 0; i < NELEMS(c_f); i++) QOP_CLOVER_free_fermion(&c_f[i]); QOP_CLOVER_fini(&clover_state); /* Compute plaquette */ plaq = plaquette(U); /* field norms */ for (i = 0; i < NELEMS(F); i++) QDP_r_eq_norm2_D(&n[i], F[i], QDP_all); /* Display the values */ printf0("plaquette = %g\n", plaq / (QDP_volume() * QDP_Nc * NDIM * (NDIM - 1) / 2 )); for (i = 0; i < NELEMS(F); i++) printf0(" |f|^2 [%d] = %20.10e\n", i, (double)(n[i])); /* Compute and display <f[1] f[2]> */ show_dot("1|D0", F[1], F[2]); /* Compute and display <f[3] f[0]> */ show_dot("X1|0", F[3], F[0]); QDP_destroy_S(state); QDP_destroy_I(I_seed); destroy_Mvector(U, NELEMS(U)); destroy_Mvector(C, NELEMS(C)); destroy_Dvector(F, NELEMS(F)); status = 0; end: /* shutdown QDP */ printf0("end\n"); QDP_finalize(); return status; }
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; }
void qhmc_fini_qopqdp(void) { QDP_finalize(); }
/* the driver */ int main(int argc, char *argv[]) { int status = 1; int i; lua_State *L = NULL; if (QDP_initialize(&argc, &argv)) { fprintf(stderr, "QDP initialization failed\n"); return 1; } QDP_profcontrol(0); double node = QDP_this_node; QMP_min_double(&node); qlua_master_node = node; L = lua_open(); if (L == NULL) { message("can not create Lua state"); goto end; } qlua_init(L, argc, argv); /* open libraries */ if (argc < 2) { message("QLUA component versions:\n"); for (i = 0; versions[i].name; i++) message(" %10s: %s\n", versions[i].name, versions[i].value); } else { for (i = 1; i < argc; i++) { char *source; if(strcmp(argv[i],"-e")==0) { // process command const char *chunk = argv[i] + 2; if (*chunk == '\0') { if (++i >= argc) { message("missing argument to -e"); goto end; } chunk = argv[i]; } QLUA_ASSERT(chunk != NULL); status = dostring(L, chunk); source = "=(command line)"; } else { status = dofile(L, argv[i]); source = argv[i]; } report(L, source, status); if (status) { fflush(stdout); fflush(stderr); QDP_abort(1); break; } } } qlua_fini(L); lua_close(L); end: QDP_finalize(); return status; }