2019-06-16 21:59:06 +02:00
|
|
|
{ lib
|
2018-10-15 19:11:39 +02:00
|
|
|
, buildPythonPackage
|
|
|
|
, pkgs
|
|
|
|
, numpy
|
|
|
|
, scipy
|
2019-06-02 11:52:10 +02:00
|
|
|
, openmpi
|
2018-10-15 19:11:39 +02:00
|
|
|
, enum34
|
|
|
|
, protobuf
|
|
|
|
, pip
|
|
|
|
, python
|
2019-06-02 11:52:10 +02:00
|
|
|
, swig
|
2018-10-15 19:11:39 +02:00
|
|
|
}:
|
|
|
|
|
2019-06-02 11:52:10 +02:00
|
|
|
let
|
|
|
|
cntk = pkgs.cntk;
|
|
|
|
in
|
2019-08-13 23:52:01 +02:00
|
|
|
buildPythonPackage {
|
2019-06-02 11:52:10 +02:00
|
|
|
inherit (cntk) name version src;
|
2018-10-15 19:11:39 +02:00
|
|
|
|
2019-06-02 11:52:10 +02:00
|
|
|
nativeBuildInputs = [ swig openmpi ];
|
|
|
|
buildInputs = [ cntk openmpi ];
|
2018-10-15 19:11:39 +02:00
|
|
|
propagatedBuildInputs = [ numpy scipy enum34 protobuf pip ];
|
|
|
|
|
2019-06-02 11:52:10 +02:00
|
|
|
CNTK_LIB_PATH = "${cntk}/lib";
|
|
|
|
CNTK_COMPONENT_VERSION = cntk.version;
|
|
|
|
CNTK_VERSION = cntk.version;
|
|
|
|
CNTK_VERSION_BANNER = cntk.version;
|
2018-10-15 19:11:39 +02:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
cd bindings/python
|
2019-06-02 11:52:10 +02: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 19:11:39 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
rm -rf $out/${python.sitePackages}/cntk/libs
|
2019-06-02 11:52:10 +02:00
|
|
|
ln -s ${cntk}/lib $out/${python.sitePackages}/cntk/libs
|
2018-10-15 19:11:39 +02: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 14:36:36 +02:00
|
|
|
|
|
|
|
meta = {
|
2019-06-02 11:52:10 +02: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 14:36:36 +02:00
|
|
|
};
|
2018-10-15 19:11:39 +02:00
|
|
|
}
|