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

Upgrade gnu-compilers to GCC 12.2 #1439

Merged
merged 1 commit into from Sep 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 9 additions & 6 deletions components/OHPC_macros
Expand Up @@ -75,21 +75,24 @@ BuildRequires: ohpc-buildroot
# these choices can be overridden by specifing the compiler_family/mpi_family
# variables via rpmbuild or other mechanisms.

%{!?compiler_family: %global compiler_family gnu9}
%{!?compiler_family: %global compiler_family gnu12}
%{!?mpi_family: %global mpi_family openmpi4}
%{!?python_family: %global python_family python3}

# Compiler dependencies
%if 0%{?ohpc_compiler_dependent} == 1

%if "%{compiler_family}" == "gnu12"
BuildRequires: gnu12-compilers%{PROJ_DELIM} >= 12.1.0
Requires: gnu12-compilers%{PROJ_DELIM} >= 12.1.0
%global gnu_family gnu12
%endif # gnu9
Copy link
Contributor

@martin-g martin-g Sep 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# gnu12

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I also need to move it off the same line. The RPM developers have indicated they may turn end-of-line comments into errors.

%if "%{compiler_family}" == "gnu9"
BuildRequires: gnu9-compilers%{PROJ_DELIM} >= 9.2.0
Requires: gnu9-compilers%{PROJ_DELIM} >= 9.2.0
%global gnu_family gnu9
%endif # gnu9
%if "%{compiler_family}" == "gnu8"
BuildRequires: gnu8-compilers%{PROJ_DELIM} >= 8.3.0
Requires: gnu8-compilers%{PROJ_DELIM} >= 8.3.0
%endif # gnu8


%if "%{compiler_family}" == "intel"
BuildRequires: gcc-c++ intel-compilers-devel%{PROJ_DELIM}
Expand Down Expand Up @@ -157,7 +160,7 @@ Requires: openmpi4-%{compiler_family}%{PROJ_DELIM}
%global python_lib_dir python%{python3_version}
BuildRequires: %{python_prefix}-devel
BuildRequires: %{python_prefix}-setuptools
BuildRequires: python-rpm-macros
BuildRequires: %{python_prefix}-rpm-macros
Requires: %{python_prefix}
%endif

Expand Down
4 changes: 2 additions & 2 deletions components/OHPC_setup_compiler
Expand Up @@ -34,13 +34,13 @@ if [ "$OHPC_COMPILER_FAMILY" = "gnu" ]; then
export F77=gfortran
module purge
module load gnu
elif [ "$OHPC_COMPILER_FAMILY" = "gnu8" ]; then
elif [ "$OHPC_COMPILER_FAMILY" = "gnu12" ]; then
export CC=gcc
export CXX=g++
export FC=gfortran
export F77=gfortran
module purge
module load gnu8
module load gnu12
elif [ "$OHPC_COMPILER_FAMILY" = "gnu9" ]; then
export CC=gcc
export CXX=g++
Expand Down
126 changes: 58 additions & 68 deletions components/compiler-families/gnu-compilers/SPECS/gnu-compilers.spec
Expand Up @@ -10,12 +10,11 @@

%include %{_sourcedir}/OHPC_macros

%global gnu_version 9.5.0
%global gnu_major_ver 9
%global pname gnu9-compilers
%global gnu_version 12.2.0
%global gnu_major_ver gnu12
%global pname %{gnu_major_ver}-compilers

# Define subcomponent versions required for build

%global gmp_version 6.2.1
%global mpc_version 1.2.1
%global mpfr_version 4.1.0
Expand All @@ -24,63 +23,68 @@ Summary: The GNU C Compiler and Support Files
Name: %{pname}%{PROJ_DELIM}
Version: %{gnu_version}
Release: 1%{?dist}
License: GNU GPL
License: GPLv3 and GPLv3+ with exceptions and LGPLv3 and GPLv2 and LGPLv2+
Group: %{PROJ_NAME}/compiler-families
URL: http://gcc.gnu.org/
Source0: https://ftp.gnu.org/gnu/gcc/gcc-%{gnu_version}/gcc-%{gnu_version}.tar.xz
Source1: https://ftp.gnu.org/gnu/gmp/gmp-%{gmp_version}.tar.bz2
Source2: https://ftp.gnu.org/gnu/mpc/mpc-%{mpc_version}.tar.gz
Source3: https://ftp.gnu.org/gnu/mpfr/mpfr-%{mpfr_version}.tar.gz

