Skip to content

Commit 493fc65

Browse files
committed
SINGA-303 Create conda package
Update Dockerfile for jenkins to install conda tools Reset the jenkin's jobs to 1. compile and do unittest of SINGA GPU version 2. create conda packages for GPU SINGA Update the conda meta.yml to replace libprotobuf with protobuf, as protobuf includes the libs. Add conda-forge into the channels before conda build for osx Enable rpath for macosx, otherwise the lib files will link to itself but with a fixed path (from otool -L) Replace nightly with main for the label of the conda package to main, otherwise we need 'conda install -c nusdbsystem/label/nightly singa'
1 parent 3417dd9 commit 493fc65

8 files changed

Lines changed: 60 additions & 72 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ IF(UNIX)
3434
ENDIF()
3535
IF(APPLE)
3636
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++ -g -O2 -fPIC -Wall -pthread")
37+
SET(CMAKE_MACOSX_RPATH 1)
3738
ENDIF()
3839

3940
IF(WIN32)

tool/conda/meta.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@ requirements:
1717
- numpy >=1.10
1818
- swig >=3.0
1919
- openblas >=0.2.10
20-
- libprotobuf 3.0.0
20+
- protobuf 3.0.0
2121
- glog 0.3.4
2222

2323
run:
2424
- python 2.7*
2525
- numpy >=1.10
26-
- libprotobuf 3.0.0
2726
- protobuf 3.0.0
2827
- glog 0.3.4
2928
- openblas >=0.2.10

tool/jenkins/README.md

Lines changed: 33 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,18 @@ Create a multi-configuration project and configure project as follows:
1717

1818
### Description
1919
This job automatically pulls latest commits from Apache incubator-singa github repository, then for different environments
20-
* compile and test SINGA
21-
* create PySINGA wheel files
22-
* create Debian packages
20+
21+
* compile and test SINGA on GPUs
22+
* create Debian GPU packages
23+
* create anaconda GPU packages
24+
25+
The working nodes (or Docker containers) are configured in Jenkins-Manage Jenkins-Mange Nodes.
26+
Each node should configure the following environment variable
27+
1. CUDA_VERSION, e.g., 7.5
28+
2. CUDNN_VERSION e.g, 5
29+
3. ANACONDA_UPLOAD_TOKEN
30+
4. SINGA_NAME=singa-cuda${CUDA_VERSION}-cudnn${CUDNN_VERSION}
31+
5. OS_VERSION, e.g., ubuntu14.04
2332

2433
### General
2534
* Discard old builds - Max # of builds to keep - 50
@@ -33,31 +42,32 @@ This job automatically pulls latest commits from Apache incubator-singa github r
3342
* Poll SCM - Schedule - ``H/30 * * * *`` (pull every 30 minutes)
3443

3544
### Configuration Matrix
36-
* User-defined Axis - name ``lang`` values ``CPP CUDA``
45+
* User-defined Axis - name ``lang`` values ``CUDA`` (Add CPP if you want to test CPU code)
3746
* Slave - name ``env`` Node/label: tick available nodes
3847

3948
### Build
40-
* Execute shell - command - ``bash -ex tool/jenkins/jenkins_wheel.sh $lang``
49+
* compile and do unit test on GPU
50+
Execute shell - command - ``bash -ex tool/jenkins/test.sh $lang``
51+
`$lang` is set in **Configuration Matrix* section
4152

