support all of C++11 in Cactus or the Einstein Toolkit

Issue #2207 resolved
Roland Haas created an issue

We are currently allowing a subset of C++11 to be used in Cactus and the Einstein Toolkit. Looking at configure.in the supported features are:

  • the auto specifier
  • C++ lambdas
  • C++ range based for

To support all interesting features one would need at least icpc 15 as well as g++ 4.8 and clang 3.3.

Compiler support

The major compilers provide the following information on the features they support:

This summarizes the specific C++11 language features.

= Description = = GCC version = = Intel version = = Clang version = = Notes =
= N2242 \ N2552 = variadic templates 4.3 \ 4.4 12.1 2.9 Wikipedia: (1)
= N1737 \ N1984 = ''auto'' type 4.4 12.0 2.9 Wikipedia: (1)
= N2930 = range-based for loops 4.6 13.0 3.0 Wikipedia: (1)
= N2431 = ''nullptr'' constant 4.6 12.1 3.0 Wikipedia: (1)
= N2927 = lambda functions 4.5 12.0 3.1 Wikipedia: (1)
= N3052 = lambda function conversions ? 13.0 ?
= N2761 = standardized attributes 4.8 12.1 3.3 Wikipedia: (1)
= N1986 = delegating constructors 4.7 14.0 3.0 Wikipedia: (1)
= N2118 = rvalue references 4.3 12.0 2.9 Wikipedia: (1)
= N2346 = defaulted and deleted methods 4.4 12.0 2.9, 3.0 Wikipedia: (1)
= N2442 = raw string literals 4.5 14.0 3.0 Stackoverflow: (1)
= N2235 = generalized constant expressions 4.6 14.0 3.1 Wikipedia: (1)
= N2343 \ N3276 = declared type of an expression 4.3 \ 4.8.1 12.0 2.9 \ 3.1 Wikipedia: (1)
= N2437 = explicit conversion operators 4.5 13.0 3.0 Stroustrup 4th edition, 18.4.2
= N1757 = right angle brackets 4.3 11.1 2.9 ''>>'' for template arguments
= N3272 = override and final 4.7 14.0 3.0 Wikipedia: (1)
= N2258 = template aliases 4.7 12.1 3.0 Wikipedia: (1)
= N3053 = move special member functions 4.6 14.0 3.0
= N2659 = thread-local storage 4.8 15.0 3.3
= N2341 = Alignment support 4.8 15.0 3.3
= N2756 = Non-static data member initializers 4.7 14.0 3.0
= N2347 Strongly-typed enums 4.4 14.0 2.9

This summarizes the specific C++11 library features.

Description libstdc++ version libc++ version Notes
std::begin, std::end 4.5 *
smart pointers <4.5 * Wikipedia: (1) Conversion between smart pointers to convertible types is not supported until libstdc++-4.6.1
std::map::emplace 4.8 cplusplus.com: (1)
std::vector::emplace <4.5 *
<regex> 4.9
<type_traits> <4.5 cplusplus.com: (1)
<chrono> 4.4 Stroustrup 4th edition
<atomic> 4.5 cplusplus.com: (1) : std::atomic::exchange does not compile for pointer types with Intel 13 (works with Intel 14)
<std::array> <4.6
std::to_string
std::unordered_map
std::function <= 4.6 First version unknown; libc++ claims full support for all C++11 features.\ See the libstdc++-4.6.4 documentation (under 20.9.4.3) for a list of unsupported traits.

Keyword: None

Comments (13)

  1. Roland Haas reporter
    • removed comment

    I had a look at the (non-personal machines) in simfactory2.

    unknown status

    • angel.ini
    • compute1.ini
    • compute20.ini
    • compute2.ini
    • compute3.ini
    • compute4.ini
    • compute5.ini
    • compute.ini
    • nvidia1.ini
    • nvidia.ini
    • pi0005009.ini
    • titan.ini
    • vesta.ini # uses the IBM compiler (a Blue Gene/Q)

    likely turned off

    • philip.ini
    • shelob.ini
    • s-kraken.ini

    too old if on

    • saw.ini
    • tianhe1a.ini # cannot be accessed other than through a VPN

    known too old

  2. Roland Haas reporter
    • removed comment

    saw, s-kraken and requin are very old. Last year, a set of new machines was made available to researcher. I have retired them based on suggestions by Erik.

    The new machines are Cedar, Graham, and Niagara.

  3. Roland Haas reporter
    • removed comment

    Erik says (offline) that

    • compute1.ini
    • compute20.ini
    • compute2.ini
    • compute3.ini
    • compute4.ini
    • compute5.ini
    • compute.ini
    • nvidia1.ini
    • nvidia.ini
    • pi0005009.ini
    • titan.ini

    are old machines at PI that will be retired in the next month or so.

    There seems to be little standing in the way of declaring C++11 to be a requirement for Cactus or the Einstein Toolkit.

  4. Roland Haas reporter
    • removed comment

    I gained access to Vesta (or had before but not realised it). Turns out that even the newest IBM XL compiler (that they have, but maybe in general): @ibm-compilers-2017-10 which is version 12.1 (see https://www.ibm.com/support/knowledgecenter/en/SS2LWA) does not support range based for loops of the type

    #include <vector>
    int main() {
    std::vector<int> xs(10);
       for (int& x: xs) x = 42;
    ; return 0; }
    

    and fails with

     /soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/bin/bgxlC_r -o conftest -g -qrtti -qlanglvl=autotypededuction -qlanglvl=decltype -qlanglvl=rightanglebracket:extc1x -qsuppress=1500-036 -g -DCARPET_AVOID_LAMBDA -DCARPET_USE_BOOST_FOREACH -DCARPET_USE_BOOST_SHARED_PTR -DCARPET_ENABLE_BBOXSET2 -DCARPET_USE_BBOXSET2  conftest.C  1>&5
    "configure", line 7458.15: 1540-0063 (S) The text ":" is unexpected.
    

    Thus vesta is currently not a supported machine anymore and requiring full C++11 support is not going to make things any worse. Also, given that the change requiring range based for loops is from Tue Apr 26 07:47:33 2016 -0400 git hash 86d7765529c63b69d58d869248f9c2080f53978b "Cactus: Enable C++11 by default, and require it" and that no one complained so far, it seems safe to state that vesta is not used by anyone.

    I would thus suggest to mark it in simfactory as only supporting ET_2015_11 which is the release before range based loops became mandatory.

  5. Roland Haas reporter
    • removed comment

    This leaves the LONI machines

    • mike.ini
    • qb.ini
    • shelob.ini
    • philip.ini

    as the only ones not yet supporting C++11 (though it should be just a matter of updating the simfactory files to use a newer compiler).

  6. Erik Schnetter
    • removed comment

    Regarding Vesta: I find that the C++ front-end of xlC leaves much to be desired and is basically unusable for any modern C++ code. Instead of using IBM's xlC, I used to use bgclang, a version of clang with BlueGene specific optimizations https://www.alcf.anl.gov/user-guides/bgclang-compiler. In other words, Vesta should still be supported, but the very old version of xlC available there isn't.

  7. Roland Haas reporter
    • removed comment

    Ok, I will take a look once more. The option list uses /soft/compilers/ibmcmp-oct2017/vacpp/bg/12.1/bin/bgxlC_r which looks like the IBM xL compiler.

    Looking at the website you pointed to, as well as in /soft/compilers/bgclang/wbin/ I cannot find a Fortran compiler though.

    Do you know off-hand if there is one that would be compatible with clang's runtime library (eg for stdio and OpenMP threads)?

  8. Log in to comment