Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Static build for Python #13916

Merged
merged 7 commits into from
Jan 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions ci/docker/runtime_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1305,6 +1305,14 @@ build_scala_static_mkl() {
popd
}

build_static_python_mkl() {
set -ex
pushd .
export mxnet_variant=mkl
./ci/publish/python/build.sh
popd
}

publish_scala_build() {
set -ex
pushd .
Expand Down
13 changes: 13 additions & 0 deletions ci/jenkins/Jenkins_steps.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,19 @@ def test_static_scala_cpu() {
}]
}

def test_static_python_cpu() {
return ['Static build CPU 14.04 Python' : {
node(NODE_LINUX_CPU) {
ws('workspace/ut-publish-python-cpu') {
timeout(time: max_time, unit: 'MINUTES') {
utils.init_git()
utils.docker_run("publish.ubuntu1404_cpu", 'build_static_python_mkl', false)
}
}
}
}]
}

def test_unix_python2_cpu() {
return ['Python2: CPU': {
node(NODE_LINUX_CPU) {
Expand Down
1 change: 1 addition & 0 deletions ci/jenkins/Jenkinsfile_unix_cpu
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ core_logic: {
custom_steps.test_unix_onnx_cpu(),
custom_steps.test_unix_cpp_cpu(),
custom_steps.test_static_scala_cpu(),
custom_steps.test_static_python_cpu(),
/* Disabled due to master build failure:
* http://jenkins.mxnet-ci.amazon-ml.com/blue/organizations/jenkins/incubator-mxnet/detail/master/1221/pipeline/
* https://github.com/apache/incubator-mxnet/issues/11801
Expand Down
16 changes: 8 additions & 8 deletions ci/publish/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# MXNet Publish Settings

This folder contains the configuration of restricted node on Jenkins for the publish. It also contains a folder called `scala` that contains everything required for scala publish. In this `README`, we would bring a brief walkthrough of the Jenkins configuration as well as the usages of the scala deployment files.
This folder contains the configuration for restricted nodes on Jenkins for the publishing MXNet artifacts. It also contains a folder called `scala` that contains everything required for publishing to Maven. In this `README`, we provide a brief walkthrough of the Jenkins configuration as well as the usage of the Scala deployment files. Python publishing is TBD.

## Jenkins
Currently, Jenkins contains three build stages, namely `Build Packages`, `Test Packages` and `Deploy Packages`. During the `build package` stages, all dependencies will be built and a Scala package would be created. In the second stage, the package created from the previous stage would move to this stage to specifically run the tests. In the final stage, the packages passed the test would be deployed by the instances.
Currently, Jenkins contains three build stages, namely `Build Packages`, `Test Packages` and `Deploy Packages`. During the `build package` stages, all dependencies are built and a Scala package are created. In the second stage, the package created from the previous stage moves to this stage to specifically run the tests. In the final stage, the packages that pass the tests are deployed by the instances.

The job is scheduled to be triggered every 24 hours on a [restricted instance](http://jenkins.mxnet-ci.amazon-ml.com/blue/organizations/jenkins/restricted-publish-artifacts).

Expand All @@ -17,17 +17,17 @@ All packages are currently built in `Ubuntu 14.04`. All Dockerfile used for publ

Apart from that, the script used to create the environment and publish are available under `ci/docker/install`:

- `ubuntu_publish.sh` install all required dependencies for Ubuntu 14.04 for publishing
- `ubuntu_base.sh` install minimum dependencies required to run the published packages
- `ubuntu_publish.sh` installs all required dependencies for Ubuntu 14.04 for publishing
- `ubuntu_base.sh` installs minimum dependencies required to run the published packages

## Scala publish
Currently Scala publish on Linux is fully supported on jenkins. The `scala/` folder contains all files needed to do the publish. Here is a breif instroduction of the files:
## Scala publishing
Currently Scala publish on Linux is fully supported on Jenkins. The `scala/` folder contains all files needed for publishing. Here is a brief introduction of the files:

- `build.sh` Main executable files to build the backend as well as scala package
- `buildkey.py` Main file used to extract password from the system and configure the maven
- `deploy.sh` Script to deploy the package
- `fullDeploy.sh` Used by CI to make full publish
- `test.sh` Make Scala test on CI

## Python
We plans to support Python build on Jenkins soon
## Python publishing
Python build support is TBD.
26 changes: 26 additions & 0 deletions ci/publish/python/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

set -ex

source tools/staticbuild/build.sh $mxnet_variant pip
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why source?


set -ex

# Compile tests for discovery later
source tools/staticbuild/build_wheel.sh
10 changes: 5 additions & 5 deletions tools/staticbuild/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# MXNet Static build
# MXNet Static Build

This folder contains the core script used to build the static library. This README would bring you the information and usages of the script in here. Please be aware, all of the scripts are designed to be run under the root folder.
This folder contains the core script used to build the static library. This README provides information on how to use the scripts in this folder. Please be aware, all of the scripts are designed to be run under the root folder.

## `build.sh`
This script is a wrapper around `build_lib.sh` aimed to simplify the usage of it. It would automatically identify the system version, number of cores and all environment variable settings. Here are the examples you can run this script:
This script is a wrapper around `build_lib.sh. It simplifies the things by automatically identifing the system version, number of cores, and all environment variable settings. Here are examples you can run with this script:

```
tools/staticbuild/build.sh cu92 maven
Expand All @@ -17,7 +17,7 @@ This would build the mxnet package based on MKLDNN and and pypi configuration se
As the result, users would have a complete static dependencies in `/staticdeps` in the root folder as well as a static-linked `libmxnet.so` file lives in `lib`. You can build your language binding by using the `libmxnet.so`.

## `build_lib.sh`
This script would clone the most up-to-date master and build the MXNet backend with static library. In order to run that, you should have prepare the the following environment variable:
This script clones the most up-to-date master and builds the MXNet backend with a static library. In order to run the static library, you must set the the following environment variables:

- `DEPS_PATH` Path to your static dependencies
- `STATIC_BUILD_TARGET` Either `pip` or `maven` as your publish platform
Expand All @@ -29,4 +29,4 @@ It is not recommended to run this file alone since there are a bunch of variable
After running this script, you would have everything you need ready in the `/lib` folder.

## `build_wheel.sh`
This script is used to build the python package as well as running a sanity test
This script builds the python package. It also runs a sanity test.
5 changes: 1 addition & 4 deletions tools/staticbuild/build_wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@
# under the License.

# This script builds the wheel for binary distribution and performs sanity check.

cd mxnet-build
echo $(git rev-parse HEAD) >> python/mxnet/COMMIT_HASH
cd -
cd python/

# Make wheel for testing
python setup.py bdist_wheel

wheel_name=$(ls -t dist | head -n 1)
pip install -U --user --force-reinstall dist/$wheel_name
python sanity_test.py