Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tasks used #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions src/exercise5_solution.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ void block_triangular_solve(const size_t m, const size_t n, const double *a,
for (size_t i = 0; i < m; i++) {
b[i * ldb + k] = tmp * b[i * ldb + k];
}

for (size_t j = k + 1; j < n; j++) {
if (a[j * lda + k] != 0.0) {
double tmp = a[j * lda + k];
Expand All @@ -258,11 +259,13 @@ void block_symmetric_rank_k_update(const size_t n, const size_t k,
const size_t ldc) {
#pragma omp parallel for
for (size_t j = 0; j < n; j++) {
#pragma omp parallel for
for (size_t l = 0; l < k; l++) {
double tmp = a[j * lda + l];
for (size_t i = j; i < n; i++) {
c[i * ldc + j] -= tmp * a[i * lda + l];
#pragma omp task
{
for (size_t l = 0; l < k; l++) {
double tmp = a[j * lda + l];
for (size_t i = j; i < n; i++) {
c[i * ldc + j] -= tmp * a[i * lda + l];
}
}
}
}
Expand All @@ -286,10 +289,12 @@ void block_sub_matrix_mul(const size_t m, const size_t n, const size_t k,
const size_t ldb, double *c, const size_t ldc) {
#pragma omp parallel for
for (size_t i = 0; i < m; i++) {
#pragma omp parallel for
for (size_t j = 0; j < n; j++)
for (size_t l = 0; l < k; l++)
c[i * ldc + j] = c[i * ldc + j] - a[i * lda + l] * b[j * ldb + l];
#pragma omp task
{
for (size_t j = 0; j < n; j++)
for (size_t l = 0; l < k; l++)
c[i * ldc + j] = c[i * ldc + j] - a[i * lda + l] * b[j * ldb + l];
}
}
}

Expand Down