Skip to content

Instantly share code, notes, and snippets.

@thaddeusc1
Last active April 22, 2023 01:44
Show Gist options
  • Save thaddeusc1/06269849c196e92b5d1f5194b61419c0 to your computer and use it in GitHub Desktop.
Save thaddeusc1/06269849c196e92b5d1f5194b61419c0 to your computer and use it in GitHub Desktop.
Install and Benchmark Various Versions of srsRAN
#!/usr/bin/env bash
# Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# Configure storage for downloads...
# ----------------------------------
# ...in the temporary area of the file-system.
# - See also: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s18.html
readonly ORIGINAL_IFS="$IFS"
IFS='/'
SCRIPT_NAME=''
for i in $0
do
SCRIPT_NAME=$i
done
IFS="$ORIGINAL_IFS"
readonly DL_STORAGE=`mktemp --directory --tmpdir "${SCRIPT_NAME}-XXXXXXXXXX"`
chmod a+rx "$DL_STORAGE"
sudo apt update
# Install GCC 10 for benchmarking select versions of srsRAN.
sudo apt install --assume-yes curl build-essential gcc-10 g++-10
# Configure environment for multiple versions of GCC
sudo update-alternatives --remove-all cc
sudo update-alternatives --remove-all c++
sudo update-alternatives --remove-all gcc
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 75
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 # Default on Ubuntu 22.04 LTS
sudo update-alternatives --remove-all g++
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 75
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 100 # Default on Ubuntu 22.04 LTS
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 100
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 100
curl --location 'https://phoronix-test-suite.com/releases/repo/pts.debian/files/phoronix-test-suite_10.8.4_all.deb' --output "${DL_STORAGE}/pts.deb"
sudo apt install --assume-yes "${DL_STORAGE}/pts.deb"
sudo apt install --assume-yes php-bz2 php-sqlite3 php-curl # Install additional recommended packages for PTS
phoronix-test-suite install-dependencies srsran-1.0.1 srsran-1.1.0 srsran-1.2.0 srsran # latest `srsran` PTS profile is 2.0.0
sudo apt install --assume-yes libmbedtls-dev libzmq5 libsctp-dev # Install srsRAN dependencies that PTS misses
#!/usr/bin/env bash
# Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# Use the performance CPU governor for testing (will revert to default after reboot)
echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
# Use the default compile toolchain that shipped with the running Linux distro.
sudo update-alternatives --auto gcc
sudo update-alternatives --auto g++
phoronix-test-suite install srsran-1.1.0 srsran-1.2.0 srsran # Does _not_ re-build srsRAN if a specified test profile was previously installed.
#phoronix-test-suite force-install srsran-1.1.0 srsran-1.2.0 srsran # _Force_ a re-build of srsRAN if a specified test profile was previously installed.
phoronix-test-suite run srsran-1.1.0 srsran-1.2.0 srsran
#!/usr/bin/env bash
# Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# Use the performance CPU governor for testing (will revert to default after reboot)
echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
# Select versions of srsRAN do not support GCC 11 (or later);
# Switch default compiler to GCC 10.
sudo update-alternatives --set gcc /usr/bin/gcc-10
sudo update-alternatives --set g++ /usr/bin/g++-10
phoronix-test-suite install srsran-1.0.1 # Does _not_ re-build srsRAN if the test profile was previously installed.
#phoronix-test-suite force-install srsran-1.0.1 # _Force_ a re-build of srsRAN if the test profile was previously installed.
phoronix-test-suite run srsran-1.0.1
# Change GCC back to the distribution's default.
sudo update-alternatives --auto gcc
sudo update-alternatives --auto g++
@thaddeusc1
Copy link
Author

thaddeusc1 commented Apr 21, 2023

Quick start guide for Debian based Linux distributions:

sudo apt install curl unzip
mkdir "${HOME}/Downloads"
cd ~/Downloads
curl --location 'https://gist.github.com/thaddeusc1/06269849c196e92b5d1f5194b61419c0/archive/3921f1cc3c799e5933be7e41746dce1c99ab4978.zip' --remote-name
unzip -j ./3921f1cc3c799e5933be7e41746dce1c99ab4978.zip"*.sh"
chmod a+x ./01-setup-srsRAN-benchmarks.sh ./02-benchmark-srsRAN+default-gcc.sh ./03-benchmark-srsRAN+gcc10.sh

The shell scripts from this gist should now be in your Downloads folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment