这是微软为并行提供的示例,我想知道如何为此代码配置最大线程数。
// A basic matrix multiplication.
// Parallelize the outer loop to partition the source array by rows.
System.Threading.Tasks.Parallel.For(0, matARows, i =>
{
for (int j = 0; j < matBCols; j++)
{
// Use a temporary to improve parallel performance.
double temp = 0;
for (int k = 0; k < matACols; k++)
{
temp += matA[i, k] * matB[k, j];
}
result[i, j] = temp;
}
}); // Parallel.For