Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pybind does not compile with Intel C++ 15 #276

Closed
nonewthing opened this issue Jul 10, 2016 · 15 comments
Closed

pybind does not compile with Intel C++ 15 #276

nonewthing opened this issue Jul 10, 2016 · 15 comments

Comments

@nonewthing
Copy link

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

@wjakob
Copy link
Member

wjakob commented Jul 10, 2016

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.

@wjakob
Copy link
Member

wjakob commented Jul 10, 2016

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

@bennybp
Copy link
Contributor

bennybp commented Jul 10, 2016

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.

@bennybp
Copy link
Contributor

bennybp commented Jul 11, 2016

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

@nonewthing
Copy link
Author

Thanks for that benny I'll try reimplementing sizeof

@wjakob
Copy link
Member

wjakob commented Jul 11, 2016

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?

@bennybp
Copy link
Contributor

bennybp commented Jul 11, 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)

@wjakob
Copy link
Member

wjakob commented Jul 12, 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.

@wjakob
Copy link
Member

wjakob commented Jul 12, 2016

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

@wjakob wjakob closed this as completed Jul 12, 2016
@bennybp
Copy link
Contributor

bennybp commented Jul 12, 2016

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.

@joaander
Copy link

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.

@uksajja
Copy link

uksajja commented Feb 11, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants
@wjakob @joaander @nonewthing @bennybp @uksajja and others