2018-10-15 18:11:39 +01:00
|
|
|
{ stdenv
|
2019-06-02 10:52:10 +01:00
|
|
|
, lib
|
2018-10-15 18:11:39 +01:00
|
|
|
, buildPythonPackage
|
|
|
|
, pkgs
|
|
|
|
, numpy
|
|
|
|
, scipy
|
2019-06-02 10:52:10 +01:00
|
|
|
, openmpi
|
2018-10-15 18:11:39 +01:00
|
|
|
, enum34
|
|
|
|
, protobuf
|
|
|
|
, pip
|
|
|
|
, python
|
2019-06-02 10:52:10 +01:00
|
|
|
, swig
|
2018-10-15 18:11:39 +01:00
|
|
|
}:
|
|
|
|
|
2019-06-02 10:52:10 +01:00
|
|
|
let
|
|
|
|
cntk = pkgs.cntk;
|
|
|
|
in
|
2018-10-15 18:11:39 +01:00
|
|
|
buildPythonPackage rec {
|
2019-06-02 10:52:10 +01:00
|
|
|
inherit (cntk) name version src;
|
2018-10-15 18:11:39 +01:00
|
|
|
|
2019-06-02 10:52:10 +01:00
|
|
|
nativeBuildInputs = [ swig openmpi ];
|
|
|
|
buildInputs = [ cntk openmpi ];
|
2018-10-15 18:11:39 +01:00
|
|
|
propagatedBuildInputs = [ numpy scipy enum34 protobuf pip ];
|
|
|
|
|
2019-06-02 10:52:10 +01:00
|
|
|
CNTK_LIB_PATH = "${cntk}/lib";
|
|
|
|
CNTK_COMPONENT_VERSION = cntk.version;
|
|
|
|
CNTK_VERSION = cntk.version;
|
|
|
|
CNTK_VERSION_BANNER = cntk.version;
|
2018-10-15 18:11:39 +01:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
cd bindings/python
|
2019-06-02 10:52:10 +01:00
|
|
|
sed -i 's,"libmpi.so.12","${openmpi}/lib/libmpi.so",g' cntk/train/distributed.py
|
|
|
|
|
|
|
|
# Remove distro and libs checks; they aren't compatible with NixOS and besides we guarantee
|
|
|
|
# compatibility by providing a package.
|
|
|
|
cat <<EOF > cntk/cntk_py_init.py
|
|
|
|
def cntk_check_distro_info():
|
|
|
|
pass
|
|
|
|
def cntk_check_libs():
|
|
|
|
pass
|
|
|
|
EOF
|
2018-10-15 18:11:39 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
rm -rf $out/${python.sitePackages}/cntk/libs
|
2019-06-02 10:52:10 +01:00
|
|
|
ln -s ${cntk}/lib $out/${python.sitePackages}/cntk/libs
|
2018-10-15 18:11:39 +01:00
|
|
|
# It's not installed for some reason.
|
|
|
|
cp cntk/cntk_py.py $out/${python.sitePackages}/cntk
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Actual tests are broken.
|
|
|
|
checkPhase = ''
|
|
|
|
cd $NIX_BUILD_TOP
|
|
|
|
${python.interpreter} -c "import cntk"
|
|
|
|
'';
|
2019-04-08 13:36:36 +01:00
|
|
|
|
|
|
|
meta = {
|
2019-06-02 10:52:10 +01:00
|
|
|
inherit (cntk.meta) homepage description license maintainers platforms;
|
|
|
|
# doesn't support Python 3.7
|
|
|
|
broken = lib.versionAtLeast python.version "3.7";
|
2019-04-08 13:36:36 +01:00
|
|
|
};
|
2018-10-15 18:11:39 +01:00
|
|
|
}
|