AnsweredAssumed Answered

Problem with parallel calls of dgemm

Question asked by awet on Jan 13, 2014
Latest reply on Oct 26, 2014 by cxyzs7

Hello all,

 

I am using the single threaded library of ACML 5.3.1 compiled with Intel Fortran. I am compiling c++ code with Visual Studio 2012 and I test on an intel core2 duo and Windows 8.

I am assuming that dgemm is thread safe (am I wrong here?), so I am simply trying to call dgemm from two different threads, but I am getting a runtime error in some cases:

 

Unhandled exception at 0x00007FF95678BB96 (ntdll.dll) in ACML_test.exe: 0xC0000005: Access violation writing location 0x0000000000000024.

 

Here is the code of a small test using boost::thread

 

#include <iostream>

#include <boost/thread.hpp>

#include <acml.h>

 

void thread()

{

   double m1[100];

   double m2[100];

   double res[100];

 

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

       m1[i]=1.;

       m2[i]=1.;

       res[i]=0.;

   }

 

   for(int i=0;true;i++)

       dgemm('N','N',10,10,10,1,m1,10,m2,10,1.,res,10);

 

}


int main()

{

  boost::thread t1(thread);

  boost::thread t2(thread);

 


    std::cin.get();

}

 

 

Am I doing something wrong?

 

Thanks, David

Outcomes