In Qt chronometry of the programme in Debug and Release, there are significant differences



  • Briefly, he wrote a decision on the diph equation in a private derivative parallel algorithm (using the OpenMP) and consistent. The implication is that, in Debug compilation, I have a consistent algorithm of about 75 to 85 seconds and a parallel 50 to 55 seconds. I think it's OK. But it's only worth compiling on the Release regime, so parallel algorithms are between 25 and 30 seconds, and sequential 18 to 20 seconds! So maybe someone had the same problem? I'm not gonna roll the whole code, I'm afraid not to. Code fragment:

    void DifferenceScheme::solveOMP()
    {
        n = round((xMax - xMin) / xStep);
        m = round((tMax - tMin) / tStep);
        u = dMatrix(n + 1, dVector(m + 1, initValue));
        TridiagonalMatrix tm(n + 1);
        dVector F(n + 1);
        Progonka progonka(tm, F);
        double error;
    
    workTime = clock();
    

    #pragma omp parallel for
    for (int i = 0; i <= n; i++)
    {
    u[i][0] = w(xMin + i * xStep, tMin);
    }
    #pragma omp parallel for
    for (int i = 0; i <= m; i++)
    {
    u[0][i] = w(xMin, tMin + i * tStep);
    u[n][i] = w(xMax, tMin + i * tStep);
    }

    for (int j = 1; j &lt;= m; j++)
    {
        do
        {
    

    #pragma omp parallel for
    for (int i = 1; i < n; i++)
    {
    tm.lower[i - 1] = dLeft(i, j);
    tm.main[i] = dCenter(i, j);
    tm.upper[i] = dRight(i, j);
    F[i] = -1 * f(i, j);
    }
    tm.main[0] = tm.main[n] = 1;
    F[0] = -1 * (u[0][j] - w(xMin, tMin + j * tStep));
    F[n] = -1 * (u[n][j] - w(xMax, tMin + j * tStep));
    progonka.solveOMP();
    #pragma omp parallel for
    for (int i = 1; i < n; i++)
    {
    u[i][j] += progonka.x[i];
    }
    error = 0;
    for (int i = 1; i < n; i++)
    if (fabs(progonka.x[i]) > error)
    error = fabs(progonka.x[i]);
    }
    while (error > accuracy);
    }
    workTime = clock() - workTime;
    }



  • I believe that you have little N (dimension of the matrix) and the cost of starting flows is compared with the time of implementation.

    To make sure you get your soup on more N.


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2