Add a package: dmlc/mxnet. (#3579)
* Add dmlc/mxnet packags. * Build mxnet+cuda+opencv with GCC-4.8.5 and GCC-5.4.0. * Build mxnet version 0.10.0, 0.10.0.post1 and 0.10.0.post2. * Add component version constrain for mxnet 0.10.0.x . * Go through flake8. * Replace commit hash with commit date as package version. * Go throught Travis-CI. * Update submodule version for 0.10.0.post2. * Add openmp variant for dmlc-core and mxnet. * Refine variant handling. * Fix filter_file for dmlc-core. * Cut long strings into multiple lies due to PEP8 requirements. * Fix for PEP8. * Add CUB_INCLUDE. * Add py-mxnet: Python binding for MXNet. * Remove distutils.dir_util. * Add the profiler variant for mxnet. * Add a shared variant for nnvm. * Set USE_OPENMP to OFF by default. * Fix flake8 errors. * Fix flake8 issues. * flake8 issues again.
This commit is contained in:
		
							
								
								
									
										37
									
								
								var/spack/repos/builtin/packages/dlpack/package.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								var/spack/repos/builtin/packages/dlpack/package.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | |||||||
|  | ############################################################################## | ||||||
|  | # Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. | ||||||
|  | # Produced at the Lawrence Livermore National Laboratory. | ||||||
|  | # | ||||||
|  | # This file is part of Spack. | ||||||
|  | # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. | ||||||
|  | # LLNL-CODE-647188 | ||||||
|  | # | ||||||
|  | # For details, see https://github.com/llnl/spack | ||||||
|  | # Please also see the NOTICE and LICENSE files for our notice and the LGPL. | ||||||
|  | # | ||||||
|  | # This program is free software; you can redistribute it and/or modify | ||||||
|  | # it under the terms of the GNU Lesser General Public License (as | ||||||
|  | # published by the Free Software Foundation) version 2.1, February 1999. | ||||||
|  | # | ||||||
|  | # This program is distributed in the hope that it will be useful, but | ||||||
|  | # WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF | ||||||
|  | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and | ||||||
|  | # conditions of the GNU Lesser General Public License for more details. | ||||||
|  | # | ||||||
|  | # You should have received a copy of the GNU Lesser General Public | ||||||
|  | # License along with this program; if not, write to the Free Software | ||||||
|  | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||||||
|  | ############################################################################## | ||||||
|  | from spack import * | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class Dlpack(Package): | ||||||
|  |     """DLPack is an RFC for common tensor and operator guidelines | ||||||
|  |     in deep learning systems.""" | ||||||
|  |  | ||||||
|  |     homepage = "https://github.com/sjtuhpcc/dlpack" | ||||||
|  |  | ||||||
|  |     version('master', git='https://github.com/dmlc/dlpack.git', branch='master') | ||||||
|  |  | ||||||
|  |     def install(self, spec, prefix): | ||||||
|  |         install_tree('include', prefix.include) | ||||||
							
								
								
									
										21
									
								
								var/spack/repos/builtin/packages/dmlc-core/cmake.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								var/spack/repos/builtin/packages/dmlc-core/cmake.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | |||||||
|  | From 82f2bde92e1f1bf35bdf7b93cacb0aa72d9f096b Mon Sep 17 00:00:00 2001 | ||||||
|  | From: Jianwen WEI <weijianwen@gmail.com> | ||||||
|  | Date: Fri, 18 Aug 2017 23:16:05 +0800 | ||||||
|  | Subject: [PATCH] Patch CMakeLists.txt to install make/ dir into destination. | ||||||
|  |  | ||||||
|  | --- | ||||||
|  |  CMakeLists.txt | 1 + | ||||||
|  |  1 file changed, 1 insertion(+) | ||||||
|  |  | ||||||
|  | diff --git a/CMakeLists.txt b/CMakeLists.txt | ||||||
|  | index f038dcb..ed01b82 100644 | ||||||
|  | --- a/CMakeLists.txt | ||||||
|  | +++ b/CMakeLists.txt | ||||||
|  | @@ -134,6 +134,7 @@ endif() | ||||||
|  |  install(TARGETS dmlc ARCHIVE DESTINATION lib LIBRARY DESTINATION lib)  | ||||||
|  |  install(DIRECTORY include DESTINATION .) | ||||||
|  |  install(DIRECTORY doc DESTINATION .) | ||||||
|  | +install(DIRECTORY make DESTINATION .) | ||||||
|  |   | ||||||
|  |  # ---[ Linter target | ||||||
|  |  if(MSVC) | ||||||
							
								
								
									
										57
									
								
								var/spack/repos/builtin/packages/dmlc-core/package.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								var/spack/repos/builtin/packages/dmlc-core/package.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,57 @@ | |||||||
|  | ############################################################################## | ||||||
|  | # Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. | ||||||
|  | # Produced at the Lawrence Livermore National Laboratory. | ||||||
|  | # | ||||||
|  | # This file is part of Spack. | ||||||
|  | # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. | ||||||
|  | # LLNL-CODE-647188 | ||||||
|  | # | ||||||
|  | # For details, see https://github.com/llnl/spack | ||||||
|  | # Please also see the LICENSE file for our notice and the LGPL. | ||||||
|  | # | ||||||
|  | # This program is free software; you can redistribute it and/or modify | ||||||
|  | # it under the terms of the GNU Lesser General Public License (as | ||||||
|  | # published by the Free Software Foundation) version 2.1, February 1999. | ||||||
|  | # | ||||||
|  | # This program is distributed in the hope that it will be useful, but | ||||||
|  | # WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF | ||||||
|  | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and | ||||||
|  | # conditions of the GNU Lesser General Public License for more details. | ||||||
|  | # | ||||||
|  | # You should have received a copy of the GNU Lesser General Public | ||||||
|  | # License along with this program; if not, write to the Free Software | ||||||
|  | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||||||
|  | ############################################################################## | ||||||
|  | from spack import * | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class DmlcCore(CMakePackage): | ||||||
|  |     """DMLC-Core is the backbone library to support all DMLC projects, | ||||||
|  |     offers the bricks to build efficient and scalable | ||||||
|  |     distributed machine learning libraries.""" | ||||||
|  |  | ||||||
|  |     homepage = "https://github.com/dmlc/dmlc-core" | ||||||
|  |     url      = "https://github.com/dmlc/dmlc-core.git" | ||||||
|  |  | ||||||
|  |     version('master', git='https://github.com/dmlc/dmlc-core.git') | ||||||
|  |     version('20170508', git='https://github.com/dmlc/dmlc-core.git', | ||||||
|  |     commit='a6c5701219e635fea808d264aefc5b03c3aec314') | ||||||
|  |  | ||||||
|  |     variant('openmp', default=False, description='Enable OpenMP support') | ||||||
|  |  | ||||||
|  |     patch('cmake.patch') | ||||||
|  |  | ||||||
|  |     def patch(self): | ||||||
|  |         filter_file('export CC = gcc', '', 'make/config.mk', string=True) | ||||||
|  |         filter_file('export CXX = g++', '', 'make/config.mk', string=True) | ||||||
|  |         filter_file('export MPICXX = mpicxx', '', | ||||||
|  |                     'make/config.mk', string=True) | ||||||
|  |         filter_file(r'^USE_OPENMP\s*=.*', | ||||||
|  |                     'USE_OPENMP=%s' % ('1' if '+openmp' in self.spec else '0'), | ||||||
|  |                     'make/config.mk') | ||||||
|  |  | ||||||
|  |     def cmake_args(self): | ||||||
|  |         spec = self.spec | ||||||
|  |         return [ | ||||||
|  |             '-DUSE_OPENMP=%s' % ('ON' if '+openmp' in spec else 'OFF'), | ||||||
|  |         ] | ||||||
							
								
								
									
										41
									
								
								var/spack/repos/builtin/packages/mshadow/package.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								var/spack/repos/builtin/packages/mshadow/package.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,41 @@ | |||||||
|  | ############################################################################## | ||||||
|  | # Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. | ||||||
|  | # Produced at the Lawrence Livermore National Laboratory. | ||||||
|  | # | ||||||
|  | # This file is part of Spack. | ||||||
|  | # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. | ||||||
|  | # LLNL-CODE-647188 | ||||||
|  | # | ||||||
|  | # For details, see https://github.com/llnl/spack | ||||||
|  | # Please also see the LICENSE file for our notice and the LGPL. | ||||||
|  | # | ||||||
|  | # This program is free software; you can redistribute it and/or modify | ||||||
|  | # it under the terms of the GNU Lesser General Public License (as | ||||||
|  | # published by the Free Software Foundation) version 2.1, February 1999. | ||||||
|  | # | ||||||
|  | # This program is distributed in the hope that it will be useful, but | ||||||
|  | # WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF | ||||||
|  | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and | ||||||
|  | # conditions of the GNU Lesser General Public License for more details. | ||||||
|  | # | ||||||
|  | # You should have received a copy of the GNU Lesser General Public | ||||||
|  | # License along with this program; if not, write to the Free Software | ||||||
|  | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||||||
|  | ############################################################################## | ||||||
|  | from spack import * | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class Mshadow(Package): | ||||||
|  |     """MShadow is a lightweight CPU/GPU Matrix/Tensor C++ Template Library. | ||||||
|  |     in C++/CUDA.""" | ||||||
|  |  | ||||||
|  |     homepage = "https://github.com/dmlc/mshadow" | ||||||
|  |     url      = "https://github.com/dmlc/mshadow/archive/v1.1.tar.gz" | ||||||
|  |  | ||||||
|  |     version('master', git='https://github.com/dmlc/mshadow.git', branch='master') | ||||||
|  |     version('20170721', git='https://github.com/dmlc/mshadow.git', | ||||||
|  |             commit='20b54f068c1035f0319fa5e5bbfb129c450a5256') | ||||||
|  |  | ||||||
|  |     def install(self, spec, prefix): | ||||||
|  |         install_tree('mshadow', prefix.include.mshadow) | ||||||
|  |         install_tree('make', prefix.make) | ||||||
							
								
								
									
										81
									
								
								var/spack/repos/builtin/packages/mxnet/makefile.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										81
									
								
								var/spack/repos/builtin/packages/mxnet/makefile.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,81 @@ | |||||||
|  | From 22b64127d7acc9c255b007e120e2a721f4e136d2 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: Jianwen WEI <weijianwen@gmail.com> | ||||||
|  | Date: Fri, 18 Aug 2017 23:32:16 +0800 | ||||||
|  | Subject: [PATCH] Enable customize CUB MSHADOW PSLITE CUDA paths. | ||||||
|  |  | ||||||
|  | --- | ||||||
|  |  Makefile | 26 +++++++++++++++++++++----- | ||||||
|  |  1 file changed, 21 insertions(+), 5 deletions(-) | ||||||
|  |  | ||||||
|  | diff --git a/Makefile b/Makefile | ||||||
|  | index c71cb13..a53d072 100644 | ||||||
|  | --- a/Makefile | ||||||
|  | +++ b/Makefile | ||||||
|  | @@ -14,6 +14,19 @@ ifndef DMLC_CORE | ||||||
|  |  	DMLC_CORE = $(ROOTDIR)/dmlc-core | ||||||
|  |  endif | ||||||
|  |   | ||||||
|  | +ifndef MSHADOW_PATH | ||||||
|  | +	MSHADOW_PATH = $(ROOTDIR)/mshadow | ||||||
|  | +endif | ||||||
|  | +ifneq ("$(wildcard $(MSHADOW_PATH)/include/mshadow/base.h)","") | ||||||
|  | +MSHADOW_INC = $(MSHADOW_PATH)/include | ||||||
|  | +else | ||||||
|  | +MSHADOW_INC = $(MSHADOW_PATH) | ||||||
|  | +endif | ||||||
|  | + | ||||||
|  | +ifndef PS_PATH | ||||||
|  | +	PS_PATH = $(ROOTDIR)/ps-lite | ||||||
|  | +endif | ||||||
|  | + | ||||||
|  |  ifndef NNVM_PATH | ||||||
|  |  	NNVM_PATH = $(ROOTDIR)/nnvm | ||||||
|  |  endif | ||||||
|  | @@ -32,7 +45,7 @@ ifeq ($(USE_MKL2017), 1) | ||||||
|  |  	export USE_MKLML = $(lastword $(RETURN_STRING)) | ||||||
|  |  endif | ||||||
|  |   | ||||||
|  | -include mshadow/make/mshadow.mk | ||||||
|  | +include $(MSHADOW_PATH)/make/mshadow.mk | ||||||
|  |  include $(DMLC_CORE)/make/dmlc.mk | ||||||
|  |   | ||||||
|  |  # all tge possible warning tread | ||||||
|  | @@ -49,7 +62,7 @@ ifeq ($(DEBUG), 1) | ||||||
|  |  else | ||||||
|  |  	CFLAGS += -O3 -DNDEBUG=1 | ||||||
|  |  endif | ||||||
|  | -CFLAGS += -I$(ROOTDIR)/mshadow/ -I$(ROOTDIR)/dmlc-core/include -fPIC -I$(NNVM_PATH)/include -Iinclude $(MSHADOW_CFLAGS) | ||||||
|  | +CFLAGS += -I$(MSHADOW_INC) -I$(DMLC_CORE)/include -fPIC -I$(NNVM_PATH)/include -Iinclude $(MSHADOW_CFLAGS) | ||||||
|  |  LDFLAGS = -pthread $(MSHADOW_LDFLAGS) $(DMLC_LDFLAGS) | ||||||
|  |  ifeq ($(DEBUG), 1) | ||||||
|  |  	NVCCFLAGS = -std=c++11 -Xcompiler -D_FORCE_INLINES -g -G -O0 -ccbin $(CXX) $(MSHADOW_NVCCFLAGS) | ||||||
|  | @@ -125,8 +138,11 @@ ifneq ($(USE_CUDA_PATH), NONE) | ||||||
|  |  	NVCC=$(USE_CUDA_PATH)/bin/nvcc | ||||||
|  |  endif | ||||||
|  |   | ||||||
|  | +ifndef CUB_INCLUDE | ||||||
|  | +	CUB_PATH = $(ROOTDIR)/cub | ||||||
|  | +endif | ||||||
|  | + | ||||||
|  |  # ps-lite | ||||||
|  | -PS_PATH=$(ROOTDIR)/ps-lite | ||||||
|  |  DEPS_PATH=$(shell pwd)/deps | ||||||
|  |  include $(PS_PATH)/make/ps.mk | ||||||
|  |  ifeq ($(USE_DIST_KVSTORE), 1) | ||||||
|  | @@ -181,11 +197,11 @@ else | ||||||
|  |  endif | ||||||
|  |   | ||||||
|  |  # all dep | ||||||
|  | -LIB_DEP += $(DMLC_CORE)/libdmlc.a $(NNVM_PATH)/lib/libnnvm.a | ||||||
|  | +LIB_DEP += $(DMLC_CORE)/lib/libdmlc.a $(NNVM_PATH)/lib/libnnvm.a | ||||||
|  |  ALL_DEP = $(OBJ) $(EXTRA_OBJ) $(PLUGIN_OBJ) $(LIB_DEP) | ||||||
|  |   | ||||||
|  |  ifeq ($(USE_CUDA), 1) | ||||||
|  | -	CFLAGS += -I$(ROOTDIR)/cub | ||||||
|  | +	CFLAGS += -I$(CUB_INCLUDE) -I$(USE_CUDA_PATH)/include -I$(CUDNN_PATH)/include | ||||||
|  |  	ALL_DEP += $(CUOBJ) $(EXTRA_CUOBJ) $(PLUGIN_CUOBJ) | ||||||
|  |  	LDFLAGS += -lcuda -lcufft | ||||||
|  |  	SCALA_PKG_PROFILE := $(SCALA_PKG_PROFILE)-gpu | ||||||
|  | --  | ||||||
|  | 1.8.3.1 | ||||||
|  |  | ||||||
							
								
								
									
										101
									
								
								var/spack/repos/builtin/packages/mxnet/package.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										101
									
								
								var/spack/repos/builtin/packages/mxnet/package.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,101 @@ | |||||||
|  | ############################################################################## | ||||||
|  | # Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. | ||||||
|  | # Produced at the Lawrence Livermore National Laboratory. | ||||||
|  | # | ||||||
|  | # This file is part of Spack. | ||||||
|  | # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. | ||||||
|  | # LLNL-CODE-647188 | ||||||
|  | # | ||||||
|  | # For details, see https://github.com/llnl/spack | ||||||
|  | # Please also see the LICENSE file for our notice and the LGPL. | ||||||
|  | # | ||||||
|  | # This program is free software; you can redistribute it and/or modify | ||||||
|  | # it under the terms of the GNU Lesser General Public License (as | ||||||
|  | # published by the Free Software Foundation) version 2.1, February 1999. | ||||||
|  | # | ||||||
|  | # This program is distributed in the hope that it will be useful, but | ||||||
|  | # WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF | ||||||
|  | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and | ||||||
|  | # conditions of the GNU Lesser General Public License for more details. | ||||||
|  | # | ||||||
|  | # You should have received a copy of the GNU Lesser General Public | ||||||
|  | # License along with this program; if not, write to the Free Software | ||||||
|  | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||||||
|  | ############################################################################## | ||||||
|  | from spack import * | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class Mxnet(MakefilePackage): | ||||||
|  |     """MXNet is a deep learning framework | ||||||
|  |     designed for both efficiency and flexibility.""" | ||||||
|  |  | ||||||
|  |     homepage = "http://mxnet.io" | ||||||
|  |     url      = "https://github.com/apache/incubator-mxnet/archive/0.10.0.post2.tar.gz" | ||||||
|  |  | ||||||
|  |     version('0.10.0.post2',  '7819d511cf4a6efad681e6662fa966e4', | ||||||
|  |             url="https://github.com/apache/incubator-mxnet/archive/0.10.0.post2.tar.gz") | ||||||
|  |     version('0.10.0.post1',  '16d540f407cd22285555b3ab22040032', | ||||||
|  |             url="https://github.com/apache/incubator-mxnet/archive/v0.10.0.post1.tar.gz") | ||||||
|  |     version('0.10.0', '2d0c83c33eda729932d620cca3078826', | ||||||
|  |             url="https://github.com/apache/incubator-mxnet/archive/v0.10.0.tar.gz") | ||||||
|  |  | ||||||
|  |     variant('cuda', default=False, description='Enable CUDA support') | ||||||
|  |     variant('opencv', default=True, description='Enable OpenCV support') | ||||||
|  |     variant('openmp', default=False, description='Enable OpenMP support') | ||||||
|  |     variant('profiler', default=False, description='Enable Profiler (for verification and debug only).') | ||||||
|  |  | ||||||
|  |     depends_on('dmlc-core@20170508') | ||||||
|  |     depends_on('dmlc-core+openmp', when='+openmp') | ||||||
|  |     depends_on('dmlc-core~openmp', when='~openmp') | ||||||
|  |     depends_on('mshadow@20170721') | ||||||
|  |     depends_on('ps-lite@20170328') | ||||||
|  |     depends_on('nnvm~shared@20170418') | ||||||
|  |     depends_on('openblas') | ||||||
|  |     depends_on('cudnn', when='+cuda') | ||||||
|  |     depends_on('cudnn', when='+cuda') | ||||||
|  |     depends_on('cub', when='+cuda') | ||||||
|  |     depends_on('opencv+core+imgproc+highgui+jpeg+png+tiff~eigen~ipp@3.0:', when='+opencv') | ||||||
|  |  | ||||||
|  |     patch('makefile.patch', when='@0.10:0.11') | ||||||
|  |  | ||||||
|  |     def build(self, spec, prefix): | ||||||
|  |         filter_file('export CC = gcc', '', 'make/config.mk', string=True) | ||||||
|  |         filter_file('export CXX = g++', '', 'make/config.mk', string=True) | ||||||
|  |  | ||||||
|  |         args = [ | ||||||
|  |             'CC=%s' % self.compiler.cc, | ||||||
|  |             'CXX=%s' % self.compiler.cxx, | ||||||
|  |             'DMLC_CORE=%s' % spec['dmlc-core'].prefix, | ||||||
|  |             'MSHADOW_PATH=%s' % spec['mshadow'].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_CUDA=%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_PROFILER=%s' % ('1' if '+profiler' in spec else '0'), | ||||||
|  |         ] | ||||||
|  |  | ||||||
|  |         if '+opencv' in spec: | ||||||
|  |             filter_file('$(shell pkg-config --cflags opencv)', | ||||||
|  |                         '-I%s' % spec['opencv'].prefix.include, | ||||||
|  |                         'Makefile', string=True) | ||||||
|  |             filter_file('$(filter-out -lopencv_ts, ' | ||||||
|  |                         '$(shell pkg-config --libs opencv))', | ||||||
|  |                         '-lopencv_core -lopencv_imgproc -lopencv_imgcodecs', | ||||||
|  |                         'Makefile', string=True) | ||||||
|  |  | ||||||
|  |         # TODO: Add more BLAS support | ||||||
|  |         args.append('USE_BLAS=openblas') | ||||||
|  |  | ||||||
|  |         if '+cuda' in spec: | ||||||
|  |             args.extend(['USE_CUDA_PATH=%s' % spec['cuda'].prefix, | ||||||
|  |                          'CUDNN_PATH=%s' % spec['cudnn'].prefix]) | ||||||
|  |  | ||||||
|  |         make(*args) | ||||||
|  |  | ||||||
|  |     def install(self, spec, prefix): | ||||||
|  |         install_tree('include', prefix.include) | ||||||
|  |         install_tree('lib', prefix.lib) | ||||||
|  |         install_tree('bin', prefix.bin) | ||||||
							
								
								
									
										63
									
								
								var/spack/repos/builtin/packages/nnvm/cmake.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								var/spack/repos/builtin/packages/nnvm/cmake.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,63 @@ | |||||||
|  | From e75004208ea98cea0bb2ad9b5f18a59cf6814333 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: Jianwen WEI <weijianwen@gmail.com> | ||||||
|  | Date: Mon, 11 Sep 2017 00:26:24 +0800 | ||||||
|  | Subject: [PATCH] Install nnvm lib and haders. Offer choice to build static or | ||||||
|  |  shared lib. | ||||||
|  |  | ||||||
|  | --- | ||||||
|  |  CMakeLists.txt | 25 +++++++++++++++++++++++-- | ||||||
|  |  1 file changed, 23 insertions(+), 2 deletions(-) | ||||||
|  |  | ||||||
|  | diff --git a/CMakeLists.txt b/CMakeLists.txt | ||||||
|  | index d40deb5..aac0531 100644 | ||||||
|  | --- a/CMakeLists.txt | ||||||
|  | +++ b/CMakeLists.txt | ||||||
|  | @@ -17,6 +17,10 @@ set(nnvm_LINKER_LIBS "") | ||||||
|  |   | ||||||
|  |  add_definitions(-DNNVM_EXPORTS) | ||||||
|  |   | ||||||
|  | +# Build a shared lib (libnnvm.so) by default | ||||||
|  | +option(USE_SHARED_NNVM "Build a shared nnvm lib" ON)             | ||||||
|  | +option(USE_STATIC_NNVM "Build a static nnvm lib" OFF) | ||||||
|  | + | ||||||
|  |  # compile | ||||||
|  |  if(MSVC) | ||||||
|  |    add_definitions(-DDMLC_USE_CXX11) | ||||||
|  | @@ -61,8 +65,15 @@ elseif(DMLC_CORE_PATH) | ||||||
|  |    include_directories(${DMLC_CORE_PATH}/include) | ||||||
|  |  endif() | ||||||
|  |   | ||||||
|  | -add_library(nnvm SHARED ${SOURCE}) | ||||||
|  | -target_link_libraries(nnvm ${nnvm_LINKER_LIBS}) | ||||||
|  | +if(USE_SHARED_NNVM) | ||||||
|  | +  add_library(nnvm SHARED ${SOURCE}) | ||||||
|  | +  target_link_libraries(nnvm ${nnvm_LINKER_LIBS}) | ||||||
|  | +endif() | ||||||
|  | +if(USE_STATIC_NNVM) | ||||||
|  | +  add_library(nnvm_static STATIC ${SOURCE}) | ||||||
|  | +  target_link_libraries(nnvm_static ${nnvm_LINKER_LIBS}) | ||||||
|  | +  set_target_properties(nnvm_static PROPERTIES OUTPUT_NAME "nnvm") | ||||||
|  | +endif() | ||||||
|  |   | ||||||
|  |  if(INSTALL_INCLUDE_DIR) | ||||||
|  |    add_custom_command(TARGET nnvm POST_BUILD | ||||||
|  | @@ -71,6 +82,16 @@ if(INSTALL_INCLUDE_DIR) | ||||||
|  |      ) | ||||||
|  |  endif() | ||||||
|  |   | ||||||
|  | +# ---[ Install lib, header and docs | ||||||
|  | +if(USE_SHARED_NNVM) | ||||||
|  | +  install(TARGETS nnvm LIBRARY DESTINATION lib)  | ||||||
|  | +endif() | ||||||
|  | +if(USE_STATIC_NNVM) | ||||||
|  | +  install(TARGETS nnvm_static ARCHIVE DESTINATION lib)  | ||||||
|  | +endif() | ||||||
|  | +install(DIRECTORY include DESTINATION .) | ||||||
|  | +install(DIRECTORY docs DESTINATION .) | ||||||
|  | + | ||||||
|  |  # ---[ Linter target | ||||||
|  |  if(MSVC) | ||||||
|  |    find_package(PythonInterp 2) | ||||||
|  | --  | ||||||
|  | 1.8.3.1 | ||||||
|  |  | ||||||
							
								
								
									
										50
									
								
								var/spack/repos/builtin/packages/nnvm/package.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								var/spack/repos/builtin/packages/nnvm/package.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,50 @@ | |||||||
|  | ############################################################################## | ||||||
|  | # Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. | ||||||
|  | # Produced at the Lawrence Livermore National Laboratory. | ||||||
|  | # | ||||||
|  | # This file is part of Spack. | ||||||
|  | # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. | ||||||
|  | # LLNL-CODE-647188 | ||||||
|  | # | ||||||
|  | # For details, see https://github.com/llnl/spack | ||||||
|  | # Please also see the LICENSE file for our notice and the LGPL. | ||||||
|  | # | ||||||
|  | # This program is free software; you can redistribute it and/or modify | ||||||
|  | # it under the terms of the GNU Lesser General Public License (as | ||||||
|  | # published by the Free Software Foundation) version 2.1, February 1999. | ||||||
|  | # | ||||||
|  | # This program is distributed in the hope that it will be useful, but | ||||||
|  | # WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF | ||||||
|  | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and | ||||||
|  | # conditions of the GNU Lesser General Public License for more details. | ||||||
|  | # | ||||||
|  | # You should have received a copy of the GNU Lesser General Public | ||||||
|  | # License along with this program; if not, write to the Free Software | ||||||
|  | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||||||
|  | ############################################################################## | ||||||
|  | from spack import * | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class Nnvm(CMakePackage): | ||||||
|  |     """nnvm is a modular, decentralized and lightweight | ||||||
|  |     part to help build deep learning libraries.""" | ||||||
|  |  | ||||||
|  |     homepage = "https://github.com/dmlc/nnvm" | ||||||
|  |     url      = "https://github.com/dmlc/nnvm.git" | ||||||
|  |  | ||||||
|  |     version('master', git='https://github.com/dmlc/nnvm.git', branch='master') | ||||||
|  |     version('20170418', git='https://github.com/dmlc/nnvm.git', | ||||||
|  |             commit='b279286304ac954098d94a2695bca599e832effb') | ||||||
|  |  | ||||||
|  |     variant('shared', default=True, description='Build a shared NNVM lib.') | ||||||
|  |  | ||||||
|  |     depends_on('dmlc-core') | ||||||
|  |  | ||||||
|  |     patch('cmake.patch') | ||||||
|  |  | ||||||
|  |     def cmake_args(self): | ||||||
|  |         spec = self.spec | ||||||
|  |         return [ | ||||||
|  |             '-DUSE_SHARED_NNVM=%s' % ('ON' if '+shared' in spec else 'OFF'), | ||||||
|  |             '-DUSE_STATIC_NNVM=%s' % ('ON' if '~shared' in spec else 'OFF'), | ||||||
|  |         ] | ||||||
							
								
								
									
										22
									
								
								var/spack/repos/builtin/packages/ps-lite/cmake.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								var/spack/repos/builtin/packages/ps-lite/cmake.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | |||||||
|  | From b787a6413d6d54c46db476176656fec108c57527 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: Jianwen WEI <weijianwen@gmail.com> | ||||||
|  | Date: Wed, 5 Apr 2017 19:53:51 +0800 | ||||||
|  | Subject: [PATCH] Add install() for ps-lite in CMake. | ||||||
|  |  | ||||||
|  | --- | ||||||
|  |  CMakeLists.txt | 5 +++++ | ||||||
|  |  1 file changed, 5 insertions(+) | ||||||
|  |  | ||||||
|  | diff --git a/CMakeLists.txt b/CMakeLists.txt | ||||||
|  | index e5d13d0..d68491c 100644 | ||||||
|  | --- a/CMakeLists.txt | ||||||
|  | +++ b/CMakeLists.txt | ||||||
|  | @@ -63,3 +63,8 @@ set(pslite_LINKER_LIBS ${pslite_LINKER_LIBS_L} PARENT_SCOPE) | ||||||
|  |  set(pslite_LINKER_LIBS_RELEASE ${pslite_LINKER_LIBS_L_RELEASE} PARENT_SCOPE) | ||||||
|  |  set(pslite_LINKER_LIBS_DEBUG ${pslite_LINKER_LIBS_L_DEBUG} PARENT_SCOPE) | ||||||
|  |  set(pslite_INCLUDE_DIR ${pslite_INCLUDE_DIR_L} PARENT_SCOPE) | ||||||
|  | + | ||||||
|  | +install(TARGETS pslite ARCHIVE DESTINATION lib) | ||||||
|  | +install(DIRECTORY include DESTINATION .) | ||||||
|  | +install(DIRECTORY docs DESTINATION .) | ||||||
|  | +install(DIRECTORY make DESTINATION .) | ||||||
							
								
								
									
										42
									
								
								var/spack/repos/builtin/packages/ps-lite/package.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								var/spack/repos/builtin/packages/ps-lite/package.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,42 @@ | |||||||
|  | ############################################################################## | ||||||
|  | # Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. | ||||||
|  | # Produced at the Lawrence Livermore National Laboratory. | ||||||
|  | # | ||||||
|  | # This file is part of Spack. | ||||||
|  | # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. | ||||||
|  | # LLNL-CODE-647188 | ||||||
|  | # | ||||||
|  | # For details, see https://github.com/llnl/spack | ||||||
|  | # Please also see the LICENSE file for our notice and the LGPL. | ||||||
|  | # | ||||||
|  | # This program is free software; you can redistribute it and/or modify | ||||||
|  | # it under the terms of the GNU Lesser General Public License (as | ||||||
|  | # published by the Free Software Foundation) version 2.1, February 1999. | ||||||
|  | # | ||||||
|  | # This program is distributed in the hope that it will be useful, but | ||||||
|  | # WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF | ||||||
|  | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and | ||||||
|  | # conditions of the GNU Lesser General Public License for more details. | ||||||
|  | # | ||||||
|  | # You should have received a copy of the GNU Lesser General Public | ||||||
|  | # License along with this program; if not, write to the Free Software | ||||||
|  | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||||||
|  | ############################################################################## | ||||||
|  | from spack import * | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class PsLite(CMakePackage): | ||||||
|  |     """ps-lite is A light and efficient implementation | ||||||
|  |     of the parameter server framework.""" | ||||||
|  |  | ||||||
|  |     homepage = "https://github.com/dmlc/ps-lite" | ||||||
|  |     url      = "https://github.com/dmlc/ps-lite.git" | ||||||
|  |  | ||||||
|  |     version('master', git='https://github.com/dmlc/ps-lite.git', branch='master') | ||||||
|  |     version('20170328', git='https://github.com/dmlc/ps-lite.git', | ||||||
|  |             commit='acdb698fa3bb80929ef83bb37c705f025e119b82') | ||||||
|  |  | ||||||
|  |     depends_on('protobuf@3:') | ||||||
|  |     depends_on('zeromq') | ||||||
|  |  | ||||||
|  |     patch('cmake.patch') | ||||||
							
								
								
									
										58
									
								
								var/spack/repos/builtin/packages/py-mxnet/package.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								var/spack/repos/builtin/packages/py-mxnet/package.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,58 @@ | |||||||
|  | ############################################################################## | ||||||
|  | # Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. | ||||||
|  | # Produced at the Lawrence Livermore National Laboratory. | ||||||
|  | # | ||||||
|  | # This file is part of Spack. | ||||||
|  | # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. | ||||||
|  | # LLNL-CODE-647188 | ||||||
|  | # | ||||||
|  | # For details, see https://github.com/llnl/spack | ||||||
|  | # Please also see the NOTICE and LICENSE files for our notice and the LGPL. | ||||||
|  | # | ||||||
|  | # This program is free software; you can redistribute it and/or modify | ||||||
|  | # it under the terms of the GNU Lesser General Public License (as | ||||||
|  | # published by the Free Software Foundation) version 2.1, February 1999. | ||||||
|  | # | ||||||
|  | # This program is distributed in the hope that it will be useful, but | ||||||
|  | # WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF | ||||||
|  | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and | ||||||
|  | # conditions of the GNU Lesser General Public License for more details. | ||||||
|  | # | ||||||
|  | # You should have received a copy of the GNU Lesser General Public | ||||||
|  | # License along with this program; if not, write to the Free Software | ||||||
|  | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||||||
|  | ############################################################################## | ||||||
|  | from spack import * | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class PyMxnet(PythonPackage): | ||||||
|  |     """Python binding for DMLC/MXNet.""" | ||||||
|  |  | ||||||
|  |     homepage = "http://mxnet.io" | ||||||
|  |     url      = "https://github.com/sjtuhpcc/python-mxnet/archive/0.10.0.post2.tar.gz" | ||||||
|  |  | ||||||
|  |     version('0.10.0.post2', '64a646fbf5d1b53ce1008da1bf94d77c', | ||||||
|  |             url='https://github.com/sjtuhpcc/python-mxnet/archive/0.10.0.post2.tar.gz') | ||||||
|  |  | ||||||
|  |     # TODO | ||||||
|  |     # install_time_test_callbacks = ['install_test', 'import_module_test'] | ||||||
|  |  | ||||||
|  |     # import_modules = ['mxnet', 'mxnet.module', 'mxnet._ctypes', 'mxnet.rnn', | ||||||
|  |     #      		'mxnet._cy2', 'mxnet._cy3', 'mxnet.notebook', 'mxnet.contrib'] | ||||||
|  |  | ||||||
|  |     variant('cuda', default=False, description='Enable CUDA support') | ||||||
|  |  | ||||||
|  |     depends_on('python@2.6:2.8,3.3:') | ||||||
|  |  | ||||||
|  |     depends_on('py-setuptools', type=('build', 'run')) | ||||||
|  |     depends_on('py-numpy@1.7.1:', type=('build', 'run')) | ||||||
|  |     # depends_on('py-pip', type='build') | ||||||
|  |  | ||||||
|  |     depends_on('mxnet', type=('build', 'run')) | ||||||
|  |     depends_on('mxnet+cuda', when='+cuda', type=('build', 'run')) | ||||||
|  |  | ||||||
|  |     def patch(self): | ||||||
|  |         spec = self.spec | ||||||
|  |         filter_file('../../../', | ||||||
|  |                     spec['mxnet'].prefix.lib, | ||||||
|  |                     'mxnet/libinfo.py', string=True) | ||||||
		Reference in New Issue
	
	Block a user
	 健美猫
					健美猫