static void destroy_qop_wilson_fermion_links( QOP_FermionLinksWilson *qop_links ) { QOP_wilson_destroy_L(qop_links); qop_links = NULL; }
void start(void) { double mf, best_mf; QLA_Real plaq; QDP_ColorMatrix **u; QDP_DiracFermion *out, *in; int i, st, ns, nm, bs, sti, nsi, nmi, bsi, best_st, best_ns, best_nm, best_bs; u = (QDP_ColorMatrix **) malloc(ndim*sizeof(QDP_ColorMatrix *)); for(i=0; i<ndim; i++) u[i] = QDP_create_M(); get_random_links(u, ndim, 0.2); plaq = get_plaq(u); if(QDP_this_node==0) printf("plaquette = %g\n", plaq); out = QDP_create_D(); in = QDP_create_D(); QDP_D_eq_gaussian_S(in, rs, QDP_all); QOP_layout_t qoplayout = QOP_LAYOUT_ZERO; qoplayout.latdim = ndim; qoplayout.latsize = (int *) malloc(ndim*sizeof(int)); for(i=0; i<ndim; i++) { qoplayout.latsize[i] = lattice_size[i]; } qoplayout.machdim = -1; QOP_info_t info = QOP_INFO_ZERO; QOP_invert_arg_t inv_arg = QOP_INVERT_ARG_DEFAULT; QOP_resid_arg_t res_arg = QOP_RESID_ARG_DEFAULT; res_arg.rsqmin = rsqmin; inv_arg.max_iter = 600; inv_arg.restart = 200; inv_arg.evenodd = QOP_EVEN; if(QDP_this_node==0) { printf("begin init\n"); fflush(stdout); } QOP_init(&qoplayout); if(QDP_this_node==0) { printf("begin load links\n"); fflush(stdout); } //flw = QOP_wilson_create_L_from_qdp(u, NULL); if(QDP_this_node==0) { printf("begin invert\n"); fflush(stdout); } if(cgtype>=0) { QOP_opt_t optcg; optcg.tag = "cg"; optcg.value = cgtype; QOP_wilson_invert_set_opts(&optcg, 1); } best_mf = 0; best_st = sta[0]; best_ns = nsa[0]; best_nm = nma[0]; best_bs = bsa[0]; QOP_opt_t optst; optst.tag = "st"; QOP_opt_t optns; optns.tag = "ns"; QOP_opt_t optnm; optnm.tag = "nm"; for(sti=0; sti<stn; sti++) { if((style>=0)&&(sti!=style)) continue; st = sta[sti]; optst.value = st; if(QOP_wilson_invert_set_opts(&optst, 1)==QOP_FAIL) continue; for(nsi=0; nsi<nsn; nsi++) { ns = nsa[nsi]; optns.value = ns; if(QOP_wilson_invert_set_opts(&optns, 1)==QOP_FAIL) continue; for(nmi=0; nmi<nmn; nmi++) { nm = nma[nmi]; if(nm==0) nm = ns; optnm.value = nm; if(QOP_wilson_invert_set_opts(&optnm, 1)==QOP_FAIL) continue; for(bsi=0; bsi<bsn; bsi++) { bs = bsa[bsi]; QDP_set_block_size(bs); flw = QOP_wilson_create_L_from_qdp(u, NULL); mf = bench_inv(&info, &inv_arg, &res_arg, out, in); QOP_wilson_destroy_L(flw); printf0("CONGRAD: st%2i ns%2i nm%2i bs%5i iter%5i sec%7.4f mflops = %g\n", st, ns, nm, bs, res_arg.final_iter, info.final_sec, mf); if(mf>best_mf) { best_mf = mf; best_st = st; best_ns = ns; best_nm = nm; best_bs = bs; } } } } } flw = QOP_wilson_create_L_from_qdp(u, NULL); optst.value = best_st; optns.value = best_ns; optnm.value = best_nm; QOP_wilson_invert_set_opts(&optst, 1); QOP_wilson_invert_set_opts(&optns, 1); QOP_wilson_invert_set_opts(&optnm, 1); QDP_set_block_size(best_bs); QDP_profcontrol(1); mf = bench_inv(&info, &inv_arg, &res_arg, out, in); QDP_profcontrol(0); printf0("prof: CONGRAD: st%2i ns%2i nm%2i bs%5i iter%5i sec%7.4f mflops = %g\n", best_st, best_ns, best_nm, best_bs, res_arg.final_iter, info.final_sec, mf); printf0("best: CONGRAD: st%2i ns%2i nm%2i bs%5i mflops = %g\n", best_st, best_ns, best_nm, best_bs, best_mf); if(QDP_this_node==0) { printf("begin unload links\n"); fflush(stdout); } //QOP_wilson_invert_unload_links(); if(QDP_this_node==0) { printf("begin finalize\n"); fflush(stdout); } QOP_finalize(); }