private void button9_Click(object sender, EventArgs e) { float kstart = 0.1f; float kend = 0.1f; float dk = 0.005f; for (float k = kstart; k <= kend; k += dk) { Core.kappa = k; Text = DateTime.Now.ToString(); tbPL.Text += "8x2 k = " + Core.kappa.ToString() + (char)13 + (char)10; for (int i = 0; i <= 100; i++) { double beta = 5 + i * 0.01; Core kern = new Core(8, 8, 8, 2, beta, 0); for (int j = 0; j < 10000; j++) { if (j % 1000 == 0) { label6.Text = j.ToString(); Application.DoEvents(); } //label23.Text = DateTime.Now.ToString(); kern.Calculate();//SweepWithFermions(); } kern.CalculateS();double res = 0; for (int n = 0; n < 1000; n++) { kern.Calculate(); kern.Calculate(); kern.CalculatePL(); res += kern.PL[0];//kern.BiCGStab(); label10.Text = n.ToString(); Application.DoEvents(); } res /= 1000.0; tbB.Text += beta.ToString() + (char)13 + (char)10; tbPL.Text += res.ToString() + (char)13 + (char)10; tbS.Text += kern.S[0].ToString() + (char)13 + (char)10; kern.Dispose(); Application.DoEvents(); } } }
private void button7_Click(object sender, EventArgs e) { Text = DateTime.Now.ToString(); tbPL.Text += "4x2" + (char)13 + (char)10; for (int i = 9; i >= 0 ; i--) { double beta = 2 + i; Core kern = new Core(4, 4, 4, 2, beta, 0); for (int j = 0; j < 150; j++) { label6.Text = j.ToString(); label23.Text = DateTime.Now.ToString(); Application.DoEvents(); kern.SweepWithFermions(); } kern.CalculateS(); double res = kern.BiCGStab(); tbB.Text += beta.ToString() + (char)13 + (char)10; tbPL.Text += res.ToString() + (char)13 + (char)10; tbS.Text += kern.S[0].ToString() + (char)13 + (char)10; kern.Dispose(); Application.DoEvents(); } tbPL.Text += "4x4" + (char)13 + (char)10; for (int i = 0; i < 10; i++) { double beta = 2 + i; Core kern = new Core(4, 4, 4, 4, beta, 0); for (int j = 0; j < 150; j++) { label6.Text = j.ToString(); label23.Text = DateTime.Now.ToString(); Application.DoEvents(); kern.SweepWithFermions(); } kern.CalculateS(); double res = kern.BiCGStab(); tbB.Text += beta.ToString() + (char)13 + (char)10; tbPL.Text += res.ToString() + (char)13 + (char)10; tbS.Text += kern.S[0].ToString() + (char)13 + (char)10; kern.Dispose(); Application.DoEvents(); } Text += " " + DateTime.Now.ToString(); }
//private void button5_Click_1(object sender, EventArgs e) //{ // int Nx = 16; int Ny = 16; int Nt = 8; double flux = 0.5; double beta = 6.0; // int Therm = 1000; int Meas = 10000; int tDiscard = 1; // DateTime t; // double Scumul = 0, S2cumul = 0; // for (int Ntr = 6; Ntr <= 16; Ntr += 4) // { // MyKernel Kern = new MyKernel(Nx, Ny, Ntr, Nt, beta, flux); // //ZoomStart = DateTime.Now; // label6.Text = "Thermalization..."; Application.DoEvents(); // for (int i = 0; i < Therm; i++) { Kern.Calculate(); } // Scumul = 0; S2cumul = 0; // if (!working) { working = true; return; } // label6.Text = "Measuring..."; Application.DoEvents(); // t = DateTime.Now; // for (int i = 0; i < Meas; i++) // { // label6.Text = "Measuring..." + i.ToString(); // Application.DoEvents(); // Kern.Calculate();//discard one measure // Kern.Calculate(); // Scumul += Kern.S[0]; // S2cumul += Kern.S[0] * Kern.S[0]; // } // //write results // Scumul /= Meas; S2cumul /= Meas; // tbB.Text += Ntr.ToString() + (char)13 + (char)10; // tbS.Text += (Scumul).ToString() + (char)13 + (char)10; // double chi = Math.Sqrt(S2cumul - Scumul * Scumul);//P2general - Pgeneral * Pgeneral; // tbSchi.Text += chi.ToString() + (char)13 + (char)10;//chi in resmid textbox // label23.Text = "Last measure: Ntr = " + Ntr.ToString() + ", T = " + (DateTime.Now - t).TotalSeconds.ToString(); // Application.DoEvents(); // MyKernel = null; // GC.Collect(); // } //} private void button5_Click_1(object sender, EventArgs e) { //int Nx = 16; int Ny = 16; int Nt = 4; int Nstart = 4, Nend = 18; double startflux = 0, flux = 1; double beta = 6.0; int Therm = 1000; int Meas = 10000; int tDiscard = 1; DateTime t; double Scumul=0, S2cumul = 0; for (int Ntr = Nstart; Ntr <= Nend; Ntr += 2) { // flux = startflux / (double)Nstart * (double)Ntr; Core Kern = new Core(Ntr, Ntr, Ntr, Nt, beta, flux); //ZoomStart = DateTime.Now; label6.Text = "Thermalization..."; Application.DoEvents(); for (int i = 0; i < Therm; i++) { Kern.Calculate();} Scumul = 0; S2cumul = 0; if (!working) { working = true; return; } label6.Text = "Measuring..."; Application.DoEvents(); t = DateTime.Now; for (int i = 0; i < Meas; i++) { if (i % 1000==0) { label6.Text = "Measuring..." + i.ToString(); Application.DoEvents(); } //Kern.Calculate();//discard one measure Kern.Calculate(); Scumul += Kern.S[0]; S2cumul += Kern.S[0] * Kern.S[0]; } //write results Scumul /= Meas; S2cumul /= Meas; tbB.Text += Ntr.ToString() + (char)13 + (char)10; tbPLchi.Text += flux.ToString() + (char)13 + (char)10; tbS.Text += (Scumul).ToString() + (char)13 + (char)10; double chi = Math.Sqrt(S2cumul - Scumul * Scumul);//P2general - Pgeneral * Pgeneral; tbSchi.Text += chi.ToString() + (char)13 + (char)10;//chi in resmid textbox label23.Text = "Last measure: Ntr = "+Ntr.ToString()+", T = "+(DateTime.Now - t).TotalSeconds.ToString(); Application.DoEvents(); MyKernel = null; GC.Collect(); } }
//private void button6_Click(object sender, EventArgs e) //{ // Therm = Convert.ToInt32(tbTherm.Text); Meas = Convert.ToInt32(tbMeas.Text); // double beginbeta = Convert.ToDouble(tbBegin.Text); // double endbeta = Convert.ToDouble(tbEnd.Text); // double stepbeta = Convert.ToDouble(tbStep.Text); // double curbeta = beginbeta; // int resnum = Convert.ToInt32(tbRes.Text); // while (curbeta <= endbeta) // { // label10.Text = "beta="+curbeta.ToString(); // tbResult.Text += "beta=" + curbeta.ToString() + (char)13 + (char)10 + (char)13 + (char)10; // tbResMid.Text += "beta=" + curbeta.ToString() + (char)13 + (char)10 + (char)13 + (char)10; // Pcumul = 0; Scount = 0; Pgeneral = 0; // P2cumul = 0; P2general = 0; // MyKernel Kern = new MyKernel(Convert.ToInt32(tbNs.Text), Convert.ToInt32(tbNt.Text), curbeta,Convert.ToDouble(tbflux.Text)); // //ZoomStart = DateTime.Now; // label6.Text = "Thermalization..."; // for (int i = 0; i < Therm; i++) { Kern.Calculate(); Application.DoEvents(); } // for (int i = 0; i < resnum; i++) // { // Pcumul = 0; P2cumul = 0; // for (int j = 0; j < Meas; j++) // { // Kern.Calculate(); // Pcumul += Kern.PL[0]; // P2cumul += Kern.PL[0] * Kern.PL[0]; // Application.DoEvents(); // } // label6.Text = "result №" + i.ToString(); // //Thread.Sleep(1000); // Pcumul /= Meas; P2cumul /= Meas; // Pgeneral = (i * Pgeneral + Pcumul) / (i + 1); // P2general = (i * P2general + P2cumul) / (i + 1); // tbResult.Text += "PL = " + (Pgeneral).ToString() + (char)13 + (char)10; // lblNum.Text = Scount.ToString(); // double chi = P2general - Pgeneral * Pgeneral; // tbResMid.Text += chi.ToString() + (char)13 + (char)10;//chi in resmid textbox // Pcumul = 0; P2cumul = 0; // } // Application.DoEvents(); // curbeta += stepbeta; // } // working = true; //} private void button6_Click(object sender, EventArgs e) { Therm = Convert.ToInt32(tbTherm.Text); Meas = Convert.ToInt32(tbMeas.Text); double beginbeta = Convert.ToDouble(tbBegin.Text); double endbeta = Convert.ToDouble(tbEnd.Text); double stepbeta = Convert.ToDouble(tbStep.Text); double curbeta = beginbeta; int resnum = Convert.ToInt32(tbRes.Text); while (curbeta <= endbeta) { label10.Text = "beta=" + curbeta.ToString(); tbB.Text += curbeta.ToString() + (char)13 + (char)10; //tbPLchi.Text += "beta=" + curbeta.ToString() + (char)13 + (char)10 + (char)13 + (char)10; Pcumul = 0; Scount = 0; Pgeneral = 0; P2cumul = 0; P2general = 0; double Scumul = 0, S2cumul = 0; Core Kern = new Core(Convert.ToInt32(tbNx.Text), int.Parse(tbNy.Text), int.Parse(tbNz.Text), Convert.ToInt32(tbNt.Text), curbeta, Convert.ToDouble(tbflux.Text)); //ZoomStart = DateTime.Now; label6.Text = "Thermalization..."; for (int i = 0; i < Therm; i++) { Kern.Calculate(); Application.DoEvents(); } for (int i = 0; i < resnum; i++) { Pcumul = 0; P2cumul = 0; Scumul = 0; S2cumul = 0; if (!working) { working = true; return; } for (int j = 0; j < Meas; j++) { Kern.Calculate(); Pcumul += Kern.PL[0]; P2cumul += Kern.PL[0] * Kern.PL[0]; Scumul += Kern.S[0]; S2cumul += Kern.S[0] * Kern.S[0]; } label6.Text = "result №" + i.ToString(); //Thread.Sleep(1000); Pcumul /= Meas; P2cumul /= Meas; Scumul /= Meas; S2cumul /= Meas; //Pgeneral = (i * Pgeneral + Pcumul) / (i + 1); //P2general = (i * P2general + P2cumul) / (i + 1); tbPL.Text += (Pcumul).ToString() + (char)13 + (char)10; tbS.Text += (Scumul).ToString() + (char)13 + (char)10; lblNum.Text = Scount.ToString(); double chi = Math.Sqrt(P2cumul - Pcumul * Pcumul);//P2general - Pgeneral * Pgeneral; tbPLchi.Text += chi.ToString() + (char)13 + (char)10;//chi in resmid textbox chi = Math.Sqrt(S2cumul - Scumul * Scumul);//P2general - Pgeneral * Pgeneral; tbSchi.Text += chi.ToString() + (char)13 + (char)10;//chi in resmid textbox Application.DoEvents(); } Application.DoEvents(); curbeta += stepbeta; } working = true; }
private void button3_Click(object sender, EventArgs e) { MyKernel = null; GC.Collect(); }
private void button2_Click(object sender, EventArgs e) { DateTime t = DateTime.Now; try { MyKernel = new Core(Convert.ToInt32(tbNx.Text),int.Parse(tbNy.Text),int.Parse(tbNz.Text), Convert.ToInt32(tbNt.Text), Convert.ToDouble(tbBeta.Text), Convert.ToDouble(tbflux.Text)); MyKernel.betagauge = (float)Convert.ToDouble(tbBeta.Text); MessageBox.Show(MyKernel.openCLPlatform.Name + ": " + (DateTime.Now - t).ToString()); // UpdateMyKernel(); } catch (Exception oex) { MessageBox.Show(oex.ToString(), "OpenCL Initialization failed"); //Application.Exit(); } }