#8333 closed Bugs (fixed)
[math] PGI 11.3 problems (sph_bessel.cpp, sph_bessel.cpp)
| Reported by: | Owned by: | John Maddock | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | math |
| Version: | Boost 1.53.0 | Severity: | Problem |
| Keywords: | pgi | Cc: |
Description
Hi,
Compilation of boost 1.53.0 with the PGI 11.3 compiler on RHEL5 fails for the following targets:
- bin.v2/libs/math/build/pgi/release/threading-multi/sph_bessel.o
- bin.v2/libs/math/build/pgi/release/threading-multi/sph_bessell.o
Is this a known issue? I cannot seem to find it mentioned in the bugtracker.
Thanks,
Mark
Error messages follow:
pgi.compile.c++ bin.v2/libs/math/build/pgi/release/threading-multi/sph_bessel.o
"./boost/math/special_functions/sinc.hpp", line 70: error: more than one
instance of overloaded function "abs" matches the argument list:
function "abs(double)"
function "abs(int)"
argument types are: (const long double)
if (abs(x) >= taylor_n_bound)
^
detected during:
instantiation of "T boost::math::detail::sinc_pi_imp(T) [with
T=long double]" at line 110
instantiation of "boost::math::tools::promote_args<T, float,
float, float, float, float>::type
boost::math::sinc_pi(T, const Policy &) [with T=long
double, Policy=c_policies::c_policy]" at line 154 of
"./boost/math/special_functions/bessel.hpp"
instantiation of "T boost::math::detail::sph_bessel_j_imp(unsigned
int, T, const Policy &) [with T=long double,
Policy=c_policies::c_policy]" at line 394 of
"./boost/math/special_functions/bessel.hpp"
instantiation of "boost::math::detail::bessel_traits<T, T,
Policy>::result_type boost::math::sph_bessel(unsigned
int, T, const Policy &) [with T=double,
Policy=c_policies::c_policy]" at line 129 of
"libs/math/build/../src/tr1/c_policy.hpp"
instantiation of "boost::math::detail::bessel_traits<T, T,
c_policies::c_policy>::result_type
c_policies::sph_bessel(unsigned int, T) [with T=double]"
at line 16 of "libs/math/build/../src/tr1/sph_bessel.cpp"
"./boost/math/special_functions/sinc.hpp", line 79: error: more than one
instance of overloaded function "abs" matches the argument list:
function "abs(double)"
function "abs(int)"
argument types are: (const long double)
if (abs(x) >= taylor_0_bound)
^
detected during:
instantiation of "T boost::math::detail::sinc_pi_imp(T) [with
T=long double]" at line 110
instantiation of "boost::math::tools::promote_args<T, float,
float, float, float, float>::type
boost::math::sinc_pi(T, const Policy &) [with T=long
double, Policy=c_policies::c_policy]" at line 154 of
"./boost/math/special_functions/bessel.hpp"
instantiation of "T boost::math::detail::sph_bessel_j_imp(unsigned
int, T, const Policy &) [with T=long double,
Policy=c_policies::c_policy]" at line 394 of
"./boost/math/special_functions/bessel.hpp"
instantiation of "boost::math::detail::bessel_traits<T, T,
Policy>::result_type boost::math::sph_bessel(unsigned
int, T, const Policy &) [with T=double,
Policy=c_policies::c_policy]" at line 129 of
"libs/math/build/../src/tr1/c_policy.hpp"
instantiation of "boost::math::detail::bessel_traits<T, T,
c_policies::c_policy>::result_type
c_policies::sph_bessel(unsigned int, T) [with T=double]"
at line 16 of "libs/math/build/../src/tr1/sph_bessel.cpp"
"./boost/math/special_functions/sinc.hpp", line 86: error: more than one
instance of overloaded function "abs" matches the argument list:
function "abs(double)"
function "abs(int)"
argument types are: (const long double)
if (abs(x) >= taylor_2_bound)
^
detected during:
instantiation of "T boost::math::detail::sinc_pi_imp(T) [with
T=long double]" at line 110
instantiation of "boost::math::tools::promote_args<T, float,
float, float, float, float>::type
boost::math::sinc_pi(T, const Policy &) [with T=long
double, Policy=c_policies::c_policy]" at line 154 of
"./boost/math/special_functions/bessel.hpp"
instantiation of "T boost::math::detail::sph_bessel_j_imp(unsigned
int, T, const Policy &) [with T=long double,
Policy=c_policies::c_policy]" at line 394 of
"./boost/math/special_functions/bessel.hpp"
instantiation of "boost::math::detail::bessel_traits<T, T,
Policy>::result_type boost::math::sph_bessel(unsigned
int, T, const Policy &) [with T=double,
Policy=c_policies::c_policy]" at line 129 of
"libs/math/build/../src/tr1/c_policy.hpp"
instantiation of "boost::math::detail::bessel_traits<T, T,
c_policies::c_policy>::result_type
c_policies::sph_bessel(unsigned int, T) [with T=double]"
at line 16 of "libs/math/build/../src/tr1/sph_bessel.cpp"
3 errors detected in the compilation of "libs/math/build/../src/tr1/sph_bessel.cpp".
"pgCC" -Kieee -fpic -fPIC -fast -Mx,8,0x10000000 -Minform=warn -DBOOST_ALL_NO_LIB=1 -DBOOST_MATH_TR1_DYN_LINK=1 -DNDEBUG -D__need_IOV_MAX -
I"." -I"libs/math/src/tr1" -c -o "bin.v2/libs/math/build/pgi/release/threading-multi/sph_bessel.o" "libs/math/build/../src/tr1/sph_bessel.cpp"
pgi.compile.c++ bin.v2/libs/math/build/pgi/release/threading-multi/sph_bessell.o
"./boost/math/special_functions/sinc.hpp", line 70: error: more than one
instance of overloaded function "abs" matches the argument list:
function "abs(double)"
function "abs(int)"
argument types are: (const long double)
if (abs(x) >= taylor_n_bound)
^
detected during:
instantiation of "T boost::math::detail::sinc_pi_imp(T) [with
T=long double]" at line 110
instantiation of "boost::math::tools::promote_args<T, float,
float, float, float, float>::type
boost::math::sinc_pi(T, const Policy &) [with T=long
double, Policy=c_policies::c_policy]" at line 154 of
"./boost/math/special_functions/bessel.hpp"
instantiation of "T boost::math::detail::sph_bessel_j_imp(unsigned
int, T, const Policy &) [with T=long double,
Policy=c_policies::c_policy]" at line 394 of
"./boost/math/special_functions/bessel.hpp"
instantiation of "boost::math::detail::bessel_traits<T, T,
Policy>::result_type boost::math::sph_bessel(unsigned
int, T, const Policy &) [with T=long double,
Policy=c_policies::c_policy]" at line 129 of
"libs/math/build/../src/tr1/c_policy.hpp"
instantiation of "boost::math::detail::bessel_traits<T, T,
c_policies::c_policy>::result_type
c_policies::sph_bessel(unsigned int, T) [with T=long
double]" at line 16 of
"libs/math/build/../src/tr1/sph_bessell.cpp"
"./boost/math/special_functions/sinc.hpp", line 79: error: more than one
instance of overloaded function "abs" matches the argument list:
function "abs(double)"
function "abs(int)"
argument types are: (const long double)
if (abs(x) >= taylor_0_bound)
^
detected during:
instantiation of "T boost::math::detail::sinc_pi_imp(T) [with
T=long double]" at line 110
instantiation of "boost::math::tools::promote_args<T, float,
float, float, float, float>::type
boost::math::sinc_pi(T, const Policy &) [with T=long
double, Policy=c_policies::c_policy]" at line 154 of
"./boost/math/special_functions/bessel.hpp"
instantiation of "T boost::math::detail::sph_bessel_j_imp(unsigned
int, T, const Policy &) [with T=long double,
Policy=c_policies::c_policy]" at line 394 of
"./boost/math/special_functions/bessel.hpp"
instantiation of "boost::math::detail::bessel_traits<T, T,
Policy>::result_type boost::math::sph_bessel(unsigned
int, T, const Policy &) [with T=long double,
Policy=c_policies::c_policy]" at line 129 of
"libs/math/build/../src/tr1/c_policy.hpp"
instantiation of "boost::math::detail::bessel_traits<T, T,
c_policies::c_policy>::result_type
c_policies::sph_bessel(unsigned int, T) [with T=long
double]" at line 16 of
"libs/math/build/../src/tr1/sph_bessell.cpp"
"./boost/math/special_functions/sinc.hpp", line 86: error: more than one
instance of overloaded function "abs" matches the argument list:
function "abs(double)"
function "abs(int)"
argument types are: (const long double)
if (abs(x) >= taylor_2_bound)
^
detected during:
instantiation of "T boost::math::detail::sinc_pi_imp(T) [with
T=long double]" at line 110
instantiation of "boost::math::tools::promote_args<T, float,
float, float, float, float>::type
boost::math::sinc_pi(T, const Policy &) [with T=long
double, Policy=c_policies::c_policy]" at line 154 of
"./boost/math/special_functions/bessel.hpp"
instantiation of "T boost::math::detail::sph_bessel_j_imp(unsigned
int, T, const Policy &) [with T=long double,
Policy=c_policies::c_policy]" at line 394 of
"./boost/math/special_functions/bessel.hpp"
instantiation of "boost::math::detail::bessel_traits<T, T,
Policy>::result_type boost::math::sph_bessel(unsigned
int, T, const Policy &) [with T=long double,
Policy=c_policies::c_policy]" at line 129 of
"libs/math/build/../src/tr1/c_policy.hpp"
instantiation of "boost::math::detail::bessel_traits<T, T,
c_policies::c_policy>::result_type
c_policies::sph_bessel(unsigned int, T) [with T=long
double]" at line 16 of
"libs/math/build/../src/tr1/sph_bessell.cpp"
3 errors detected in the compilation of "libs/math/build/../src/tr1/sph_bessell.cpp".
"pgCC" -Kieee -fpic -fPIC -fast -Mx,8,0x10000000 -Minform=warn -DBOOST_ALL_NO_LIB=1 -DBOOST_MATH_TR1_DYN_LINK=1 -DNDEBUG -D__need_IOV_MAX -
I"." -I"libs/math/src/tr1" -c -o "bin.v2/libs/math/build/pgi/release/threading-multi/sph_bessell.o" "libs/math/build/../src/tr1/sph_bessell.cpp
"
Change History (12)
comment:1 by , 10 years ago
comment:2 by , 10 years ago
Hi,
I warn you, I've not done any C++ before, but I'm not sure that's the problem - the following test compiles and prints out 3.14:
#include <cmath>
#include <iostream>
int main()
{
long double value = -3.14;
cout << "Absolute: " << std::abs(value) << endl;
}
$ pgCC -o test2 test2.cpp $ ./test2 Absolute: 3.14
comment:4 by , 10 years ago
What happens if you add #include <cstdlib> to your test case?
That was going to be my next question as well, add
#include <cstdlib>
To the very top of libs/math/src/tr1/sph_bessel.cpp
comment:5 by , 10 years ago
Thank you both for the suggestions, but I'm afraid there's no change:-
My test case still works and the boost build still fails (with the same message - except it's now complaining about line 17 of sph_bessel.cpp instead of 16)
Mark
comment:6 by , 10 years ago
I'm also seeing this error on PGI 12.2 and PGI 12.5 on SuSE 11 (CLE4, specifically). Same system compiling with GCC (4.6.1, 4.6.2, 4.7.0, & 4.7.1), Intel 11.1 or Cray's compiler (8.0 and 8.1) aren't showing this error.
comment:7 by , 10 years ago
Are you able to do a quick grep and find out which header defines std::abs(long double) on that platform as from the comments above neither <cmath> nor <cstdlib> appear to be defining it?
Thanks, John.
comment:8 by , 10 years ago
For PGI 11.3, it seems to be in:
${PGI_HOME}/include/CC/stl/_cmath.h
Which is included by the following headers:
${PGI_HOME}/include/CC/cmath
${PGI_HOME}/include/CC/stl/_valarray.h
${PGI_HOME}/include/CC/stl/_complex.h
So it "should" be included.
Sticking the following definition:
long double abs (long double __x) { return __x; }
At the very top of sph_bessel.cpp results in the following compile error:
"/apps/compilers/pgi/11.3/1/default/linux86-64/11.3/include/CC/stl/_cmath.h", line 208: error:
function "std::abs(long double)" conflicts with using-declaration of
function "abs(long double)"
inline long double abs (long double __x) { return _STLP_DO_ABS(long double)((double)__x); }
^
"./boost/math/special_functions/fpclassify.hpp", line 85: error:
using-declaration of function "abs(long double)" conflicts with
function "std::abs(long double)" (declared at line 208 of
"/apps/compilers/pgi/11.3/1/default/linux86-64/11.3/include/CC/stl/_c
math.h")
namespace std{ using ::abs; using ::fabs; }
^
2 errors detected in the compilation of "libs/math/src/tr1/sph_bessel.cpp".
So it would appear that it is being included.
Alternatively, if I alter sph_bessel.cpp to read:
// Copyright John Maddock 2008.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
# include <pch.hpp>
#ifndef BOOST_MATH_TR1_SOURCE
# define BOOST_MATH_TR1_SOURCE
#endif
#include <boost/math/tr1.hpp>
#include <boost/math/special_functions/bessel.hpp>
#include "c_policy.hpp"
extern "C" double BOOST_MATH_TR1_DECL boost_sph_bessel BOOST_PREVENT_MACRO_SUBSTITUTION(unsigned n, double x) BOOST_MATH_C99_THROW_SPEC
{
long double val = 3.14;
std::abs(val);
return c_policies::sph_bessel BOOST_PREVENT_MACRO_SUBSTITUTION(n, x);
}
I get the 3 compile errors originally reported, but no new ones. sph_bessel.cpp clearly knows about the long double abs definition.
Presumably the problem is deep in the include files?
Thanks,
Mark
comment:9 by , 10 years ago
OK, next try: can you replace in boost/math/special_functions/sinc.hpp, from line 64
#if defined(BOOST_NO_STDC_NAMESPACE) && !defined(__SUNPRO_CC)
using ::abs;
using ::sin;
using ::sqrt;
#else /* BOOST_NO_STDC_NAMESPACE */
using ::std::abs;
using ::std::sin;
using ::std::sqrt;
#endif /* BOOST_NO_STDC_NAMESPACE */
with simply
BOOST_MATH_STD_USING
And see if that kills some of the errors?
comment:10 by , 10 years ago
Nice one - library "math" now builds with no compiler errors at all :)
Thanks,
Mark

No it's not a known issue, is there no std::abs(long double) overload on that platform?
I could change it to use std::fabs if that helps?