#include <iostream>
#include <omp.h>
int main()
{
int a1 = 2000;
int a2 = 2000;
int b1 = 2000;
int b2 = 2000;
double start, stop;
start = omp_get_wtime();
int **A = new int *[a1];
int **B = new int *[a2];
int **C = new int *[a1];
int **BT = new int *[a2];
for (int i = 0;i < a1;i++) A[i] = new int[b1];
for (int i = 0;i < a2;i++) B[i] = new int[b2];
for (int i = 0;i < a1;i++) C[i] = new int[b2];
for (int i = 0;i < a2;i++) BT[i] = new int[b1];
for (int i = 0;i < a1;i++)
for (int j = 0;j < b1;j++)
A[i][j] = 1;
for (int i = 0;i < a2;i++)
for (int j = 0;j < b2;j++)
B[i][j] = 1;
for (int i = 0;i < a2;i++)
for (int j = 0;j < b1;j++)
BT[i][j] = B[j][i];
for (int i = 0;i < a1;i++)
for (int j = 0;j < b2;j++)
C[i][j] = 0;
//#pragma omp parallel for num_threads(1)
for(int k = 0;k < a1;k++)
for (int i = 0;i < a2;i++)
for (int j = 0;j < b1;j++)
C[k][i] += A[k][j] * BT[i][j];
stop = omp_get_wtime();
std::cout << "A:" << a1 << "x" << b1 << " B:" << a2 << "x" << b2 <<std::endl;
std::cout << "Time: "<< stop - start;
return 0;
}
Replies to Untitled
Title |
Name |
Language |
UNIX |
When |
Re: Untitled |
Whipped Partdridge |
text |
1617023628 |
3 Years ago. |
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}