From d6ffaecb663bce52a9be8337d71ff14d6adad95e Mon Sep 17 00:00:00 2001
From: Jean-Baptiste Keck <jean-baptiste.keck@imag.fr>
Date: Sun, 19 Nov 2017 01:29:48 +0100
Subject: [PATCH] fixed advection test path, reduced transposition test load,
 added working debian dockerfile

---
 ci/docker_images/debian/Dockerfile     | 173 +++++++++++++++++++------
 ci/scripts/test.sh                     |   2 +-
 hysop/operator/tests/test_transpose.py |  10 +-
 3 files changed, 137 insertions(+), 48 deletions(-)

diff --git a/ci/docker_images/debian/Dockerfile b/ci/docker_images/debian/Dockerfile
index db738d755..7252dbba9 100644
--- a/ci/docker_images/debian/Dockerfile
+++ b/ci/docker_images/debian/Dockerfile
@@ -1,50 +1,137 @@
 # Test docker for gitlab-ci
-FROM debian:latest
-MAINTAINER Franck.Perignon@imag.fr
-# we need cmake, python ...
-RUN apt-get update && apt-get install -y \
-	cmake\
-	ssh\
-	python-dev\
-	libblas-dev\
-        python\
-        liblapacke-dev\
- 	libatlas-base-dev\
-	libatlas-dev\
-	gcc\
-	libgfortran3\
-	libgcc1\
-	libgcc-4.9-dev\
-	gfortran\
-	python-pip\
-	openmpi-bin\
-	libopenmpi-dev\
-	libhdf5-openmpi-dev\
-	cython\
-	python-numpy\
-	python-scipy\
-	python-pyopencl\
-	python-scitools\
-	libfftw3-dev\
-	libfftw3-mpi-dev\
-	python-pytest\
-	wget && \
-	rm -rf /var/lib/apt/lists/*
+FROM debian:stretch
+MAINTAINER Jean-Baptiste.Keck@imag.fr
+
+# upgrade initial image
+RUN apt-get update
+RUN apt-get upgrade -y
+
+# get build tools and required libraries
+RUN apt-get install -y expat
+RUN apt-get install -y automake
+RUN apt-get install -y pkg-config
+RUN apt-get install -y cmake
+RUN apt-get install -y git
+RUN apt-get install -y ssh
+RUN apt-get install -y gcc
+RUN apt-get install -y gfortran
+RUN apt-get install -y cython
+RUN apt-get install -y swig
+RUN apt-get install -y libreadline-dev
+RUN apt-get install -y libboost-all-dev
+RUN apt-get install -y libblas-dev
+RUN apt-get install -y liblapack-dev
+RUN apt-get install -y libcgal-dev
+RUN apt-get install -y libatlas-base-dev
+RUN apt-get install -y libatlas-dev
+RUN apt-get install -y libopenblas-dev
+RUN apt-get install -y libgfortran3
+RUN apt-get install -y libgcc1
+RUN apt-get install -y libopenmpi-dev
+RUN apt-get install -y libhdf5-openmpi-dev
+RUN apt-get install -y libfftw3-dev
+RUN apt-get install -y libfftw3-mpi-dev
+RUN apt-get install -y libgmp-dev
+RUN apt-get install -y libmpfr-dev
+RUN apt-get install -y libmpc-dev
+RUN apt-get install -y libsparsehash-dev
+RUN apt-get install -y python
+RUN apt-get install -y python-dev
+RUN apt-get install -y python-pip
+RUN apt-get install -y opencl-headers
+RUN apt-get install -y ocl-icd-libopencl1
+RUN apt-get install -y clinfo
+
+# python packages
 RUN pip install --upgrade pip
 RUN pip install --upgrade setuptools
+RUN pip install cffi
+RUN pip install wheel
+RUN pip install pytest
+RUN pip install numpy
+RUN pip install scipy
+RUN pip install sympy
+RUN pip install matplotlib
 RUN pip install mpi4py
 RUN pip install sphinx
-RUN pip install wheel
-RUN wget https://pypi.python.org/packages/22/82/64dada5382a60471f85f16eb7d01cc1a9620aea855cd665609adf6fdbb0d/h5py-2.6.0.tar.gz && \
-	tar -zxvf h5py-2.6.0.tar.gz && \
-	cd h5py-2.6.0 && \
-	export CC=mpicc && \
-	export CFLAGS="-I/usr/include/hdf5/openmpi/"&& \
-	export LDFLAGS="-L /usr/lib/x86_64-linux-gnu/hdf5/openmpi/"&& \
-	python setup.py configure --mpi --hdf5=/usr/ && \
-	python setup.py install && \
-	cd .. && \
-	rm -rf h5py-2.6.0*
-RUN cd ..
+RUN pip install h5py
+RUN pip install gmpy2
+RUN pip install psutil
+RUN pip install py-cpuinfo
+RUN pip install Mako
+
+RUN cd /tmp                                      \
+ && git clone https://github.com/hplgit/scitools \
+ && cd scitools                                  \
+ && pip install .                                \
+ && cd -                                         \
+ && rm -Rf /tmp/scitools
+
+# patchelf
+RUN cd /tmp                                     \
+ && git clone https://github.com/NixOS/patchelf \
+ && cd patchelf                                 \
+ && ./bootstrap.sh                              \
+ && ./configure                                 \
+ && make                                        \
+ && make install                                \
+ && cd -                                        \
+ && rm -Rf /tmp/patchelf
+
+# precompiled python graphtools (need to be patched with patchelf)
+RUN echo 'deb http://downloads.skewed.de/apt/stretch stretch main'     >> /etc/apt/sources.list \
+ && echo 'deb-src http://downloads.skewed.de/apt/stretch stretch main' >> /etc/apt/sources.list \
+ && apt-get update                                                                              \
+ && apt-get install --assume-yes --allow-unauthenticated python-graph-tool                      \
+ && patchelf --add-needed libboost_context.so $(find /usr/ -name 'libgraph_tool_search.so')
+
+RUN echo 'deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch main'     >> /etc/apt/sources.list \
+ && echo 'deb-src http://apt.llvm.org/stretch/ llvm-toolchain-stretch main' >> /etc/apt/sources.list \
+ && apt-get update                                                                               \
+ && apt-get install --assume-yes --allow-unauthenticated llvm-3.8 clang-3.8 libllvm3.8 libclang-3.8-dev
+
+# POCL
+RUN cd /tmp                              \
+&& git clone http://github.com/pocl/pocl \
+&& cd pocl                               \
+&& mkdir build                           \
+&& cd build                              \
+&& cmake -DCMAKE_BUILD_TYPE=Release  ..  \
+&& make                                  \
+&& make install                          \
+&& cd --                                 \
+&& rm -Rf /tmp/pocl
+
+# pyopencl
+RUN cd /tmp                                       \
+&& rm -f /usr/lib/x86_64-linux-gnu/libOpenCL.so.* \
+&& ldconfig                                       \
+&& git clone https://github.com/inducer/pyopencl  \
+&& cd pyopencl                                    \
+&& git submodule update --init                    \
+&& ./configure.py                                 \
+&& echo 'CL_PRETEND_VERSION="1.2"' >> siteconf.py \
+&& make                                           \
+&& pip install --upgrade .                        \
+&& cd -                                           \
+&& rm -Rf /tmp/pyopencl
+
+# oclgrind
+RUN apt-get install --assume-yes --allow-unauthenticated llvm-6.0 clang-6.0 libllvm6.0 libclang-6.0-dev
+RUN cd /tmp                                                           \
+ && git clone https://github.com/jrprice/Oclgrind                     \
+ && cd Oclgrind                                                       \
+ && mkdir build                                                       \
+ && cd build                                                          \
+ && cmake -DCMAKE_BUILD_TYPE=Release ..                               \
+ && make                                                              \
+ && make install                                                      \
+ && cd -                                                              \
+ && rm -Rf /tmp/Oclgrind
+
+# clean cached packages
+RUN rm -rf /var/lib/apt/lists/*
+RUN rm -rf $HOME/.cache/pip/*
+RUN rm -rf /tmp/*
 
 CMD ["/bin/bash"]
diff --git a/ci/scripts/test.sh b/ci/scripts/test.sh
index 99b93e93c..61a3bd059 100644
--- a/ci/scripts/test.sh
+++ b/ci/scripts/test.sh
@@ -35,7 +35,7 @@ python -c 'import hysop; print hysop'
 python "$HYSOP_DIR/backend/device/codegen/kernels/tests/test_directional_advection.py"
 python "$HYSOP_DIR/backend/device/codegen/kernels/tests/test_directional_remesh.py"
 python "$HYSOP_DIR/operator/tests/test_transpose.py"
-python "$HYSOP_DIR/operator/tests/test_advection.py"
+python "$HYSOP_DIR/operator/tests/test_directional_advection.py"
 python "$HYSOP_DIR/operator/tests/test_custom_symbolic.py"
 
 cp -r /root/.cache/* $CACHE_DIR/
diff --git a/hysop/operator/tests/test_transpose.py b/hysop/operator/tests/test_transpose.py
index 8836d0d78..7dc0f1f0c 100644
--- a/hysop/operator/tests/test_transpose.py
+++ b/hysop/operator/tests/test_transpose.py
@@ -212,13 +212,15 @@ class TestTransposeOperator(object):
     def perform_tests(self):
         self.test_2d_out_of_place()
         self.test_3d_out_of_place()
-        self.test_4d_out_of_place()
-        self.test_upper_dimensions_out_of_place()
+        if __ENABLE_LONG_TESTS__:
+            self.test_4d_out_of_place()
+            self.test_upper_dimensions_out_of_place()
         
         self.test_2d_inplace()
         self.test_3d_inplace()
-        self.test_4d_inplace()
-        self.test_upper_dimensions_inplace()
+        if __ENABLE_LONG_TESTS__:
+            self.test_4d_inplace()
+            self.test_upper_dimensions_inplace()
     
 if __name__ == '__main__':
     TestTransposeOperator.setup_class(enable_extra_tests=False, 
-- 
GitLab