Modern C++ availability on Zusie

Modern C++ availability on Zusie

par Ioan-Cristian Olariu,
Nombre de réponses : 3

Hello,

Currently it seems that the only C++ compiler available on the Zusie machine is G++ 4.3.4 which does not support the 2011 C++ standard (also known as C++0x).  This is unfortunate because it prevents us from using modern C++ approaches in our assignments if we also need to compile and run the code on Zusie.

C++11 is fully supported by GCC/G++ version 4.8.1 or newer or Clang version 3.3 or newer. Is it possible to add such a compiler suite to the system?

It looks like upgrading the existing SUSE Linux Enterprise Server 11 to Service Pack 4 would make it possible to add GCC 5.2 as an optional compiler: https://www.suse.com/releasenotes/x86_64/SUSE-SLES/11-SP4/index.html#fate-319015 

If an upgrade to the last Service Pack is still possible at the time (also not too risky or disruptive), I respectfully would like to submit this as a reason to take it into consideration.

Best regards,

Cristian Olariu

En réponse à Ioan-Cristian Olariu

Re: Modern C++ availability on Zusie

par Wolfgang Schreiner,

zusie has installations of gcc 7, 8, and 9, see command "module avail" and slide 6 of slide set "OpenMP", respectively. Already gcc 7 supports C++11, gcc 8 and 9 support C++17. 

There is also an installation of gcc 12 supporting C++-20. However, this requires the use of a Singularity container, which makes it a bit awkward to use, see below. I recommend to stick to gcc versions 7, 8, or 9.

|> superUser@zusie:/tmp # su - risc03
|>
|> risc03@zusie:~> cp /apps/GCC122/ex1_for_each_loop.cpp .
|>
|> risc03@zusie:~> load.ExecEnv::GnuCC_12.2
|> ...
|>
|> Launching a Singularity Container featuring DWARF Vers. 4 Debugging
|> and a GLIBC 2.12+ Linux-x86_64 / ABI execution layer ...
|>
|> #-----------------------------------------------------------------
|> # Commands:
|> # ---------
|> #
|> # gcc -> Gnu C Compiler
|> # g++ -> Gnu C++ Compiler
|> # gfortran -> Gnu Fortran Compiler
|> #
|> # exit -> leave this Ubuntu Xenial Runtime Shell
|> #
|> #-----------------------------------------------------------------
|>
|> risc03@zusie:~$ head -5 ex1_for_each_loop.cpp
|>
|> // siehe: https://www.geeksforgeeks.org/for_each-loop-c/
|>
|> // C++ code to demonstrate the
|> // working of for_each loop
|>
|> risc03@zusie:~$ which g++
|> /apps/GCC122/inst/bin/g++
|>
|> risc03@zusie:~$ g++ -std=c++11 ex1_for_each_loop.cpp -o ex1.exe
|>
|> risc03@zusie:~$ ldd -r ex1.exe
|> linux-vdso.so.1 => (0x00007ffff7fd8000)
|> libstdc++.so.6 => /apps/GCC122/inst/lib64/libstdc++.so.6 (0x00007ffff7bc1000)
|> libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ffff789f000)
|> libgcc_s.so.1 => /apps/GCC122/inst/lib64/libgcc_s.so.1 (0x00007ffff7682000)
|> libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ffff72b7000)
|> /lib64/ld-linux-x86-64.so.2 (0x00007ffff7fd9000)
|>
|> risc03@zusie:~$ ./ex1.exe
|> Using Arrays:
|> Multiple of 2 of elements are : 2 10 4 8 6
|> Multiple of 3 of elements are : 3 15 6 12 9
|> Using Vectors:
|> Multiple of 2 of elements are : 8 10 16 6 2
|> Multiple of 3 of elements are : 12 15 24 9 3
|>
|> risc03@zusie:~$ exit
|> exit
|>
|> Done with this Singularity Container.
|> Returning to the Command Line Interpreter ...
En réponse à Wolfgang Schreiner

Re: Modern C++ availability on Zusie

par Ioan-Cristian Olariu,
Thank you for the detailed answer.

I have also just seen that slide 6 in the OpenMP deck already answered my concern.