incorrect AMD math library link order
Max R. Dechantsreiter
max at performancejones.com
Mon Mar 11 10:37:21 CDT 2024
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/parallel-netcdf/attachments/20240311/e278d580/attachment.html>
-------------- next part --------------
# -------------------------------------------------------
# Build PnetCDF using OpenMPI 5.0.2 built with AOCC 4.2.0
# -------------------------------------------------------
#
# https://parallel-netcdf.github.io/
# https://parallel-netcdf.github.io/wiki/Download.html
#
# [Times below are for building on Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz]
# Start time
SECONDS=0
PROJECT=$HOME/AOCC
# -------------------------------
# Set environment for build tools
# -------------------------------
# AOCC
AOCC_VERSION=4.2.0 # 2024-02-27
AOCC=aocc-$AOCC_VERSION
PROJECT_AOCC=$PROJECT/opt/amd/aocc/$AOCC_VERSION
source $PROJECT_AOCC/bin/setenv_AOCC.sh
# AOCL
AOCL_VERSION=$AOCC_VERSION
PROJECT_AOCL=$PROJECT/opt/amd/aocl/$AOCL_VERSION/aocc
source $PROJECT_AOCL/amd-libs.cfg
# Facilitate use of AMD libm
export LD_LIBRARY_PATH=$PROJECT_AOCC/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
# AND link with '-lamdlibm -lm' instead of '-lm'
# OpenMPI
OMPI_VERSION=5.0.2 # 2024-02-06
OMPI=openmpi-${OMPI_VERSION}_$AOCC
HWLOC_VERSION=2.10.0 # 2023-12-04
HWLOC=hwloc-${HWLOC_VERSION}_$AOCC
PROJECT_OMPI=$PROJECT/opt/amd/ompi
CPATH=$PROJECT_OMPI/$HWLOC/include${CPATH:+:$CPATH}
PATH=$PROJECT_OMPI/$HWLOC/bin${PATH:+:$PATH}
LD_LIBRARY_PATH=$PROJECT_OMPI/$HWLOC/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
CPATH=$PROJECT_OMPI/$OMPI/include${CPATH:+:$CPATH}
PATH=$PROJECT_OMPI/$OMPI/bin${PATH:+:$PATH}
LD_LIBRARY_PATH=$PROJECT_OMPI/$OMPI/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
export CPATH PATH LD_LIBRARY_PATH
export HWLOC_ALLOW=all # VPS workaround
# Set environment for other build tools
#MAKE=gmake
MAKE=make # Linux make is gmake
export MAKEFLAGS="V=1 -j1"
# Check build tools
clang --version | grep AMD
gcc --version | grep gcc
ompi_info | grep "Open MPI:"
make --version | grep Make
# Build PnetCDF
PNETCDF_VERSION=1.13.0.rc1
PNETCDF=pnetcdf-$PNETCDF_VERSION
ARCHIVE=$PROJECT/Archive
BUILD=$PROJECT/Build
LIB=$PROJECT/opt/amd/lib
mkdir -p $ARCHIVE $BUILD $LIB
# Set installation directory
PREFIX=$LIB/$PNETCDF
# Download source
cd $ARCHIVE
PNETCDF_TAR_GZ=$PNETCDF.tar.gz
if [ ! -f "$PNETCDF_TAR_GZ" ]; then
#wget https://parallel-netcdf.github.io/Release/$PNETCDF_TAR_GZ
wget https://github.com/Parallel-NetCDF/Parallel-NetCDF.github.io/raw/master/Release/$PNETCDF_TAR_GZ
fi
cd $BUILD
tar xzf $ARCHIVE/$PNETCDF_TAR_GZ
cd $BUILD/$PNETCDF
# Build PnetCDF
export CPP='clang -E'
export CXXCPP='clang++ -E'
#
export MPICC=mpicc
export MPICXX=mpicxx
export MPIF77=mpifort
export MPIF90=mpif90
#
ARCH='-march=broadwell -mtune=broadwell'
#
#FLAGS="$ARCH -O3 -ip -no-prec-div -static-intel" # recommended by Intel (ICC)
FLAGS="$ARCH -O3 -freciprocal-math"
FLAGS="$FLAGS -fPIC" # required by NetCDF4 build
#
export CFLAGS=$FLAGS
export CXXFLAGS=$FLAGS
export FCFLAGS=$FLAGS
export FFLAGS=$FLAGS
export LDFLAGS=$FLAGS
#
export LIBS='-lamdlibm'
#
time ./configure --prefix=$PREFIX \
--enable-fortran --enable-cxx --enable-mpi-io-test \
>& configure.log # ~42s
time make >& make.log # ~5m18s
make install >& make_install.log
#
# (Result is $PREFIX/lib/libpnetcdf.a - no shared library)
More information about the parallel-netcdf
mailing list