Skip to content

Commit

Permalink
Merge pull request #13 from voduchuy/improve_docker
Browse files Browse the repository at this point in the history
Improve docker
  • Loading branch information
voduchuy authored Aug 14, 2021
2 parents 65f0388 + 971c789 commit c6b9b7c
Show file tree
Hide file tree
Showing 25 changed files with 112 additions and 348 deletions.
17 changes: 11 additions & 6 deletions docker/arm/Dockerfile → docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
FROM ubuntu:latest
MAINTAINER Huy Duc Vo

ARG pacmensl_version=0.1.0

RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections

RUN apt-get update && \
Expand All @@ -9,7 +11,8 @@ RUN apt-get update && \
RUN apt-get -y install dialog apt-utils

# set environment variables
ENV USERNAME huy
ENV USERNAME user
ENV PACMENSL_VERSION $pacmensl_version

RUN adduser --disabled-password --gecos --create-home ${USERNAME}
RUN adduser ${USERNAME} sudo
Expand Down Expand Up @@ -41,7 +44,6 @@ ENV PACKAGES="\

RUN sudo apt-get install -y ${PACKAGES} && sudo apt-get clean


RUN sudo echo "export LD_LIBRARY_PATH=/usr/local/lib" >> /home/${USERNAME}/.bashrc && \
mkdir /home/${USERNAME}/software && \
mkdir /home/${USERNAME}/software/src && \
Expand All @@ -59,7 +61,6 @@ RUN sudo chmod +x ./install_cmake.sh && ./install_cmake.sh
COPY install_scripts/install_metis.sh ./
RUN sudo chmod +x ./install_metis.sh && ./install_metis.sh


# install Zoltan
COPY install_scripts/install_zoltan.sh ./
RUN sudo chmod +x ./install_zoltan.sh && ./install_zoltan.sh
Expand All @@ -69,14 +70,13 @@ COPY install_scripts/install_arma.sh ./
RUN sudo chmod +x ./install_arma.sh && ./install_arma.sh

# install anaconda
COPY install_scripts/install_conda_arm.sh ./
COPY install_scripts/install_conda.sh ./
ENV PATH /home/${USERNAME}/anaconda/bin:${PATH}
RUN sudo chmod +x ./install_conda_arm.sh && ./install_conda_arm.sh \
RUN sudo chmod +x ./install_conda.sh && ./install_conda.sh \
&& \
conda update conda && \
conda init bash


# install petsc
COPY install_scripts/install_petsc.sh ./
RUN sudo chmod +x ./install_petsc.sh && ./install_petsc.sh
Expand All @@ -95,3 +95,8 @@ RUN sudo chmod +x ./install_pacmensl.sh && ./install_pacmensl.sh

# Set OMPI environment variable to prevent spurious printing, see issue 4948 openmpi github page
ENV OMPI_MCA_btl_vader_single_copy_mechanism=none

# Cleanup
RUN sudo rm *.sh && \
sudo rm -rf /home/${USERNAME}/software/build && \
sudo rm -rf /home/${USERNAME}/software/src
17 changes: 0 additions & 17 deletions docker/arm/install_scripts/install_arma.sh

This file was deleted.

11 changes: 0 additions & 11 deletions docker/arm/install_scripts/install_cmake.sh

This file was deleted.

10 changes: 0 additions & 10 deletions docker/arm/install_scripts/install_conda_arm.sh

This file was deleted.

24 changes: 0 additions & 24 deletions docker/arm/install_scripts/install_mpi.sh

This file was deleted.

13 changes: 0 additions & 13 deletions docker/arm/install_scripts/install_pacmensl.sh

This file was deleted.

23 changes: 0 additions & 23 deletions docker/arm/install_scripts/install_petsc.sh

This file was deleted.

24 changes: 0 additions & 24 deletions docker/arm/install_scripts/install_sundials.sh

This file was deleted.

25 changes: 0 additions & 25 deletions docker/arm/install_scripts/install_zoltan.sh

This file was deleted.

4 changes: 4 additions & 0 deletions docker/build_docker_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PACMENSL_VERSION=0.1.0
ARCH=$(uname -m)

docker build -t pacmensl:v${PACMENSL_VERSION}_${ARCH} --build-arg pacmensl_version=$PACMENSL_VERSION .
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ rm *.xz
cd ../build
mkdir arma
cd arma
cmake -DCMAKE_INSTALL_PREFIX=/home/${user}/software/install ../../src/arma
cmake -DCMAKE_INSTALL_PREFIX=/home/${user}/software/install -DBUILD_SHARED_LIBS=OFF ../../src/arma
make -j4
make install

# Cleanup
rm -rf /home/${user}/software/src/arma


Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ tar -zxvf cmake-3.20.0.tar.gz
cd cmake-3.20.0
cmake .
make -j4
sudo make install
sudo make install

# Cleanup
rm -rf /home/${user}/software/src/cmake-3.20.0
17 changes: 17 additions & 0 deletions docker/install_scripts/install_conda.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
user=${USERNAME}

arch=$(uname -m)

if [ "$arch" = "arm64" ] || [ "$arch" = "aarch64" ]; then
conda_link="https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-aarch64.sh"
else
conda_link="https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh"
fi

