<br><br><div class="gmail_quote">On Wed, May 19, 2010 at 8:56 PM, Satish Balay <span dir="ltr"><<a href="mailto:balay@mcs.anl.gov">balay@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I don't understand the code change -<br></blockquote><div>I do not understand either. In my codes, there are a lots of mathematically complex number operators such exp, *, +, - etc. <br>I do not understand why c++ std::complex <> is so slow compared to C99 complex number even with "-O3" flag on.<br>
<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">but if you want to use c99<br>
complex - you can build petsc with:<br>
<br>
--with-scalar-type=complex --with-clanguage=c [which is the default for clanguage]<br>
<br>
And no code-change needed for PETSc. However if your code uses c++ -<br>
you might have to address that..<br>
<font color="#888888"><br>
Satish<br>
</font><div><div></div><div class="h5"><br>
On Wed, 19 May 2010, RenZhengYong wrote:<br>
<br>
> Hi, PETSc team,<br>
> I wrote a C++ code dealing with electromagnetic problems, which can smoothly<br>
> call PETSc complied by using " --with-scalar-type=complex<br>
> --with-clanguage=cxx" .<br>
> To improve the performances of the C++ code, I changed the complex number of<br>
> type from std::complex<double> to double _Complex (C99 standard, roughly<br>
> 30~50 times faster compared to std::complex<double>). But when I find that<br>
> the C99 complex number head file <complex.h> will lead to the following<br>
> kinds of errors"<br>
><br>
> /usr/include/c++/4.3/complex:57: error: expected identifier before<br>
> ‘__complex__’<br>
> /usr/include/c++/4.3/complex:58: error: expected identifier before<br>
> ‘__complex__’<br>
> /usr/include/c++/4.3/complex:58: error: expected unqualified-id before ‘<’<br>
> token<br>
> /usr/include/c++/4.3/complex:59: error: expected identifier before<br>
> ‘__complex__’<br>
> /usr/include/c++/4.3/complex:59: error: expected unqualified-id before ‘<’<br>
> token<br>
> /usr/include/c++/4.3/complex:60: error: expected identifier before<br>
> ‘__complex__’<br>
> /home/Zhengyong/packages/petsc-3.1-p1/include/petscmath.h:157: error:<br>
> expected unqualified-id before ‘__complex__’<br>
> /home/Zhengyong/packages/petsc-3.1-p1/include/petscmath.h:306: error:<br>
> ‘PetscScalar’ does not name a type<br>
> /home/Zhengyong/packages/petsc-3.1-p1/include/petscmath.h:339: error:<br>
> ‘PetscScalar’ does not name a type<br>
> /home/Zhengyong/packages/petsc-3.1-p1/include/petscmath.h:469: warning:<br>
> ‘PetscGlobalSum’ initialized and declared ‘extern’<br>
> /home/Zhengyong/packages/petsc-3.1-p1/include/petscmath.h:469: error:<br>
> ‘PetscScalar’ was not declared in this scope<br>
> /home/Zhengyong/packages/petsc-3.1-p1/include/petscmath.h:469: error:<br>
> expected primary-expression before ‘,’ token<br>
> /home/Zhengyong/packages/petsc-3.1-p1/include/petscmath.h:469: error:<br>
> ‘PetscScalar’ was not declared in this scope<br>
> /home/Zhengyong/packages/petsc-3.1-p1/include/petscmath.h:469: error:<br>
> expected primary-expression before ‘,’ token<br>
> /home/Zhengyong/packages/petsc-3.1-p1/include/petscmath.h:469: error:<br>
> expected primary-expression before ‘)’ token<br>
> /home/Zhengyong/packages/petsc-3.1-p1/include/petscmath.h:469: error:<br>
> initializer expression list treated as compound expression<br>
><br>
><br>
> Could you please give me some idea to deal with these problems?<br>
><br>
> Kind regards,<br>
> Zhengyong Ren<br>
><br>
><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Zhengyong Ren<br>AUG Group, Institute of Geophysics<br>Department of Geosciences, ETH Zurich<br>NO H 47 Sonneggstrasse 5<br>CH-8092, Zürich, Switzerland<br>Tel: +41 44 633 37561<br>
e-mail: <a href="mailto:zhengyong.ren@aug.ig.erdw.ethz.ch">zhengyong.ren@aug.ig.erdw.ethz.ch</a><br>Gmail: <a href="mailto:renzhengyong@gmail.com">renzhengyong@gmail.com</a><br>