Toolchain: Add Tensorflow as an optional requirement

This commit is contained in:
Ole Schütt 2021-08-11 14:00:23 +02:00 committed by Ole Schütt
parent 734046d1e0
commit e489c1dbd3
3 changed files with 41 additions and 3 deletions

View file

@ -11,11 +11,15 @@ ARG BASE_IMAGE
USER root
# install Linux packages.
# Install Linux packages.
COPY ./install_requirements*.sh ./
RUN ./install_requirements.sh ${BASE_IMAGE}
# copy helper scripts
# Install Tensorflow.
COPY ./install_tensorflow.sh ./
RUN ./install_tensorflow.sh ${BASE_IMAGE}
# Copy helper scripts.
WORKDIR /opt/cp2k-toolchain
RUN mkdir scripts
COPY ./scripts/VERSION \

View file

@ -9,10 +9,14 @@ FROM nvidia/cuda:11.3.1-devel-ubuntu20.04
ENV CUDA_PATH /usr/local/cuda
ENV LD_LIBRARY_PATH /usr/local/cuda/lib64
# install Ubuntu packages.
# Install Ubuntu packages.
COPY ./install_requirements_ubuntu.sh .
RUN ./install_requirements_ubuntu.sh
# Install Tensorflow.
COPY ./install_tensorflow.sh ./
RUN ./install_tensorflow.sh ubuntu
# Install some more Ubuntu packages.
RUN apt-get update -qq && apt-get install -qq --no-install-recommends \
gfortran \

View file

@ -0,0 +1,30 @@
#!/bin/bash -e
# author: Ole Schuett
if (($# != 1)); then
echo "Usage: install_tensorflow.sh <BASE_IMAGE>"
exit 1
fi
BASE_IMAGE=$1
echo "Installing Tensorflow..."
if [[ ${BASE_IMAGE} == ubuntu* ]]; then
apt-get update -qq
apt-get install -qq --no-install-recommends python3-pip
rm -rf /var/lib/apt/lists/*
pip install --quiet tensorflow
elif [[ ${BASE_IMAGE} == fedora* ]]; then
dnf -qy install python3-pip
dnf clean -q all
pip install --quiet tensorflow
else
echo "Unknown base image: ${BASE_IMAGE}"
exit 1
fi
#EOF