Skip to content

Commit 8d6dd44

Browse files
author
alielabridi
committed
vectorization so far before moving to arrays
1 parent 16bd49b commit 8d6dd44

File tree

5 files changed

+341
-206
lines changed

5 files changed

+341
-206
lines changed

AddSubMat.h

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,24 @@
44

55
class addition :public CBase_addition{
66
public:
7-
addition(CkMigrateMessage *m) {};
8-
addition(CkFuture f,std::vector<std::vector<int>> A, std::vector<std::vector<int>> B, int size){
9-
thisProxy.run(f,A,B,size);
7+
addition(CkMigrateMessage *m) {}
8+
addition(CkFuture f,AddSubMsg* Msg, int size){
9+
thisProxy.run(f,Msg,size);
1010
}
11-
void run(CkFuture f,std::vector<std::vector<int>> A, std::vector<std::vector<int>> B, int size){
12-
//if(VERBOSE)CkPrintf("addition run 1:\n");
11+
void run(CkFuture f,AddSubMsg* Msg, int size){
1312
/*wrap the resulting addition in a message of size and send it back to future*/
1413

1514
//if(VERBOSE)CkPrintf("Work done by processor %d\n",CkMyPe());
1615

17-
1816
ValueMsg *m = new ValueMsg(size);
1917

20-
21-
22-
//if(VERBOSE)CkPrintf("addition run 1-1:\n");
23-
2418
for (int i = 0; i < size; ++i)
2519
{
2620
for (int j = 0; j < size; ++j)
2721
{
28-
m->v[i][j] = A[i][j] + B[i][j];
22+
m->v[i][j] = Msg->A[i][j] + Msg->A[i][j];
2923
}
3024
}
31-
//if(VERBOSE)CkPrintf("addition run 2:\n");
32-
33-
34-
35-
//if(VERBOSE)CkPrintf("addition run 4:\n");
3625

3726
CkSendToFuture(f, m);
3827
}
@@ -42,11 +31,11 @@ class addition :public CBase_addition{
4231

4332
class substraction :public CBase_substraction{
4433
public:
45-
substraction(CkMigrateMessage *m) {};
46-
substraction(CkFuture f,std::vector<std::vector<int>> A, std::vector<std::vector<int>> B, int size){
47-
thisProxy.run(f,A,B,size);
34+
substraction(CkMigrateMessage *m) {}
35+
substraction(CkFuture f,AddSubMsg* Msg, int size){
36+
thisProxy.run(f,Msg,size);
4837
}
49-
void run(CkFuture f,std::vector<std::vector<int>> A, std::vector<std::vector<int>> B, int size){
38+
void run(CkFuture f,AddSubMsg* Msg, int size){
5039
//std::vector<std::vector<int>> C;
5140

5241
//if(VERBOSE)CkPrintf("Work done by processor %d\n",CkMyPe());
@@ -58,7 +47,7 @@ class substraction :public CBase_substraction{
5847
{
5948
for (int j = 0; j < size; ++j)
6049
{
61-
m->v[i][j] = A[i][j] - B[i][j];
50+
m->v[i][j] = Msg->A[i][j] - Msg->A[i][j];
6251
}
6352
}
6453
/*wrap the resulting substraction in a message of size and send it back to future*/

0 commit comments

Comments
 (0)