You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@singa.apache.org by zh...@apache.org on 2019/03/19 09:53:52 UTC

[incubator-singa] 01/02: SINGA-432 Update depdent lib versions in conda-build config

This is an automated email from the ASF dual-hosted git repository.

zhaojing pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-singa.git

commit ba7ffc0f61b519a71a8b21665361a2e1411a312c
Author: Wang Wei <wa...@gmail.com>
AuthorDate: Fri Mar 15 22:40:30 2019 +0800

    SINGA-432 Update depdent lib versions in conda-build config
    
    Update the dependent libs and gcc using [conda-build 3.0|https://www.anaconda.com/package-better-conda-build-3/.]
    
    introduce the build, host and run sections in meta.yaml
    introduce the conda_build_config.yaml to configure the lib versions. note the gcc version must be 5.4 as cuda does not support gcc>=6.
    use the compiler selected by conda via c_complier() cxx_compiler()
    use the cudnn from anaconda.
    move docker for conda build into tool/conda. Now the dockerfile for conda build and the dockerfile for devel are different. The former one uses the libs from anaconda. The later one uses the latest libs from ubuntu.
---
 tool/conda/cpu/meta.yaml                           |  2 +-
 .../conda/cuda => conda/docker/cuda10}/Dockerfile  |  4 +-
 .../conda/cuda => conda/docker/cuda9}/Dockerfile   |  4 +-
 tool/conda/gpu/meta.yaml                           |  2 +-
 tool/conda/singa/build.sh                          | 17 ++++-----
 .../meta.yaml => singa/conda_build_config.yaml}    | 26 ++++++-------
 tool/conda/singa/meta.yaml                         | 44 ++++++++++++----------
 tool/docker/devel/{native => }/centos6/Dockerfile  |  0
 .../devel/{native => }/ubuntu/cpu/py3/Dockerfile   |  0
 .../devel/{native => }/ubuntu/cuda/py2/Dockerfile  |  0
 .../devel/{native => }/ubuntu/cuda/py3/Dockerfile  |  0
 .../{native => }/ubuntu/cuda10/py3/Dockerfile      |  0
 12 files changed, 49 insertions(+), 50 deletions(-)

diff --git a/tool/conda/cpu/meta.yaml b/tool/conda/cpu/meta.yaml
index 6c6f7cb..169dea8 100644
--- a/tool/conda/cpu/meta.yaml
+++ b/tool/conda/cpu/meta.yaml
@@ -24,7 +24,7 @@ package:
 
 requirements:
   run:
-    - singa 1.2.0 py36_cpu
+    - singa 1.2.0 cpu
 
 about:
   home: http://singa.apache.org/
diff --git a/tool/docker/devel/conda/cuda/Dockerfile b/tool/conda/docker/cuda10/Dockerfile
similarity index 93%
copy from tool/docker/devel/conda/cuda/Dockerfile
copy to tool/conda/docker/cuda10/Dockerfile
index debafe6..1b93cf2 100644
--- a/tool/docker/devel/conda/cuda/Dockerfile
+++ b/tool/conda/docker/cuda10/Dockerfile
@@ -16,7 +16,7 @@
 #
 
 # Change tags to build with different cuda/cudnn versions:
-FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04
+FROM nvidia/cuda:10.0-devel-ubuntu16.04
 
 # install dependencies
 RUN apt-get update \
@@ -45,8 +45,6 @@ RUN apt-get update \
     # config ssh service
     && mkdir /var/run/sshd \
     && echo 'root:singa' | chpasswd \
-    # for ubuntu 14.04
-    # RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
     # for ubuntu 16.04 prohibit
     && sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config \
     # SSH login fix. Otherwise user is kicked off after login
diff --git a/tool/docker/devel/conda/cuda/Dockerfile b/tool/conda/docker/cuda9/Dockerfile
similarity index 93%
rename from tool/docker/devel/conda/cuda/Dockerfile
rename to tool/conda/docker/cuda9/Dockerfile
index debafe6..e3e1842 100644
--- a/tool/docker/devel/conda/cuda/Dockerfile
+++ b/tool/conda/docker/cuda9/Dockerfile
@@ -16,7 +16,7 @@
 #
 
 # Change tags to build with different cuda/cudnn versions:
-FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04
+FROM nvidia/cuda:9.0-devel-ubuntu16.04
 
 # install dependencies
 RUN apt-get update \
@@ -45,8 +45,6 @@ RUN apt-get update \
     # config ssh service
     && mkdir /var/run/sshd \
     && echo 'root:singa' | chpasswd \
-    # for ubuntu 14.04
-    # RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
     # for ubuntu 16.04 prohibit
     && sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config \
     # SSH login fix. Otherwise user is kicked off after login
diff --git a/tool/conda/gpu/meta.yaml b/tool/conda/gpu/meta.yaml
index b78ef29..57c5b21 100644
--- a/tool/conda/gpu/meta.yaml
+++ b/tool/conda/gpu/meta.yaml
@@ -23,7 +23,7 @@ package:
 
 requirements:
   run:
-    - singa 1.2.0 py36_cuda9.0_cudnn7.1.2
+    - singa 1.2.0 cudnn7.3.1_cuda10.0
 
 about:
   home: http://singa.apache.org/
diff --git a/tool/conda/singa/build.sh b/tool/conda/singa/build.sh
index b54e451..f5a3acf 100644
--- a/tool/conda/singa/build.sh
+++ b/tool/conda/singa/build.sh
@@ -23,23 +23,22 @@ export CMAKE_PREFIX_PATH=$PREFIX:$CMAKE_PREFIX_PATH
 export CMAKE_INCLUDE_PATH=$PREFIX/include:$CMAKE_INCLUDE_PATH
 export CMAKE_LIBRARY_PATH=$PREFIX/lib:$CMAKE_LIBRARY_PATH
 
-echo "----------------------$CUDNN_PATH---------------"
 
-if [ -z ${CUDNN_PATH+x} ]; then
+
+# USE_PYTHON3=OFF
+# PY3K is set by conda
+# if  [ "$PY3K" == "1" ]; then USE_PYTHON3=ON; fi
+
+if [ -z ${CUDA+x} ]; then
 	USE_CUDA=OFF
 else
 	USE_CUDA=ON
-	cp $CUDNN_PATH/include/* $PREFIX/include/ 
-	cp -P $CUDNN_PATH/lib64/libcudnn.so* $PREFIX/lib/
 fi
 
-USE_PYTHON3=OFF
-# PY3K is set by conda
-if  [ "$PY3K" == "1" ]; then USE_PYTHON3=ON; fi
-
 
 mkdir build
 cd build
-cmake -DCMAKE_INSTALL_PREFIX=$PREFIX -DUSE_CUDA=$USE_CUDA -DUSE_PYTHON3=$USE_PYTHON3 ..
+cmake -DCMAKE_INSTALL_PREFIX=$PREFIX -DUSE_CUDA=$USE_CUDA \
+	-DUSE_PYTHON3=ON -DUSE_MKLDNN=ON ..
 make
 make install
diff --git a/tool/conda/cpu/meta.yaml b/tool/conda/singa/conda_build_config.yaml
similarity index 60%
copy from tool/conda/cpu/meta.yaml
copy to tool/conda/singa/conda_build_config.yaml
index 6c6f7cb..8b25cd6 100644
--- a/tool/conda/cpu/meta.yaml
+++ b/tool/conda/singa/conda_build_config.yaml
@@ -17,16 +17,16 @@
 # under the License.
 #
 
-
-package:
-  name: singa-cpu
-  version: 1.2.0
-
-requirements:
-  run:
-    - singa 1.2.0 py36_cpu
-
-about:
-  home: http://singa.apache.org/
-  license: Apache V2
-  summary: SINGA is an Apache Incubating project for providing distributed deep learning. Apache disclaimers http://singa.apache.org/en/index.html#disclaimers
+c_compiler_version:         # [linux]
+    - 5.4                   # [linux]
+cxx_compiler_version:       # [linux]
+    - 5.4                   # [linux]
+cudnn:                      # [linux]
+    - "7.3.1 cuda10.0_0"    # [environ.get("CUDA")=="10.0"]
+    - "7.3.1 cuda9.0_0"     # [environ.get("CUDA")=="9.0"]
+mkldnn:
+    - 0.14
+build_str:
+    - "cudnn7.3.1_cuda10.0" # [environ.get("CUDA")=="10.0"]
+    - "cudnn7.3.1_cuda9.0"  # [environ.get("CUDA")=="9.0"]
+    - "cpu"                 # [environ.get("CUDA")== ""]
\ No newline at end of file
diff --git a/tool/conda/singa/meta.yaml b/tool/conda/singa/meta.yaml
index ff576ea..eaca5c5 100644
--- a/tool/conda/singa/meta.yaml
+++ b/tool/conda/singa/meta.yaml
@@ -27,35 +27,39 @@ source:
 
 build:
   number: 0
-  string: py{{py}}_{{ environ.get('BUILD_STR', 'cpu') }}
-  script_env:
-    - CUDNN_PATH
+  string: {{ build_str }}
+  # py{{py}}_{{ environ.get('BUILD_STR', 'cpu') }}
 
 requirements:
   build:
-    - swig 3.0.10
-    - openblas 0.2.19
-    - protobuf 3.2.0
-    - glog 0.3.4
-    - libgfortran 3.0.0 # [osx]
-    - gcc 4.8.5 # [linux]
+    - {{ compiler('cxx') }}
+    - {{ compiler('c') }}
+    - cmake >=3.12.2
+    - make # [unix]
+
+  host:
+    - swig 3.0.12
+    - openblas 0.3.3
+    - protobuf 3.4.0
+    - glog 0.3.5
     - python 3.6*
-    - numpy 1.12.0
+    - numpy 1.16.0
+    - cudnn {{ cudnn }}       # ['cudnn' in build_str]
+    - mkl-dnn {{ mkldnn }}
 
   run:
-    - openblas 0.2.19
-    - protobuf 3.2.0
-    - glog 0.3.4
-    - libgfortran 3.0.0 # [osx]
-    - libgcc 4.8.5 # [linux]
+    - {{ pin_compatible('libopenblas', max_pin='x.x') }}
+    - {{ pin_compatible('libprotobuf', max_pin='x.x') }}
+    - {{ pin_compatible('glog', max_pin='x.x') }}
+    - {{ pin_compatible('numpy', max_pin='x.x') }}
+    - {{ pin_compatible('mkl-dnn', max_pin='x.x') }}
+    - cudnn {{ cudnn }}       # ['cudnn' in build_str]
     - python 3.6*
-    - numpy >=1.12.0
-    - flask >=0.10.1
-    - flask-cors >=3.0.2
-    - pillow >=2.3.0
-    - future >=0.16.0
+    - pillow
+    - future
     - tqdm
 
+
 test:
   source_files:
     - test/python/*.py
diff --git a/tool/docker/devel/native/centos6/Dockerfile b/tool/docker/devel/centos6/Dockerfile
similarity index 100%
rename from tool/docker/devel/native/centos6/Dockerfile
rename to tool/docker/devel/centos6/Dockerfile
diff --git a/tool/docker/devel/native/ubuntu/cpu/py3/Dockerfile b/tool/docker/devel/ubuntu/cpu/py3/Dockerfile
similarity index 100%
rename from tool/docker/devel/native/ubuntu/cpu/py3/Dockerfile
rename to tool/docker/devel/ubuntu/cpu/py3/Dockerfile
diff --git a/tool/docker/devel/native/ubuntu/cuda/py2/Dockerfile b/tool/docker/devel/ubuntu/cuda/py2/Dockerfile
similarity index 100%
rename from tool/docker/devel/native/ubuntu/cuda/py2/Dockerfile
rename to tool/docker/devel/ubuntu/cuda/py2/Dockerfile
diff --git a/tool/docker/devel/native/ubuntu/cuda/py3/Dockerfile b/tool/docker/devel/ubuntu/cuda/py3/Dockerfile
similarity index 100%
rename from tool/docker/devel/native/ubuntu/cuda/py3/Dockerfile
rename to tool/docker/devel/ubuntu/cuda/py3/Dockerfile
diff --git a/tool/docker/devel/native/ubuntu/cuda10/py3/Dockerfile b/tool/docker/devel/ubuntu/cuda10/py3/Dockerfile
similarity index 100%
rename from tool/docker/devel/native/ubuntu/cuda10/py3/Dockerfile
rename to tool/docker/devel/ubuntu/cuda10/py3/Dockerfile