This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Parallel (OpenMP) matmul library function


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]