Building from source
Last updated
Was this helpful?
Last updated
Was this helpful?
Konduit Serving sources are hosted on GitHub. If you have git
installed, clone the using the git clone
command:
To install the konduit
Python module from source, in the python
directory, after installing Cython, run
To install all extensions needed for development run
The dev
dependencies use black
as a pre-commit hook to lint your code automatically. To activate this functionality, run pre-commit install
on the command line first.
Install test dependencies using pip install 'konduit[tests]'
if you want to run tests.
On Windows, compiling the test dependencies requires Visual Studio Build Tools 14.0, which can be installed from . You may also need to install the Windows 8.1 / 10 SDK. See Python's page for details.
The tests also require bert_mrpc_frozen.pb
to be placed in the python/tests
folder. Run the following code in python/tests
:
The resulting JAR will be generated at the base of the konduit
project. To copy that JAR into the tests
folder and prepare the documentation (in the docs
folder) to be tested within the testing framework, run:
The tests are then run with pytest
:
To quickly run unit tests (recommended before each commit), or run the full set of integration tests, you can do:
To also run documentation tests with doctest
for an individual file, simply run:
A Java Archive (JAR) file is used to bundle a Java program.
Run the following commands in the root directory of konduit-serving:
where <your-platform>
is picked from windows-x86_64
,linux-x86_64
,linux-x86_64-gpu
, macosx-x86_64
, linux-armhf
and windows-x86_64-gpu
, depending on your operating system and architecture. Use the --help
flag to view the full list of arguments.
Once the konduit
Python package is installed, you have access to a command line interface (CLI) tool called konduit
.
The init
command:
gets the latest Konduit Serving code, then
builds the Java dependencies needed forkonduit
.
It assumes that you have git
installed on your system and that python
is available.
Run:
where <your-platform>
is picked from windows-x86_64
, linux-x86_64
, linux-x86_64-gpu
, macosx-x86_64
, linux-armhf
and windows-x86_64-gpu
, depending on your operating system and architecture.
To rebuild the Konduit Serving JAR without re-downloading sources, run build
instead of init
with the appropriate flags.
Generally, the Linux builds of Konduit Serving perform the following tasks on installation:
Copy Konduit Serving JAR file to /opt/konduit/serving/
;
Create the necessary environment variables; and
Install a Konduit Serving-specific Conda distribution with install-python.sh
.
First, install required packages with yum
:
This command installs the developer tools for developing Java programs using JDK 8, the which
package to locate a program file's path, tools to build RPM files and Red Hat-specific RPM configuration files.
In the root folder of the konduit-serving
project, run the following command to build RPM files using Maven Wrapper:
The Maven Wrapper mvnw
script allows Maven to be used even if mvn
is not available on the system PATH. This command runs the Maven goals clean
and install
with the following arguments:
maven.test.skip=true
Profiles: uberjar,tar,rpm
(ensure this is specified without spaces in between). The profiles python
and pmml
are optional.
chip
: cpu
(use gpu
to enable CUDA support)
javacpp.platform
: linux-x86_64
The clean install
command first deletes previously compiled Java sources and resources; then compiles, tests and packages the Java project and copies it into the relevant folder. The path where the RPM file is saved depends on the spin.version
(default custom
) and the chip (cpu
or gpu
) .
Use the YUM command yum localinstall
to install the RPM file.
Install JDK 8 using apt-get
:
In the root directory of the Konduit Serving project, run the mvnw
script with parameters:
maven.test.skip=true
Enable the profiles uberjar,tar,deb
(ensure this is specified without spaces in between). The python
and pmml
profiles are optional.
chip
: cpu
(use gpu
to enable CUDA support)
javacpp.platform
: linux-x86_64
Finally, use dpkg
to install the built package:
Note that dpkg
does not support dependencies. If you run into missing dependencies, run
Konduit Serving can also be built as a tarball, where the JAR file and associated scripts are packaged in a gzip-compressed tar file. To build a Konduit Serving tar file, run the following Maven Wrapper command in the root folder of the Konduit Serving project:
This generates two compressed files in the target
directory of the konduit-serving-tar
folder: a tar (.tar.gz
) and a zip (.zip)
file. In addition to the JAR file, the tar file contains a script to install a Conda distribution (ìnstall-python.sh
) and a script to set environment variables (bin/konduit-serving
).
After extracting the tar file, first run the konduit-serving
shell script:
then the ìnstall-python.sh
script:
The following packages are included in this Conda distribution:
Package
Version
NumPy
1.16.4
Jupyter
1.0.0
SciPy
1.3.3
requests
2.22.0
pandas
0.24.2
TensorFlow
1.15.0
Keras
2.2.4
konduit
0.1.3rc1
scikit-learn
0.22
matplotlib
3.1.2
PyTorch
1.3.1
torchvision
0.4.2
CUDA Toolkit
10.1
OpenJDK
8
An additional --spin
argument provides the option to package Python (python
), PMML (pmml
), both (all
) or neither (minimal
). By default, both Python and PMML are packaged. Python bundling is not encouraged on ARM platforms, and PMML bundling is not encouraged if is an issue.
An additional --spin
argument provides the option to package Python (python
), PMML (pmml
), both (all
) or neither (minimal
). By default, both Python and PMML are packaged. Python bundling is not encouraged on ARM platforms, and PMML bundling is not encouraged if is an issue.
konduit init
fails for linux-86_64-gpu
()
Konduit Serving RPM packages are generated using the .
Konduit Serving Debian packages are generated with the library.
The error java.io.IOException: This archives contains unclosed entries.
usually indicates insufficient disk space (see ).
to install dependencies. Alternately, use the gdebi
package to install the local DEB package (see this for details), or simply (apt 1.1 and above):
Note that packages are sourced from the following Anaconda channels, in descending order of priority: , , , .