- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi,
a part of my senior project is about sparse matrix multiplication.
am getting very bad results in the timing, sometimes it's doubling.
in a previous thread, i was told that my loop has to have a big number of iterations...
so am asking some1 to help me solving my problem, GIVING ME THE RIGHT CODE, so that i can undertand better parallelism and implement it on my bigger task, sparse matrix myltiplication.
after parallelizing the code below, the time has increased instead of decreasing to half.
i have a core 2 duo centrino, am using microsoft visual C++ 2008.
these are the results from my parallel amplifier:
-before parallelism:
Elapsed Time: 0.355s
CPU Time: 0.275s
Unused CPU Time: 0.435s
Core Count: 2
Threads Created: 1
-after parallelism:
Elapsed Time: 0.400s
CPU Time: 0.312s
Unused CPU Time: 0.487s
Core Count: 2
Threads Created: 2
this is my code:
#include
#include
using namespace std;
int main()
{
int A[10000],B[10000];
for(int i=0;i<10000;i++)
{
A=B=2;
}
int count=0;
#pragma omp parallel for
for(int i=0;i<10000;i++)
{
count=count+A*B;
}
cout< return 0;
}
plz gimme the correct code, i'm running out of time, i must undertanfd this little matter in order to be able to multiply my sparse matrix correctly.
if some1 is interested in helping me even more, plz add me to my e-mail: kayjay66@hotmail.com
10X in advance :)
a part of my senior project is about sparse matrix multiplication.
am getting very bad results in the timing, sometimes it's doubling.
in a previous thread, i was told that my loop has to have a big number of iterations...
so am asking some1 to help me solving my problem, GIVING ME THE RIGHT CODE, so that i can undertand better parallelism and implement it on my bigger task, sparse matrix myltiplication.
after parallelizing the code below, the time has increased instead of decreasing to half.
i have a core 2 duo centrino, am using microsoft visual C++ 2008.
these are the results from my parallel amplifier:
-before parallelism:
Elapsed Time: 0.355s
CPU Time: 0.275s
Unused CPU Time: 0.435s
Core Count: 2
Threads Created: 1
-after parallelism:
Elapsed Time: 0.400s
CPU Time: 0.312s
Unused CPU Time: 0.487s
Core Count: 2
Threads Created: 2
this is my code:
#include
#include
using namespace std;
int main()
{
int A[10000],B[10000];
for(int i=0;i<10000;i++)
{
A=B=2;
}
int count=0;
#pragma omp parallel for
for(int i=0;i<10000;i++)
{
count=count+A*B;
}
cout<
}
plz gimme the correct code, i'm running out of time, i must undertanfd this little matter in order to be able to multiply my sparse matrix correctly.
if some1 is interested in helping me even more, plz add me to my e-mail: kayjay66@hotmail.com
10X in advance :)
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i also used the system clock, the results were bad too, the time needed has increased, and at some point, it doubled :(:(
i know the variable should be shared too, how to do it?
plz correct this simple code for me, i've been looking for more then 2 weeks for solutions with nothing in return :( i know all the concepts used, but not how to implement it correctly, ot it's a problem from my laptop?
i know the variable should be shared too, how to do it?
plz correct this simple code for me, i've been looking for more then 2 weeks for solutions with nothing in return :( i know all the concepts used, but not how to implement it correctly, ot it's a problem from my laptop?

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