Rice University logo
 
Top blue bar image Kiran Thyagaraja
Brain Dump
 

Archive for the ‘Compiling and Linking’ Category

Compiling GCC 4.3.2 and MPICH2 1.1 on Blue Gene/P

Tuesday, April 29th, 2014

Compiling GCC 4.3.2 and MPICH2 1.1 for the Blue Gene/P

GCC 4.3.2

1. First install GMP and MPFR

GMP

wget ftp://ftp.gnu.org/gnu/gmp/gmp-6.0.0a.tar.bz2
tar xf gmp-6.0.0a.tar.bz2
cd gmp-6.0.0a
./configure CFLAGS="-O3" CC=powerpc-bgp-linux-gcc --prefix=/opt/apps/gcc/4.3.2/ --host=powerpc-bgp-linux --with-gmp=/opt/apps/gcc/4.3.2/

Note: While running “make”, several files are generated using newly compiled binaries. Since these binaries are cross-compiled, the build process fails, so you have to manually build this one binary and then generate the necessary file like so:

gcc -m32 -o gen-psqr gen-psqr.c
gen-psqr 32 0 >mpn/perfsqr.h
make install

MPFR

wget ftp://ftp.gnu.org/gnu/mpfr/mpfr-3.1.2.tar.bz2
tar xf mpfr-3.1.2.tar.bz2 
cd mpfr-3.1.2/
./configure CFLAGS="-O3" CC=powerpc-bgp-linux-gcc --prefix=/opt/apps/gcc/4.3.2/ --host=powerpc-bgp-linux --with-gmp=/opt/apps/gcc/4.3.2/
make install

* Add /opt/apps/gcc/4.3.2/lib into /etc/ld.so.conf.d/gcc.conf and run ldconfig. This is needed for the temp gcc to compile glibc in the toolchain.

cat /bgsys/drivers//ppcfloor/toolchain/README.toolchain.gomp 
cp /bgsys/drivers//ppcfloor/toolchain/buildGompToolChain.sh .
./buildGompToolChain.sh /bgsys/drivers/ppcfloor /home/kkt3863/src/gcc-4.3.2-toolchain /opt/apps/gcc/4.3.2 /opt/apps/gcc/4.3.2 /bgsys/linux/1.4.220110323/usr/src/linux/include

MPICH2 1.1

1. First fetch the dmcf source repo from ANL

git clone http://dcmf.anl-external.org/dcmf.git

2. cd dmcf/lib/mpich2

This directory contains the patches to mpich2 source directory

3. Fetch mpich2 1.1 (This version only) and untar

wget http://www.mcs.anl.gov/research/projects/mpich2staging/goodell/downloads/tarballs/1.1/mpich2-1.1.tar.gz
tar xf mpich2-1.1.tar.gz

3. Apply the patches from DMCF into MPICH2

zcat ~/src/dcmf/lib/mpich2/patch.gz | patch -p0 --force --directory=~/src/mpich2-1.1
zcat ~/src/dcmf/lib/mpich2/patch.gz | ~/src/dcmf/tools/patch-delete --directory=~/src/mpich2-1.1

4. The autoconf tool on BGP is old. So tar up the newly patched mpich2 directory and then run maint/updatefiles on Davinci
(On BGP)

tar cf mpich2-1.1.tar mpich2-1.1

(On davinci)

tar xf mpich2-1.1.tar
cd mpich2-1.1
./maint/updatefiles

Repackage the mpich2 directory and scp it back to BGP

cd src/mpich2-1.1
touch --no-create Makefile.in

5. In the mpich2-1.1 source directory mkdir a build directory and cd into it. Use the following configure line to configure the source

GCC="/opt/apps/gcc/4.3.2/gnu-linux/bin/powerpc-bgp-linux-gcc" \
CC="/opt/apps/gcc/4.3.2/gnu-linux/bin/powerpc-bgp-linux-gcc" \
CXX="/opt/apps/gcc/4.3.2/gnu-linux/bin/powerpc-bgp-linux-g++" \
F77="/opt/apps/gcc/4.3.2/gnu-linux/bin/powerpc-bgp-linux-gfortran -fno-underscoring" \
F90="/opt/apps/gcc/4.3.2/gnu-linux/bin/powerpc-bgp-linux-gfortran -fno-underscoring" \
AR="/opt/apps/gcc/4.3.2/gnu-linux/bin/powerpc-bgp-linux-ar" \
LD="/opt/apps/gcc/4.3.2/gnu-linux/bin/powerpc-bgp-linux-ld" \
MPICH2LIB_CFLAGS="-g -Wall -O3 -mcpu=450fp2 -mstrict-align -fno-strict-aliasing" \
MPICH2LIB_CXXFLAGS="-g -Wall -O3 -mcpu=450fp2 -mstrict-align -fno-strict-aliasing" \
MPICH2LIB_FFLAGS="-g -Wall -O3 -mcpu=450fp2 -mstrict-align -fno-strict-aliasing" \
MPICH2LIB_F90FLAGS="-g -Wall -O3 -mcpu=450fp2 -mstrict-align -fno-strict-aliasing" \
CFLAGS="-I/bgsys/drivers/ppcfloor/comm/sys/include" \
CXXFLAGS="-I/bgsys/drivers/ppcfloor/comm/sys/include" \
FFLAGS="-I/bgsys/drivers/ppcfloor/comm/sys/include" \
F90FLAGS="-I/bgsys/drivers/ppcfloor/comm/sys/include" \
LDFLAGS="" \
MPILIBNAME="mpich.cnk" \
MPICXXLIBNAME="cxxmpich.cnk" \
MSGLAYER_INCLUDE="-I/bgsys/drivers/ppcfloor/comm/sys/include" \
MSGLAYER_LIB="-L/bgsys/drivers/ppcfloor/comm/sys/lib -Wl,-rpath,/bgsys/drivers/ppcfloor/comm/sys/lib -ldcmf.cnk      -ldcmfcoll.cnk      -lpthread -L/bgsys/drivers/ppcfloor/runtime/SPI -Wl,-rpath,/bgsys/drivers/ppcfloor/runtime/SPI -lSPI.cna -lrt" \
../configure \
--enable-cache \
--prefix=/opt/apps/gcc/4.3.2/comm/default \
--mandir=/opt/apps/gcc/4.3.2/comm/default/man \
--htmldir=/opt/apps/gcc/4.3.2/comm/default/www \
--host=powerpc-bgp-linux \
--target=powerpc-bgp-linux \
--build=powerpc64-linux-gnu \
--enable-dependencies \
--enable-debuginfo \
--enable-g=none \
--enable-sharedlibs=gcc \
--with-device=dcmfd:BGP \
--enable-romio=yes \
--enable-f77=yes \
--enable-f90=yes \
--with-file-system=bgl+bglockless \
--enable-timer-type=device \
--enable-threads=multiple \
--with-fwrapname=fmpich.cnk \
--with-cross=../src/mpid/dcmfd/cross8 \
--with-mpe=no \
--enable-wrappers \
--disable-fast \
--enable-timing=no \
--disable-collchk \
--disable-graphics \
--disable-rlog \
--disable-sample \
--with-assert-level=2 \
--with-aint-size=8 \

make && make install

VOILA. You have a new MPICH installed in /opt/apps/gcc/4.3.2/comm/default

Compiling Quantum Espresson on Linux PPC64

Monday, January 23rd, 2012

1. Download; untar and configure

./configure FFT_LIBS="-L/opt/apps/fftw/3.2.2/lib -lfftw3f" BLAS_LIBS="-L/opt/apps/ibm/essl/5.1/lib64 -lessl" LAPACK_LIBS="-L/opt/apps/ibm/essl/5.1/lib64 -lessl -llapack" LIBDIRS="/opt/apps/fftw/3.2.2/lib /opt/apps/ibm/essl/5.1/lib64/" MPIF90=mpif90 CFLAGS="-O3 -q64" FC=mpif90 F77=mpif90 F90=mpif90 CC=mpicc FFLAGS="-q64" --enable-parallel

2. Edit make.sys and replace F90, F77, CC with xlf90_r, xlf_r and xlc_r respectively.
3. make all

Lapack on a GNU/Linux PPC64 System

Tuesday, June 15th, 2010

Building Lapack with IBM’s ESSL is a little tricky. First you have to download lapack and also the call conversion interface (cci) patch that takes care of renaming lapack routines that overlap with ESSL ones. Also generic BLAS has to be built to take care of few BLAS routines that ESSL doesn’t implement.

Use the following contents of the make.inc to build Lapack and Blas. Generic BLAS (libblas.a) should be built to take care of the few BLAS routines that ESSL doesn’t implement. Build the generic BLAS first by editing the setting the BLASLIB = ../../libblas.a and then revert to the original BLASLIB line to build liblapack_cci.

SHELL = /bin/sh
PLAT = _ppc64
FORTRAN  = xlf_r
OPTS     = -q64 -qtune=pwr7  -qsuppress=cmpmsg -qextname
DRVOPTS  = $(OPTS)
NOOPT    = -q64 -qtune=pwr7  -qsuppress=cmpmsg -qextname
LOADER   = xlf_r
LOADOPTS = -q64 -qtune=pwr7  -qsuppress=cmpmsg -qextname
TIMER    = INT_CPU_TIME
ARCH     = ar
ARCHFLAGS= cr
RANLIB   = ranlib
BLASLIB      = -L/opt/apps/ibm/essl/5.1/lib64 -lessl ../../libblas.a
#BLASLIB      = ../../libblas.a
XBLASLIB     =
LAPACKLIB    = lapack$(PLAT).a
TMGLIB       = tmglib$(PLAT).a
EIGSRCLIB    = eigsrc$(PLAT).a 
LINSRCLIB    = linsrc$(PLAT).a

To link Lapack with ESSL use the following line:

-L/path/to/essl -lessl -llapack_cci -lblas