pybind / pybind11

Seamless operability between C++11 and Python

Home Page:https://pybind11.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pybind does not compile with Intel C++ 15

nonewthing opened this issue · comments

using Intel c++ 2015.1.133
including pybind11/pybind11.h I get this message

In file included from pysynapse/../3rdParty/pybind11-master/include/pybind11/pytypes.h(12),
from pysynapse/../3rdParty/pybind11-master/include/pybind11/cast.h(13),
from pysynapse/../3rdParty/pybind11-master/include/pybind11/attr.h(13),
from pysynapse/../3rdParty/pybind11-master/include/pybind11/pybind11.h(32),
from pysynapse/src/systemwrapper.cpp(2):
include/pybind11/common.h(323): error: function call must have a constant value in a constant expression
{ "bBhHiIqQ"[detail::log2(sizeof(T))*2 + (std::is_unsigned::value ? 1 : 0)], '\0' };
^

this is almost certainly a compiler bug (see https://software.intel.com/en-us/forums/intel-c-compiler/topic/532880) , so I am asking is their any known workaround for this ?

thanks

John

This is the first time this issue is reported. Sadly, the Intel compiler is not available on the various CI testing services (AppVeyor, Travis), which means that it's not tested as part of our test suite. Thus, Intel support may occasionally break as we run into issues such as this one.

I agree that it's most certainly a compiler bug.

(please consider escalating this to Intel so that it can at least be fixed in a future version of the compiler)

This still is probably a compiler bug, but not the one you pointed to (pybind11 isn't using and of the standard library math functions).

I can't seem to reproduce it with a small (without pybind11) example, though. So I'm not sure yet what is going on.

I think I managed to reproduce the problem. Intel 2015 doesn't have the sizeof operator marked as constexpr. This looks to be fixed already in Intel 2016.

The only workarounds I can think of are to modify use PYBIND11_DECL_FMT manually for all the integer types as well, or to replace sizeof with something like this: http://stackoverflow.com/questions/1219199/size-of-a-datatype-without-using-sizeof

Thanks for that benny I'll try reimplementing sizeof

Ugh, that sound tricky. It doesn't feel right to reimplement a constexpr sizeof replacement in this library though -- maybe the best course of action is to bump the version requirement to Intel 2016?

Yeah it's probably not right. The solution from stack overflow looks pretty simple, but might not be standard. It's probably fine for anyone who wants to use it as a workaround, though, assuming it actually fixes the problem.

(I don't know how many people are actually using pybind11 with Intel. We've been using it for a while now with no problems, although we have 2016)

Does the Intel compiler offers any benefits over GCC/Clang these days? I know it used to, but the latter have gotten very good at vectorization.

(I'll close this ticket then, see 59b240a)

Looks good to me.

For your Intel question, I generally find the code it generates to be faster (particularly with the MKL). Even 10% or so can matter a lot in scientific code. It certainly depends on what you want to do with it, though.

Intel 2015 support is important for HPC users. Many of the national centers (TACC, SDSC) default to the intel compilers and do not provide as much support for users who use gcc. The centers are slow to update, and intel 2015 is what is currently available.

Hi,
I am a newbie here. Trying to compile a project that has pybind11 dependency. The code compiles with gcc compilers whereas with intel 2018 compiler, I am getting some compilation errors similar to the following:
external_libraries\pybind11/pybind11.h(167): error : a variable declared with an auto type specifier cannot appear in its own initializer
static constexpr auto signature = _("(") + cast_in::arg_names + _(") -> ") + cast_out::name;
detected during:
instantiation of "void pybind11::cpp_function::initialize(Func &&, Return (*)(Args...), const Extra &...)
pybind11/cast.h(1838): error : no instance of overloaded function "pybind11::detail::concat" matches the argument list [
static constexpr auto arg_names = concat(type_descr(make_caster::name)...);

Is this issue related to the topic discussed here? Is there any workaround for this?
There is some discussion on intel forum on this.
https://software.intel.com/en-us/forums/intel-c-compiler/topic/532880#
https://groups.google.com/a/isocpp.org/forum/#!topic/std-discussion/a7D2SYqUX-I

I appreciate any help in resolving this.