Skip to content
This repository has been archived by the owner on Jun 30, 2024. It is now read-only.

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
vadimbelan authored Jun 4, 2024
1 parent c27bf75 commit 782f8a5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 0 additions & 2 deletions tasks/tbb/belan_vadim_mat_fox_tbb/include/ops_tbb.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright 2024 Vadim Belan
#pragma once

#include <tbb/tbb.h>

#include <memory>
#include <utility>
#include <vector>
Expand Down
19 changes: 10 additions & 9 deletions tasks/tbb/belan_vadim_mat_fox_tbb/src/ops_tbb.cpp
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
// Copyright 2024 Vadim Belan
#include "tbb/belan_vadim_mat_fox_tbb/include/ops_tbb.hpp"
#include "tbb/tbb.h"

#include <tbb/tbb.h>

using BelanTBB::FoxBlockedParallel;
using BelanTBB::FoxBlockedSequential;
using BelanTBB::Matrix;

bool FoxBlockedSequential::validation() {
internal_order_test();
this->internal_order_test();

return taskData->inputs_count[0] == taskData->inputs_count[1] &&
taskData->inputs_count[0] == taskData->outputs_count[0];
}

bool FoxBlockedSequential::pre_processing() {
internal_order_test();
this->internal_order_test();

auto* matrixA = reinterpret_cast<double*>(taskData->inputs[0]);
auto* matrixB = reinterpret_cast<double*>(taskData->inputs[1]);
Expand All @@ -39,7 +40,7 @@ bool FoxBlockedSequential::pre_processing() {
}

bool FoxBlockedSequential::run() {
internal_order_test();
this->internal_order_test();

for (std::vector<double>::size_type i = 0; i < A.size(); i += block_size) {
for (std::vector<double>::size_type j = 0; j < B[0].size(); j += block_size) {
Expand All @@ -59,7 +60,7 @@ bool FoxBlockedSequential::run() {
}

bool FoxBlockedSequential::post_processing() {
internal_order_test();
this->internal_order_test();

auto* out_ptr = reinterpret_cast<double*>(taskData->outputs[0]);

Expand All @@ -73,14 +74,14 @@ bool FoxBlockedSequential::post_processing() {
}

bool FoxBlockedParallel::validation() {
internal_order_test();
this->internal_order_test();

return taskData->inputs_count[0] == taskData->inputs_count[1] &&
taskData->inputs_count[0] == taskData->outputs_count[0];
}

bool FoxBlockedParallel::pre_processing() {
internal_order_test();
this->internal_order_test();

auto* matrixA = reinterpret_cast<double*>(taskData->inputs[0]);
auto* matrixB = reinterpret_cast<double*>(taskData->inputs[1]);
Expand All @@ -105,7 +106,7 @@ bool FoxBlockedParallel::pre_processing() {
}

bool FoxBlockedParallel::run() {
internal_order_test();
this->internal_order_test();

tbb::parallel_for(0, static_cast<int>(A.size()), block_size, [&](int ii) {
for (std::vector<double>::size_type jj = 0; jj < B[0].size();
Expand All @@ -125,7 +126,7 @@ bool FoxBlockedParallel::run() {
}

bool FoxBlockedParallel::post_processing() {
internal_order_test();
this->internal_order_test();

auto* out_ptr = reinterpret_cast<double*>(taskData->outputs[0]);

Expand Down

0 comments on commit 782f8a5

Please sign in to comment.