Dynamic Workload Manager (CPU/GPU)

thysol

BIOS-Overclocker(in)
Hi,
Ich moechte euch hier in diesem Thread meine Idee vorstellen. Ich habe diesen Thread in diesem Unterforum aufgemacht weil es hier sehr viel um Grafikkarten geht.

Einfuehrung:

Durch meinem neuen Algorithm ist es moeglich die Effizienz von HPC (High Performance Computing) generell zu steigern. Dieser Algorithm koennte auch benutzt werden um die Performance in Games zu steigern. Ich nenne diesen Algorithm Dynamic Workload Manager.

Dynamic Workload Manager:

Mein Dynamic Workload Manager ist in der Lage dynamisch die Arbeitsaufteilung innerhalb des Computers zu steuern. Als erstes testet er welcher Code mit welcher Performance auf welchen Prozessoren laeuft. Theoretisch kann der Dynamic Workload Manager die Arbeit auf einer unendlichen Zahl CPUs und GPUs aufteilen.

Wer profitiert am meisten vom Dynamic Workload Manager?


Am meisten profitieren Multi-GPU Setups mit unterschiedlichen GPUs. Ein Beispiel waere ein Lucid Hydra Setup mit Geforce + Radeon. Der Dynamic Workload Manager wuerde der Radeon die Aufgaben zuteilen worin sie am schnellsten ist und die Aufgaben wo die Geforce schneller ist kriegt dann logischer Weise die Geforce. Der Dynamic Workload Manager kann voll automatisch herausfinden welche Algorithmen auf welchem Prozessor im System am besten laufen. Dadurch kann es sein das ein System mit einer Radeon HD 5750 + Geforce GTS 450 schneller ist als ein System mit Geforce GTX 580 SLI. Dass kann passieren wenn eine Aufgabe besonders schlecht auf einer Geforce laeuft. Der Dynamic Workload Manager wuerde dann die Aufgaben wo die Geforce schlecht drin ist der Radeon zuweisen. Die Geforce wuerde dann eine andere Arbeit kriegen. Die CPU wuerde automatisch die Arbeit aufkriegen wo beide GPUs schlecht drin sind. Im Prinzip ist mein Dynamic Workload Manager sowas wie Lucid Hydra nur fuer HPC Rechenaufgaben und nicht fuer Grafikrendering.

Was sind die Voraussetzungen dafuer dass der Dynamic Workload Manager funktioniert?

Der Code muss parrallelisierbar sein und muss zumindest teilweise unabhaengige Daten enthalten.

Ich kann euch gleich noch das Programm dass ich geschrieben habe hier reinstellen aber erstmal wollte ich von euch Wissen ob es sowas ueberhaupt schon gibt oder was ihr generell von der Idee haltet?;)


Radeon User sollten sich erst das hier installieren:

http://developer.amd.com/gpu/AMDAPPSDK/downloads/Pages/default.aspx


 
Zuletzt bearbeitet:
TE
TE
thysol

thysol

BIOS-Overclocker(in)
Source Code des Programms:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;

namespace Orbit_Dynamic_Workload_Manager
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

public static double CPUtime;
public static double GPUtime;
public static double total;

public static double b;
public static float gpu2;
public static float cpu2;

public static int z = 0;
public static int s = 0;
public static int gpudec2;
public static int f = 0;
public static int o = 0;
public static int p = 0;

Thread a2 = new Thread(new ThreadStart(GPUthread));
Thread b2 = new Thread(new ThreadStart(GPUthread2));
Thread c2 = new Thread(new ThreadStart(GPUthread3));
Thread d2 = new Thread(new ThreadStart(GPUthread4));
Thread e2 = new Thread(new ThreadStart(GPUthread5));
Thread f2 = new Thread(new ThreadStart(GPUthread6));
Thread g2 = new Thread(new ThreadStart(GPUthread7));
Thread h2 = new Thread(new ThreadStart(GPUthread8));
Thread i2 = new Thread(new ThreadStart(GPUthread9));
Thread j2 = new Thread(new ThreadStart(GPUthread10));
Thread k2 = new Thread(new ThreadStart(GPUthread11));
Thread l2 = new Thread(new ThreadStart(GPUthread12));
Thread m2 = new Thread(new ThreadStart(GPUthread13));

System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();

public static void GPUthread()
{
Random RandomClass = new Random();
f = 0;
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();

string orbit = @"
__kernel void
orbit(__global float * v1,
__global float * v2,
__global float * v3,
__global float * v4,
__global float * v5,
__global float * v6,
__global float * v7,
__global float * v8,
__global float * v9,
__global float * v10,
__global float * v11,
__global float * v12,
__global float * v13)
{
int i = get_global_id(0);
while (v11[0] < v12[0])
{
v9[0] = v13[0];
while (v9[0] < v10[0])
{
v4 = v3 / (2 * 398600500000000 / (v3 * (v1 * v1)) - 1);
v5 = v3 * (v1 * v1) / 398600500000000 - 1;
v6 = v4 / (1 + v5);
v7 = v5 * v6;
v6 = v6 * v6;
v7 = v7 * v7;
v8 = v6 - v7;
v8 = sqrt( v8 );
v9[0]++;
}
v11[0]++;
}
}";

OpenCLTemplate.CLCalc.InitCL();

OpenCLTemplate.CLCalc.Program.Compile(new string[] { orbit });

OpenCLTemplate.CLCalc.Program.Kernel VectorSum = new OpenCLTemplate.CLCalc.Program.Kernel("orbit");

int n = 1000000;

float[] v1 = new float[n], v2 = new float[n], v3 = new float[n], v4 = new float[n], v5 = new float[n], v6 = new float[n], v7 = new float[n], v8 = new float[n], v9 = new float[1], v10 = new float[1], v11 = new float[1], v12 = new float[1], v13 = new float[1];

for (int i = 0; i < n; i++)
{
v1 = RandomClass.Next(1000, 100000);
v2 = RandomClass.Next(200000, 10000000);
v3 = 6378140 + v2;
}

v13[0] = s;
v9[0] = s;
v10[0] = gpu2;
v11[0] = o;
v12[0] = p;

OpenCLTemplate.CLCalc.Program.Variable varV1 = new OpenCLTemplate.CLCalc.Program.Variable(v1);
OpenCLTemplate.CLCalc.Program.Variable varV2 = new OpenCLTemplate.CLCalc.Program.Variable(v2);
OpenCLTemplate.CLCalc.Program.Variable varV3 = new OpenCLTemplate.CLCalc.Program.Variable(v3);
OpenCLTemplate.CLCalc.Program.Variable varV4 = new OpenCLTemplate.CLCalc.Program.Variable(v4);
OpenCLTemplate.CLCalc.Program.Variable varV5 = new OpenCLTemplate.CLCalc.Program.Variable(v5);
OpenCLTemplate.CLCalc.Program.Variable varV6 = new OpenCLTemplate.CLCalc.Program.Variable(v6);
OpenCLTemplate.CLCalc.Program.Variable varV7 = new OpenCLTemplate.CLCalc.Program.Variable(v7);
OpenCLTemplate.CLCalc.Program.Variable varV8 = new OpenCLTemplate.CLCalc.Program.Variable(v8);
OpenCLTemplate.CLCalc.Program.Variable varV9 = new OpenCLTemplate.CLCalc.Program.Variable(v9);
OpenCLTemplate.CLCalc.Program.Variable varV10 = new OpenCLTemplate.CLCalc.Program.Variable(v10);
OpenCLTemplate.CLCalc.Program.Variable varV11 = new OpenCLTemplate.CLCalc.Program.Variable(v11);
OpenCLTemplate.CLCalc.Program.Variable varV12 = new OpenCLTemplate.CLCalc.Program.Variable(v12);
OpenCLTemplate.CLCalc.Program.Variable varV13 = new OpenCLTemplate.CLCalc.Program.Variable(v13);

OpenCLTemplate.CLCalc.Program.Variable[] args = new OpenCLTemplate.CLCalc.Program.Variable[] { varV1, varV2, varV3, varV4, varV5, varV6, varV7, varV8, varV9, varV10, varV11, varV12, varV13 };

int[] workers = new int[1] { n };

sw.Start();
while (f < gpudec2)
{
VectorSum.Execute(args, workers);
f++;
v9[0] = s;
}
varV4.ReadFromDeviceTo(v4);
varV5.ReadFromDeviceTo(v5);
varV6.ReadFromDeviceTo(v6);
varV7.ReadFromDeviceTo(v7);
varV8.ReadFromDeviceTo(v8);

sw.Stop();


GPUtime = sw.Elapsed.TotalSeconds;

}

public static void GPUthread2()
{
Random RandomClass = new Random();
f = 0;
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();

string orbit = @"
__kernel void
orbit(__global float * v1,
__global float * v2,
__global float * v3,
__global float * v4,
__global float * v5,
__global float * v6,
__global float * v7,
__global float * v8,
__global float * v9,
__global float * v10,
__global float * v11,
__global float * v12,
__global float * v13)
{
int i = get_global_id(0);
while (v11[0] < v12[0])
{
v9[0] = v13[0];
while (v9[0] < v10[0])
{
v4 = v3 / (2 * 398600500000000 / (v3 * (v1 * v1)) - 1);
v5 = v3 * (v1 * v1) / 398600500000000 - 1;
v6 = v4 / (1 + v5);
v7 = v5 * v6;
v6 = v6 * v6;
v7 = v7 * v7;
v8 = v6 - v7;
v8 = sqrt( v8 );
v9[0]++;
}
v11[0]++;
}
}";

OpenCLTemplate.CLCalc.InitCL();

OpenCLTemplate.CLCalc.Program.Compile(new string[] { orbit });

OpenCLTemplate.CLCalc.Program.Kernel VectorSum = new OpenCLTemplate.CLCalc.Program.Kernel("orbit");

int n = 1000000;

float[] v1 = new float[n], v2 = new float[n], v3 = new float[n], v4 = new float[n], v5 = new float[n], v6 = new float[n], v7 = new float[n], v8 = new float[n], v9 = new float[1], v10 = new float[1], v11 = new float[1], v12 = new float[1], v13 = new float[1];

for (int i = 0; i < n; i++)
{
v1 = RandomClass.Next(1000, 100000);
v2 = RandomClass.Next(200000, 10000000);
v3 = 6378140 + v2;
}

v13[0] = s;
v9[0] = s;
v10[0] = gpu2;
v11[0] = o;
v12[0] = p;

OpenCLTemplate.CLCalc.Program.Variable varV1 = new OpenCLTemplate.CLCalc.Program.Variable(v1);
OpenCLTemplate.CLCalc.Program.Variable varV2 = new OpenCLTemplate.CLCalc.Program.Variable(v2);
OpenCLTemplate.CLCalc.Program.Variable varV3 = new OpenCLTemplate.CLCalc.Program.Variable(v3);
OpenCLTemplate.CLCalc.Program.Variable varV4 = new OpenCLTemplate.CLCalc.Program.Variable(v4);
OpenCLTemplate.CLCalc.Program.Variable varV5 = new OpenCLTemplate.CLCalc.Program.Variable(v5);
OpenCLTemplate.CLCalc.Program.Variable varV6 = new OpenCLTemplate.CLCalc.Program.Variable(v6);
OpenCLTemplate.CLCalc.Program.Variable varV7 = new OpenCLTemplate.CLCalc.Program.Variable(v7);
OpenCLTemplate.CLCalc.Program.Variable varV8 = new OpenCLTemplate.CLCalc.Program.Variable(v8);
OpenCLTemplate.CLCalc.Program.Variable varV9 = new OpenCLTemplate.CLCalc.Program.Variable(v9);
OpenCLTemplate.CLCalc.Program.Variable varV10 = new OpenCLTemplate.CLCalc.Program.Variable(v10);
OpenCLTemplate.CLCalc.Program.Variable varV11 = new OpenCLTemplate.CLCalc.Program.Variable(v11);
OpenCLTemplate.CLCalc.Program.Variable varV12 = new OpenCLTemplate.CLCalc.Program.Variable(v12);
OpenCLTemplate.CLCalc.Program.Variable varV13 = new OpenCLTemplate.CLCalc.Program.Variable(v13);

OpenCLTemplate.CLCalc.Program.Variable[] args = new OpenCLTemplate.CLCalc.Program.Variable[] { varV1, varV2, varV3, varV4, varV5, varV6, varV7, varV8, varV9, varV10, varV11, varV12, varV13 };

int[] workers = new int[1] { n };

sw.Start();
while (f < gpudec2)
{
VectorSum.Execute(args, workers);
f++;
v9[0] = s;
}
varV4.ReadFromDeviceTo(v4);
varV5.ReadFromDeviceTo(v5);
varV6.ReadFromDeviceTo(v6);
varV7.ReadFromDeviceTo(v7);
varV8.ReadFromDeviceTo(v8);

sw.Stop();


GPUtime = sw.Elapsed.TotalSeconds;

}
public static void GPUthread3()
{
Random RandomClass = new Random();
f = 0;
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();

string orbit = @"
__kernel void
orbit(__global float * v1,
__global float * v2,
__global float * v3,
__global float * v4,
__global float * v5,
__global float * v6,
__global float * v7,
__global float * v8,
__global float * v9,
__global float * v10,
__global float * v11,
__global float * v12,
__global float * v13)
{
int i = get_global_id(0);
while (v11[0] < v12[0])
{
v9[0] = v13[0];
while (v9[0] < v10[0])
{
v4 = v3 / (2 * 398600500000000 / (v3 * (v1 * v1)) - 1);
v5 = v3 * (v1 * v1) / 398600500000000 - 1;
v6 = v4 / (1 + v5);
v7 = v5 * v6;
v6 = v6 * v6;
v7 = v7 * v7;
v8 = v6 - v7;
v8 = sqrt( v8 );
v9[0]++;
}
v11[0]++;
}
}";

OpenCLTemplate.CLCalc.InitCL();

OpenCLTemplate.CLCalc.Program.Compile(new string[] { orbit });

OpenCLTemplate.CLCalc.Program.Kernel VectorSum = new OpenCLTemplate.CLCalc.Program.Kernel("orbit");

int n = 1000000;

float[] v1 = new float[n], v2 = new float[n], v3 = new float[n], v4 = new float[n], v5 = new float[n], v6 = new float[n], v7 = new float[n], v8 = new float[n], v9 = new float[1], v10 = new float[1], v11 = new float[1], v12 = new float[1], v13 = new float[1];

for (int i = 0; i < n; i++)
{
v1 = RandomClass.Next(1000, 100000);
v2 = RandomClass.Next(200000, 10000000);
v3 = 6378140 + v2;
}

v13[0] = s;
v9[0] = s;
v10[0] = gpu2;
v11[0] = o;
v12[0] = p;

OpenCLTemplate.CLCalc.Program.Variable varV1 = new OpenCLTemplate.CLCalc.Program.Variable(v1);
OpenCLTemplate.CLCalc.Program.Variable varV2 = new OpenCLTemplate.CLCalc.Program.Variable(v2);
OpenCLTemplate.CLCalc.Program.Variable varV3 = new OpenCLTemplate.CLCalc.Program.Variable(v3);
OpenCLTemplate.CLCalc.Program.Variable varV4 = new OpenCLTemplate.CLCalc.Program.Variable(v4);
OpenCLTemplate.CLCalc.Program.Variable varV5 = new OpenCLTemplate.CLCalc.Program.Variable(v5);
OpenCLTemplate.CLCalc.Program.Variable varV6 = new OpenCLTemplate.CLCalc.Program.Variable(v6);
OpenCLTemplate.CLCalc.Program.Variable varV7 = new OpenCLTemplate.CLCalc.Program.Variable(v7);
OpenCLTemplate.CLCalc.Program.Variable varV8 = new OpenCLTemplate.CLCalc.Program.Variable(v8);
OpenCLTemplate.CLCalc.Program.Variable varV9 = new OpenCLTemplate.CLCalc.Program.Variable(v9);
OpenCLTemplate.CLCalc.Program.Variable varV10 = new OpenCLTemplate.CLCalc.Program.Variable(v10);
OpenCLTemplate.CLCalc.Program.Variable varV11 = new OpenCLTemplate.CLCalc.Program.Variable(v11);
OpenCLTemplate.CLCalc.Program.Variable varV12 = new OpenCLTemplate.CLCalc.Program.Variable(v12);
OpenCLTemplate.CLCalc.Program.Variable varV13 = new OpenCLTemplate.CLCalc.Program.Variable(v13);

OpenCLTemplate.CLCalc.Program.Variable[] args = new OpenCLTemplate.CLCalc.Program.Variable[] { varV1, varV2, varV3, varV4, varV5, varV6, varV7, varV8, varV9, varV10, varV11, varV12, varV13 };

int[] workers = new int[1] { n };

sw.Start();
while (f < gpudec2)
{
VectorSum.Execute(args, workers);
f++;
v9[0] = s;
}
varV4.ReadFromDeviceTo(v4);
varV5.ReadFromDeviceTo(v5);
varV6.ReadFromDeviceTo(v6);
varV7.ReadFromDeviceTo(v7);
varV8.ReadFromDeviceTo(v8);

sw.Stop();


GPUtime = sw.Elapsed.TotalSeconds;

}

