/**
 * One iteration over the entire 1D stencil, using either
 * multipliation or division.
 */
void solve_iteration(std::vector<double> * in_array, std::vector<double> * out_array) {
    apex::profiler* p = apex::start((apex_function_address)solve_iteration);
    if (method == DIVIDE_METHOD) {
#pragma omp parallel num_threads(active_threads)
        {
#pragma omp single
            for (long j = 0; j < num_cells ; j += block_size) {
#pragma omp task
                solve_a(*in_array,*out_array,j,j+block_size);
            }
// #pragma omp taskwait
        }
    } else {
#pragma omp parallel num_threads(active_threads)
        {
#pragma omp single
            for (long j = 0; j < num_cells ; j += block_size) {
#pragma omp task
                solve_b(*in_array,*out_array,j,j+block_size);
            }
// #pragma omp taskwait
        }
    }
    apex::stop(p);
}
Exemple #2
0
int main() {
    assert(freopen("suma4.in", "r", stdin));
    assert(freopen("suma4.out", "w", stdout));

    read();

    solve_a();

    init();

    solve_b();

    return 0;
}