Skip to content

Commit c6b9b7c

Browse files
authored
Merge pull request #13 from voduchuy/improve_docker
Improve docker
2 parents 65f0388 + 971c789 commit c6b9b7c

25 files changed

+112
-348
lines changed

docker/arm/Dockerfile renamed to docker/Dockerfile

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
FROM ubuntu:latest
22
MAINTAINER Huy Duc Vo
33

4+
ARG pacmensl_version=0.1.0
5+
46
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
57

68
RUN apt-get update && \
@@ -9,7 +11,8 @@ RUN apt-get update && \
911
RUN apt-get -y install dialog apt-utils
1012

1113
# set environment variables
12-
ENV USERNAME huy
14+
ENV USERNAME user
15+
ENV PACMENSL_VERSION $pacmensl_version
1316

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

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

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

62-
6364
# install Zoltan
6465
COPY install_scripts/install_zoltan.sh ./
6566
RUN sudo chmod +x ./install_zoltan.sh && ./install_zoltan.sh
@@ -69,14 +70,13 @@ COPY install_scripts/install_arma.sh ./
6970
RUN sudo chmod +x ./install_arma.sh && ./install_arma.sh
7071

7172
# install anaconda
72-
COPY install_scripts/install_conda_arm.sh ./
73+
COPY install_scripts/install_conda.sh ./
7374
ENV PATH /home/${USERNAME}/anaconda/bin:${PATH}
74-
RUN sudo chmod +x ./install_conda_arm.sh && ./install_conda_arm.sh \
75+
RUN sudo chmod +x ./install_conda.sh && ./install_conda.sh \
7576
&& \
7677
conda update conda && \
7778
conda init bash
7879

79-
8080
# install petsc
8181
COPY install_scripts/install_petsc.sh ./
8282
RUN sudo chmod +x ./install_petsc.sh && ./install_petsc.sh
@@ -95,3 +95,8 @@ RUN sudo chmod +x ./install_pacmensl.sh && ./install_pacmensl.sh
9595

9696
# Set OMPI environment variable to prevent spurious printing, see issue 4948 openmpi github page
9797
ENV OMPI_MCA_btl_vader_single_copy_mechanism=none
98+
99+
# Cleanup
100+
RUN sudo rm *.sh && \
101+
sudo rm -rf /home/${USERNAME}/software/build && \
102+
sudo rm -rf /home/${USERNAME}/software/src

docker/arm/install_scripts/install_arma.sh

Lines changed: 0 additions & 17 deletions
This file was deleted.

docker/arm/install_scripts/install_cmake.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

docker/arm/install_scripts/install_conda_arm.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

docker/arm/install_scripts/install_mpi.sh

Lines changed: 0 additions & 24 deletions
This file was deleted.

docker/arm/install_scripts/install_pacmensl.sh

Lines changed: 0 additions & 13 deletions
This file was deleted.

docker/arm/install_scripts/install_petsc.sh

Lines changed: 0 additions & 23 deletions
This file was deleted.

docker/arm/install_scripts/install_sundials.sh

Lines changed: 0 additions & 24 deletions
This file was deleted.

docker/arm/install_scripts/install_zoltan.sh

Lines changed: 0 additions & 25 deletions
This file was deleted.

docker/build_docker_image.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
PACMENSL_VERSION=0.1.0
2+
ARCH=$(uname -m)
3+
4+
docker build -t pacmensl:v${PACMENSL_VERSION}_${ARCH} --build-arg pacmensl_version=$PACMENSL_VERSION .

docker/x86/install_scripts/install_arma.sh renamed to docker/install_scripts/install_arma.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ rm *.xz
1010
cd ../build
1111
mkdir arma
1212
cd arma
13-
cmake -DCMAKE_INSTALL_PREFIX=/home/${user}/software/install ../../src/arma
13+
cmake -DCMAKE_INSTALL_PREFIX=/home/${user}/software/install -DBUILD_SHARED_LIBS=OFF ../../src/arma
1414
make -j4
1515
make install
1616

17+
# Cleanup
18+
rm -rf /home/${user}/software/src/arma
19+
1720

docker/x86/install_scripts/install_cmake.sh renamed to docker/install_scripts/install_cmake.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@ tar -zxvf cmake-3.20.0.tar.gz
88
cd cmake-3.20.0
99
cmake .
1010
make -j4
11-
sudo make install
11+
sudo make install
12+
13+
# Cleanup
14+
rm -rf /home/${user}/software/src/cmake-3.20.0
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
user=${USERNAME}
3+
4+
arch=$(uname -m)
5+
6+
if [ "$arch" = "arm64" ] || [ "$arch" = "aarch64" ]; then
7+
conda_link="https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-aarch64.sh"
8+
else
9+
conda_link="https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh"
10+
fi
11+
12+
cd /home/${user}/software/src
13+
wget ${conda_link} -O conda.sh
14+
15+
sudo chmod u+x ./conda.sh
16+
bash ./conda.sh -b -p /home/${user}/anaconda
17+
rm ./conda.sh