public static void GPUthread4()
{
Random RandomClass = new Random();
f = 0;
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();

string orbit = @"
__kernel void
orbit(__global float * v1,
__global float * v2,
__global float * v3,
__global float * v4,
__global float * v5,
__global float * v6,
__global float * v7,
__global float * v8,
__global float * v9,
__global float * v10,
__global float * v11,
__global float * v12,
__global float * v13)
{
int i = get_global_id(0);
while (v11[0] < v12[0])
{
v9[0] = v13[0];
while (v9[0] < v10[0])
{
v4 = v3 / (2 * 398600500000000 / (v3 * (v1 * v1)) - 1);
v5 = v3 * (v1 * v1) / 398600500000000 - 1;
v6 = v4 / (1 + v5);
v7 = v5 * v6;
v6 = v6 * v6;
v7 = v7 * v7;
v8 = v6 - v7;
v8 = sqrt( v8 );
v9[0]++;
}
v11[0]++;
}
}";

OpenCLTemplate.CLCalc.InitCL();

OpenCLTemplate.CLCalc.Program.Compile(new string[] { orbit });

OpenCLTemplate.CLCalc.Program.Kernel VectorSum = new OpenCLTemplate.CLCalc.Program.Kernel("orbit");

int n = 1000000;

float[] v1 = new float[n], v2 = new float[n], v3 = new float[n], v4 = new float[n], v5 = new float[n], v6 = new float[n], v7 = new float[n], v8 = new float[n], v9 = new float[1], v10 = new float[1], v11 = new float[1], v12 = new float[1], v13 = new float[1];

for (int i = 0; i < n; i++)
{
v1 = RandomClass.Next(1000, 100000);
v2 = RandomClass.Next(200000, 10000000);
v3 = 6378140 + v2;
}

v13[0] = s;
v9[0] = s;
v10[0] = gpu2;
v11[0] = o;
v12[0] = p;

OpenCLTemplate.CLCalc.Program.Variable varV1 = new OpenCLTemplate.CLCalc.Program.Variable(v1);
OpenCLTemplate.CLCalc.Program.Variable varV2 = new OpenCLTemplate.CLCalc.Program.Variable(v2);
OpenCLTemplate.CLCalc.Program.Variable varV3 = new OpenCLTemplate.CLCalc.Program.Variable(v3);
OpenCLTemplate.CLCalc.Program.Variable varV4 = new OpenCLTemplate.CLCalc.Program.Variable(v4);
OpenCLTemplate.CLCalc.Program.Variable varV5 = new OpenCLTemplate.CLCalc.Program.Variable(v5);
OpenCLTemplate.CLCalc.Program.Variable varV6 = new OpenCLTemplate.CLCalc.Program.Variable(v6);
OpenCLTemplate.CLCalc.Program.Variable varV7 = new OpenCLTemplate.CLCalc.Program.Variable(v7);
OpenCLTemplate.CLCalc.Program.Variable varV8 = new OpenCLTemplate.CLCalc.Program.Variable(v8);
OpenCLTemplate.CLCalc.Program.Variable varV9 = new OpenCLTemplate.CLCalc.Program.Variable(v9);
OpenCLTemplate.CLCalc.Program.Variable varV10 = new OpenCLTemplate.CLCalc.Program.Variable(v10);
OpenCLTemplate.CLCalc.Program.Variable varV11 = new OpenCLTemplate.CLCalc.Program.Variable(v11);
OpenCLTemplate.CLCalc.Program.Variable varV12 = new OpenCLTemplate.CLCalc.Program.Variable(v12);
OpenCLTemplate.CLCalc.Program.Variable varV13 = new OpenCLTemplate.CLCalc.Program.Variable(v13);

OpenCLTemplate.CLCalc.Program.Variable[] args = new OpenCLTemplate.CLCalc.Program.Variable[] { varV1, varV2, varV3, varV4, varV5, varV6, varV7, varV8, varV9, varV10, varV11, varV12, varV13 };

int[] workers = new int[1] { n };

sw.Start();
while (f < gpudec2)
{
VectorSum.Execute(args, workers);
f++;
v9[0] = s;
}
varV4.ReadFromDeviceTo(v4);
varV5.ReadFromDeviceTo(v5);
varV6.ReadFromDeviceTo(v6);
varV7.ReadFromDeviceTo(v7);
varV8.ReadFromDeviceTo(v8);

sw.Stop();


GPUtime = sw.Elapsed.TotalSeconds;


}

public static void GPUthread5()
{
Random RandomClass = new Random();
f = 0;
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();

string orbit = @"
__kernel void
orbit(__global float * v1,
__global float * v2,
__global float * v3,
__global float * v4,
__global float * v5,
__global float * v6,
__global float * v7,
__global float * v8,
__global float * v9,
__global float * v10,
__global float * v11,
__global float * v12,
__global float * v13)
{
int i = get_global_id(0);
while (v11[0] < v12[0])
{
v9[0] = v13[0];
while (v9[0] < v10[0])
{
v4 = v3 / (2 * 398600500000000 / (v3 * (v1 * v1)) - 1);
v5 = v3 * (v1 * v1) / 398600500000000 - 1;
v6 = v4 / (1 + v5);
v7 = v5 * v6;
v6 = v6 * v6;
v7 = v7 * v7;
v8 = v6 - v7;
v8 = sqrt( v8 );
v9[0]++;
}
v11[0]++;
}
}";

OpenCLTemplate.CLCalc.InitCL();

OpenCLTemplate.CLCalc.Program.Compile(new string[] { orbit });

OpenCLTemplate.CLCalc.Program.Kernel VectorSum = new OpenCLTemplate.CLCalc.Program.Kernel("orbit");

int n = 1000000;

float[] v1 = new float[n], v2 = new float[n], v3 = new float[n], v4 = new float[n], v5 = new float[n], v6 = new float[n], v7 = new float[n], v8 = new float[n], v9 = new float[1], v10 = new float[1], v11 = new float[1], v12 = new float[1], v13 = new float[1];

for (int i = 0; i < n; i++)
{
v1 = RandomClass.Next(1000, 100000);
v2 = RandomClass.Next(200000, 10000000);
v3 = 6378140 + v2;
}

v13[0] = s;
v9[0] = s;
v10[0] = gpu2;
v11[0] = o;
v12[0] = p;

OpenCLTemplate.CLCalc.Program.Variable varV1 = new OpenCLTemplate.CLCalc.Program.Variable(v1);
OpenCLTemplate.CLCalc.Program.Variable varV2 = new OpenCLTemplate.CLCalc.Program.Variable(v2);
OpenCLTemplate.CLCalc.Program.Variable varV3 = new OpenCLTemplate.CLCalc.Program.Variable(v3);
OpenCLTemplate.CLCalc.Program.Variable varV4 = new OpenCLTemplate.CLCalc.Program.Variable(v4);
OpenCLTemplate.CLCalc.Program.Variable varV5 = new OpenCLTemplate.CLCalc.Program.Variable(v5);
OpenCLTemplate.CLCalc.Program.Variable varV6 = new OpenCLTemplate.CLCalc.Program.Variable(v6);
OpenCLTemplate.CLCalc.Program.Variable varV7 = new OpenCLTemplate.CLCalc.Program.Variable(v7);
OpenCLTemplate.CLCalc.Program.Variable varV8 = new OpenCLTemplate.CLCalc.Program.Variable(v8);
OpenCLTemplate.CLCalc.Program.Variable varV9 = new OpenCLTemplate.CLCalc.Program.Variable(v9);
OpenCLTemplate.CLCalc.Program.Variable varV10 = new OpenCLTemplate.CLCalc.Program.Variable(v10);
OpenCLTemplate.CLCalc.Program.Variable varV11 = new OpenCLTemplate.CLCalc.Program.Variable(v11);
OpenCLTemplate.CLCalc.Program.Variable varV12 = new OpenCLTemplate.CLCalc.Program.Variable(v12);
OpenCLTemplate.CLCalc.Program.Variable varV13 = new OpenCLTemplate.CLCalc.Program.Variable(v13);

OpenCLTemplate.CLCalc.Program.Variable[] args = new OpenCLTemplate.CLCalc.Program.Variable[] { varV1, varV2, varV3, varV4, varV5, varV6, varV7, varV8, varV9, varV10, varV11, varV12, varV13 };

int[] workers = new int[1] { n };

sw.Start();
while (f < gpudec2)
{
VectorSum.Execute(args, workers);
f++;
v9[0] = s;
}
varV4.ReadFromDeviceTo(v4);
varV5.ReadFromDeviceTo(v5);
varV6.ReadFromDeviceTo(v6);
varV7.ReadFromDeviceTo(v7);
varV8.ReadFromDeviceTo(v8);

sw.Stop();


GPUtime = sw.Elapsed.TotalSeconds;

}

