<commit_before><commit_msg>tensorflow draft install<commit_after>#! /bin/sh
#
# PLEASE DO NOT EDIT IT DIRECTLY ON cloudmesh.github.io
#
# Instead if modifications are needed modify it here  
#
# * https://github.com/cloudmesh/get/blob/main/pi/tensorflow/2.5.0/index.html
#
# Using python3
#
#   curl -Ls http://cloudmesh.github.io/get/pi/tensorflow/2.5.0 | sh
#
# development: curl -Ls https://raw.githubusercontent.com/cloudmesh/get/main/pi/tensorflow/2.5.0/index.html | sh -
#
# adapted from: https://qengineering.eu/install-ubuntu-20.04-on-raspberry-pi-4.html
#
# <pre>

start_total=`date +%s`

NORMAL='\033[0m'
RED='\033[0;31m'


if [ -z "$VERSION" ]
then
    VERSION='3'
    PYTHON="python3"
    PIP="pip3"
else
    PYTHON="python${VERSION%.*}"
    PIP="pip{VERSION%.*}"
fi

AddToBashrc(){
grep -qF -- "${1}" ~/.bashrc || echo "${1}" >> "${HOME}/.bashrc"
}

Echo() {
 echo "${RED}${1}${NORMAL}"
}

Echo "#################################################"
Echo "# Raspbery Pi Cloudmesh Cluster Installation     #"
Echo "#################################################"
echo
echo "Aproximate instalation time: 4-7 minutes"
echo
echo "Using Python ${VERSION}"
echo "Expecting it to be accessible via $PYTHON"
echo
Echo "# -----------------------------------------------"
Echo "# Update the system"
Echo "# -----------------------------------------------"

start_update=`date +%s`
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y nmap
sudo apt-get install -y libatlas-base-dev
sudo apt-get install -y pv
sudo apt-get install -y libjpeg-dev
sudo apt-get install -y git
sudo apt-get install -y libopenjp2-7
sudo apt-get install -y libtiff5
sudo apt-get install -y wget curl
sudo apt-get install -y python-pip python3-pip
sudo pip uninstall tensorflow
sudo pip3 uninstall tensorflow
# install the dependencies (if not already onboard)
sudo apt-get install -y gfortran
sudo apt-get install -y libhdf5-dev libc-ares-dev libeigen3-dev
sudo apt-get install -y libatlas-base-dev libopenblas-dev libblas-dev
sudo apt-get install -y liblapack-dev
upgrade setuptools 47.1.1 -> 57.0.0
sudo -H pip3 install --upgrade setuptools
# utmost important: use only numpy version 1.19.5
sudo -H pip3 install numpy==1.19.5
sudo -H pip3 install pybind11
sudo -H pip3 install Cython
# install h5py with Cython version 0.29.23 (± 6 min @1950 MHz)
sudo -H pip3 install h5py==3.1.0
sudo -H pip3 install --upgrade wrapt
sudo -H pip3 install gast==0.4.0
sudo -H pip3 install absl-py astunparse
sudo -H pip3 install flatbuffers google_pasta
sudo -H pip3 install keras_preprocessing --no-deps
sudo -H pip3 install opt_einsum protobuf
sudo -H pip3 install six termcolor wheel
sudo -H pip3 install typing_extensions
# install gdown to download from Google drive
pip3 install gdown
# download the wheel
gdown https://drive.google.com/uc?id=1I1H2xMs4BTm-UQhBPuLgqnLgmE0ATRl5
# install TensorFlow 2.5.0 (± 108 min @1950 MHz)
sudo -H pip3 install tensorflow-2.5.0-cp38-cp38-linux_aarch64.whl
# remove old versions (if found)
sudo rm -r /usr/local/lib/libtensorflow*
sudo rm -r /usr/local/include/tensorflow
# the dependencies
sudo apt-get install -y wget curl libhdf5-dev libc-ares-dev libeigen3-dev
sudo apt-get install -y libatomic1 libatlas-base-dev zip unzip
# install gdown to download from Google drive (if not already done)
# download the tarball
gdown https://drive.google.com/uc?id=1uZ-WZakMQkN1ESf3mXuwcr7mbE0QZhIHK
# unpack the ball
sudo tar -C /usr/local -xzf libtensorflow_cp38_64OS_2_5_0.tar.gz
end_update=`date +%s`

echo
Echo "# -----------------------------------------------"
Echo "# Install tensorflow"
Echo "# -----------------------------------------------"

start_tensorflow=`date +%s`

end_tensorflow=`date +%s`

cd ${HOME}


Echo "#################################################"
Echo "# Install Completed                             #"
Echo "#################################################"
echo
end_total=`date +%s`
time_update=$((end_update-start_update))
time_total=$((end_total-start_total))
time_venv=$((end_venv-start_venv))
time_tensorflow=$((end_tensorflow-start_tensorflow))
echo
echo
echo "Time to update and upgarde: ${time_update} s"
echo "Time to install tensorflow:  ${time_tensorflow} s"
echo
echo "Time for total install:     ${time_total} s"
echo
echo "Time to install: ${time_total} s"
echo
Echo "#################################################"

exit 0

# </pre>

{'fraction_non_alphanumeric': 0.20892125625853436, 'fraction_numerical': 0.030040964952207556, 'mean_word_length': 3.5638629283489096, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5276698', 'n_tokens_mistral': 1595, 'n_tokens_neox': 1474, 'n_words': 434}