- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i am not sure why am i getting this error. This example follows the pattern similar to the one provided on TBB documentation except I am trying to do a 1D array for matrix multiplication.
The code is below
The compilation command i enter is : g++ -std=c++11 matrix.cpp -ltbb -o matrix.out
(thanks for the help in advance)
#include <iostream> #include "tbb/tbb.h" #include "tbb/parallel_for.h" #include "tbb/blocked_range2d.h" #include <chrono> const size_t m_rows = 2048; const size_t m_columns = 2048; const size_t m_k = 2048; class MatrixMultiply2D { private: double *m_A; double *m_B; double *m_C; public: void operator()(const blocked_range2d<size_t>& rnge ) { double *usrA = m_A; double *usrB = m_B; double *usrC = m_C; for(size_t row=rnge.rows().begin(); row<rnge.rows().end(); ++row) { for(size_t col=rnge.cols().begin(); col <rnge.cols().end(); ++col) { double sum = 0.0; for(size_t k=0; k<m_k; ++k) { usrC[row*(rnge.col().end()-rnge.col().begin()) + col] += usrA[row*m_k + k]*usrB[k*(rnge.cols.end()-rnge.cols.begin()) + col]; } } } } MatrixMultiply2D(double *A, double *B, double *C): m_A(A), m_B(B), m_C(C) { } }; int main(int argc, char **argv) { double *A = new double[m_rows*m_k]; double *B = new double[m_k*m_columns]; double *C = new double[m_rows*m_columns]; serialMatrixMultiply(A, B, C, m_rows, m_columns, m_k); delete[] A; delete[] B; delete[] C; return 0; }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
The most functionality of Intel TBB library is located inside the tbb namespace. Try to use tbb::blocked_range2d<size_t>. You can find what namespace is used for particular functionality in documentation, e.g. the blocked_range2d section states:
namespace tbb { template<typename RowValue, typename ColValue=RowValue> class blocked_range2d { public: ...
Regards,
Alex
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
The most functionality of Intel TBB library is located inside the tbb namespace. Try to use tbb::blocked_range2d<size_t>. You can find what namespace is used for particular functionality in documentation, e.g. the blocked_range2d section states:
namespace tbb { template<typename RowValue, typename ColValue=RowValue> class blocked_range2d { public: ...
Regards,
Alex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Alex,
Thanks for pointing out the error. My code doesn't give me that error anymore. It was a silly mistake :|

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page