public static void GPUthread6()
{
Random RandomClass = new Random();
f = 0;
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();

string orbit = @"
__kernel void
orbit(__global float * v1,
__global float * v2,
__global float * v3,
__global float * v4,
__global float * v5,
__global float * v6,
__global float * v7,
__global float * v8,
__global float * v9,
__global float * v10,
__global float * v11,
__global float * v12,
__global float * v13)
{
int i = get_global_id(0);
while (v11[0] < v12[0])
{
v9[0] = v13[0];
while (v9[0] < v10[0])
{
v4 = v3 / (2 * 398600500000000 / (v3 * (v1 * v1)) - 1);
v5 = v3 * (v1 * v1) / 398600500000000 - 1;
v6 = v4 / (1 + v5);
v7 = v5 * v6;
v6 = v6 * v6;
v7 = v7 * v7;
v8 = v6 - v7;
v8 = sqrt( v8 );
v9[0]++;
}
v11[0]++;
}
}";

OpenCLTemplate.CLCalc.InitCL();

OpenCLTemplate.CLCalc.Program.Compile(new string[] { orbit });

OpenCLTemplate.CLCalc.Program.Kernel VectorSum = new OpenCLTemplate.CLCalc.Program.Kernel("orbit");

int n = 1000000;

float[] v1 = new float[n], v2 = new float[n], v3 = new float[n], v4 = new float[n], v5 = new float[n], v6 = new float[n], v7 = new float[n], v8 = new float[n], v9 = new float[1], v10 = new float[1], v11 = new float[1], v12 = new float[1], v13 = new float[1];

for (int i = 0; i < n; i++)
{
v1 = RandomClass.Next(1000, 100000);
v2 = RandomClass.Next(200000, 10000000);
v3 = 6378140 + v2;
}

v13[0] = s;
v9[0] = s;
v10[0] = gpu2;
v11[0] = o;
v12[0] = p;

OpenCLTemplate.CLCalc.Program.Variable varV1 = new OpenCLTemplate.CLCalc.Program.Variable(v1);
OpenCLTemplate.CLCalc.Program.Variable varV2 = new OpenCLTemplate.CLCalc.Program.Variable(v2);
OpenCLTemplate.CLCalc.Program.Variable varV3 = new OpenCLTemplate.CLCalc.Program.Variable(v3);
OpenCLTemplate.CLCalc.Program.Variable varV4 = new OpenCLTemplate.CLCalc.Program.Variable(v4);
OpenCLTemplate.CLCalc.Program.Variable varV5 = new OpenCLTemplate.CLCalc.Program.Variable(v5);
OpenCLTemplate.CLCalc.Program.Variable varV6 = new OpenCLTemplate.CLCalc.Program.Variable(v6);
OpenCLTemplate.CLCalc.Program.Variable varV7 = new OpenCLTemplate.CLCalc.Program.Variable(v7);
OpenCLTemplate.CLCalc.Program.Variable varV8 = new OpenCLTemplate.CLCalc.Program.Variable(v8);
OpenCLTemplate.CLCalc.Program.Variable varV9 = new OpenCLTemplate.CLCalc.Program.Variable(v9);
OpenCLTemplate.CLCalc.Program.Variable varV10 = new OpenCLTemplate.CLCalc.Program.Variable(v10);
OpenCLTemplate.CLCalc.Program.Variable varV11 = new OpenCLTemplate.CLCalc.Program.Variable(v11);
OpenCLTemplate.CLCalc.Program.Variable varV12 = new OpenCLTemplate.CLCalc.Program.Variable(v12);
OpenCLTemplate.CLCalc.Program.Variable varV13 = new OpenCLTemplate.CLCalc.Program.Variable(v13);

OpenCLTemplate.CLCalc.Program.Variable[] args = new OpenCLTemplate.CLCalc.Program.Variable[] { varV1, varV2, varV3, varV4, varV5, varV6, varV7, varV8, varV9, varV10, varV11, varV12, varV13 };

int[] workers = new int[1] { n };

sw.Start();
while (f < gpudec2)
{
VectorSum.Execute(args, workers);
f++;
v9[0] = s;
}
varV4.ReadFromDeviceTo(v4);
varV5.ReadFromDeviceTo(v5);
varV6.ReadFromDeviceTo(v6);
varV7.ReadFromDeviceTo(v7);
varV8.ReadFromDeviceTo(v8);

sw.Stop();


GPUtime = sw.Elapsed.TotalSeconds;

}

public static void GPUthread7()
{
Random RandomClass = new Random();
f = 0;
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();

string orbit = @"
__kernel void
orbit(__global float * v1,
__global float * v2,
__global float * v3,
__global float * v4,
__global float * v5,
__global float * v6,
__global float * v7,
__global float * v8,
__global float * v9,
__global float * v10,
__global float * v11,
__global float * v12,
__global float * v13)
{
int i = get_global_id(0);
while (v11[0] < v12[0])
{
v9[0] = v13[0];
while (v9[0] < v10[0])
{
v4 = v3 / (2 * 398600500000000 / (v3 * (v1 * v1)) - 1);
v5 = v3 * (v1 * v1) / 398600500000000 - 1;
v6 = v4 / (1 + v5);
v7 = v5 * v6;
v6 = v6 * v6;
v7 = v7 * v7;
v8 = v6 - v7;
v8 = sqrt( v8 );
v9[0]++;
}
v11[0]++;
}
}";

OpenCLTemplate.CLCalc.InitCL();

OpenCLTemplate.CLCalc.Program.Compile(new string[] { orbit });

OpenCLTemplate.CLCalc.Program.Kernel VectorSum = new OpenCLTemplate.CLCalc.Program.Kernel("orbit");

int n = 1000000;

float[] v1 = new float[n], v2 = new float[n], v3 = new float[n], v4 = new float[n], v5 = new float[n], v6 = new float[n], v7 = new float[n], v8 = new float[n], v9 = new float[1], v10 = new float[1], v11 = new float[1], v12 = new float[1], v13 = new float[1];

for (int i = 0; i < n; i++)
{
v1 = RandomClass.Next(1000, 100000);
v2 = RandomClass.Next(200000, 10000000);
v3 = 6378140 + v2;
}

v13[0] = s;
v9[0] = s;
v10[0] = gpu2;
v11[0] = o;
v12[0] = p;

OpenCLTemplate.CLCalc.Program.Variable varV1 = new OpenCLTemplate.CLCalc.Program.Variable(v1);
OpenCLTemplate.CLCalc.Program.Variable varV2 = new OpenCLTemplate.CLCalc.Program.Variable(v2);
OpenCLTemplate.CLCalc.Program.Variable varV3 = new OpenCLTemplate.CLCalc.Program.Variable(v3);
OpenCLTemplate.CLCalc.Program.Variable varV4 = new OpenCLTemplate.CLCalc.Program.Variable(v4);
OpenCLTemplate.CLCalc.Program.Variable varV5 = new OpenCLTemplate.CLCalc.Program.Variable(v5);
OpenCLTemplate.CLCalc.Program.Variable varV6 = new OpenCLTemplate.CLCalc.Program.Variable(v6);
OpenCLTemplate.CLCalc.Program.Variable varV7 = new OpenCLTemplate.CLCalc.Program.Variable(v7);
OpenCLTemplate.CLCalc.Program.Variable varV8 = new OpenCLTemplate.CLCalc.Program.Variable(v8);
OpenCLTemplate.CLCalc.Program.Variable varV9 = new OpenCLTemplate.CLCalc.Program.Variable(v9);
OpenCLTemplate.CLCalc.Program.Variable varV10 = new OpenCLTemplate.CLCalc.Program.Variable(v10);
OpenCLTemplate.CLCalc.Program.Variable varV11 = new OpenCLTemplate.CLCalc.Program.Variable(v11);
OpenCLTemplate.CLCalc.Program.Variable varV12 = new OpenCLTemplate.CLCalc.Program.Variable(v12);
OpenCLTemplate.CLCalc.Program.Variable varV13 = new OpenCLTemplate.CLCalc.Program.Variable(v13);

OpenCLTemplate.CLCalc.Program.Variable[] args = new OpenCLTemplate.CLCalc.Program.Variable[] { varV1, varV2, varV3, varV4, varV5, varV6, varV7, varV8, varV9, varV10, varV11, varV12, varV13 };

int[] workers = new int[1] { n };

sw.Start();
while (f < gpudec2)
{
VectorSum.Execute(args, workers);
f++;
v9[0] = s;
}
varV4.ReadFromDeviceTo(v4);
varV5.ReadFromDeviceTo(v5);
varV6.ReadFromDeviceTo(v6);
varV7.ReadFromDeviceTo(v7);
varV8.ReadFromDeviceTo(v8);

sw.Stop();


GPUtime = sw.Elapsed.TotalSeconds;

}

