Software Archive
Read-only legacy content
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17060 Discussions

time has increased after parallelism... plz help!!

kayjay66
Beginner
489 Views
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 :)
0 Kudos
1 Reply
kayjay66
Beginner
489 Views
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?
0 Kudos
Reply