Skip to content

Commit

Permalink
fix: install cmake version 3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
quadeare committed May 15, 2020
1 parent 3a36b57 commit 10666b8
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 32 deletions.
26 changes: 13 additions & 13 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,17 @@ cpu_build() {
case ${DEEPDETECT_BUILD} in

"caffe-tf")
cmake . -DUSE_TF=ON -DUSE_TF_CPU_ONLY=ON -DUSE_SIMSEARCH=ON -DUSE_TSNE=ON -DUSE_NCNN=OFF
cmake .. -DUSE_TF=ON -DUSE_TF_CPU_ONLY=ON -DUSE_SIMSEARCH=ON -DUSE_TSNE=ON -DUSE_NCNN=OFF
make -j
;;

"armv7")
cmake . -DUSE_NCNN=ON -DRPI3=ON -DUSE_HDF5=OFF -DUSE_CAFFE=OFF
cmake .. -DUSE_NCNN=ON -DRPI3=ON -DUSE_HDF5=OFF -DUSE_CAFFE=OFF
make -j
;;

*)
cmake . -DUSE_XGBOOST=ON -DUSE_SIMSEARCH=ON -DUSE_TSNE=ON -DUSE_NCNN=ON
cmake .. -DUSE_XGBOOST=ON -DUSE_SIMSEARCH=ON -DUSE_TSNE=ON -DUSE_NCNN=ON
make -j
;;
esac
Expand All @@ -130,52 +130,52 @@ gpu_build() {
case ${DEEPDETECT_BUILD} in

"tf")
cmake . -DUSE_TF=ON -DUSE_CUDNN=ON -DUSE_XGBOOST=ON -DUSE_SIMSEARCH=ON -DUSE_TSNE=ON -DCUDA_ARCH="-gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_62,code=sm_62"
cmake .. -DUSE_TF=ON -DUSE_CUDNN=ON -DUSE_XGBOOST=ON -DUSE_SIMSEARCH=ON -DUSE_TSNE=ON -DCUDA_ARCH="-gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_62,code=sm_62"
make -j
;;

"tf-cpu")
cmake . -DUSE_TF=ON -DUSE_TF_CPU_ONLY=ON -DUSE_CUDNN=ON -DUSE_XGBOOST=ON -DUSE_SIMSEARCH=ON -DUSE_TSNE=ON -DCUDA_ARCH="-gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_62,code=sm_62"
cmake .. -DUSE_TF=ON -DUSE_TF_CPU_ONLY=ON -DUSE_CUDNN=ON -DUSE_XGBOOST=ON -DUSE_SIMSEARCH=ON -DUSE_TSNE=ON -DCUDA_ARCH="-gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_62,code=sm_62"
make -j
;;

"caffe-cpu-tf")
cmake . -DUSE_TF=ON -DUSE_TF_CPU_ONLY=ON -DUSE_CUDNN=ON -DUSE_XGBOOST=ON -DUSE_SIMSEARCH=ON -DUSE_TSNE=ON -DCUDA_ARCH="-gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_61,code=sm_61"
cmake .. -DUSE_TF=ON -DUSE_TF_CPU_ONLY=ON -DUSE_CUDNN=ON -DUSE_XGBOOST=ON -DUSE_SIMSEARCH=ON -DUSE_TSNE=ON -DCUDA_ARCH="-gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_61,code=sm_61"
make
;;

"caffe-tf")
cmake . -DUSE_TF=ON -DUSE_CUDNN=ON -DUSE_SIMSEARCH=ON -DUSE_TSNE=ON -DCUDA_ARCH="-gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_61,code=sm_61"
cmake .. -DUSE_TF=ON -DUSE_CUDNN=ON -DUSE_SIMSEARCH=ON -DUSE_TSNE=ON -DCUDA_ARCH="-gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_61,code=sm_61"
make -j
;;

"caffe2")
cmake . -DUSE_CUDNN=ON -DUSE_XGBOOST=ON -DUSE_SIMSEARCH=ON -DUSE_TSNE=ON -DUSE_CAFFE2=ON -DCUDA_ARCH="-gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_62,code=sm_62"
cmake .. -DUSE_CUDNN=ON -DUSE_XGBOOST=ON -DUSE_SIMSEARCH=ON -DUSE_TSNE=ON -DUSE_CAFFE2=ON -DCUDA_ARCH="-gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_62,code=sm_62"
make -j
;;

"p100")
cmake . -DUSE_CUDNN=ON -DUSE_SIMSEARCH=ON -DUSE_TSNE=ON -DCUDA_ARCH="-gencode arch=compute_60,code=sm_60"
cmake .. -DUSE_CUDNN=ON -DUSE_SIMSEARCH=ON -DUSE_TSNE=ON -DCUDA_ARCH="-gencode arch=compute_60,code=sm_60"
make -j
;;

"volta")
cmake . -DUSE_CUDNN=ON -DUSE_SIMSEARCH=ON -DUSE_TSNE=ON -DCUDA_ARCH="-gencode arch=compute_70,code=sm_70"
cmake .. -DUSE_CUDNN=ON -DUSE_SIMSEARCH=ON -DUSE_TSNE=ON -DCUDA_ARCH="-gencode arch=compute_70,code=sm_70"
make -j
;;

"volta-faiss")
cmake . -DUSE_CUDNN=ON -DUSE_FAISS=ON -DUSE_SIMSEARCH=ON -DUSE_TSNE=ON -DCUDA_ARCH="-gencode arch=compute_70,code=sm_70"
cmake .. -DUSE_CUDNN=ON -DUSE_FAISS=ON -DUSE_SIMSEARCH=ON -DUSE_TSNE=ON -DCUDA_ARCH="-gencode arch=compute_70,code=sm_70"
make -j
;;

"faiss")
cmake . -DUSE_CUDNN=ON -DUSE_FAISS=ON -DUSE_XGBOOST=ON -DUSE_SIMSEARCH=ON -DUSE_TSNE=ON -DCUDA_ARCH="-gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_62,code=sm_62"
cmake .. -DUSE_CUDNN=ON -DUSE_FAISS=ON -DUSE_XGBOOST=ON -DUSE_SIMSEARCH=ON -DUSE_TSNE=ON -DCUDA_ARCH="-gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_62,code=sm_62"
make -j
;;

*)
cmake . -DUSE_CUDNN=ON -DUSE_XGBOOST=ON -DUSE_SIMSEARCH=ON -DUSE_TSNE=ON -DCUDA_ARCH="-gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_62,code=sm_62"
cmake .. -DUSE_CUDNN=ON -DUSE_XGBOOST=ON -DUSE_SIMSEARCH=ON -DUSE_TSNE=ON -DCUDA_ARCH="-gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_62,code=sm_62"
make -j
;;
esac
Expand Down
14 changes: 12 additions & 2 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ where `path/to/volume` is the path to your local volume that you'd like to attac

## Build Deepdetect Docker images

Dockerfiles are stored in the "docker" folder, but **you must launch build from root directory**.
Dockerfiles are stored in the "docker" folder, but **you must launch build from root directory**.

We choose to prefix Dockerfiles with target architecture :
* cpu-armv7.Dockerfile
Expand All @@ -123,7 +123,7 @@ We choose to prefix Dockerfiles with target architecture :

### Build script

Build script is avaliable in docker path : build/build.sh
Build script is available in docker path : build/build.sh

Docker build-arg : DEEPDETECT_BUILD

Expand All @@ -146,6 +146,16 @@ Expected values :
* faiss
* default

#### Prepare build environment

Create build directory and put build script inside :

```bash
mkdir build
cd build
cp -a ../build.sh .
```

#### Launch build with environments variables

```bash
Expand Down
17 changes: 12 additions & 5 deletions docker/cpu-armv7.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,24 @@ RUN cmake . && \
make install && \
cp /usr/local/lib/libcurlpp.* /usr/lib/

# Build Deepdetect
# Copy Deepdetect sources files
ADD ./ /opt/deepdetect
WORKDIR /opt/deepdetect/
RUN ./build.sh

# Build Deepdetect
RUN mkdir build && \
cd build && \
cp -a ../build.sh . && \
./build.sh

# Copy libs to /tmp/libs for next build stage
RUN ./get_libs.sh
RUN ./docker/get_libs.sh

# Build final Docker image
FROM armv7/armhf-ubuntu:16.04

# Copy Deepdetect binaries from previous step
COPY --from=build /opt/deepdetect/main /opt/deepdetect/main
COPY --from=build /opt/deepdetect/build/main /opt/deepdetect/build/main

LABEL maintainer="[email protected]"
LABEL description="DeepDetect deep learning server & API / CPU NCNN-only RPi3 version"
Expand Down Expand Up @@ -99,7 +106,7 @@ RUN mkdir /opt/models
# Copy missings libs from build step
COPY --from=build /tmp/lib/* /usr/lib/

WORKDIR /opt/deepdetect/main
WORKDIR /opt/deepdetect/build/main
VOLUME ["/data"]

# Set entrypoint
Expand Down
30 changes: 23 additions & 7 deletions docker/cpu.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ RUN apt update && \
# Install build dependencies
RUN apt-get update -y && \
apt-get install -y git \
cmake \
automake \
build-essential \
openjdk-8-jdk \
Expand Down Expand Up @@ -59,28 +58,45 @@ RUN apt-get update -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Need cmake > 3.10 : https://github.com/jolibrain/ncnn/blob/master/CMakeLists.txt#L14
RUN mkdir /tmp/cmake && cd /tmp/cmake && \
apt remove cmake && \
wget https://cmake.org/files/v3.10/cmake-3.10.3.tar.gz && \
tar xf cmake-3.10.3.tar.gz && \
cd cmake-3.10.3 && \
./configure && \
make install && \
rm -rf /tmp/cmake

WORKDIR /opt
RUN git clone https://github.com/jpbarrette/curlpp.git
WORKDIR /opt/curlpp
RUN cmake . && \
make install && \
cp /usr/local/lib/libcurlpp.* /usr/lib/

# Build Deepdetect
# Copy Deepdetect sources files
ADD ./ /opt/deepdetect
ADD ./docker/*.sh /opt/deepdetect
WORKDIR /opt/deepdetect/
RUN ./build.sh

# Build Deepdetect
RUN mkdir build && \
cd build && \
cp -a ../build.sh . && \
./build.sh

# Copy libs to /tmp/libs for next build stage
RUN ./get_libs.sh
RUN ./docker/get_libs.sh

# Build final Docker image
FROM ubuntu:16.04

# Download default Deepdetect models
ARG DEEPDETECT_DEFAULT_MODELS=true

# Copy Deepdetect binaries from previous step
COPY --from=build /opt/deepdetect/main /opt/deepdetect/main
COPY --from=build /opt/deepdetect/build/main /opt/deepdetect/build/main
COPY --from=build /opt/deepdetect/get_models.sh /opt/deepdetect/get_models.sh

LABEL maintainer="[email protected]"
LABEL description="DeepDetect deep learning server & API / CPU version"
Expand Down Expand Up @@ -126,7 +142,7 @@ COPY --chown=dd --from=build /opt/deepdetect/templates/caffe/googlenet/*prototxt
COPY --chown=dd --from=build /opt/deepdetect/templates/caffe/resnet_50/*prototxt /opt/models/resnet_50/
COPY --from=build /tmp/lib/* /usr/lib/

WORKDIR /opt/deepdetect/main
WORKDIR /opt/deepdetect/build/main
VOLUME ["/data"]

# Set entrypoint
Expand Down
17 changes: 12 additions & 5 deletions docker/gpu.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,28 @@ RUN cmake . && \
make install && \
cp /usr/local/lib/libcurlpp.* /usr/lib/

# Build Deepdetect
# Copy Deepdetect sources files
ADD ./ /opt/deepdetect
WORKDIR /opt/deepdetect/

RUN ./build.sh
# Build Deepdetect
RUN mkdir build && \
cd build && \
cp -a ../build.sh . && \
./build.sh

# Copy libs to /tmp/libs for next build stage
RUN ./get_libs.sh
RUN ./docker/get_libs.sh

# Build final Docker image
FROM nvidia/cuda:${CUDA_VERSION}-runtime-ubuntu16.04

# Download default Deepdetect models
ARG DEEPDETECT_DEFAULT_MODELS=true

# Copy Deepdetect binaries from previous step
COPY --from=build /opt/deepdetect/main /opt/deepdetect/main
COPY --from=build /opt/deepdetect/build/main /opt/deepdetect/build/main
COPY --from=build /opt/deepdetect/get_models.sh /opt/deepdetect/get_models.sh

LABEL maintainer="[email protected]"
LABEL description="DeepDetect deep learning server & API / GPU version"
Expand Down Expand Up @@ -135,7 +142,7 @@ COPY --chown=dd --from=build /opt/deepdetect/templates/caffe/googlenet/*prototxt
COPY --chown=dd --from=build /opt/deepdetect/templates/caffe/resnet_50/*prototxt /opt/models/resnet_50/
COPY --from=build /tmp/lib/* /usr/lib/

WORKDIR /opt/deepdetect/main
WORKDIR /opt/deepdetect/build/main
VOLUME ["/data"]

# Set entrypoint
Expand Down

0 comments on commit 10666b8

Please sign in to comment.