BuildRequires: bison
BuildRequires: flex
BuildRequires: gettext-devel
BuildRequires: perl
# Requirements from https://gcc.gnu.org/install/prerequisites.htmlzypper
BuildRequires: gcc-c++
%if 0%{?suse_version} > 1220
BuildRequires: makeinfo
%else
BuildRequires: texinfo
%endif
BuildRequires: zlib-devel
%if 0%{?sles_version} || 0%{?suse_version}
BuildRequires: binutils >= 2.30
BuildRequires: make >= 3.80
BuildRequires: gettext-devel >= 0.14.5
BuildRequires: flex >= 2.5.4
BuildRequires: texinfo >= 4.7
BuildRequires: m4 >= 1.4.6
%if 0%{?sle_version} || 0%{?suse_version}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should line 79 below also be updated from sles_version to sle_version ?
Disclaimer: I don't know yet what is the difference between those but I noticed that it has changed here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I've updated it to sle_version. sles_version is the older macro.

BuildRequires: fdupes
%endif
Requires: glibc-devel
Requires: binutils

Requires: glibc >= 2.10.90

%define install_path %{OHPC_COMPILERS}/gcc/%{version}
%global install_path %{OHPC_COMPILERS}/gcc/%{version}
%global module_path %{OHPC_MODULES}/%{gnu_major_ver}

%description

Core package for the GNU Compiler Collection, including the C language
frontend.


%prep
%setup -q -n gcc-%{version} -a1 -a2 -a3

ln -s gmp-%{gmp_version} gmp
ln -s mpc-%{mpc_version} mpc
ln -s mpfr-%{mpfr_version} mpfr

%build

%{__mkdir} obj
%build
mkdir obj
cd obj
../configure --disable-multilib --enable-languages="c,c++,fortran" --prefix=%{install_path} --disable-static --enable-shared
../configure --disable-multilib \
--enable-languages="c,c++,fortran" \
--prefix=%{install_path} \
--disable-static \
--enable-shared
make %{?_smp_mflags}


%install
cd obj
make %{?_smp_mflags} DESTDIR=$RPM_BUILD_ROOT install

%if 0%{?sles_version} || 0%{?suse_version}
%if 0%{?sle_version} || 0%{?suse_version}
%fdupes -s $RPM_BUILD_ROOT/%{install_path}/include
%fdupes -s $RPM_BUILD_ROOT/%{install_path}/lib
%fdupes -s $RPM_BUILD_ROOT/%{install_path}/install-tools
%fdupes -s $RPM_BUILD_ROOT/%{install_path}/share
%endif

mkdir -p ${RPM_BUILD_ROOT}/%{_docdir}

# Based on https://git.centos.org/rpms/gcc/blob/c8/f/SPECS/gcc.spec
ln -sf gcc %{buildroot}%{install_path}/bin/cc
ln -sf gfortran %{buildroot}%{install_path}/bin/f95
Expand All @@ -92,7 +96,7 @@ for opt; do
case "$opt" in
-ansi|-std=c89|-std=iso9899:1990) fl="";;
-std=*) echo "`basename $0` called with non ANSI/ISO C option $opt" >&2
exit 1;;
exit 1;;
esac
done
exec gcc $fl ${1+"$@"}
Expand All @@ -104,69 +108,55 @@ for opt; do
case "$opt" in
-std=c99|-std=iso9899:1999) fl="";;
-std=*) echo "`basename $0` called with non ISO C99 option $opt" >&2
exit 1;;
exit 1;;
esac
done
exec gcc $fl ${1+"$@"}
EOF
chmod 755 %{buildroot}%{install_path}/bin/c?9

# OpenHPC module file
%{__mkdir_p} %{buildroot}/%{OHPC_MODULES}/gnu%{gnu_major_ver}
%{__cat} << EOF > %{buildroot}/%{OHPC_MODULES}/gnu%{gnu_major_ver}/%{version}
#%Module1.0#####################################################################
# OpenHPC module files
mkdir -p %{buildroot}%{module_path}