42-
### Post-build Actions
43-
* Publish JUnit test result report - Test report XMLs - ``**/gtest.xml, **/unittest.xml``
44-
* (optional) Archive the artifacts - ``build/python/dist/**.whl, build/debian/**.deb``
45-
* Send build artifacts (wheel) over SSH
46-
* jenkins_wheel.sh packages the .whl file into $BUILD_ID.tar.gz. Inside the tar file,
47-
the folder layout is `build_id/commit_hash/os_lang/*.whl`, where `os_lang` is the combination of os version, device programming language (cuda/cpp/opencl) and cudnn version.
48-
* In `Manage Jenkins`-`Configure System`, configure the SSH for connecting to the remote public server and set the target folder location
49-
* Source files - `build/python/dist/*.tar.gz`
50-
* Remove prefix - `build/python/dist`
51-
* Remote directory - `wheel/linux`
52-
* Exec a command on the remote server to decompress the package and add a symlink to the latest build. E.g., on a Solaris server the command is
53+
* create Debian package
54+
Execute shell - command - ``bash -ex tool/debian/build.sh --python --$lang``
5355

54-
cd <target_folder>/wheel/linux && gunzip $BUILD_ID.tar.gz && tar xf $BUILD_ID.tar && chmod -R 755 $BUILD_ID && /bin/rm -f $BUILD_ID.tar && /bin/rm -f latest && ln -s $BUILD_ID/* latest
56+
* create conda package
57+
Execute shell - command -
5558

56-
* The file links on the remote public server would be like
59+
git push --mirror <https://username:auth_token@github.com/mirror_repo>
60+
/root/miniconda/conda tool/conda/
61+
export CONDA_BLD_PATH=/root/conda-bld-$BUILD_NUMBER
62+
mkdir $CONDA_BLD_PATH
63+
/root/miniconda/anaconda -t $ANACONDA_UPLOAD_TOKEN upload -u $USER -l main $CONDA_BLD_PATH/$OS/singa-*.tar.bz2 --force
5764

58-
wheel/Linux/32/84d56b7/ubuntu16.04-cpp/singa-1.0.1-py2-none-any.whl
59-
wheel/Linux/32/84d56b7/ubuntu16.04-cuda8.0-cudnn5/singa-1.0.1-py2-none-any.whl
65+
It first pushes to a mirror site to invoke travis-ci for CPU package creation;
66+
Then it creates the conda package for GPU and uploads the package.
6067

68+
### Post-build Actions
69+
* Publish JUnit test result report - Test report XMLs - ``**/gtest.xml, **/unittest.xml``
70+
* (optional) Archive the artifacts - ``build/python/dist/**.whl, build/debian/**.deb``
6171
* Send build artifacts (Debian package) over SSH for wheel
6272
* ../debian/build.sh packages the .deb file into $BUILD_ID.tar.gz. Inside the tar file,
6373
the folder layout is `build_id/commit_hash/os_lang/*.deb`, where `os_lang` is the combination of os version, device programming language (cuda/cpp/opencl) and cudnn version.
@@ -71,29 +81,12 @@ This job automatically pulls latest commits from Apache incubator-singa github r
7181

7282
* The file links on the remote public server would be like
7383

74-
debian/32/84d56b7/ubuntu16.04-cpp/singa-1.0.1-py2-none-any.whl
75-
debian/32/84d56b7/ubuntu16.04-cuda8.0-cudnn5/singa-1.0.1-py2-none-any.whl
76-
77-
### Notes for Mac OS X
78-
The Job configuration is the same as stated above except,
79-
* Machines (or docker containers) with Mac OS X should be configured as jenkin nodes; the following environmental variables should be exported in the .bashrc or in the node configuration
80-
81-
# 10.11 or 10.12
82-
export OS_VERSION=macosx10.11
83-
# if using Homebrew
84-
export PATH=/usr/local/bin:$PATH
85-
# for numpy.i
86-
export CPLUS_INCLUDE_PATH=`python -c "import numpy; print numpy.get_include()"`:$CPLUS_INCLUDE_PATH
87-
88-
* Set User-defined Axis to None and tick only Mac OS X nodes
84+
debian/32/84d56b7/ubuntu16.04-cpp/singa-1.0.1.deb
85+
debian/32/84d56b7/ubuntu16.04-cuda8.0-cudnn5/singa-1.0.1.deb
8986

90-
* Send build artifacts (wheel) over SSH
91-
* The remote directly -- `wheel/macosx`
92-
* The shell command is
9387

94-
cd <target_folder>/wheel/macosx && gunzip $BUILD_ID.tar.gz && tar xf $BUILD_ID.tar && chmod -R 755 $BUILD_ID && /bin/rm -f $BUILD_ID.tar && /bin/rm -f latest && ln -s $BUILD_ID/* latest
9588
### Docker Images
96-
We provide in `docker` a number of singa docker images for Jenkins to use as slaves.
89+
We provide in a number of singa docker [images](../docker) for Jenkins to use as slaves.
9790
To run the docker images,
9891

9992
nvidia-docker run --name <jenkins-slaveXX> -d <Image ID>

tool/jenkins/docker/ubuntu14.04/devel/Dockerfile

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
#
1717
# Base unbuntu 14.04 image from nvidia/cuda
1818
# Change tags to build with different cuda/cudnn versions:
19-
# FROM nvidia/cuda:8.0-cudnn5-devel
20-
# FROM nvidia/cuda:7.5-cudnn5-devel
21-
# FROM nvidia/cuda:7.5-cudnn4-devel
22-
# FROM nvidia/cuda:7.0-cudnn4-devel
23-
FROM nvidia/cuda:7.5-cudnn5-devel
19+
# FROM nvidia/cuda:8.0-cudnn5-devel-ubuntu14.04
20+
# FROM nvidia/cuda:7.5-cudnn5-devel-ubuntu14.04
21+
# FROM nvidia/cuda:7.5-cudnn4-devel-ubuntu14.04
22+
# FROM nvidia/cuda:7.0-cudnn4-devel-ubuntu14.04
23+
FROM nvidia/cuda:7.5-cudnn5-devel-ubuntu14.04
2424

2525
# install dependencies
2626
RUN apt-get update \
27-
&& apt-get install -y --no-install-recommends git build-essential autoconf libtool cmake libpcre3-dev python-dev python-pip wget openssh-server \
27+
&& apt-get install -y --no-install-recommends git build-essential autoconf libtool cmake libprotobuf-dev libopenblas-dev libpcre3-dev python-dev python-pip protobuf-compiler wget openssh-server \
2828
&& apt-get clean && apt-get autoremove && apt-get autoclean \
2929
&& rm -rf /var/lib/apt/lists/* \
3030
&& pip install -U pip wheel numpy setuptools unittest-xml-reporting protobuf
@@ -35,14 +35,22 @@ RUN wget http://prdownloads.sourceforge.net/swig/swig-3.0.10.tar.gz && \
3535
tar zxf swig-3.0.10.tar.gz && cd swig-3.0.10 && \
3636
./configure && make && make install
3737

38+
# install conda, conda-build and anaconda-client
39+
RUN wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh;
40+
RUN bash miniconda.sh -b -p $HOME/miniconda
41+
RUN $HOME/miniconda/bin/conda config --set always_yes yes --set changeps1 no
42+
RUN $HOME/miniconda/bin/conda update -q conda
43+
RUN $HOME/miniconda/bin/conda install conda-build
44+
RUN $HOME/miniconda/bin/conda install anaconda-client
45+
ENV PATH $HOME/miniconda/bin:${PATH}
46+
3847
# set environment
3948
ENV CPLUS_INCLUDE_PATH /usr/local/lib/python2.7/dist-packages/numpy/core/include:${CPLUS_INCLUDE_PATH}
40-
ENV CMAKE_INCLUDE_PATH /usr/local/cuda/include:${CMAKE_INCLUDE_PATH}
41-
ENV CMAKE_LIBRARY_PATH /usr/local/cuda/lib64:${CMAKE_LIBRARY_PATH}
42-
ENV OS_VERSION ubuntu14.04
49+
# ENV CMAKE_INCLUDE_PATH /usr/local/cuda/include:${CMAKE_INCLUDE_PATH}
50+
# ENV CMAKE_LIBRARY_PATH /usr/local/cuda/lib64:${CMAKE_LIBRARY_PATH}
4351

4452
# download singa source
45-
RUN git clone https://github.com/apache/incubator-singa.git
53+
# RUN git clone https://github.com/apache/incubator-singa.git
4654

4755
# config ssh service
4856
RUN mkdir /var/run/sshd

tool/jenkins/docker/ubuntu16.04/devel/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ RUN apt-get update \
3636
ENV CPLUS_INCLUDE_PATH /usr/local/lib/python2.7/dist-packages/numpy/core/include:${CPLUS_INCLUDE_PATH}
3737
ENV CMAKE_INCLUDE_PATH /usr/local/cuda/include:${CMAKE_INCLUDE_PATH}
3838
ENV CMAKE_LIBRARY_PATH /usr/local/cuda/lib64:${CMAKE_LIBRARY_PATH}
39-
ENV OS_VERSION ubuntu16.04
4039

4140
# download singa source
4241
RUN git clone https://github.com/apache/incubator-singa.git
Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,24 @@
1818
# * limitations under the License.
1919
# */
2020

21-
# This script is used by Jenkins to compile and distribute SINGA wheel file.
21+
# This script is used by Jenkins to compile and test SINGA
2222

23-
echo Compile, test and distribute PySINGA...
23+
echo Compile and test SINGA...
2424
echo parameters: $1
2525
echo workspace: `pwd`
2626
echo OS version: `cat /etc/issue`
2727
echo kernal version: `uname -a`
2828
echo CUDA version: $CUDA_VERSION
2929
echo CUDNN version: $CUDNN_VERSION
30-
echo OS name: $OS_VERSION
3130
COMMIT=`git rev-parse --short HEAD`
3231
echo COMMIT HASH: $COMMIT
3332
# set parameters
3433
CUDA="OFF"
3534
CUDNN="OFF"
36-
FOLDER=$BUILD_NUMBER/$COMMIT/$OS_VERSION-cpp
3735
if [ $1 = "CUDA" ]; then
3836
CUDA="ON"
3937
CUDNN="ON"
40-
FOLDER=$BUILD_NUMBER/$COMMIT/$OS_VERSION-cuda$CUDA_VERSION-cudnn$CUDNN_VERSION
4138
fi
42-
echo wheel file folder: build/python/dist/whl/$FOLDER
4339

4440
# setup env
4541
rm -rf build
@@ -51,20 +47,11 @@ fi
5147

5248
# compile singa c++
5349
cd build
54-
cmake -DUSE_CUDNN=$CUDNN -DUSE_CUDA=$CUDA -DUSE_MODULES=ON $EXTRA_ARGS ../
50+
cmake -DUSE_CUDA=$CUDA -DENABLE_TEST=ON $EXTRA_ARGS ../
5551
make
5652
# unit test cpp code
5753
./bin/test_singa --gtest_output=xml:./gtest.xml
58-
# compile pysinga
59-
cd python
60-
python setup.py bdist_wheel
61-
# mv whl file to a folder whose name identifies the OS, CUDA, CUDNN etc.
62-
cd dist
63-
mkdir -p $FOLDER
64-
mv *.whl $FOLDER/
65-
tar czf $BUILD_NUMBER.tar.gz $FOLDER/*
66-
6754
# unit test python code
68-
cd ../../../test/python
55+
cd ../test/python
6956
PYTHONPATH=../../build/python/ python run.py
7057
echo Job finished...

tool/travis/conda.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ export PATH="$HOME/miniconda/bin:$PATH"
2727
conda config --set anaconda_upload no
2828

2929
# save the package at given folder, then we can upload using singa-*.tar.bz2
30-
suffix=`TZ=Asia/Singapore date +%Y-%m-%d-%H-%M-%S`
30+
suffix=$TRAVIS_JOB_NUMBER #`TZ=Asia/Singapore date +%Y-%m-%d-%H-%M-%S`
3131
export CONDA_BLD_PATH=~/conda-bld-$suffix
3232
mkdir $CONDA_BLD_PATH
3333

3434
conda build tool/conda/
3535

3636
# turn off debug to hide the token in travis log
3737
set +x
38-
anaconda -t $ANACONDA_UPLOAD_TOKEN upload -u $USER -l nightly $CONDA_BLD_PATH/$OS/singa-*.tar.bz2 --force
38+
anaconda -t $ANACONDA_UPLOAD_TOKEN upload -u $USER -l main $CONDA_BLD_PATH/$OS/singa-*.tar.bz2 --force

tool/travis/depends.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,5 @@ else
4343
conda update -q conda
4444
conda install conda-build
4545
conda install anaconda-client
46+
conda config --add channels conda-forge
4647
fi

0 commit comments

Comments
 (0)