[GiNaC-list] Ginac and OpenMP
Martin Ettl
ettl.martin at gmx.de
Wed May 19 17:46:40 CEST 2010
-------- Original-Nachricht --------
> Datum: Wed, 19 May 2010 17:37:44 +0200
> Von: "Martin Ettl" <ettl.martin at gmx.de>
> An: jros at unavarra.es, GiNaC discussion list <ginac-list at ginac.de>
> Betreff: [GiNaC-list] Ginac and OpenMP
> Hello,
>
> i try to do some symbolic computation in parallel using openMP. This is
> offered from gcc since version 4.2 on Linux.
>
> Here a reduced version of what i have tried:
>
> #include <iostream>
> #include <stdexcept>
> #include <ginac/ginac.h>
> #include <omp.h>
> using namespace std;
> using namespace GiNaC;
>
>
> int main()
> {
>
> symbol omega("om"),u("u"),du("du");
> ex F = -(pow(omega,12)*u) - (pow(u,13));
> unsigned int ui;
> #pragma omp parallel for private(F) shared(ui,u,omega,du)
> for(ui = 0; ui < 10 ; ui++)
> std::cout << F.diff(u,ui) << std::endl;
>
> }
>
> Compile it with : g++ -fopenmp -o test test.cpp -lginac
>
> For every iteration of the for loop, the result is still zero.
> Has anybody else have had the same (or similiar) problem. Have i made
> misst something?
>
> Many thanks in advance
>
> Martin
BTW,
switching off OpenMP prints the following correct result:
-om^12*u-u^13
-13*u^12-om^12
-156*u^11
-1716*u^10
-17160*u^9
-154440*u^8
-1235520*u^7
-8648640*u^6
-51891840*u^5
-259459200*u^4
Maybe Ginac is not usable with OpenMP?
Cheers,
Martin
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
More information about the GiNaC-list
mailing list