From 2c1b781db7563f01031368d2cca5a628c5d64916 Mon Sep 17 00:00:00 2001 From: NevesLucas Date: Fri, 8 Jul 2022 00:15:19 -0400 Subject: [PATCH 1/5] add serial and parallel dockerfiles, update requirements.txt to align with current python supported packages. --- Docker/parallel.dockerfile | 88 ++++++++++++++++++++++++++++++++++++++ Docker/serial.dockerfile | 80 ++++++++++++++++++++++++++++++++++ build_docker.sh | 4 ++ requirements.txt | 8 ++-- 4 files changed, 176 insertions(+), 4 deletions(-) create mode 100644 Docker/parallel.dockerfile create mode 100644 Docker/serial.dockerfile create mode 100644 build_docker.sh diff --git a/Docker/parallel.dockerfile b/Docker/parallel.dockerfile new file mode 100644 index 00000000..4cba305e --- /dev/null +++ b/Docker/parallel.dockerfile @@ -0,0 +1,88 @@ +FROM ubuntu:focal as xyce_build + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt update && apt install -y git cmake build-essential gcc g++ ninja-build gfortran make bison flex libfl-dev libfftw3-dev libsuitesparse-dev libblas-dev liblapack-dev libtool autoconf automake libopenmpi-dev openmpi-bin + +RUN git clone --branch Release-7.4.0 --depth 1 https://github.com/Xyce/Xyce.git + +RUN git clone --branch trilinos-release-12-12-1 --depth 1 https://github.com/trilinos/Trilinos.git + +WORKDIR /Trilinos + +RUN mkdir build && cd build && cmake -GNinja -DCMAKE_C_COMPILER=mpicc \ +-DCMAKE_CXX_COMPILER=mpic++ \ +-DCMAKE_Fortran_COMPILER=mpif77 \ +-DCMAKE_CXX_FLAGS="-O3 -fPIC" \ +-DCMAKE_C_FLAGS="-O3 -fPIC" \ +-DCMAKE_Fortran_FLAGS="-O3 -fPIC" \ +-DCMAKE_MAKE_PROGRAM="ninja" \ +-DCMAKE_INSTALL_PREFIX="/opt/trilinos_parallel" \ +-DTrilinos_ENABLE_NOX=ON \ +-DNOX_ENABLE_LOCA=ON \ +-DTrilinos_ENABLE_EpetraExt=ON \ +-DEpetraExt_BUILD_BTF=ON \ +-DEpetraExt_BUILD_EXPERIMENTAL=ON \ +-DEpetraExt_BUILD_GRAPH_REORDERINGS=ON \ +-DTrilinos_ENABLE_TrilinosCouplings=ON \ +-DTrilinos_ENABLE_Ifpack=ON \ +-DTrilinos_ENABLE_Isorropia=ON \ +-DTrilinos_ENABLE_AztecOO=ON \ +-DTrilinos_ENABLE_Belos=ON \ +-DTrilinos_ENABLE_Teuchos=ON \ +-DTrilinos_ENABLE_COMPLEX_DOUBLE=ON \ +-DTrilinos_ENABLE_Amesos=ON \ +-DAmesos_ENABLE_KLU=ON \ +-DTrilinos_ENABLE_Amesos2=ON \ +-DAmesos2_ENABLE_KLU2=ON \ +-DAmesos2_ENABLE_Basker=ON \ +-DTrilinos_ENABLE_Sacado=ON \ +-DTrilinos_ENABLE_Stokhos=ON \ +-DTrilinos_ENABLE_Kokkos=ON \ +-DTrilinos_ENABLE_Zoltan=ON \ +-DTrilinos_ENABLE_ALL_OPTIONAL_PACKAGES=OFF \ +-DTrilinos_ENABLE_CXX11=ON \ +-DTPL_ENABLE_AMD=ON \ +-DAMD_LIBRARY_DIRS="/usr/lib" \ +-DTPL_AMD_INCLUDE_DIRS="/usr/include/suitesparse" \ +-DTPL_ENABLE_BLAS=ON \ +-DTPL_ENABLE_LAPACK=ON \ +-DTPL_ENABLE_MPI=ON .. + +RUN cd build && cmake --build . && ninja install + +WORKDIR /Xyce + +RUN ./bootstrap && mkdir build && cd build && \ + ../configure CXXFLAGS="-O3" ARCHDIR="/opt/trilinos_parallel" CPPFLAGS="-I/usr/include/suitesparse" -enable-mpi \ +CXX=mpicxx \ +CC=mpicc \ +F77=mpif77 \ +--enable-stokhos \ +--enable-amesos2 \ +--prefix=/opt/XyceInstall/Parallel && \ +make -j $(nproc) && make install + +FROM ubuntu:focal + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt update && apt install -y nano vim python-is-python3 python3-pip gfortran bison flex libfl-dev libfftw3-dev libsuitesparse-dev libblas-dev liblapack-dev libtool libopenmpi-dev openmpi-bin +WORKDIR / +COPY --from=xyce_build /opt /opt + +ENV PATH /opt/XyceInstall/Parallel/bin:$PATH + +RUN useradd -ms /bin/bash pact + +WORKDIR /home/pact + +COPY ./requirements.txt requirements.txt + +USER pact + +RUN pip3 install -r requirements.txt + +COPY --chown=pact:pact . ./ + +CMD ["/bin/bash"] \ No newline at end of file diff --git a/Docker/serial.dockerfile b/Docker/serial.dockerfile new file mode 100644 index 00000000..9a7aee48 --- /dev/null +++ b/Docker/serial.dockerfile @@ -0,0 +1,80 @@ +FROM ubuntu:focal as xyce_build + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt update && apt install -y gcc g++ build-essential ninja-build gfortran make cmake bison flex libfl-dev libfftw3-dev libsuitesparse-dev libblas-dev liblapack-dev libtool automake autoconf + +RUN git clone --branch Release-7.4.0 --depth 1 https://github.com/Xyce/Xyce.git + +RUN git clone --branch trilinos-release-12-12-1 --depth 1 https://github.com/trilinos/Trilinos.git + +WORKDIR /Trilinos + +ARG FLAGS="-O3 -fPIC" + +RUN mkdir build && cd build && cmake -GNinja \ +-DCMAKE_C_COMPILER=gcc \ +-DCMAKE_CXX_COMPILER=g++ \ +-DCMAKE_Fortran_COMPILER=gfortran \ +-DCMAKE_CXX_FLAGS="$FLAGS" \ +-DCMAKE_C_FLAGS="$FLAGS" \ +-DCMAKE_Fortran_FLAGS="$FLAGS" \ +-DCMAKE_INSTALL_PREFIX="/opt/trilinos_serial" \ +-DCMAKE_MAKE_PROGRAM="ninja" \ +-DTrilinos_ENABLE_NOX=ON \ + -DNOX_ENABLE_LOCA=ON \ +-DTrilinos_ENABLE_EpetraExt=ON \ + -DEpetraExt_BUILD_BTF=ON \ + -DEpetraExt_BUILD_EXPERIMENTAL=ON \ + -DEpetraExt_BUILD_GRAPH_REORDERINGS=ON \ +-DTrilinos_ENABLE_TrilinosCouplings=ON \ +-DTrilinos_ENABLE_Ifpack=ON \ +-DTrilinos_ENABLE_Isorropia=ON \ +-DTrilinos_ENABLE_AztecOO=ON \ +-DTrilinos_ENABLE_Belos=ON \ +-DTrilinos_ENABLE_Teuchos=ON \ + -DTeuchos_ENABLE_COMPLEX=ON \ +-DTrilinos_ENABLE_Amesos=ON \ + -DAmesos_ENABLE_KLU=ON \ +-DTrilinos_ENABLE_Sacado=ON \ +-DTrilinos_ENABLE_Kokkos=OFF \ +-DTrilinos_ENABLE_ALL_OPTIONAL_PACKAGES=OFF \ +-DTrilinos_ENABLE_CXX11=OFF \ +-DTPL_ENABLE_AMD=ON \ +-DAMD_LIBRARY_DIRS="/usr/lib" \ +-DTPL_AMD_INCLUDE_DIRS="/usr/include/suitesparse" \ +-DTPL_ENABLE_BLAS=ON \ +-DTPL_ENABLE_LAPACK=ON .. + +RUN cd build && cmake --build . && ninja install + +WORKDIR /Xyce + +RUN ./bootstrap && mkdir build && cd build && \ + ../configure CXXFLAGS="-O3" ARCHDIR="/opt/trilinos_serial" CPPFLAGS="-I/usr/include/suitesparse" \ +--prefix=/opt/XyceInstall/Serial && \ +make -j $(nproc) && make install + +FROM ubuntu:focal + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt update && apt install -y nano vim python-is-python3 python3-pip gfortran bison flex libfl-dev libfftw3-dev libsuitesparse-dev libblas-dev liblapack-dev libtool +WORKDIR / +COPY --from=xyce_build /opt /opt + +ENV PATH /opt/XyceInstall/Parallel/bin:$PATH + +RUN useradd -ms /bin/bash pact + +WORKDIR /home/pact + +COPY ./requirements.txt requirements.txt + +USER pact + +RUN pip3 install -r requirements.txt + +COPY --chown=pact:pact . ./ + +CMD ["/bin/bash"] \ No newline at end of file diff --git a/build_docker.sh b/build_docker.sh new file mode 100644 index 00000000..20d56fc7 --- /dev/null +++ b/build_docker.sh @@ -0,0 +1,4 @@ +#!/bin/sh -l + +docker build --pull --rm -f "Docker\parallel.dockerfile" -t pact:latest-parallel . +docker build --pull --rm -f "Docker\serial.dockerfile" -t pact:latest-serial . \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 728523a6..996d2241 100755 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -numpy==1.14.5 -pandas==0.23.3 -scipy==1.1.0 -configparser==3.5.0 +numpy==1.22.0 +pandas==1.4.3 +scipy==1.8.1 +configparser==3.5.0 \ No newline at end of file From 98d218acadd12ce916445e2839115a5abea1d049 Mon Sep 17 00:00:00 2001 From: NevesLucas Date: Fri, 8 Jul 2022 00:22:07 -0400 Subject: [PATCH 2/5] add dockerignore, missing git dep --- .dockerignore | 5 +++++ Docker/serial.dockerfile | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..70501f57 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +.git +.cache +Docker/ +*.md +build_docker.sh diff --git a/Docker/serial.dockerfile b/Docker/serial.dockerfile index 9a7aee48..3b7ddb95 100644 --- a/Docker/serial.dockerfile +++ b/Docker/serial.dockerfile @@ -2,7 +2,7 @@ FROM ubuntu:focal as xyce_build ARG DEBIAN_FRONTEND=noninteractive -RUN apt update && apt install -y gcc g++ build-essential ninja-build gfortran make cmake bison flex libfl-dev libfftw3-dev libsuitesparse-dev libblas-dev liblapack-dev libtool automake autoconf +RUN apt update && apt install -y gcc g++ git build-essential ninja-build gfortran make cmake bison flex libfl-dev libfftw3-dev libsuitesparse-dev libblas-dev liblapack-dev libtool automake autoconf RUN git clone --branch Release-7.4.0 --depth 1 https://github.com/Xyce/Xyce.git From 526dca417acb8f466ea6091697293cca81121ab5 Mon Sep 17 00:00:00 2001 From: NevesLucas Date: Fri, 8 Jul 2022 00:28:43 -0400 Subject: [PATCH 3/5] disable parallel container build due to mpi issues --- build_docker.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build_docker.sh b/build_docker.sh index 20d56fc7..b1dd8224 100644 --- a/build_docker.sh +++ b/build_docker.sh @@ -1,4 +1,7 @@ #!/bin/sh -l -docker build --pull --rm -f "Docker\parallel.dockerfile" -t pact:latest-parallel . +#docker build --pull --rm -f "Docker\parallel.dockerfile" -t pact:latest-parallel . <-- not currently working + +###TODO: check if models are already downloaded before building docker image, get them if not + docker build --pull --rm -f "Docker\serial.dockerfile" -t pact:latest-serial . \ No newline at end of file From 55f7cbd1bf2059d8d3c2110814dc9fe2d180a447 Mon Sep 17 00:00:00 2001 From: NevesLucas Date: Fri, 8 Jul 2022 00:43:04 -0400 Subject: [PATCH 4/5] Update .gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 3f3182fb..d1e07b93 100755 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,6 @@ src/__pycache__/ # Timing logs: src/Example/logs/*.log +*tar.gz +MLModels/ + From c1b9cd37b4c7cd2ff6bf694e17282175478cf26e Mon Sep 17 00:00:00 2001 From: NevesLucas Date: Fri, 8 Jul 2022 19:18:13 -0400 Subject: [PATCH 5/5] fix incorrect path addition at end of dockerfile, clean apt cache for smaller final image size --- .dockerignore | 1 - Docker/serial.dockerfile | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.dockerignore b/.dockerignore index 70501f57..72d2366b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,4 @@ .git -.cache Docker/ *.md build_docker.sh diff --git a/Docker/serial.dockerfile b/Docker/serial.dockerfile index 3b7ddb95..0731e3c2 100644 --- a/Docker/serial.dockerfile +++ b/Docker/serial.dockerfile @@ -59,11 +59,11 @@ FROM ubuntu:focal ARG DEBIAN_FRONTEND=noninteractive -RUN apt update && apt install -y nano vim python-is-python3 python3-pip gfortran bison flex libfl-dev libfftw3-dev libsuitesparse-dev libblas-dev liblapack-dev libtool +RUN apt update && apt install -y nano vim python-is-python3 python3-pip gfortran bison flex libfl-dev libfftw3-dev libsuitesparse-dev libblas-dev liblapack-dev libtool && rm -rf /var/lib/apt/lists/* WORKDIR / COPY --from=xyce_build /opt /opt -ENV PATH /opt/XyceInstall/Parallel/bin:$PATH +ENV PATH /opt/XyceInstall/Serial/bin:$PATH RUN useradd -ms /bin/bash pact