Where to ask for help?

General OpenMP discussion

Where to ask for help?

Postby Matt » Wed Oct 24, 2007 3:01 am

Hello,
I am new to using OpenMp and added it into a piece of code I have written for matrix multiplication, however the results are rather slow, much slower than without the omp directives so I am assuming I have gone wrong somewhere or the overhead in setting up the threads outways the benefits of having them. Is this the right place to post for some advice?

thanks in advance
Matt
Matt
 

Re: Where to ask for help?

Postby Ally » Wed Oct 24, 2007 5:24 am

Hi Matt

I managed to parallelise some C++ code for matrix multiplication using OpenMP, and definitely got a speed-up. Can you post your code and I'll compare it with mine? Maybe then I can give you some advice.

Cheers

Ally
Ally
 
Posts: 3
Joined: Wed Oct 24, 2007 5:22 am

Re: Where to ask for help?

Postby Matt » Thu Oct 25, 2007 1:38 am

Hi,

In the following code the matrix wt is represented in a 1D array for speed issues and contains 1*4 vectors.
Then the code simply executes a large dot product with the vector f which also contains 1*4 vectors

#pragma omp parallel for
for(int j=0; j<m; j++)
{


for(int i=0; i<n34; i++)
{

A[j/4][j%4] += wt[j*n34+i] * f[i];
}
}

without the pragma instruction the code is around 0.001secs quicker (which is about double the speed,) I have also tried adding a few other instructions including the shared(...) addition and setting the number of threads to the number of processors although I assume this is done by default.

The hardware is an Intel core 2 duo (1.86) with 2gb of RAM.
Matt
 
Posts: 4
Joined: Wed Oct 24, 2007 3:03 am

Re: Where to ask for help?

Postby Ally » Thu Oct 25, 2007 4:37 am

What are the dimensions of the matrix?

I wonder if it's not big enough for the overhead of parallelisation?

Ally
Ally
 
Posts: 3
Joined: Wed Oct 24, 2007 5:22 am

Re: Where to ask for help?

Postby Matt » Fri Oct 26, 2007 1:31 am

The dimensions for wt are 12*24000 and f is a 24000 column vector. These arent the biggest matrices/vectors I could use, the thing is, the structures are made of vectors that are 4 values long so the actual size of the arrays is the dimensions above/4. I havent tried it with anything bigger than that.
Matt
 
Posts: 4
Joined: Wed Oct 24, 2007 3:03 am

Re: Where to ask for help?

Postby lfm » Sun Oct 28, 2007 9:29 am

If the code really runs for only .002 seconds it is not surprising that you see no speedup with OpenMP. I don't see anything wrong with your code at first glance. Is this part of a bigger problem that you really need to speed up, or are you just experimenting?

-- Larry
lfm
 
Posts: 135
Joined: Sun Oct 21, 2007 4:58 pm
Location: OpenMP ARB

Re: Where to ask for help?

Postby Matt » Mon Oct 29, 2007 4:50 am

Well it could do with speeding up (I am of course using a relatively slow processor at the moment,) I suppose it is experimenting, I am just starting a PhD (three weeks into it, so it is all experimental at the moment! still trying to find my feet!) and part of the problem I am investigating involves very fast matrix multiplication (it is haptic feedback so the entire loop must run at 1000Hz or better) this area is of course only a small part of the program, the code you are looking at uses SSE intrinsics to reduce the calculations which has already given me a large speed boost (around 2.5 times increase over standard matrix multiplication) I am thinking that perhaps the code structure is slowing it down, the * symbol is an overloaded function, did I read somewhere that function calls within parallelised for loops affects performance? I could of course try some much larger numbers to see if i get any improvement but I am still supprised that the code is slower with openMP than without

Matt
Matt
 
Posts: 4
Joined: Wed Oct 24, 2007 3:03 am

Re: Where to ask for help?

Postby lfm » Mon Oct 29, 2007 8:47 am

There shouldn't be any problem with the overloaded operator. If you felt like attaching an executable example I'd be happy to run it on a couple of different machines (I work for Intel and have good access to hardware) and see if I can find anything.
-- Larry
lfm
 
Posts: 135
Joined: Sun Oct 21, 2007 4:58 pm
Location: OpenMP ARB

Re: Where to ask for help?

Postby Matt » Tue Oct 30, 2007 1:07 pm

That would be great, I am waiting for some new hardware at the moment (mmmm quad core) so when that arrives I will knock up a small example exe and post it.

thanks,
Matt
Matt
 
Posts: 4
Joined: Wed Oct 24, 2007 3:03 am

Re: Where to ask for help?

Postby lfm » Tue Nov 27, 2007 2:28 am

It would be good to have source, too.


Last bumped by Anonymous on Tue Nov 27, 2007 2:28 am.
lfm
 
Posts: 135
Joined: Sun Oct 21, 2007 4:58 pm
Location: OpenMP ARB


Return to Using OpenMP

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 12 guests