diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1204f97 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +tamaas +dist diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..02015ba --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM quay.io/pypa/manylinux2010_x86_64 + +MAINTAINER Lucas Frérot + +ENV PATH=/opt/python/cp37-cp37m/bin:$PATH + +RUN yum install -y \ + boost \ + boost-devel +RUN pip install scons +RUN mkdir /app + +# Setting up thrust +RUN cd /app && curl -L https://github.com/thrust/thrust/archive/1.9.2.tar.gz | tar -xz + +# Setting up fftw +RUN cd /app && curl -L http://fftw.org/fftw-3.3.8.tar.gz | tar -xz && \ + cd fftw-3.3.8 && CFLAGS='-fPIC' ./configure --prefix=$PWD && make && make install + +ENV THRUST_ROOT=/app/thrust-1.9.2 +ENV FFTW_ROOT=/app/fftw-3.3.8 +RUN cd /app/thrust-1.9.2 && mkdir include && ln -s ../thrust include/thrust diff --git a/build_all.sh b/build_all.sh new file mode 100755 index 0000000..9d8dee2 --- /dev/null +++ b/build_all.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +set -u -x -e + +cd /app/tamaas + +printf 'build_static_lib="True"\nbackend="cpp"\nverbose="true"\nstrip_info="true"\n' > build-setup.conf + +for PYROOT in /opt/python/*; do + MAJOR=$($PYROOT/bin/python --version 2>&1 | cut -d " " -f 2 | cut -d . -f 1) + MINOR=$($PYROOT/bin/python --version 2>&1 | cut -d " " -f 2 | cut -d . -f 2) + + # Skip 3.9 for now + [ $MINOR -ge 9 ] && continue + # Avoid cp27mu + (basename $PYROOT | grep -Eq 'mu') && continue + + # Compile + scons -j4 py_exec="$PYROOT/bin/python$MAJOR" | tee compile.log + + # Link fftw statically + grep 'build-release/python/tamaas/_tamaas' compile.log \ + | sed -e 's/lfftw3/l:libfftw3.a/' \ + | bash + + TAG=$(basename $PYROOT | cut -d "-" -f 1) + + # Create wheel + pushd build-release/python + $PYROOT/bin/python setup.py bdist_wheel \ + --python-tag $TAG \ + --plat-name manylinux2010_x86_64 \ + -d /dist/wheels/ + + popd + + rm -rf build-release/python +done + +for wheel in /dist/wheels/*.whl; do + auditwheel repair $wheel -w /dist/wheelhouse +done diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..62adaa8 --- /dev/null +++ b/run.sh @@ -0,0 +1,16 @@ +#!/usr/bin/bash + +sudo rm -rf tamaas dist/* +mkdir dist/wheelhouse +git clone https://c4science.ch/source/tamaas.git tamaas + +pushd tamaas +git submodule update --init third-party/pybind11 third-party/expolit +popd + +sudo docker run --rm \ + -v $PWD/tamaas:/app/tamaas \ + -v $PWD:/app/build \ + -v $PWD/dist:/dist \ + -t tamaas_manylinux \ + /app/build/build_all.sh