Skip to content

Instantly share code, notes, and snippets.

@gaborigloi
Last active January 11, 2019 18:26
Show Gist options
  • Save gaborigloi/b59dc87c3ff9e988f8e5ef78f2d787c5 to your computer and use it in GitHub Desktop.
Save gaborigloi/b59dc87c3ff9e988f8e5ef78f2d787c5 to your computer and use it in GitHub Desktop.
# Instructions on how to build the owl OCaml scientific library (https://github.com/owlbarn/owl)
# Debian, Option 3: Pin the Dev-Repo, with distro's native OpenBLAS/LAPACKE packages
docker run --rm -it debian bash -eux -c 'apt-get update
# basic tools needed for opam to work:
apt-get install -y curl patch unzip make gcc bzip2 git
# we cannot automate running the install.sh from opam because it is interactive, instead we just download the opam binary:
curl -sL https://github.com/ocaml/opam/releases/download/2.0.1/opam-2.0.1-x86_64-linux --output /usr/local/bin/opam
chmod +x /usr/local/bin/opam
opam init --compiler=4.06.1 --reinit --disable-sandboxing --auto-setup --yes
eval $(opam env)
opam install -y opam-depext
opam pin add -n owl --dev-repo
opam pin add -n owl-base --dev-repo
opam depext -y owl
# needed for eigen:
apt-get install -y g++
# needed for configuring owl, should be added to the opam file:
opam install -y sexplib
opam install -y owl
'
echo 'FROM ocaml/opam2:debian-stable
RUN opam pin add -n owl --dev-repo
RUN opam pin add -n owl-base --dev-repo
RUN sudo apt-get update
RUN opam depext -y owl
# needed for eigen:
RUN sudo apt-get install -y g++
# needed for configuring owl, should be added to the opam file:
RUN opam install -y sexplib
RUN opam install -y owl
RUN opam pin add -n owl-top --dev-repo
RUN opam pin add -n owl-zoo --dev-repo
RUN opam install -y owl-top' > Dockerfile
# Debian, Option 3: Pin the Dev-Repo, installing OpenBLAS from source
echo 'FROM ocaml/opam2:debian-stable
RUN sudo apt-get update
# Install a Fortran compiler to get LAPACKE:
RUN sudo apt-get install --no-install-recommends -y gfortran
RUN git clone https://github.com/xianyi/OpenBLAS.git
WORKDIR OpenBLAS
RUN make
RUN sudo make PREFIX=/usr/local/ install
WORKDIR ..
#RUN opam pin add -n owl --dev-repo
#RUN opam pin add -n owl-base --dev-repo
# owl compiles with my changes:
RUN opam pin add -n owl https://github.com/gaborigloi/owl.git#llapacke
RUN opam pin add -n owl-base https://github.com/gaborigloi/owl.git#llapacke
RUN opam install -y opam-depext
RUN sudo apt-get install --no-install-recommends -y $(opam depext --list owl | grep -v "blas\|lapack")
# needed for eigen:
RUN sudo apt-get install --no-install-recommends -y g++
# needed for configuring owl, should be added to the opam file:
RUN opam install -y sexplib
RUN opam install -y owl
#RUN opam pin add -n owl-top --dev-repo
#RUN opam pin add -n owl-zoo --dev-repo
# owl compiles with my changes:
RUN opam pin add -n owl-top https://github.com/gaborigloi/owl.git#llapacke
RUN opam pin add -n owl-zoo https://github.com/gaborigloi/owl.git#llapacke
RUN opam install -y owl-top' > Dockerfile
# Fedora, Option 3: Pin the Dev-Repo, with distro's native OpenBLAS/LAPACKE packages
echo 'FROM ocaml/opam2:fedora
#RUN opam pin add -n owl --dev-repo
#RUN opam pin add -n owl-base --dev-repo
# owl compiles with my changes:
RUN opam pin add -n owl https://github.com/gaborigloi/owl.git#llapacke
RUN opam pin add -n owl-base https://github.com/gaborigloi/owl.git#llapacke
RUN opam depext -y owl
# ensure headers are found:
ENV C_INCLUDE_PATH="$C_INCLUDE_PATH:/usr/include/openblas"
# needed for plplot, should be added to the opam file::
RUN sudo dnf install -y plplot-devel
# needed for eigen, should be added to the opam file:
#RUN sudo yum install -y g++
# needed for configuring owl, should be added to the opam file:
RUN opam install -y sexplib
RUN opam install -y owl
#RUN opam pin add -n owl-top --dev-repo
#RUN opam pin add -n owl-zoo --dev-repo
# owl compiles with my changes:
RUN opam pin add -n owl-top https://github.com/gaborigloi/owl.git#llapacke
RUN opam pin add -n owl-zoo https://github.com/gaborigloi/owl.git#llapacke
RUN opam install -y owl-top' > Dockerfile
# Fedora, Option 3: Pin the Dev-Repo, installing OpenBLAS from source
echo 'FROM ocaml/opam2:fedora
# Install a Fortran compiler to get LAPACKE:
RUN sudo dnf install -y gcc-gfortran
RUN git clone https://github.com/xianyi/OpenBLAS.git
WORKDIR OpenBLAS
RUN make
RUN sudo make PREFIX=/usr/local/ install
WORKDIR ..
#RUN opam pin add -n owl --dev-repo
#RUN opam pin add -n owl-base --dev-repo
# owl compiles with my changes:
RUN opam pin add -n owl https://github.com/gaborigloi/owl.git#llapacke
RUN opam pin add -n owl-base https://github.com/gaborigloi/owl.git#llapacke
RUN opam install -y opam-depext
RUN sudo dnf install -y $(opam depext --list owl | grep -v "blas\|lapack")
# needed for eigen:
RUN sudo dnf install -y gcc-c++
# needed for plplot:
RUN sudo dnf install -y plplot-devel
# needed for configuring owl, should be added to the opam file:
RUN opam install -y sexplib
RUN opam install -y owl
#RUN opam pin add -n owl-top --dev-repo
#RUN opam pin add -n owl-zoo --dev-repo
# owl compiles with my changes:
RUN opam pin add -n owl-top https://github.com/gaborigloi/owl.git#llapacke
RUN opam pin add -n owl-zoo https://github.com/gaborigloi/owl.git#llapacke
RUN opam install -y owl-top' > Dockerfile
# Debian, Option 4: Compile from Source, with distro's native OpenBLAS/LAPACKE packages
echo 'FROM ocaml/opam2:debian-stable
RUN sudo apt-get update
# Clone owl repo
RUN git clone https://github.com/owlbarn/owl.git
WORKDIR owl
RUN opam pin add -n -y .
# Install depexts
# needed for eigen:
RUN sudo apt-get install -y g++
RUN opam depext -y $(ls *.opam | sed "s/\.opam//g")
# Install opam deps
# needed for configuring owl, should be added to the opam file:
RUN opam install -y sexplib
# make should not require test dependencies for default target:
RUN opam install -y --with-test --deps-only .
# Build owl
RUN opam exec -- make
RUN opam exec -- make install' > Dockerfile
# Debian, Option 4: Compile from Source, installing OpenBLAS from source
echo 'FROM ocaml/opam2:debian-stable
RUN sudo apt-get update
# Install OpenBLAS
# Install a Fortran compiler to get LAPACKE:
RUN sudo apt-get install --no-install-recommends -y gfortran
RUN git clone https://github.com/xianyi/OpenBLAS.git
WORKDIR OpenBLAS
RUN make
RUN sudo make PREFIX=/usr/local/ install
WORKDIR ..
# Clone owl repo
#RUN git clone https://github.com/owlbarn/owl.git
# owl compiles with my changes:
RUN git clone https://github.com/gaborigloi/owl.git
WORKDIR owl
RUN git checkout llapacke
RUN opam pin add -n -y .
# Install depexts
# needed for eigen:
RUN sudo apt-get install -y g++
RUN sudo apt-get install --no-install-recommends -y $(opam depext --list $(ls *.opam | sed s/\.opam//g) | grep -v "blas\|lapack")
# Install opam deps
# needed for configuring owl, should be added to the opam file:
RUN opam depext -y sexplib
RUN opam install -y sexplib
# make should not require test dependencies for default target:
RUN opam install -y --with-test --deps-only .
# Build owl
RUN opam exec -- make
RUN opam exec -- make install' > Dockerfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment