I am new to programming in general so please keep that in mind when you answer my question.
I have a program that takes a large 3D array (1 billion elements) and sums up
Try this code:
int dim = 1000;
int steps = 7 //ranges from 1 to 255
for (int stage = 1; stage < steps; stage++)
for (int k = 0; k < dim; k++)
for (int i = 0; i < dim; i++)
{
sum = 0;
for (int j = 0; j < dim; j++)
if (partMap[(((i * dim) + k) * dim) + j] >= stage)
projection[i*dim + j] ++ ;
// changed order of i and j
}
transponse(projection)
I changed the order of loops to make the code cache friendly... You would gain with it an order of magninute performance boost... Be shure.
This is the step you should do before you try to run into multithreading