I am creating a database using C#. The problem is I have close to 4 million datapoints and it takes a lot of time to complete the database (maybe several month). The code looks like something like this.
int[,,,] Result1=new int[10,10,10,10];
int[,,,] Result2=new int[10,10,10,10];
int[,,,] Result3=new int[10,10,10,10];
int[,,,] Result4=new int[10,10,10,10];
for (int i=0;i<10;i++)
{
for (int j=0;j<10;j++)
{
for (int k=0;k<10;k++)
{
for (int l=0;l<10;l++)
{
Result1[i,j,k,l]=myFunction1(i,j,k,l);
Result2[i,j,k,l]=myFunction2(i,j,k,l);
Result3[i,j,k,l]=myFunction3(i,j,k,l);
Result4[i,j,k,l]=myFunction4(i,j,k,l);
}
}
}
}
All the elements of the Result array are completely independent of each other. My PC has 8 cores and I have create a thread for each of myFunction methods, but still the whole process would take a lot simply because there are many cases. I am wondering if there is any way to run this on GPU rather than CPU. I have not done it before and I do not know how its gonna work. I do appreciate if someone can help me on this.