proc ModulesHelp { } {
cat << EOF > %{buildroot}%{module_path}/%{version}.lua
help([[
This module loads the GNU compiler collection"

puts stderr " "
puts stderr "This module loads the GNU compiler collection"
puts stderr " "
puts stderr "See the man pages for gcc, g++, and gfortran for detailed information"
puts stderr "on available compiler options and command-line syntax."
puts stderr " "
See the man pages for gcc, g++, and gfortran for detailed information
on available compiler options and command-line syntax.

puts stderr "\nVersion %{version}\n"
Version %{version}
]])

}
module-whatis "Name: GNU Compiler Collection"
module-whatis "Version: %{version}"
module-whatis "Category: compiler, runtime support"
module-whatis "Description: GNU Compiler Family (C/C++/Fortran for x86_64)"
module-whatis "URL: http://gcc.gnu.org/"
whatis("Name: GNU Compiler Collection")
whatis("Version: %{version}")
whatis("Category: compiler, runtime support")
whatis("Description: GNU Compiler Family (C/C++/Fortran for x86_64)")
whatis("URL: http://gcc.gnu.org/")

set version %{version}
local version = "%{version}"

prepend-path PATH %{install_path}/bin
prepend-path MANPATH %{install_path}/share/man
prepend-path INCLUDE %{install_path}/include
prepend-path LD_LIBRARY_PATH %{install_path}/lib64
prepend-path MODULEPATH %{OHPC_MODULEDEPS}/gnu%{gnu_major_ver}
prepend_path("PATH", "%{install_path}/bin")
prepend_path("MANPATH", "%{install_path}/share/man")
prepend_path("INCLUDE", "%{install_path}/include")
prepend_path("LD_LIBRARY_PATH", "%{install_path}/lib64")
prepend_path("MODULEPATH", "%{OHPC_MODULEDEPS}/%{gnu_major_ver}")

family "compiler"
family("compiler")
EOF

%{__cat} << EOF > %{buildroot}/%{OHPC_MODULES}/gnu%{gnu_major_ver}/.version.%{version}
#%Module1.0#####################################################################
##
## version file for %{pname}-%{version}
##
set ModulesVersion "%{version}"
EOF
ln -s %{version}.lua %{buildroot}%{module_path}/default

%{__mkdir_p} ${RPM_BUILD_ROOT}/%{_docdir}