public static void GPUthread8()
{
Random RandomClass = new Random();
f = 0;
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();

string orbit = @"
__kernel void
orbit(__global float * v1,
__global float * v2,
__global float * v3,
__global float * v4,
__global float * v5,
__global float * v6,
__global float * v7,
__global float * v8,
__global float * v9,
__global float * v10,
__global float * v11,
__global float * v12,
__global float * v13)
{
int i = get_global_id(0);
while (v11[0] < v12[0])
{
v9[0] = v13[0];
while (v9[0] < v10[0])
{
v4 = v3 / (2 * 398600500000000 / (v3 * (v1 * v1)) - 1);
v5 = v3 * (v1 * v1) / 398600500000000 - 1;
v6 = v4 / (1 + v5);
v7 = v5 * v6;
v6 = v6 * v6;
v7 = v7 * v7;
v8 = v6 - v7;
v8 = sqrt( v8 );
v9[0]++;
}
v11[0]++;
}
}";

OpenCLTemplate.CLCalc.InitCL();

OpenCLTemplate.CLCalc.Program.Compile(new string[] { orbit });

OpenCLTemplate.CLCalc.Program.Kernel VectorSum = new OpenCLTemplate.CLCalc.Program.Kernel("orbit");

int n = 1000000;

float[] v1 = new float[n], v2 = new float[n], v3 = new float[n], v4 = new float[n], v5 = new float[n], v6 = new float[n], v7 = new float[n], v8 = new float[n], v9 = new float[1], v10 = new float[1], v11 = new float[1], v12 = new float[1], v13 = new float[1];

for (int i = 0; i < n; i++)
{
v1 = RandomClass.Next(1000, 100000);
v2 = RandomClass.Next(200000, 10000000);
v3 = 6378140 + v2;
}

v13[0] = s;
v9[0] = s;
v10[0] = gpu2;
v11[0] = o;
v12[0] = p;

OpenCLTemplate.CLCalc.Program.Variable varV1 = new OpenCLTemplate.CLCalc.Program.Variable(v1);
OpenCLTemplate.CLCalc.Program.Variable varV2 = new OpenCLTemplate.CLCalc.Program.Variable(v2);
OpenCLTemplate.CLCalc.Program.Variable varV3 = new OpenCLTemplate.CLCalc.Program.Variable(v3);
OpenCLTemplate.CLCalc.Program.Variable varV4 = new OpenCLTemplate.CLCalc.Program.Variable(v4);
OpenCLTemplate.CLCalc.Program.Variable varV5 = new OpenCLTemplate.CLCalc.Program.Variable(v5);
OpenCLTemplate.CLCalc.Program.Variable varV6 = new OpenCLTemplate.CLCalc.Program.Variable(v6);
OpenCLTemplate.CLCalc.Program.Variable varV7 = new OpenCLTemplate.CLCalc.Program.Variable(v7);
OpenCLTemplate.CLCalc.Program.Variable varV8 = new OpenCLTemplate.CLCalc.Program.Variable(v8);
OpenCLTemplate.CLCalc.Program.Variable varV9 = new OpenCLTemplate.CLCalc.Program.Variable(v9);
OpenCLTemplate.CLCalc.Program.Variable varV10 = new OpenCLTemplate.CLCalc.Program.Variable(v10);
OpenCLTemplate.CLCalc.Program.Variable varV11 = new OpenCLTemplate.CLCalc.Program.Variable(v11);
OpenCLTemplate.CLCalc.Program.Variable varV12 = new OpenCLTemplate.CLCalc.Program.Variable(v12);
OpenCLTemplate.CLCalc.Program.Variable varV13 = new OpenCLTemplate.CLCalc.Program.Variable(v13);

OpenCLTemplate.CLCalc.Program.Variable[] args = new OpenCLTemplate.CLCalc.Program.Variable[] { varV1, varV2, varV3, varV4, varV5, varV6, varV7, varV8, varV9, varV10, varV11, varV12, varV13 };

int[] workers = new int[1] { n };

sw.Start();
while (f < gpudec2)
{
VectorSum.Execute(args, workers);
f++;
v9[0] = s;
}
varV4.ReadFromDeviceTo(v4);
varV5.ReadFromDeviceTo(v5);
varV6.ReadFromDeviceTo(v6);
varV7.ReadFromDeviceTo(v7);
varV8.ReadFromDeviceTo(v8);

sw.Stop();


GPUtime = sw.Elapsed.TotalSeconds;


}

