OpenMP + ACLiC

From: OKUMURA, Akira <oxon_at_astro.isas.jaxa.jp>
Date: Wed, 15 Sep 2010 08:47:12 -0700


Hello ROOTers,

Does ACLiC support OpenMP?

I started learning OpenMP to improve the speed of my analysis. The following is an example to calculate pi with OpenMP.         

void pi()
{
  const Int_t kN = 100000000;
  long double top = 0.L;
  long double bottom = 0.L;
  long double kStep = 1.L/kN;
  long double sum = 0.L;

#pragma omp parallel private(top, bottom)
  {
#pragma omp for reduction(+:sum)

    for(Int_t i = 0; i < kN; i++) {

      top = 4.L/(1.L + (kStep*i)*(kStep*i));
      bottom = 4.L/(1.L + (kStep*(i+1))*(kStep*(i + 1)));
      sum += (top + bottom)*kStep/2.L;

    } // i
  }
  std::cout.precision(16);
  std::cout << "pi = " << sum << "\n";
}

But I got the following error.


root [0] gSystem->SetIncludePath("-fopenmp")
root [1] gSystem->AddLinkedLibs("-lgomp")
root [2] .L pi.C+O

Info in <TUnixSystem::ACLiC>: creating shared library /Users/oxon/./pi_C.so In file included from /Users/oxon/pi_C_ACLiC_dict.h:34,
                 from /Users/oxon/pi_C_ACLiC_dict.cxx:16:
/Users/oxon/./pi.C: In function ‘void pi()’: /Users/oxon/./pi.C:13: error: expected ‘#pragma omp’ clause before ‘public’ i686-apple-darwin10-g++-4.2.1: /Users/oxon/pi_C_ACLiC_dict.o: No such file or directory Error in <ACLiC>: Compilation failed!

It seems that some of OpenMP words are not handled properly in generation of a dictionary. I suppose ACLiC does not support OpenMP yet.

If ACLiC supports OpenMP, how can I run the script in ROOT? This example runs as I expected in standalone C++ program.

I am using ROOT trunk and GCC (i686-apple-darwin10-g++-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664)) on Snow Leopard.

Regards,

--
OKUMURA, Akira oxon@{astro.isas.jaxa.jp,stanford.edu}
Institute of Space and Astronautical Science (ISAS/JAXA)
Now at KIPAC/SLAC/Stanford
Varian Physics #306
382 Via Pueblo Mall, MC 406 Stanford, CA94305
TEL 650-736-0971/FAX 650-724-5065
Skype : okumura.akira
Received on Wed Sep 15 2010 - 17:47:27 CEST

This archive was generated by hypermail 2.2.0 : Wed Sep 15 2010 - 23:50:02 CEST