%files
%{OHPC_MODULES}/gnu%{gnu_major_ver}/
%{module_path}
%dir %{OHPC_COMPILERS}/gcc
%{install_path}
%doc COPYING
%doc COPYING3
%doc COPYING3.LIB
%license COPYING
%license COPYING.LIB
%license COPYING.RUNTIME
%license COPYING3
%license COPYING3.LIB
%doc README
%doc ChangeLog.tree-ssa
%doc ChangeLog
%doc COPYING.LIB
%doc COPYING.RUNTIME
%if "%{compiler_family}" != "gnu7"
%doc NEWS
%endif
2 changes: 1 addition & 1 deletion tests/common/TEST_ENV.in
Expand Up @@ -8,7 +8,7 @@ PYTHON_FAMILIES="@PYTHON_FAMILIES@"
BEEGFS_TEST_PATH="/mnt/beegfs"
LUSTRE_TEST_PATH="/mnt/lustre/ohpc-test"
NUM_COMPUTES=2
GCC_DEFAULT="gnu9"
GCC_DEFAULT="gnu12"
export BATS_USE_MKTEMP=1
export OMPI_MCA_rmaps_base_oversubscribe=1
#
Expand Down
15 changes: 1 addition & 14 deletions tests/common/functions
Expand Up @@ -45,11 +45,6 @@ check_exe() {
# export python family variables
get_python_vars() {
local __python_family=$1
if [ "x$__python_family" == "xpython2" ]; then
export _python=python
export python_module_prefix=py2
export python_package_prefix=python
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is Python2 no more needed/supported ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Python2 is no longer available in the latest SUSE 15 and deprecated in RHEL 8. Good time to drop it.

fi
if [ "x$__python_family" == "xpython3" ]; then
export _python=python3
export python_module_prefix=py3
Expand Down Expand Up @@ -158,11 +153,7 @@ check_compiler_family()
myCC=gcc
myCXX=g++
myFC=gfortran
elif [ $LMOD_FAMILY_COMPILER == "gnu7" ];then
myCC=gcc
myCXX=g++
myFC=gfortran
elif [ $LMOD_FAMILY_COMPILER == "gnu8" ];then
elif [ $LMOD_FAMILY_COMPILER == "gnu12" ];then
myCC=gcc
myCXX=g++
myFC=gfortran
Expand All @@ -174,10 +165,6 @@ check_compiler_family()
myCC=clang
myCXX=clang++
myFC=gfortran
elif [[ $LMOD_FAMILY_COMPILER == "llvm5" ]];then
myCC=clang
myCXX=clang++
myFC=flang
else
ERROR "Unknown compiler family"
exit 1
Expand Down
4 changes: 2 additions & 2 deletions tests/configure.ac
Expand Up @@ -58,12 +58,12 @@ AC_ARG_ENABLE([psxe],
# Default MPI families to test
if test x$enable_psxe = xyes ;then
AC_MSG_RESULT([yes])
AC_SUBST(COMPILER_FAMILIES,["gnu9 intel"])
AC_SUBST(COMPILER_FAMILIES,["gnu12 intel"])
AC_SUBST(MPI_FAMILIES,["mpich mvapich2 openmpi4 impi"])
AC_SUBST(PYTHON_FAMILIES,["python3"])
else
AC_MSG_RESULT([no])
AC_SUBST(COMPILER_FAMILIES,[gnu9])
AC_SUBST(COMPILER_FAMILIES,[gnu12])
AC_SUBST(MPI_FAMILIES,["mpich mvapich2 openmpi4"])
AC_SUBST(PYTHON_FAMILIES,["python3"])
fi
Expand Down
3 changes: 1 addition & 2 deletions tests/libs/gsl/configure.ac
Expand Up @@ -54,8 +54,7 @@ if test "$LMOD_FAMILY_COMPILER" = "intel"; then
fi

AM_CONDITIONAL(USE_GNU_COMPILER, test "$LMOD_FAMILY_COMPILER" = "gnu")
AM_CONDITIONAL(USE_GNU_COMPILER, test "$LMOD_FAMILY_COMPILER" = "gnu7")
AM_CONDITIONAL(USE_GNU_COMPILER, test "$LMOD_FAMILY_COMPILER" = "gnu8")
AM_CONDITIONAL(USE_GNU_COMPILER, test "$LMOD_FAMILY_COMPILER" = "gnu12")
AM_CONDITIONAL(USE_GNU_COMPILER, test "$LMOD_FAMILY_COMPILER" = "gnu9")
AM_COND_IF(USE_GNU_COMPILER, LDFLAGS="${LDFLAGS} -lm")

Expand Down
2 changes: 1 addition & 1 deletion tests/libs/opencoarrays/ohpc-tests/test_mpi_families
Expand Up @@ -15,7 +15,7 @@ export BATS_JUNIT_CLASS=OpenCoarrays

./bootstrap || exit 1

for compiler in gnu9 ; do
for compiler in gnu12 ; do
for mpi in $MPI_FAMILIES ; do

echo " "
Expand Down
4 changes: 2 additions & 2 deletions tests/m4/compiler_family.m4
Expand Up @@ -24,11 +24,11 @@ if test "x$LMOD_FAMILY_COMPILER" = "xgnu"; then
CXX=g++
FC=gfortran
AC_MSG_RESULT([gnu])
elif test "x$LMOD_FAMILY_COMPILER" = "xgnu8"; then
elif test "x$LMOD_FAMILY_COMPILER" = "xgnu12"; then
CC=gcc
CXX=g++
FC=gfortran
AC_MSG_RESULT([gnu8])
AC_MSG_RESULT([gnu12])
OHPC_BLAS="-L${OPENBLAS_LIB} -lopenblas"
elif test "x$LMOD_FAMILY_COMPILER" = "xgnu9"; then
CC=gcc
Expand Down
2 changes: 1 addition & 1 deletion tests/user-env/ompi_info
Expand Up @@ -11,7 +11,7 @@ source ./common/functions || exit 1
@test "[openmpi] check for no output to stderr with ompi_info" {

module purge
module load gnu9
module load gnu12
module load openmpi4

run which ompi_info
Expand Down