public static void GPUthread9()
{
Random RandomClass = new Random();
f = 0;
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();

string orbit = @"
__kernel void
orbit(__global float * v1,
__global float * v2,
__global float * v3,
__global float * v4,
__global float * v5,
__global float * v6,
__global float * v7,
__global float * v8,
__global float * v9,
__global float * v10,
__global float * v11,
__global float * v12,
__global float * v13)
{
int i = get_global_id(0);
while (v11[0] < v12[0])
{
v9[0] = v13[0];
while (v9[0] < v10[0])
{
v4 = v3 / (2 * 398600500000000 / (v3 * (v1 * v1)) - 1);
v5 = v3 * (v1 * v1) / 398600500000000 - 1;
v6 = v4 / (1 + v5);
v7 = v5 * v6;
v6 = v6 * v6;
v7 = v7 * v7;
v8 = v6 - v7;
v8 = sqrt( v8 );
v9[0]++;
}
v11[0]++;
}
}";

OpenCLTemplate.CLCalc.InitCL();

OpenCLTemplate.CLCalc.Program.Compile(new string[] { orbit });

OpenCLTemplate.CLCalc.Program.Kernel VectorSum = new OpenCLTemplate.CLCalc.Program.Kernel("orbit");

int n = 1000000;

float[] v1 = new float[n], v2 = new float[n], v3 = new float[n], v4 = new float[n], v5 = new float[n], v6 = new float[n], v7 = new float[n], v8 = new float[n], v9 = new float[1], v10 = new float[1], v11 = new float[1], v12 = new float[1], v13 = new float[1];

for (int i = 0; i < n; i++)
{
v1 = RandomClass.Next(1000, 100000);
v2 = RandomClass.Next(200000, 10000000);
v3 = 6378140 + v2;
}

v13[0] = s;
v9[0] = s;
v10[0] = gpu2;
v11[0] = o;
v12[0] = p;

OpenCLTemplate.CLCalc.Program.Variable varV1 = new OpenCLTemplate.CLCalc.Program.Variable(v1);
OpenCLTemplate.CLCalc.Program.Variable varV2 = new OpenCLTemplate.CLCalc.Program.Variable(v2);
OpenCLTemplate.CLCalc.Program.Variable varV3 = new OpenCLTemplate.CLCalc.Program.Variable(v3);
OpenCLTemplate.CLCalc.Program.Variable varV4 = new OpenCLTemplate.CLCalc.Program.Variable(v4);
OpenCLTemplate.CLCalc.Program.Variable varV5 = new OpenCLTemplate.CLCalc.Program.Variable(v5);
OpenCLTemplate.CLCalc.Program.Variable varV6 = new OpenCLTemplate.CLCalc.Program.Variable(v6);
OpenCLTemplate.CLCalc.Program.Variable varV7 = new OpenCLTemplate.CLCalc.Program.Variable(v7);
OpenCLTemplate.CLCalc.Program.Variable varV8 = new OpenCLTemplate.CLCalc.Program.Variable(v8);
OpenCLTemplate.CLCalc.Program.Variable varV9 = new OpenCLTemplate.CLCalc.Program.Variable(v9);
OpenCLTemplate.CLCalc.Program.Variable varV10 = new OpenCLTemplate.CLCalc.Program.Variable(v10);
OpenCLTemplate.CLCalc.Program.Variable varV11 = new OpenCLTemplate.CLCalc.Program.Variable(v11);
OpenCLTemplate.CLCalc.Program.Variable varV12 = new OpenCLTemplate.CLCalc.Program.Variable(v12);
OpenCLTemplate.CLCalc.Program.Variable varV13 = new OpenCLTemplate.CLCalc.Program.Variable(v13);

OpenCLTemplate.CLCalc.Program.Variable[] args = new OpenCLTemplate.CLCalc.Program.Variable[] { varV1, varV2, varV3, varV4, varV5, varV6, varV7, varV8, varV9, varV10, varV11, varV12, varV13 };

int[] workers = new int[1] { n };

sw.Start();
while (f < gpudec2)
{
VectorSum.Execute(args, workers);
f++;
v9[0] = s;
}
varV4.ReadFromDeviceTo(v4);
varV5.ReadFromDeviceTo(v5);
varV6.ReadFromDeviceTo(v6);
varV7.ReadFromDeviceTo(v7);
varV8.ReadFromDeviceTo(v8);

sw.Stop();


GPUtime = sw.Elapsed.TotalSeconds;

}

public static void GPUthread10()
{
Random RandomClass = new Random();
f = 0;
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();

string orbit = @"
__kernel void
orbit(__global float * v1,
__global float * v2,
__global float * v3,
__global float * v4,
__global float * v5,
__global float * v6,
__global float * v7,
__global float * v8,
__global float * v9,
__global float * v10,
__global float * v11,
__global float * v12,
__global float * v13)
{
int i = get_global_id(0);
while (v11[0] < v12[0])
{
v9[0] = v13[0];
while (v9[0] < v10[0])
{
v4 = v3 / (2 * 398600500000000 / (v3 * (v1 * v1)) - 1);
v5 = v3 * (v1 * v1) / 398600500000000 - 1;
v6 = v4 / (1 + v5);
v7 = v5 * v6;
v6 = v6 * v6;
v7 = v7 * v7;
v8 = v6 - v7;
v8 = sqrt( v8 );
v9[0]++;
}
v11[0]++;
}
}";

OpenCLTemplate.CLCalc.InitCL();

OpenCLTemplate.CLCalc.Program.Compile(new string[] { orbit });

OpenCLTemplate.CLCalc.Program.Kernel VectorSum = new OpenCLTemplate.CLCalc.Program.Kernel("orbit");

int n = 1000000;

float[] v1 = new float[n], v2 = new float[n], v3 = new float[n], v4 = new float[n], v5 = new float[n], v6 = new float[n], v7 = new float[n], v8 = new float[n], v9 = new float[1], v10 = new float[1], v11 = new float[1], v12 = new float[1], v13 = new float[1];

for (int i = 0; i < n; i++)
{
v1 = RandomClass.Next(1000, 100000);
v2 = RandomClass.Next(200000, 10000000);
v3 = 6378140 + v2;
}

v13[0] = s;
v9[0] = s;
v10[0] = gpu2;
v11[0] = o;
v12[0] = p;

OpenCLTemplate.CLCalc.Program.Variable varV1 = new OpenCLTemplate.CLCalc.Program.Variable(v1);
OpenCLTemplate.CLCalc.Program.Variable varV2 = new OpenCLTemplate.CLCalc.Program.Variable(v2);
OpenCLTemplate.CLCalc.Program.Variable varV3 = new OpenCLTemplate.CLCalc.Program.Variable(v3);
OpenCLTemplate.CLCalc.Program.Variable varV4 = new OpenCLTemplate.CLCalc.Program.Variable(v4);
OpenCLTemplate.CLCalc.Program.Variable varV5 = new OpenCLTemplate.CLCalc.Program.Variable(v5);
OpenCLTemplate.CLCalc.Program.Variable varV6 = new OpenCLTemplate.CLCalc.Program.Variable(v6);
OpenCLTemplate.CLCalc.Program.Variable varV7 = new OpenCLTemplate.CLCalc.Program.Variable(v7);
OpenCLTemplate.CLCalc.Program.Variable varV8 = new OpenCLTemplate.CLCalc.Program.Variable(v8);
OpenCLTemplate.CLCalc.Program.Variable varV9 = new OpenCLTemplate.CLCalc.Program.Variable(v9);
OpenCLTemplate.CLCalc.Program.Variable varV10 = new OpenCLTemplate.CLCalc.Program.Variable(v10);
OpenCLTemplate.CLCalc.Program.Variable varV11 = new OpenCLTemplate.CLCalc.Program.Variable(v11);
OpenCLTemplate.CLCalc.Program.Variable varV12 = new OpenCLTemplate.CLCalc.Program.Variable(v12);
OpenCLTemplate.CLCalc.Program.Variable varV13 = new OpenCLTemplate.CLCalc.Program.Variable(v13);

OpenCLTemplate.CLCalc.Program.Variable[] args = new OpenCLTemplate.CLCalc.Program.Variable[] { varV1, varV2, varV3, varV4, varV5, varV6, varV7, varV8, varV9, varV10, varV11, varV12, varV13 };

int[] workers = new int[1] { n };

sw.Start();
while (f < gpudec2)
{
VectorSum.Execute(args, workers);
f++;
v9[0] = s;
}
varV4.ReadFromDeviceTo(v4);
varV5.ReadFromDeviceTo(v5);
varV6.ReadFromDeviceTo(v6);
varV7.ReadFromDeviceTo(v7);
varV8.ReadFromDeviceTo(v8);

sw.Stop();


GPUtime = sw.Elapsed.TotalSeconds;

}

