Disabled OpenMP pragmas in low-level fluid evaluations.

This is done to reduce risk of misuse, considering two cases:
 - These functions are often called with a single data point,
   making the thread setup and teardown time prohibitively expensive.
 - This may conflict with higher-level use of OpenMP.
This commit is contained in:
Atgeirr Flø Rasmussen 2012-04-10 15:46:24 +02:00
parent fa5143abad
commit d0aeeb780c
11 changed files with 36 additions and 36 deletions

View File

@ -125,7 +125,7 @@ namespace Opm
double B[2]; // Must be enough since component classes do not handle more than 2.
pvt_.B(1, 0, 0, B);
// Compute A matrix
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
double* m = A + i*np*np;
std::fill(m, m + np*np, 0.0);
@ -137,7 +137,7 @@ namespace Opm
// Derivative of A matrix.
if (dAdp) {
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
double* m = dAdp + i*np*np;
std::fill(m, m + np*np, 0.0);
@ -157,7 +157,7 @@ namespace Opm
{
const int np = numPhases();
const double* sdens = pvt_.surfaceDensities();
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
for (int phase = 0; phase < np; ++phase) {
rho[np*i + phase] = 0.0;

View File

@ -131,7 +131,7 @@ namespace Opm
const int g = phase_pos[BlackoilPhases::Vapour];
// Compute A matrix
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
double* m = A + i*np*np;
std::fill(m, m + np*np, 0.0);
@ -148,7 +148,7 @@ namespace Opm
// Derivative of A matrix.
if (dAdp) {
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
double* m = dAdp + i*np*np;
std::fill(m, m + np*np, 0.0);
@ -177,7 +177,7 @@ namespace Opm
{
const int np = numPhases();
const double* sdens = pvt_.surfaceDensities();
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
for (int phase = 0; phase < np; ++phase) {
rho[np*i + phase] = 0.0;

View File

@ -79,7 +79,7 @@ namespace Opm
{
const int np = numPhases();
for (int phase = 0; phase < np; ++phase) {
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
output_mu[np*i + phase] = viscosity_[phase];
}
@ -93,7 +93,7 @@ namespace Opm
{
const int np = numPhases();
for (int phase = 0; phase < np; ++phase) {
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
output_B[np*i + phase] = formation_volume_factor_[phase];
}
@ -108,7 +108,7 @@ namespace Opm
{
const int np = numPhases();
for (int phase = 0; phase < np; ++phase) {
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
output_B[np*i + phase] = formation_volume_factor_[phase];
output_dBdp[np*i + phase] = 0.0;

View File

@ -42,7 +42,7 @@ namespace Opm
permeability_.clear();
const int dsq = dimensions*dimensions;
permeability_.resize(num_cells*dsq, 0.0);
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < num_cells; ++i) {
for (int d = 0; d < dimensions; ++d) {
permeability_[dsq*i + dimensions*d + d] = perm;

View File

@ -71,13 +71,13 @@ namespace Opm
const double* s, double* kr, double* dkrds, Fun fun)
{
if (dkrds == 0) {
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n*np; ++i) {
kr[i] = fun.kr(s[i]);
}
return;
}
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
std::fill(dkrds + i*np*np, dkrds + (i+1)*np*np, 0.0);
for (int phase = 0; phase < np; ++phase) {

View File

@ -111,12 +111,12 @@ namespace Opm
{
const int np = phase_usage_.num_phases;
if (dkrds) {
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
evalKrDeriv(s + np*i, kr + np*i, dkrds + np*np*i);
}
} else {
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
evalKr(s + np*i, kr + np*i);
}
@ -142,12 +142,12 @@ namespace Opm
{
const int np = phase_usage_.num_phases;
if (dpcds) {
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
evalPcDeriv(s + np*i, pc + np*i, dpcds + np*np*i);
}
} else {
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
evalPc(s + np*i, pc + np*i);
}

View File

@ -134,7 +134,7 @@ namespace Opm
data1_.resize(n);
for (int phase = 0; phase < phase_usage_.num_phases; ++phase) {
props_[phase]->mu(n, p, z, &data1_[0]);
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
output_mu[phase_usage_.num_phases*i + phase] = data1_[i];
}
@ -149,7 +149,7 @@ namespace Opm
data1_.resize(n);
for (int phase = 0; phase < phase_usage_.num_phases; ++phase) {
props_[phase]->B(n, p, z, &data1_[0]);
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
output_B[phase_usage_.num_phases*i + phase] = data1_[i];
}
@ -166,7 +166,7 @@ namespace Opm
data2_.resize(n);
for (int phase = 0; phase < phase_usage_.num_phases; ++phase) {
props_[phase]->dBdp(n, p, z, &data1_[0], &data2_[0]);
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
output_B[phase_usage_.num_phases*i + phase] = data1_[i];
output_dBdp[phase_usage_.num_phases*i + phase] = data2_[i];
@ -183,7 +183,7 @@ namespace Opm
data1_.resize(n);
for (int phase = 0; phase < phase_usage_.num_phases; ++phase) {
props_[phase]->R(n, p, z, &data1_[0]);
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
output_R[phase_usage_.num_phases*i + phase] = data1_[i];
}
@ -200,7 +200,7 @@ namespace Opm
data2_.resize(n);
for (int phase = 0; phase < phase_usage_.num_phases; ++phase) {
props_[phase]->dRdp(n, p, z, &data1_[0], &data2_[0]);
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
output_R[phase_usage_.num_phases*i + phase] = data1_[i];
output_dRdp[phase_usage_.num_phases*i + phase] = data2_[i];

View File

@ -81,7 +81,7 @@ namespace Opm
double* output_B) const
{
if (comp_) {
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
// Computing a polynomial approximation to the exponential.
double x = comp_*(p[i] - ref_press_);
@ -100,7 +100,7 @@ namespace Opm
{
B(n, p, 0, output_B);
if (comp_) {
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
output_dBdp[i] = -comp_*output_B[i];
}

View File

@ -75,7 +75,7 @@ namespace Opm
const double* /*z*/,
double* output_mu) const
{
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
output_mu[i] = viscosity_(p[i]);
}
@ -86,7 +86,7 @@ namespace Opm
const double* /*z*/,
double* output_B) const
{
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
output_B[i] = 1.0/one_over_B_(p[i]);
}
@ -99,7 +99,7 @@ namespace Opm
double* output_dBdp) const
{
B(n, p, 0, output_B);
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
double Bg = output_B[i];
output_dBdp[i] = -Bg*Bg*one_over_B_.derivative(p[i]);

View File

@ -91,7 +91,7 @@ namespace Opm
const double* z,
double* output_mu) const
{
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
output_mu[i] = miscible_gas(p[i], z + num_phases_*i, 2, false);
}
@ -104,7 +104,7 @@ namespace Opm
const double* z,
double* output_B) const
{
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
output_B[i] = evalB(p[i], z + num_phases_*i);
}
@ -119,7 +119,7 @@ namespace Opm
double* output_B,
double* output_dBdp) const
{
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
evalBDeriv(p[i], z + num_phases_*i, output_B[i], output_dBdp[i]);
}
@ -132,7 +132,7 @@ namespace Opm
const double* z,
double* output_R) const
{
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
output_R[i] = evalR(p[i], z + num_phases_*i);
}
@ -147,7 +147,7 @@ namespace Opm
double* output_R,
double* output_dRdp) const
{
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
evalRDeriv(p[i], z + num_phases_*i, output_R[i], output_dRdp[i]);
}

View File

@ -168,7 +168,7 @@ namespace Opm
const double* z,
double* output_mu) const
{
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
output_mu[i] = miscible_oil(p[i], z + num_phases_*i, 2, false);
}
@ -181,7 +181,7 @@ namespace Opm
const double* z,
double* output_B) const
{
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
output_B[i] = evalB(p[i], z + num_phases_*i);
}
@ -196,7 +196,7 @@ namespace Opm
double* output_B,
double* output_dBdp) const
{
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
evalBDeriv(p[i], z + num_phases_*i, output_B[i], output_dBdp[i]);
}
@ -209,7 +209,7 @@ namespace Opm
const double* z,
double* output_R) const
{
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
output_R[i] = evalR(p[i], z + num_phases_*i);
}
@ -224,7 +224,7 @@ namespace Opm
double* output_R,
double* output_dRdp) const
{
#pragma omp parallel for
// #pragma omp parallel for
for (int i = 0; i < n; ++i) {
evalRDeriv(p[i], z + num_phases_*i, output_R[i], output_dRdp[i]);
}