[petsc-dev] tao and complex numbers

Lisandro Dalcin dalcinl at gmail.com
Sun Feb 8 11:42:47 CST 2015


On 8 February 2015 at 20:25, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
>> On Feb 8, 2015, at 11:19 AM, Lisandro Dalcin <dalcinl at gmail.com> wrote:
>>
>> On 8 February 2015 at 20:14, Barry Smith <bsmith at mcs.anl.gov> wrote:
>>>
>>>> On Feb 8, 2015, at 11:11 AM, Lisandro Dalcin <dalcinl at gmail.com> wrote:
>>>>
>>>> On 8 February 2015 at 19:39, Barry Smith <bsmith at mcs.anl.gov> wrote:
>>>>>
>>>>> Since all the TAO implementations seem to have
>>>>>
>>>>> #requiresscalar    real
>>>>>
>>>>> in the makefile why don't we just move that up to the tao directory level and put an error generator in tao.h if included with complex so users see immediately and clearly they cannot us tao with complex instead of having to send us email?
>>>>>
>>>>
>>>> I'm afraid this will break petsc4py in a hard-to-fix way.
>>>
>>>   How? Do you do two builds with petsc4py once with real and once with complex?
>>>
>>
>> No, what I meant is that if you make tao.h to generate an error, then
>> petsc4py will not build in the complex scalar case.
>
>    Hmm, can't you just not build the tao directory in that case? Hence petsc4py would not see tao.h at all?
>
>    Currently we have this weird situation where when you build PETSc with complex it compiles in the tao/interface directory but not in any of the impls directories (like unconstrained etc) which petsc4py already handles somehow. I am just proposing not building in the tao/interface directory either (and putting in the error generator in tao.h in case users try to include it while using complex).
>

The fact that PETSc currently builds tao/interface is what makes
possible to build petsc4py. Cython does not have a "conditional
compilation" feature. So, in order to provide support for TAO, I do
need to unconditionally include tao.h and wrap the stuff in
tao/interface.

Of course, I could write some compatibility header file with dummy
routine for ALL of the routines in tao/interface to include instead of
the regular tao.h. IMHO it is not worth the effort, a prominent (maybe
fatal?) error message should be enough.



-- 
Lisandro Dalcin
============
Research Scientist
Computer, Electrical and Mathematical Sciences & Engineering (CEMSE)
Numerical Porous Media Center (NumPor)
King Abdullah University of Science and Technology (KAUST)
http://numpor.kaust.edu.sa/

4700 King Abdullah University of Science and Technology
al-Khawarizmi Bldg (Bldg 1), Office # 4332
Thuwal 23955-6900, Kingdom of Saudi Arabia
http://www.kaust.edu.sa

Office Phone: +966 12 808-0459



More information about the petsc-dev mailing list