Parallel (OpenMP) matmul library function
FX Coudert
fxcoudert@gmail.com
Wed Mar 26 00:41:00 GMT 2008
Hi there,
In its current state, the matmul implementation in libgfortran is
based on a triple loop, like this:
> for (y = 0; y < ycount; y++)
> {
> bbase_y = bbase + y*bystride;
> dest_y = dest + y*rystride;
> for (n = 0; n < count; n++)
> {
> abase_n = abase + n*aystride;
> bbase_yn = bbase_y[n];
> for (x = 0; x < xcount; x++)
> {
> dest_y[x] += abase_n[x] * bbase_yn;
> }
> }
> }
(there are actually several cases depending on the strides involved,
but you get the idea). I'm thinking we could provide an OpenMP
version with very little work and added maintainance. I've never used
OpenMP with C code, so I'm not sure exactly how pointers are handled,
but I supposed there is a way to parallelize the outer loop. Do you
think it's possible? Would it be a good thing? (We could introduce a
new option to call these functions.)
FX
--
François-Xavier Coudert
http://www.homepages.ucl.ac.uk/~uccafco/
More information about the Fortran
mailing list