Skip to content

Instantly share code, notes, and snippets.

@denizetkar
Forked from kparrish/atlas_install.sh
Last active December 4, 2021 12:33
Show Gist options
  • Save denizetkar/03d021724fbda28081cfab07b1f98e99 to your computer and use it in GitHub Desktop.
Save denizetkar/03d021724fbda28081cfab07b1f98e99 to your computer and use it in GitHub Desktop.
A bash script to install ATLAS on an Alpine linux machine. To install run the script: sudo bash atlas_install.sh. Note on newer linux machines will have to 1. Edit /etc/default/grub 2. Find line with: GRUB_CMDLINE_LINUX_DEFAULT 3. Append the following to args: intel_pstate=disable 4. Update grub: update-grub 5. Reboot; from http://math-atlas.sou…
#!/bin/bash
### ATLAS Ubuntu install
# Assign user name
if [[ -v SUDO_USER ]]; then
UserName=$SUDO_USER
echo sudo user name found: $SUDO_USER
else
read -p "Enter your user name: " UserName
fi
### MAIN ###
# Number of CPUs
CPUNum=$(nproc)
# Install required packages
apk update && apk upgrade
apk add --no-cache --upgrade build-base gfortran cpufrequtils
# Turn off CPU throttling
for (( i=0; i<$CPUNum; i++ ))
do
echo "cpufreq-set -c $i -g performance"
cpufreq-set -c $i -g performance
done
cd /home/${UserName}/Downloads
atlas_file="atlas3.10.3.tar.bz2"
# Check/remove $atlas_file
if [ -f /home/${UserName}/Downloads/$atlas_file ]
then
rm /home/${UserName}/Downloads/$atlas_file
fi
lapack_file="lapack-3.10.0.tar.gz"
# Check/remove $lapack_file
if [ -f /home/${UserName}/Downloads/$lapack_file ]
then
rm /home/${UserName}/Downloads/$lapack_file
fi
# Download $atlas_file
sudo -u $UserName wget https://downloads.sourceforge.net/project/math-atlas/Stable/3.10.3/atlas3.10.3.tar.bz2 -O $atlas_file
# Download $lapack_file
sudo -u $UserName wget https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v3.10.0.tar.gz -O $lapack_file
# Extract $atlas_file
sudo -u $UserName tar xjf /home/${UserName}/Downloads/$atlas_file
# Compile and Install
cd ATLAS
sudo -u $UserName mkdir obj64
cd obj64
sudo -u $UserName mkdir /home/${UserName}/Downloads/atlasComp
sudo -u $UserName ../configure -b 64 -D c -DPentiumCPS=3400 --shared --prefix=/home/${UserName}/Downloads/atlasComp --with-netlib-lapack-tarfile=/home/${UserName}/Downloads/$lapack_file
sudo -u $UserName make
sudo -u $UserName make check
sudo -u $UserName make ptcheck
sudo -u $UserName make time
sudo -u $UserName make install
cd /home/${UserName}
# Move files
mkdir /usr/local/include/atlas
cp -r /home/${UserName}/Downloads/atlasComp/include/atlas/* /usr/local/include/atlas/
cp -r /home/${UserName}/Downloads/atlasComp/include/cblas.h /usr/local/include/atlas/
cp -r /home/${UserName}/Downloads/atlasComp/include/clapack.h /usr/local/include/atlas/
cp -r /home/${UserName}/Downloads/atlasComp/lib/* /usr/local/lib/
# Cleanup
rm /home/${UserName}/Downloads/$atlas_file
rm /home/${UserName}/Downloads/$lapack_file
rm -r /home/${UserName}/Downloads/ATLAS
rm -r /home/${UserName}/Downloads/atlasComp
echo "ATLAS Install Complete"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment