[ADOL-C] fmax conflict with c++ gcc 4.4.6

Antoine De Blois antoine.deblois at aero.bombardier.com
Mon Apr 22 11:32:34 EDT 2013


Hi,

The source code is  the following:

adouble pswmax = fmax(psw[sian],psw[sia]);

where psw is an array of adouble's declared as adouble* psw = new adouble[thatmany];

I agree that the fmax from ADOL-C should be called, but the problem comes from the fact that the <cmath> fmax is a template!! See below. Then, the compiler picks it up. The following is an excerpt from the /usr/include/c++/..../cmath

template<typename _Tp, typename _Up>
    inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
    fmax(_Tp __x, _Up __y)
    {
      typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
      return fmax(__type(__x), __type(__y));
    }

Antoine

-----Message d'origine-----
De : Kshitij Kulshreshtha [mailto:kshitij at math.upb.de] 
Envoyé : Monday, April 22, 2013 11:27 AM
À : Antoine De Blois
Cc : adol-c at list.coin-or.org
Objet : Re: [ADOL-C] fmax conflict with c++ gcc 4.4.6

Hello,

the declarations

fmin(const double&, const double&) and the corresponding fmax has been deleted. These are the ones that ISO C99 and C++11 define.

fmin(double, const badouble&)
fmin(const badouble&, double)
fmin(const badouble&, const badouble&) and the corresponding fmax are required. These are the ones you see in adouble.h

What source code are you compiling that creates the error you quote?
It looks like two adouble arguments have been passed, and the <cmath> version should not even be called.

Best
Kshitij


As on 2013-04-22 17:02h, Antoine De Blois did write:
> Hi Kshitij,
> 
> I already use the ADOL-C 2.4.1. My error is in fact with fmax using adouble as arguments. I get the following complaint by the compiler:
> 
> /usr/include/c++/4.4.6/tr1_impl/cmath(525): error: no instance of constructor "adub::adub" matches the argument list  argument types are: (adouble)
>         return fmax(__type(__x), __type(__y));
>                     ^
>           detected during instantiation of 
> "__gnu_cxx::__promote_2<_Tp, _Up>::__type std::fmax(_Tp, _Up) [with 
> _Tp=adouble, _Up=adouble]" at line 74
> 
> Just so I understand, what was removed exactly in 2.4.1? Because in my adouble.h, fmin and fmax are there (at line 226 to 231).
> Regards,
> Antoine
> 
> -----Message d'origine-----
> De : Kshitij Kulshreshtha [mailto:kshitij at math.upb.de] Envoyé : 
> Monday, April 22, 2013 10:54 AM À : Antoine De Blois Cc : 
> adol-c at list.coin-or.org Objet : Re: [ADOL-C] fmax conflict with c++ 
> gcc 4.4.6
> 
> fmin/fmax definitions for double type are now standard in all C/C++ compilers that support C99 and C++11 standards. So these have been removed in the latest ADOL-C version 2.4.1. Please use that.
> 
> As on 2013-04-22 16:45h, Antoine De Blois did write:
>> Hi everyone,
>>
>> We recently upgraded our linux cluster from redhat rhel5 to rhel6, which comes with the upgrade gcc 4.4.6. The latter has an fmax function defined in the <cmath>, which results in a conflict with the ADOL-C implementation.
>>
>> Has anyone came up with a simple fix for that? I tried to define a new namespace, as follows, without success:
>>
>> namespace AD
>> {
>> template <typename ADdouble1, typename ADdouble2> inline adouble
>> fmax(ADdouble1 a, ADdouble2 b) {
>>    return fmax(a,b);
>> }
>> }
>>
>> But when I try to use it, the function get caught into the locint
>> StoreManagerLocintBlock::next_loc()
>>
>> of tape_handling.cpp
>>
>> and I do not understand why.
>>
>> Thank you for your time and efforts,
>> Antoine
>>
>> _______________________________________________
>> ADOL-C mailing list
>> ADOL-C at list.coin-or.org
>> http://list.coin-or.org/mailman/listinfo/adol-c
>>
> 
> --
> Dr. Kshitij Kulshreshtha
> 
> Institut für Mathematik,
> Universität Paderborn,
> Warburger Straße 100,
> 33098 Paderborn.
> 
> Büro: A3.235
> 
> Privatanschrift:
> Arnikaweg 62
> 33100 Paderborn.
> 

--
Dr. Kshitij Kulshreshtha

Institut für Mathematik,
Universität Paderborn,
Warburger Straße 100,
33098 Paderborn.

Büro: A3.235

Privatanschrift:
Arnikaweg 62
33100 Paderborn.



More information about the ADOL-C mailing list