public static void GPUthread11()
{
Random RandomClass = new Random();
f = 0;
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();

string orbit = @"
__kernel void
orbit(__global float * v1,
__global float * v2,
__global float * v3,
__global float * v4,
__global float * v5,
__global float * v6,
__global float * v7,
__global float * v8,
__global float * v9,
__global float * v10,
__global float * v11,
__global float * v12,
__global float * v13)
{
int i = get_global_id(0);
while (v11[0] < v12[0])
{
v9[0] = v13[0];
while (v9[0] < v10[0])
{
v4 = v3 / (2 * 398600500000000 / (v3 * (v1 * v1)) - 1);
v5 = v3 * (v1 * v1) / 398600500000000 - 1;
v6 = v4 / (1 + v5);
v7 = v5 * v6;
v6 = v6 * v6;
v7 = v7 * v7;
v8 = v6 - v7;
v8 = sqrt( v8 );
v9[0]++;
}
v11[0]++;
}
}";

OpenCLTemplate.CLCalc.InitCL();

OpenCLTemplate.CLCalc.Program.Compile(new string[] { orbit });

OpenCLTemplate.CLCalc.Program.Kernel VectorSum = new OpenCLTemplate.CLCalc.Program.Kernel("orbit");

int n = 1000000;

float[] v1 = new float[n], v2 = new float[n], v3 = new float[n], v4 = new float[n], v5 = new float[n], v6 = new float[n], v7 = new float[n], v8 = new float[n], v9 = new float[1], v10 = new float[1], v11 = new float[1], v12 = new float[1], v13 = new float[1];

for (int i = 0; i < n; i++)
{
v1 = RandomClass.Next(1000, 100000);
v2 = RandomClass.Next(200000, 10000000);
v3 = 6378140 + v2;
}

v13[0] = s;
v9[0] = s;
v10[0] = gpu2;
v11[0] = o;
v12[0] = p;

OpenCLTemplate.CLCalc.Program.Variable varV1 = new OpenCLTemplate.CLCalc.Program.Variable(v1);
OpenCLTemplate.CLCalc.Program.Variable varV2 = new OpenCLTemplate.CLCalc.Program.Variable(v2);
OpenCLTemplate.CLCalc.Program.Variable varV3 = new OpenCLTemplate.CLCalc.Program.Variable(v3);
OpenCLTemplate.CLCalc.Program.Variable varV4 = new OpenCLTemplate.CLCalc.Program.Variable(v4);
OpenCLTemplate.CLCalc.Program.Variable varV5 = new OpenCLTemplate.CLCalc.Program.Variable(v5);
OpenCLTemplate.CLCalc.Program.Variable varV6 = new OpenCLTemplate.CLCalc.Program.Variable(v6);
OpenCLTemplate.CLCalc.Program.Variable varV7 = new OpenCLTemplate.CLCalc.Program.Variable(v7);
OpenCLTemplate.CLCalc.Program.Variable varV8 = new OpenCLTemplate.CLCalc.Program.Variable(v8);
OpenCLTemplate.CLCalc.Program.Variable varV9 = new OpenCLTemplate.CLCalc.Program.Variable(v9);
OpenCLTemplate.CLCalc.Program.Variable varV10 = new OpenCLTemplate.CLCalc.Program.Variable(v10);
OpenCLTemplate.CLCalc.Program.Variable varV11 = new OpenCLTemplate.CLCalc.Program.Variable(v11);
OpenCLTemplate.CLCalc.Program.Variable varV12 = new OpenCLTemplate.CLCalc.Program.Variable(v12);
OpenCLTemplate.CLCalc.Program.Variable varV13 = new OpenCLTemplate.CLCalc.Program.Variable(v13);

OpenCLTemplate.CLCalc.Program.Variable[] args = new OpenCLTemplate.CLCalc.Program.Variable[] { varV1, varV2, varV3, varV4, varV5, varV6, varV7, varV8, varV9, varV10, varV11, varV12, varV13 };

int[] workers = new int[1] { n };

sw.Start();
while (f < gpudec2)
{
VectorSum.Execute(args, workers);
f++;
v9[0] = s;
}
varV4.ReadFromDeviceTo(v4);
varV5.ReadFromDeviceTo(v5);
varV6.ReadFromDeviceTo(v6);
varV7.ReadFromDeviceTo(v7);
varV8.ReadFromDeviceTo(v8);

sw.Stop();


GPUtime = sw.Elapsed.TotalSeconds;

}




public static void GPUthread12()
{
Random RandomClass = new Random();
f = 0;
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();

string orbit = @"
__kernel void
orbit(__global float * v1,
__global float * v2,
__global float * v3,
__global float * v4,
__global float * v5,
__global float * v6,
__global float * v7,
__global float * v8,
__global float * v9,
__global float * v10,
__global float * v11,
__global float * v12,
__global float * v13)
{
int i = get_global_id(0);
while (v11[0] < v12[0])
{
v9[0] = v13[0];
while (v9[0] < v10[0])
{
v4 = v3 / (2 * 398600500000000 / (v3 * (v1 * v1)) - 1);
v5 = v3 * (v1 * v1) / 398600500000000 - 1;
v6 = v4 / (1 + v5);
v7 = v5 * v6;
v6 = v6 * v6;
v7 = v7 * v7;
v8 = v6 - v7;
v8 = sqrt( v8 );
v9[0]++;
}
v11[0]++;
}
}";

OpenCLTemplate.CLCalc.InitCL();

OpenCLTemplate.CLCalc.Program.Compile(new string[] { orbit });

OpenCLTemplate.CLCalc.Program.Kernel VectorSum = new OpenCLTemplate.CLCalc.Program.Kernel("orbit");

int n = 1000000;

float[] v1 = new float[n], v2 = new float[n], v3 = new float[n], v4 = new float[n], v5 = new float[n], v6 = new float[n], v7 = new float[n], v8 = new float[n], v9 = new float[1], v10 = new float[1], v11 = new float[1], v12 = new float[1], v13 = new float[1];

for (int i = 0; i < n; i++)
{
v1 = RandomClass.Next(1000, 100000);
v2 = RandomClass.Next(200000, 10000000);
v3 = 6378140 + v2;
}

v13[0] = s;
v9[0] = s;
v10[0] = gpu2;
v11[0] = o;
v12[0] = p;

OpenCLTemplate.CLCalc.Program.Variable varV1 = new OpenCLTemplate.CLCalc.Program.Variable(v1);
OpenCLTemplate.CLCalc.Program.Variable varV2 = new OpenCLTemplate.CLCalc.Program.Variable(v2);
OpenCLTemplate.CLCalc.Program.Variable varV3 = new OpenCLTemplate.CLCalc.Program.Variable(v3);
OpenCLTemplate.CLCalc.Program.Variable varV4 = new OpenCLTemplate.CLCalc.Program.Variable(v4);
OpenCLTemplate.CLCalc.Program.Variable varV5 = new OpenCLTemplate.CLCalc.Program.Variable(v5);
OpenCLTemplate.CLCalc.Program.Variable varV6 = new OpenCLTemplate.CLCalc.Program.Variable(v6);
OpenCLTemplate.CLCalc.Program.Variable varV7 = new OpenCLTemplate.CLCalc.Program.Variable(v7);
OpenCLTemplate.CLCalc.Program.Variable varV8 = new OpenCLTemplate.CLCalc.Program.Variable(v8);
OpenCLTemplate.CLCalc.Program.Variable varV9 = new OpenCLTemplate.CLCalc.Program.Variable(v9);
OpenCLTemplate.CLCalc.Program.Variable varV10 = new OpenCLTemplate.CLCalc.Program.Variable(v10);
OpenCLTemplate.CLCalc.Program.Variable varV11 = new OpenCLTemplate.CLCalc.Program.Variable(v11);
OpenCLTemplate.CLCalc.Program.Variable varV12 = new OpenCLTemplate.CLCalc.Program.Variable(v12);
OpenCLTemplate.CLCalc.Program.Variable varV13 = new OpenCLTemplate.CLCalc.Program.Variable(v13);

OpenCLTemplate.CLCalc.Program.Variable[] args = new OpenCLTemplate.CLCalc.Program.Variable[] { varV1, varV2, varV3, varV4, varV5, varV6, varV7, varV8, varV9, varV10, varV11, varV12, varV13 };

int[] workers = new int[1] { n };

sw.Start();
while (f < gpudec2)
{
VectorSum.Execute(args, workers);
f++;
v9[0] = s;
}
varV4.ReadFromDeviceTo(v4);
varV5.ReadFromDeviceTo(v5);
varV6.ReadFromDeviceTo(v6);
varV7.ReadFromDeviceTo(v7);
varV8.ReadFromDeviceTo(v8);

sw.Stop();


GPUtime = sw.Elapsed.TotalSeconds;

}

public static void GPUthread13()
{
Random RandomClass = new Random();
f = 0;
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();

string orbit = @"
__kernel void
orbit(__global float * v1,
__global float * v2,
__global float * v3,
__global float * v4,
__global float * v5,
__global float * v6,
__global float * v7,
__global float * v8,
__global float * v9,
__global float * v10,
__global float * v11,
__global float * v12,
__global float * v13)
{
int i = get_global_id(0);
while (v11[0] < v12[0])
{
v9[0] = v13[0];
while (v9[0] < v10[0])
{
v4 = v3 / (2 * 398600500000000 / (v3 * (v1 * v1)) - 1);
v5 = v3 * (v1 * v1) / 398600500000000 - 1;
v6 = v4 / (1 + v5);
v7 = v5 * v6;
v6 = v6 * v6;
v7 = v7 * v7;
v8 = v6 - v7;
v8 = sqrt( v8 );
v9[0]++;
}
v11[0]++;
}
}";

OpenCLTemplate.CLCalc.InitCL();

OpenCLTemplate.CLCalc.Program.Compile(new string[] { orbit });

OpenCLTemplate.CLCalc.Program.Kernel VectorSum = new OpenCLTemplate.CLCalc.Program.Kernel("orbit");

int n = 1000000;

float[] v1 = new float[n], v2 = new float[n], v3 = new float[n], v4 = new float[n], v5 = new float[n], v6 = new float[n], v7 = new float[n], v8 = new float[n], v9 = new float[1], v10 = new float[1], v11 = new float[1], v12 = new float[1], v13 = new float[1];

for (int i = 0; i < n; i++)
{
v1 = RandomClass.Next(1000, 100000);
v2 = RandomClass.Next(200000, 10000000);
v3 = 6378140 + v2;
}

v13[0] = s;
v9[0] = s;
v10[0] = gpu2;
v11[0] = o;
v12[0] = p;

OpenCLTemplate.CLCalc.Program.Variable varV1 = new OpenCLTemplate.CLCalc.Program.Variable(v1);
OpenCLTemplate.CLCalc.Program.Variable varV2 = new OpenCLTemplate.CLCalc.Program.Variable(v2);
OpenCLTemplate.CLCalc.Program.Variable varV3 = new OpenCLTemplate.CLCalc.Program.Variable(v3);
OpenCLTemplate.CLCalc.Program.Variable varV4 = new OpenCLTemplate.CLCalc.Program.Variable(v4);
OpenCLTemplate.CLCalc.Program.Variable varV5 = new OpenCLTemplate.CLCalc.Program.Variable(v5);
OpenCLTemplate.CLCalc.Program.Variable varV6 = new OpenCLTemplate.CLCalc.Program.Variable(v6);
OpenCLTemplate.CLCalc.Program.Variable varV7 = new OpenCLTemplate.CLCalc.Program.Variable(v7);
OpenCLTemplate.CLCalc.Program.Variable varV8 = new OpenCLTemplate.CLCalc.Program.Variable(v8);
OpenCLTemplate.CLCalc.Program.Variable varV9 = new OpenCLTemplate.CLCalc.Program.Variable(v9);
OpenCLTemplate.CLCalc.Program.Variable varV10 = new OpenCLTemplate.CLCalc.Program.Variable(v10);
OpenCLTemplate.CLCalc.Program.Variable varV11 = new OpenCLTemplate.CLCalc.Program.Variable(v11);
OpenCLTemplate.CLCalc.Program.Variable varV12 = new OpenCLTemplate.CLCalc.Program.Variable(v12);
OpenCLTemplate.CLCalc.Program.Variable varV13 = new OpenCLTemplate.CLCalc.Program.Variable(v13);

OpenCLTemplate.CLCalc.Program.Variable[] args = new OpenCLTemplate.CLCalc.Program.Variable[] { varV1, varV2, varV3, varV4, varV5, varV6, varV7, varV8, varV9, varV10, varV11, varV12, varV13 };

int[] workers = new int[1] { n };

sw.Start();
while (f < gpudec2)
{
VectorSum.Execute(args, workers);
f++;
v9[0] = s;
}
varV4.ReadFromDeviceTo(v4);
varV5.ReadFromDeviceTo(v5);
varV6.ReadFromDeviceTo(v6);
varV7.ReadFromDeviceTo(v7);
varV8.ReadFromDeviceTo(v8);

sw.Stop();


GPUtime = sw.Elapsed.TotalSeconds;

}

static void orbit(object work)
{
Work w = (Work)(work);

while (z < cpu2)
{


for (int i = w.begin; i < w.end; i++)
{
Work.v4 = Work.v3 / (2 * 398600500000000 / (Work.v3 * (Work.v1 * Work.v1)) - 1);
Work.v5 = Work.v3 * (Work.v1 * Work.v1) / 398600500000000 - 1;
Work.v6 = Work.v4 / (1 + Work.v5);
Work.v7 = Work.v5 * Work.v6;
Work.v8 = (Work.v6 * Work.v6) - (Work.v7 * Work.v7);
Work.v8 = (float)Math.Pow(Work.v8, 0.5);
}
z++;
}

}

private void button1_Click(object sender, EventArgs e)
{
cpu2 = (float)cpu.Value;
gpu2 = (float)gpu.Value;
s = 990000;
z = 990000;

gpudec2 = (int)gpudec.Value;
int cores = Environment.ProcessorCount;

System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();

Random RandomClass = new Random();

int n = 1000000;
Work.v1 = new float[n];
Work.v2 = new float[n];
Work.v3 = new float[n];
Work.v4 = new float[n];
Work.v5 = new float[n];
Work.v6 = new float[n];
Work.v7 = new float[n];
Work.v8 = new float[n];

for (int i = 0; i < n; i++)
{
Work.v1 = RandomClass.Next(1000, 100000);
Work.v2 = RandomClass.Next(200000, 10000000);
Work.v3 = 6378140 + Work.v2;
}
Work[] w = new Work[cores];
int iwork = n / cores;
for (int i = 0; i < cores; i++)
{
w = new Work(i * iwork, (i + 1) * iwork);
}
int round = n % cores;
Thread[] threads = new Thread[cores];



if (round != 0)
{
w[cores - 1].end += round;
}

label9.Text = "5000";
label10.Text = "5000";

a2.Start();
while (!a2.IsAlive) ;

for (int i = 0; i < cores; i++)
{
threads = new Thread(new ParameterizedThreadStart(orbit));
threads.Priority = ThreadPriority.Normal;
}

for (int i = 0; i < cores; i++)
{
threads = new Thread(new ParameterizedThreadStart(orbit));
 
Zuletzt bearbeitet:
TE
TE
thysol

thysol

BIOS-Overclocker(in)
Ok. Klingt interessant.
Wenn ich das richtig verstehe bringt es aber bei meinem System (Signatur) z.B. gar nichts?

Doch. Es bringt immer was. Wieviel es bringt haengt ganz von der Rechenaufgabe und dem System ab. Ich poste mal jetzt gleich das eigentliche Programm. Dann kannst du selber ausprobieren wie viel es bringt bei deinem System.;)
 
TE
TE
thysol

thysol

BIOS-Overclocker(in)
Ok. Mit welchen Benchmarks hast du es jetzt getestet? Ich denke ich werde kaum ein + an FPS kriegen...

Der Benchmark bestand daraus die Umlaufbahn fuer ganz viele Steine um ein Objekt zu berechnen. Hier ist die Recheaufgabe:

v4 = v3 / (2 * 398600500000000 / (v3 * (v1 * v1)) - 1);
v5 = v3 * (v1 * v1) / 398600500000000 - 1;
v6 = v4 / (1 + v5);
v7 = v5 * v6;
v6 = v6 * v6;
v7 = v7 * v7;
v8 = v6 - v7;
v8 = sqrt( v8 );

Mehr FPS koennte mann nur kriegen wenn Spiele-Entwickler den Algorithm in ihr Code implementieren. Ich lade jetzt auch mal das Programm hoch.;)
 

Skysnake

Lötkolbengott/-göttin
Thysol der OpenCL Support sollte bei AMD inzwischen auch in den neuesten GPU Treibern enthalten sein. Das SDK sollte man nicht mehr benötigen.
 

Papzt

Volt-Modder(in)
Naja, gibt noch genug Sachen, die nur auf einem Kern laufen.
Habe gerade mal 9% Auslastung auf der GPU. Ist ja ganz schön wenig
 
TE
TE
thysol

thysol

BIOS-Overclocker(in)
Thysol der OpenCL Support sollte bei AMD inzwischen auch in den neuesten GPU Treibern enthalten sein. Das SDK sollte man nicht mehr benötigen.

Ok, werde ich dann spaeter rauseditieren. Danke fuer den Hinweis.;)

Naja, gibt noch genug Sachen, die nur auf einem Kern laufen.
Habe gerade mal 9% Auslastung auf der GPU. Ist ja ganz schön wenig

Das liegt daran das die Berechnung so kurz ist und die GPU so schnell. Ich poste spaeter noch ein Tutorial mit dem GPU Decelarator. Dann sollte die Auslastung bei nahezu 100% sein.;)
 
Oben Unten