cd /home/${user}/software/src
wget ${conda_link} -O conda.sh

sudo chmod u+x ./conda.sh
bash ./conda.sh -b -p /home/${user}/anaconda
rm ./conda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ make config prefix=/home/${user}/software/install shared=1
make -j4
make install

# Cleanup
rm -rf /home/${user}/software/src/*metis*



4 changes: 4 additions & 0 deletions docker/install_scripts/install_mpi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

sudo apt-get install -y libopenmpi-dev openmpi-bin openmpi-common

20 changes: 20 additions & 0 deletions docker/install_scripts/install_pacmensl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
user=${USERNAME}

export CPATH=${CPATH};/home/${user}/software/install/include

cd /home/${user}/software/src
wget https://github.com/voduchuy/pacmensl/archive/refs/tags/v${PACMENSL_VERSION}.tar.gz -O pacmensl.tar.gz
tar -xf pacmensl.tar.gz
rm *.tar.gz
mv pacmensl* pacmensl

cd /home/${user}/software/build
mkdir pacmensl
cd pacmensl

cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCMAKE_POSITION_INDPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=/home/${user}/software/install /home/${user}/software/src/pacmensl
make -j4

# Now install
make install
32 changes: 32 additions & 0 deletions docker/install_scripts/install_petsc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

user=${USERNAME}

cd /home/${user}/software/src

wget https://gitlab.com/petsc/petsc/-/archive/v3.13.6/petsc-v3.13.6.tar.gz -O petsc.tar.gz
tar -xvf petsc.tar.gz
rm petsc.tar.gz
mv petsc* petsc

cd petsc

arch=$(uname -m)

if [ "$arch" = "arm64" ] || [ "$arch" = "aarch64" ]; then
export PETSC_DIR=`pwd`; unset PETSC_ARCH; ./configure PETSC_ARCH=linux-c-opt --with-precision=double --with-scalar-type=real --with-debugging=0 COPTFLAGS=-O3 CXXOPTFLAGS=-O3 --with-fc=0 --with-shared-libraries=1 --prefix=/home/${user}/software/install/petsc
else
export PETSC_DIR=`pwd`; unset PETSC_ARCH; ./configure PETSC_ARCH=linux-c-opt --with-precision=double --with-scalar-type=real --with-debugging=0 COPTFLAGS=-O3 CXXOPTFLAGS=-O3 --with-fc=0 --with-shared-libraries=1 --with-avx512-kernels 1 --prefix=/home/${user}/software/install/petsc
fi

make -j4 PETSC_DIR=/home/${user}/software/src/petsc PETSC_ARCH=linux-c-opt all
make PETSC_DIR=/home/${user}/software/src/petsc PETSC_ARCH=linux-c-opt install

# add petsc to environment variables
echo "export PETSC_DIR=/home/${user}/software/install/petsc" >> /home/${user}/.bashrc
echo "export PETSC_ARCH=linux-c-opt" >> /home/${user}/.bashrc
echo "export LD_LIBRARY_PATH=/home/${user}/software/install/petsc/lib:/usr/local/lib:/home/${user}/software/install/lib:${LD_LIBRARY_PATH}" >> /home/${user}/.bashrc
echo "export LIBRARY_PATH=home/${user}/software/install/petsc/lib:/usr/local/lib:/home/${user}/software/install/lib:${LIBRARY_PATH}" >> /home/${user}/.bashrc

# cleanup
rm -rf /home/${user}/software/src/petsc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ cd sundials
echo ${PETSC_DIR}

cmake -DCMAKE_INSTALL_PREFIX=/home/${user}/software/install -DPETSC_ENABLE=ON -DMPI_ENABLE=ON -DPETSC_LIBRARIES=${PETSC_DIR}/lib/libpetsc.so -DPETSC_INCLUDES=${PETSC_DIR}/include \
-DSUNDIALS_INDEX_SIZE=32 /home/${user}/software/src/sundials
-DSUNDIALS_INDEX_SIZE=32 -DBUILD_SHARED_LIBS=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON /home/${user}/software/src/sundials
make -j4
make install

# Cleanup
rm -rf /home/${user}/software/src/sundials
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
#!/bin/bash
user=${USERNAME}


trilinos_link=https://github.com/trilinos/Trilinos/archive/refs/tags/trilinos-release-13-0-1.tar.gz

cd /home/${user}/software/src
git clone https://github.com/trilinos/Trilinos.git --depth 1 --branch master --single-branch
wget ${trilinos_link} -O trilinos.tar.gz
tar -xf trilinos.tar.gz
rm trilinos.tar.gz
mv Trilinos* Trilinos

cd ../build
mkdir zoltan
cd zoltan
cmake \
-DCMAKE_INSTALL_PREFIX=/home/${user}/software/install \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DTPL_ENABLE_MPI=ON \
-DTrilinos_ENABLE_Zoltan=ON \
-DBUILD_SHARED_LIBS=ON \
Expand All @@ -21,5 +26,8 @@ cmake \
make -j4
make install

# Cleanup
rm -rf /home/${user}/software/src/Trilinos



Loading

0 comments on commit c6b9b7c

Please sign in to comment.