cntk: fix build and add comments (#28676)

This commit is contained in:
Glenn Johnson 2022-02-04 10:56:21 -06:00 committed by GitHub
parent caa1a5cec7
commit d0019d7049
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,8 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
from spack import *
@ -15,6 +17,7 @@ class Cntk(Package):
url = "https://github.com/Microsoft/CNTK/archive/v2.0.tar.gz"
git = "https://github.com/Microsoft/CNTK.git"
# CNTK is not an active project since April 2019.
version('master', branch='master')
version('2.0', sha256='3adee17f166e2a682dfb551ca017ae5c3836ca9772c0af14215a7e76254f201c')
@ -29,11 +32,11 @@ class Cntk(Package):
depends_on('openblas')
depends_on('mpi')
depends_on('boost')
depends_on('protobuf')
depends_on('protobuf@3.10')
# CNTK depends on kaldi@c02e8.
# See https://github.com/Microsoft/CNTK/blob/master/Tools/docker/CNTK-CPUOnly-Image/Dockerfile#L105-L125
depends_on('kaldi@2015-10-07', when='+kaldi')
depends_on('opencv', when='+opencv')
depends_on('opencv@:3+imgcodecs+imgproc', when='+opencv')
depends_on('cuda', when='+cuda')
depends_on('cub@1.4.1', when='+cuda')
depends_on('cudnn@5.1', when='+cuda')
@ -49,6 +52,22 @@ class Cntk(Package):
# Patch to change behaviour of lock file - https://github.com/Microsoft/CNTK/issues/62
patch('lock-file.patch')
# It seems that cntk, at least version 2.0, can not be built with GCC
# beyond 4.8.5.
conflicts('%gcc@5:')
def patch(self):
protobuf_path = os.path.split(self.spec['protobuf'].libs[0])
protobuf_ld_flags = self.spec['protobuf'].libs.ld_flags
filter_file(r'(protobuf_check=)lib/libprotobuf\.a',
r'\1{0}/{1}'.format(os.path.basename(protobuf_path[0]),
protobuf_path[1]),
'configure')
filter_file(r'\$\(PROTOBUF_PATH\)/lib/libprotobuf.a',
protobuf_ld_flags,
'Makefile')
def install(self, spec, prefix):
args = []