install_likwid.sh 2.77 KB
Newer Older
Frank Winkler's avatar
Frank Winkler committed
1 2 3 4
#!/bin/bash

source ../pika_install.conf

5 6 7 8 9 10
install_path=$PIKA_INSTALL_PATH

if [ `id -u` -ne 0 ]; then
install_path=$PIKA_BUILD_PATH
fi

Frank Winkler's avatar
Frank Winkler committed
11 12 13 14 15 16 17
# set compiler
if [ -n "${PIKA_TARGET}" ] && [ ${PIKA_TARGET} == 'power' ]; then
  COMPILER=GCCPOWER
else
  COMPILER=GCC #GCCPOWER for IBM Power systems
fi

18 19
mkdir -p $install_path/../sources
cd $install_path/../sources
Frank Winkler's avatar
Frank Winkler committed
20

21 22
PYTHON_ROOT=$install_path/python/${PYTHON_VERSION}
LIKWID_INST_PATH=$install_path/likwid/${LIKWID_VERSION}
Frank Winkler's avatar
Frank Winkler committed
23 24 25 26 27 28 29 30 31

### Build Likwid

# download likwid, unpack and remove package
if [ $LIKWID_VERSION == '5.0.0' ] || [ $LIKWID_VERSION == '5.0.1' ]; then
  echo "Get Likwid version $VERSION"
  wget https://github.com/RRZE-HPC/likwid/archive/v${LIKWID_VERSION}.tar.gz
  tar xfz v${LIKWID_VERSION}.tar.gz
  rm -f v${LIKWID_VERSION}.tar.gz
32 33
elif [ $LIKWID_VERSION == 'git' ]; then
  git clone https://github.com/RRZE-HPC/likwid.git likwid-${LIKWID_VERSION}
Frank Winkler's avatar
Frank Winkler committed
34
else
35 36 37 38
  wget https://github.com/RRZE-HPC/likwid/archive/likwid-${LIKWID_VERSION}.tar.gz
  tar xfz likwid-${LIKWID_VERSION}.tar.gz
  rm -f likwid-${LIKWID_VERSION}.tar.gz
  mv likwid-likwid-${LIKWID_VERSION} likwid-${LIKWID_VERSION}
Frank Winkler's avatar
Frank Winkler committed
39 40 41 42 43 44
fi

# install Likwid
cd likwid-${LIKWID_VERSION}

# apply PIKA patch (set counters)
45
if [ $LIKWID_VERSION == '5.0.1' ] || [ $LIKWID_VERSION == 'git' ]; then
Frank Winkler's avatar
Frank Winkler committed
46
  patch -p0 < $PIKA_PATCHES/pika_likwid-5.0.0_src.patch
47 48 49 50 51 52
elif [ $LIKWID_VERSION == '4.3.4' ]; then
  wget https://github.com/RRZE-HPC/likwid/releases/download/4.3.4/likwid-4.3.4-perf.patch
  patch -p1 < likwid-4.3.4-perf.patch
  patch -p0 < $PIKA_PATCHES/prope_likwid-4.3.3_src.patch
elif [ $LIKWID_VERSION == '4.3.3' ]; then
  patch -p0 < $PIKA_PATCHES/prope_likwid-4.3.3_src.patch
Frank Winkler's avatar
Frank Winkler committed
53 54 55 56 57 58 59 60
else
  patch -p0 < $PIKA_PATCHES/pika_likwid-${LIKWID_VERSION}_src.patch
fi

if [ $LIKWID_VERSION == '5.0.1' ]; then
  cd bench/perl
  patch -p0 < $PIKA_PATCHES/likwid-5.0.1_power9.patch
  cd ../..
61 62 63 64
  
  cd src
  patch -p0 < $PIKA_PATCHES/likwid-5.0.1_fixmemleak.patch
  cd ..
Frank Winkler's avatar
Frank Winkler committed
65 66 67 68 69 70 71 72 73
fi

# backup default configuration
cp config.mk config.mk.backup

# set Likwid install path
sed -i "/^PREFIX .*/ s|.*|PREFIX = $LIKWID_INST_PATH|" config.mk

# set access mode
74 75
#sed -i "/^ACCESSMODE = .*/ s|.*|ACCESSMODE = direct|" config.mk
sed -i "/^ACCESSMODE = .*/ s|.*|ACCESSMODE = perf_event|" config.mk
Frank Winkler's avatar
Frank Winkler committed
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93

# do not build access daemon or frequency changer
sed -i "/^BUILDDAEMON = .*/ s|.*|BUILDDAEMON = false|" config.mk
sed -i "/^BUILDFREQ = .*/ s|.*|BUILDFREQ = false|" config.mk

# the default compiler is GCC, change to GCCPOWER for the power architecture
if [ $COMPILER == 'GCCPOWER' ]; then
  sed -i "/^COMPILER = .*/ s|.*|COMPILER = $COMPILER|" config.mk
fi

make -j4 -k
make install -k
cd ..

# softlinks to our directory that we can still modify those files
cd $LIKWID_INST_PATH/share/likwid
mv perfgroups perfgroups_backup
ln -s /sw/taurus/tools/pika/daemon/likwid/perfgroups