Closed chjacob-tubs closed 6 years ago
Which version of icpc
are you using? I suspect it's not C++11 compliant. And it that's the case it means we need to put a CMake check (though I thought it was automatic, so it's a bit puzzling)
The newest one I tried / have available is 2017.4.
Disturbing, I will try to reproduce ASAP.
I managed to compile without problems (apart from a warning on a deprecated flag) I think your Intel compilers are using header from a pre-C++11 standard library provided by an ancient GCC. What does icpc -v
say for you? I get:
icpc version 17.0.4 (gcc version 6.4.0 compatibility)
It does indeed say
icpc version 17.0.4 (gcc version 5.0.0 compatibility)
I will try to fix my installation then ...
No, your installation looks fine to me. GCC 4.8 is already enough for C++11 (you'd need 4.9 if you needed C++11 regexes) I'll see if our cluster has an Intel installed against GCC 5 and re-test.
I managed to compile all the way down to this Intel compiler:
icpc -v
icpc version 12.1.2 (gcc version 4.6.0 compatibility)
which surprised me quite a bit, given your current predicament with something that looks perfectly fine.
Can your icpc
compile the following?
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
int main()
{
std::vector<int> c = {1, 2, 3, 4, 5, 6, 7};
int x = 5;
c.erase(std::remove_if(c.begin(), c.end(), [x](int n) { return n < x; }), c.end());
std::cout << "c: ";
std::for_each(c.begin(), c.end(), [](int i){ std::cout << i << ' '; });
std::cout << '\n';
// the type of a closure cannot be named, but can be inferred with auto
// since C++14, lambda could own default arguments
auto func1 = [](int i = 6) { return i + 4; };
std::cout << "func1: " << func1() << '\n';
// like all callable objects, closures can be captured in std::function
// (this may incur unnecessary overhead)
std::function<int(int)> func2 = [](int i) { return i + 4; };
std::cout << "func2: " << func2(6) << '\n';
}
Yes it can, if I use the -std=c++11
option.
Which is not used when compiling XcFun. If I use --extra-cxx-flags='-std=c++11'
XcFun compiles.
I now installed CMake 3.11 instead of CMake 3.5 on our cluster and that solves the problem. So somehow CMake 3.5 does not tell icpc correctly that it has to use C++11.
Indeed! CMake 3.6 is needed to pick up C++11 from Intel: https://cmake.org/cmake/help/v3.6/release/3.6.html#other
Sorry for your troubles, but at least now we know that a properly set up Intel 12.1.2 works.
@bast should I add -std=c++11
to the flags, or should I bump up CMake requirements? I think the former is most desirable, otherwise the same thing here reported will happen with PGI, which seems to be supported by XCFun.
I agree that we should here add the flag.
@chjacob-tubs can you check that #71 fixes your problems? If yes, close this issue. Thanks!
Yes, works. Thankss a lot!
I was trying to use Intel compilers (to check whether this breaks the Python bindings) but the code is not compiling. I tried to understand the problem, but did not succeed.
[ 1%] Building CXX object src/CMakeFiles/xcfun-objlib.dir/xcfun.cpp.o icpc: command line remark #10148: option '-vec-report0' not supported In file included from /home/christoph/sources/xcfun-mybranch/src/xcfun.cpp(15): /home/christoph/sources/xcfun-mybranch/src/xcint.hpp(70): error: expected an expression FOR_EACH(XC_MAX_ORDER, FP, ) ^
In file included from /home/christoph/sources/xcfun-mybranch/src/xcfun.cpp(15): /home/christoph/sources/xcfun-mybranch/src/xcint.hpp(70): error: expected a ">" FOR_EACH(XC_MAX_ORDER, FP, ) ^
In file included from /home/christoph/sources/xcfun-mybranch/src/xcfun.cpp(15): /home/christoph/sources/xcfun-mybranch/src/xcint.hpp(70): error: expected a ">" FOR_EACH(XC_MAX_ORDER, FP, ) ^
In file included from /home/christoph/sources/xcfun-mybranch/src/xcfun.cpp(15): /home/christoph/sources/xcfun-mybranch/src/xcint.hpp(70): error: expected an expression FOR_EACH(XC_MAX_ORDER, FP, ) ^
In file included from /home/christoph/sources/xcfun-mybranch/src/xcfun.cpp(15): /home/christoph/sources/xcfun-mybranch/src/xcint.hpp(70): error: expected a ">" FOR_EACH(XC_MAX_ORDER, FP, ) ^
In file included from /home/christoph/sources/xcfun-mybranch/src/xcfun.cpp(15): /home/christoph/sources/xcfun-mybranch/src/xcint.hpp(70): error: expected a ">" FOR_EACH(XC_MAX_ORDER, FP, ) ^
In file included from /home/christoph/sources/xcfun-mybranch/src/xcfun.cpp(15): /home/christoph/sources/xcfun-mybranch/src/xcint.hpp(70): error: expected an expression FOR_EACH(XC_MAX_ORDER, FP, ) ^
In file included from /home/christoph/sources/xcfun-mybranch/src/xcfun.cpp(15): /home/christoph/sources/xcfun-mybranch/src/xcint.hpp(70): error: expected a ">" FOR_EACH(XC_MAX_ORDER, FP, ) ^
In file included from /home/christoph/sources/xcfun-mybranch/src/xcfun.cpp(15): /home/christoph/sources/xcfun-mybranch/src/xcint.hpp(70): error: expected a ">" FOR_EACH(XC_MAX_ORDER, FP, ) ^
In file included from /home/christoph/sources/xcfun-mybranch/src/xcfun.cpp(15): /home/christoph/sources/xcfun-mybranch/src/xcint.hpp(70): error: expected an expression FOR_EACH(XC_MAX_ORDER, FP, ) ^
In file included from /home/christoph/sources/xcfun-mybranch/src/xcfun.cpp(15): /home/christoph/sources/xcfun-mybranch/src/xcint.hpp(70): error: expected a ">" FOR_EACH(XC_MAX_ORDER, FP, ) ^
In file included from /home/christoph/sources/xcfun-mybranch/src/xcfun.cpp(15): /home/christoph/sources/xcfun-mybranch/src/xcint.hpp(70): error: expected a ">" FOR_EACH(XC_MAX_ORDER, FP, ) ^
compilation aborted for /home/christoph/sources/xcfun-mybranch/src/xcfun.cpp (code 2) src/CMakeFiles/xcfun-objlib.dir/build.make:84: recipe for target 'src/CMakeFiles/xcfun-objlib.dir/xcfun.cpp.o' failed make[2]: [src/CMakeFiles/xcfun-objlib.dir/xcfun.cpp.o] Error 2 CMakeFiles/Makefile2:1060: recipe for target 'src/CMakeFiles/xcfun-objlib.dir/all' failed make[1]: [src/CMakeFiles/xcfun-objlib.dir/all] Error 2 Makefile:138: recipe for target 'all' failed make: *** [all] Error 2