mxnet: added 1.3.0 (#9236)
* add version 1.3.0 * change build parameters, install process * mxnet will not compile against spack's nnvm and dmlc so we must use the distributions provided by the source package. * also removed 'bin' installation as mxnet is just a shared library. * improve BLAS linking * remove unnecessary args * added variant for python bindings
This commit is contained in:
parent
24dd24600c
commit
451328d6e6
@ -32,6 +32,8 @@ class Mxnet(MakefilePackage):
|
|||||||
homepage = "http://mxnet.io"
|
homepage = "http://mxnet.io"
|
||||||
url = "https://github.com/apache/incubator-mxnet/archive/0.10.0.post2.tar.gz"
|
url = "https://github.com/apache/incubator-mxnet/archive/0.10.0.post2.tar.gz"
|
||||||
|
|
||||||
|
version('1.3.0', 'c00d6fbb2947144ce36c835308e603f002c1eb90a9f4c5a62f4d398154eed4d2',
|
||||||
|
url='https://github.com/apache/incubator-mxnet/releases/download/1.3.0/apache-mxnet-src-1.3.0-incubating.tar.gz')
|
||||||
version('0.10.0.post2', '7819d511cf4a6efad681e6662fa966e4',
|
version('0.10.0.post2', '7819d511cf4a6efad681e6662fa966e4',
|
||||||
url="https://github.com/apache/incubator-mxnet/archive/0.10.0.post2.tar.gz")
|
url="https://github.com/apache/incubator-mxnet/archive/0.10.0.post2.tar.gz")
|
||||||
version('0.10.0.post1', '16d540f407cd22285555b3ab22040032',
|
version('0.10.0.post1', '16d540f407cd22285555b3ab22040032',
|
||||||
@ -43,6 +45,7 @@ class Mxnet(MakefilePackage):
|
|||||||
variant('opencv', default=True, description='Enable OpenCV support')
|
variant('opencv', default=True, description='Enable OpenCV support')
|
||||||
variant('openmp', default=False, description='Enable OpenMP support')
|
variant('openmp', default=False, description='Enable OpenMP support')
|
||||||
variant('profiler', default=False, description='Enable Profiler (for verification and debug only).')
|
variant('profiler', default=False, description='Enable Profiler (for verification and debug only).')
|
||||||
|
variant('python', default=True, description='Install python bindings')
|
||||||
|
|
||||||
depends_on('dmlc-core@20170508')
|
depends_on('dmlc-core@20170508')
|
||||||
depends_on('dmlc-core+openmp', when='+openmp')
|
depends_on('dmlc-core+openmp', when='+openmp')
|
||||||
@ -50,29 +53,45 @@ class Mxnet(MakefilePackage):
|
|||||||
depends_on('mshadow@20170721')
|
depends_on('mshadow@20170721')
|
||||||
depends_on('ps-lite@20170328')
|
depends_on('ps-lite@20170328')
|
||||||
depends_on('nnvm~shared@20170418')
|
depends_on('nnvm~shared@20170418')
|
||||||
depends_on('openblas')
|
depends_on('blas')
|
||||||
depends_on('cudnn', when='+cuda')
|
depends_on('cudnn', when='+cuda')
|
||||||
depends_on('cudnn', when='+cuda')
|
depends_on('cudnn', when='+cuda')
|
||||||
depends_on('cub', when='+cuda')
|
depends_on('cub', when='+cuda')
|
||||||
depends_on('opencv+core+imgproc+highgui+jpeg+png+tiff~eigen~ipp@3.0:', when='+opencv')
|
depends_on('opencv+core+imgproc+highgui+jpeg+png+tiff~eigen~ipp@3.0:', when='+opencv')
|
||||||
|
|
||||||
|
# python extensions
|
||||||
|
depends_on('python@2.7:', type=('build', 'run'), when='+python')
|
||||||
|
depends_on('py-setuptools', type='build', when='+python')
|
||||||
|
extends('python', when='+python')
|
||||||
|
|
||||||
patch('makefile.patch', when='@0.10:0.11')
|
patch('makefile.patch', when='@0.10:0.11')
|
||||||
|
|
||||||
def build(self, spec, prefix):
|
def build(self, spec, prefix):
|
||||||
filter_file('export CC = gcc', '', 'make/config.mk', string=True)
|
# copy template configuration file
|
||||||
filter_file('export CXX = g++', '', 'make/config.mk', string=True)
|
copy('make/config.mk', 'config.mk')
|
||||||
|
|
||||||
|
# remove compiler overrides
|
||||||
|
filter_file('export CC = gcc', '', 'config.mk', string=True)
|
||||||
|
filter_file('export CXX = g++', '', 'config.mk', string=True)
|
||||||
|
|
||||||
|
# add blas prefix to include paths
|
||||||
|
filter_file(
|
||||||
|
'-I$(NNVM_PATH)/include',
|
||||||
|
'-I$(NNVM_PATH)/include -I%s/include' % spec['blas'].prefix,
|
||||||
|
'Makefile', string=True
|
||||||
|
)
|
||||||
|
|
||||||
|
# mxnet comes with its own version of nnvm and dmlc.
|
||||||
|
# building it will fail if we use the spack paths
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
'CC=%s' % self.compiler.cc,
|
'CC=%s' % self.compiler.cc,
|
||||||
'CXX=%s' % self.compiler.cxx,
|
'CXX=%s' % self.compiler.cxx,
|
||||||
'DMLC_CORE=%s' % spec['dmlc-core'].prefix,
|
|
||||||
'MSHADOW_PATH=%s' % spec['mshadow'].prefix,
|
'MSHADOW_PATH=%s' % spec['mshadow'].prefix,
|
||||||
'PS_PATH=%s' % spec['ps-lite'].prefix,
|
'PS_PATH=%s' % spec['ps-lite'].prefix,
|
||||||
'NNVM_PATH=%s' % spec['nnvm'].prefix,
|
|
||||||
'USE_OPENMP=%s' % ('1' if '+openmp' in spec else '0'),
|
'USE_OPENMP=%s' % ('1' if '+openmp' in spec else '0'),
|
||||||
'USE_CUDA=%s' % ('1' if '+cuda' in spec else '0'),
|
'USE_CUDA=%s' % ('1' if '+cuda' in spec else '0'),
|
||||||
'USE_CUDNN=%s' % ('1' if '+cuda' in spec else '0'),
|
'USE_CUDNN=%s' % ('1' if '+cuda' in spec else '0'),
|
||||||
'CUB_INCLUDE=%s' % spec['cub'].prefix.include,
|
|
||||||
'USE_OPENCV=%s' % ('1' if '+opencv' in spec else '0'),
|
'USE_OPENCV=%s' % ('1' if '+opencv' in spec else '0'),
|
||||||
'USE_PROFILER=%s' % ('1' if '+profiler' in spec else '0'),
|
'USE_PROFILER=%s' % ('1' if '+profiler' in spec else '0'),
|
||||||
]
|
]
|
||||||
@ -86,16 +105,27 @@ def build(self, spec, prefix):
|
|||||||
'-lopencv_core -lopencv_imgproc -lopencv_imgcodecs',
|
'-lopencv_core -lopencv_imgproc -lopencv_imgcodecs',
|
||||||
'Makefile', string=True)
|
'Makefile', string=True)
|
||||||
|
|
||||||
# TODO: Add more BLAS support
|
if 'openblas' in spec:
|
||||||
args.append('USE_BLAS=openblas')
|
args.extend(['USE_BLAS=openblas'])
|
||||||
|
elif 'atlas' in spec or 'cblas' in spec:
|
||||||
|
args.extend(['USE_BLAS=atlas'])
|
||||||
|
else:
|
||||||
|
args.extend(['USE_BLAS=blas'])
|
||||||
|
|
||||||
if '+cuda' in spec:
|
if '+cuda' in spec:
|
||||||
args.extend(['USE_CUDA_PATH=%s' % spec['cuda'].prefix,
|
args.extend(['USE_CUDA_PATH=%s' % spec['cuda'].prefix,
|
||||||
'CUDNN_PATH=%s' % spec['cudnn'].prefix])
|
'CUDNN_PATH=%s' % spec['cudnn'].prefix,
|
||||||
|
'CUB_INCLUDE=%s' % spec['cub'].prefix.include])
|
||||||
|
|
||||||
make(*args)
|
make(*args)
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
def install(self, spec, prefix):
|
||||||
|
# mxnet is just a shared library -- no need to install a bin tree
|
||||||
|
|
||||||
install_tree('include', prefix.include)
|
install_tree('include', prefix.include)
|
||||||
install_tree('lib', prefix.lib)
|
install_tree('lib', prefix.lib)
|
||||||
install_tree('bin', prefix.bin)
|
|
||||||
|
# install python bindings
|
||||||
|
if '+python' in spec:
|
||||||
|
python = which('python')
|
||||||
|
python('python/setup.py', 'install', '--prefix={0}'.format(prefix))
|
||||||
|
Loading…
Reference in New Issue
Block a user