Skip to content

Commit

Permalink
revising docker CI
Browse files Browse the repository at this point in the history
  • Loading branch information
jzstark committed Mar 7, 2024
1 parent 2f57271 commit 78327be
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 82 deletions.
1 change: 0 additions & 1 deletion .github/workflows/deploy_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,5 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/Dockerfile.test
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/owl-arm64v8:latest
59 changes: 37 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,41 +1,56 @@
############################################################
# Dockerfile to build Owl docker image
# Based on owlbarn/owl master branch
# By Liang Wang <[email protected]>
############################################################

FROM owlbarn/openblas:ubuntu
FROM arm64v8/ubuntu

FROM ocaml/opam2:ubuntu
USER root
##################### PREREQUISITES ########################

#################### INSTALL OPENBLAS ######################
RUN apt-get update
RUN apt-get -y install git build-essential ocaml wget unzip aspcud m4 pkg-config bubblewrap
RUN apt-get -y install libshp-dev libopenblas-dev liblapacke-dev

WORKDIR /home/opam
COPY --from=0 /home/opam/OpenBLAS OpenBLAS
RUN make -C OpenBLAS/ install
RUN ldconfig /opt/OpenBLAS/lib/
ENV VER=2.1.5
RUN wget https://github.com/ocaml/opam/releases/download/$VER/opam-full-$VER.tar.gz \
&& tar -xvf opam-full-$VER.tar.gz \
&& cd opam-full-$VER \
&& ./configure && make lib-ext && make && make install

##################### PREREQUISITES ########################
ENV OCAML_VER=5.1.0
RUN yes | opam init --disable-sandboxing --comp $OCAML_VER && eval $(opam config env)

RUN apt-get install zlib1g-dev
RUN opam install -y dune ocaml-compiler-libs ctypes alcotest utop conf-openblas dune-configurator stdio npy

#################### Setup Env #######################

ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update -y
RUN apt-get install -y m4 wget unzip aspcud libshp-dev gfortran pkg-config git
RUN cd /home/opam/opam-repository && git pull --quiet origin master
RUN opam update -q
ENV OWLPATH /root/owl
ENV PATH /root/.opam/${OCAML_VER}/bin:/usr/local/sbin/:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
ENV CAML_LD_LIBRARY_PATH /root/.opam/${OCAML_VER}/lib/stublibs

ENV OWL_CFLAGS "-g -O3 -Ofast -march=native -funroll-loops -ffast-math -DSFMT_MEXP=19937 -fno-strict-aliasing -Wno-tautological-constant-out-of-range-compare"
ENV EIGENCPP_OPTFLAGS "-Ofast -march=native -funroll-loops -ffast-math"
ENV EIGEN_FLAGS "-O3 -Ofast -march=native -funroll-loops -ffast-math"

#################### INSTALL OWL #######################

ENV OWLPATH /home/opam/owl
ENV OWL_DISABLE_LAPACKE_LINKING_FLAG 1
ENV OWL_COMPILE_CFLAGS "-I/opt/OpenBLAS/include -I/home/opam/OpenBLAS/lapack-netlib/LAPACKE/include/ -L/opt/OpenBLAS/lib"
RUN CFLAGS=${OWL_COMPILE_CFLAGS} opam install owl owl-top utop -y
RUN cd /root && git clone https://github.com/owlbarn/owl.git

# HACK: remove unrecognised sse compiler option on arm; add libraries for linking
RUN sed -i -- 's/linux_elf/linux_eabihf/g' $OWLPATH/src/owl/config/configure.ml \
&& sed -i -- 's/-mfpmath=sse//g' $OWLPATH/src/owl/config/configure.ml \
&& sed -i -- 's/-msse2//g' $OWLPATH/src/owl/config/configure.ml

RUN cd $OWLPATH \
&& eval `opam config env ` \
&& make && make install

############## SET UP DEFAULT CONTAINER VARS ##############

RUN echo "#require \"owl-top\";; open Owl;;" >> /home/opam/.ocamlinit \
&& echo 'eval $(opam env)' >> /home/opam/.bashrc
RUN echo "#require \"owl-top\";; open Owl;;" >> /root/.ocamlinit \
&& opam config env >> /root/.bashrc \
&& bash -c "source /root/.bashrc"

WORKDIR $OWLPATH
ENTRYPOINT /bin/bash

56 changes: 0 additions & 56 deletions docker/Dockerfile

This file was deleted.

41 changes: 41 additions & 0 deletions docker/Dockerfile.openblas
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
############################################################
# Dockerfile to build Owl docker image
# Based on owlbarn/owl master branch
# By Liang Wang <[email protected]>
############################################################

FROM owlbarn/openblas:ubuntu

FROM ocaml/opam2:ubuntu
USER root

#################### INSTALL OPENBLAS ######################

WORKDIR /home/opam
COPY --from=0 /home/opam/OpenBLAS OpenBLAS
RUN make -C OpenBLAS/ install
RUN ldconfig /opt/OpenBLAS/lib/

##################### PREREQUISITES ########################

ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update -y
RUN apt-get install -y m4 wget unzip aspcud libshp-dev gfortran pkg-config git
RUN cd /home/opam/opam-repository && git pull --quiet origin master
RUN opam update -q

#################### INSTALL OWL #######################

ENV OWLPATH /home/opam/owl
ENV OWL_DISABLE_LAPACKE_LINKING_FLAG 1
ENV OWL_COMPILE_CFLAGS "-I/opt/OpenBLAS/include -I/home/opam/OpenBLAS/lapack-netlib/LAPACKE/include/ -L/opt/OpenBLAS/lib"
RUN CFLAGS=${OWL_COMPILE_CFLAGS} opam install owl owl-top utop -y

############## SET UP DEFAULT CONTAINER VARS ##############

RUN echo "#require \"owl-top\";; open Owl;;" >> /home/opam/.ocamlinit \
&& echo 'eval $(opam env)' >> /home/opam/.bashrc

WORKDIR $OWLPATH
ENTRYPOINT /bin/bash

3 changes: 0 additions & 3 deletions docker/Dockerfile.test

This file was deleted.

0 comments on commit 78327be

Please sign in to comment.