docker/arm/install_scripts/install_metis.sh renamed to docker/install_scripts/install_metis.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ make config prefix=/home/${user}/software/install shared=1
1717
make -j4
1818
make install
1919

20+
# Cleanup
21+
rm -rf /home/${user}/software/src/*metis*
2022

2123

2224

docker/install_scripts/install_mpi.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
sudo apt-get install -y libopenmpi-dev openmpi-bin openmpi-common
4+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
user=${USERNAME}
3+
4+
export CPATH=${CPATH};/home/${user}/software/install/include
5+
6+
cd /home/${user}/software/src
7+
wget https://github.com/voduchuy/pacmensl/archive/refs/tags/v${PACMENSL_VERSION}.tar.gz -O pacmensl.tar.gz
8+
tar -xf pacmensl.tar.gz
9+
rm *.tar.gz
10+
mv pacmensl* pacmensl
11+
12+
cd /home/${user}/software/build
13+
mkdir pacmensl
14+
cd pacmensl
15+
16+
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
17+
make -j4
18+
19+
# Now install
20+
make install
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
user=${USERNAME}
4+
5+
cd /home/${user}/software/src
6+
7+
wget https://gitlab.com/petsc/petsc/-/archive/v3.13.6/petsc-v3.13.6.tar.gz -O petsc.tar.gz
8+
tar -xvf petsc.tar.gz
9+
rm petsc.tar.gz
10+
mv petsc* petsc
11+
12+
cd petsc
13+
14+
arch=$(uname -m)
15+
16+
if [ "$arch" = "arm64" ] || [ "$arch" = "aarch64" ]; then
17+
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
18+
else
19+
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
20+
fi
21+
22+
make -j4 PETSC_DIR=/home/${user}/software/src/petsc PETSC_ARCH=linux-c-opt all
23+
make PETSC_DIR=/home/${user}/software/src/petsc PETSC_ARCH=linux-c-opt install
24+
25+
# add petsc to environment variables
26+
echo "export PETSC_DIR=/home/${user}/software/install/petsc" >> /home/${user}/.bashrc
27+
echo "export PETSC_ARCH=linux-c-opt" >> /home/${user}/.bashrc
28+
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
29+
echo "export LIBRARY_PATH=home/${user}/software/install/petsc/lib:/usr/local/lib:/home/${user}/software/install/lib:${LIBRARY_PATH}" >> /home/${user}/.bashrc
30+
31+
# cleanup
32+
rm -rf /home/${user}/software/src/petsc

docker/x86/install_scripts/install_sundials.sh renamed to docker/install_scripts/install_sundials.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ cd sundials
1919
echo ${PETSC_DIR}
2020

2121
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 \
22-
-DSUNDIALS_INDEX_SIZE=32 /home/${user}/software/src/sundials
22+
-DSUNDIALS_INDEX_SIZE=32 -DBUILD_SHARED_LIBS=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON /home/${user}/software/src/sundials
2323
make -j4
2424
make install
25+
26+
# Cleanup
27+
rm -rf /home/${user}/software/src/sundials

docker/x86/install_scripts/install_zoltan.sh renamed to docker/install_scripts/install_zoltan.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
#!/bin/bash
22
user=${USERNAME}
33

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

66
cd /home/${user}/software/src
7-
git clone https://github.com/trilinos/Trilinos.git --depth 1 --branch master --single-branch
7+
wget ${trilinos_link} -O trilinos.tar.gz
8+
tar -xf trilinos.tar.gz
9+
rm trilinos.tar.gz
10+
mv Trilinos* Trilinos
11+
812
cd ../build
913
mkdir zoltan
1014
cd zoltan
1115
cmake \
1216
-DCMAKE_INSTALL_PREFIX=/home/${user}/software/install \
17+
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
1318
-DTPL_ENABLE_MPI=ON \
1419
-DTrilinos_ENABLE_Zoltan=ON \
1520
-DBUILD_SHARED_LIBS=ON \
@@ -21,5 +26,8 @@ cmake \
2126
make -j4
2227
make install
2328

29+
# Cleanup
30+
rm -rf /home/${user}/software/src/Trilinos
31+
2432

2533

0 commit comments

Comments
 (0)