Hello everyone !
I'm trying to paralelize a for loop inside a instance method of a c++ class. The loop code is like this:
MeshNode is a class that stores spatial coordinates, and have a variety of geometrical functions. Inside the loop the testNodej pointer acts only as a reference to an existing node that won't be modified by the getPotentialContribution function. This loop is nested inside other loops, but this one is the only one suitable for parallelization. the A variable is a matrix declared as __block Matrix<double> A, to get read-write access inside the block function. I'm trying to paralelize the above code as :
however it gives me the following errors:
The only useful information about this error I've found is
http://lists.apple.com/archives/perfoptimization-dev/2009/Sep/msg00043.html
however the suggested workarround doesn't work for me as I think I have to declare the block inside the function.
Any suggestions? thanks in advance !
I'm trying to paralelize a for loop inside a instance method of a c++ class. The loop code is like this:
Code:
for (int k=0;k<numberOfNodes2;k++)
{
MeshNode *testNodej = testEntity2->nodeAt(k);
double testPotential = getPotentialContributionOnNode(testNodei, testNodej);
A(j+m,k+l)= testPotential;
}
MeshNode is a class that stores spatial coordinates, and have a variety of geometrical functions. Inside the loop the testNodej pointer acts only as a reference to an existing node that won't be modified by the getPotentialContribution function. This loop is nested inside other loops, but this one is the only one suitable for parallelization. the A variable is a matrix declared as __block Matrix<double> A, to get read-write access inside the block function. I'm trying to paralelize the above code as :
Code:
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_apply(numberOfNodes2, queue, ^(size_t k)
{
MeshNode *testNodej = testEntity2->nodeAt(k);
double testPotential = getPotentialContributionOnNode(testNodei, testNodej);
A(j+m,k+l)= testPotential;
});
however it gives me the following errors:
Code:
error: 'MeshNode* Bem::testNodej' is not a static member of 'class Bem'
error: 'double Bem::testPotential' is not a static member of 'class Bem'
The only useful information about this error I've found is
http://lists.apple.com/archives/perfoptimization-dev/2009/Sep/msg00043.html
however the suggested workarround doesn't work for me as I think I have to declare the block inside the function.
Any suggestions? thanks in advance !