summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToyohisa Kameyama <kameyama@riken.jp>2020-05-21 12:33:31 +0900
committerGitHub <noreply@github.com>2020-05-20 22:33:31 -0500
commit51ff18ef8d5679672107485d372798c7ab647b34 (patch)
treecd76986bc904d84a6b2b7134dc834e5646398140
parentbcd5dd6e3e322adb02be3a571750efe848002e5c (diff)
downloadspack-51ff18ef8d5679672107485d372798c7ab647b34.tar.gz
spack-51ff18ef8d5679672107485d372798c7ab647b34.tar.bz2
spack-51ff18ef8d5679672107485d372798c7ab647b34.tar.xz
spack-51ff18ef8d5679672107485d372798c7ab647b34.zip
mxnet: Fix dependency and add new version. (#16714)
* mxnet: Fix dependency and add new version. 1. Fix opencv and numpy dependency. 2. Add version 1.6.0. * typo in patch is fixed. fixed spec access.
-rw-r--r--var/spack/repos/builtin/packages/mxnet/makefile.opencv.patch35
-rw-r--r--var/spack/repos/builtin/packages/mxnet/package.py31
2 files changed, 59 insertions, 7 deletions
diff --git a/var/spack/repos/builtin/packages/mxnet/makefile.opencv.patch b/var/spack/repos/builtin/packages/mxnet/makefile.opencv.patch
new file mode 100644
index 0000000000..45e04ea626
--- /dev/null
+++ b/var/spack/repos/builtin/packages/mxnet/makefile.opencv.patch
@@ -0,0 +1,35 @@
+commit 638527ffaa35ffb0bf88a32910b809df09432406
+Author: Toyohisa Kameyama <kameyama@riken.jp>
+Date: Mon May 18 11:58:00 2020 +0900
+
+ Makefile bug fix for opencv4.
+
+diff --git a/Makefile b/Makefile
+index 51930c782..7f5d4da39 100644
+--- a/Makefile
++++ b/Makefile
+@@ -165,7 +165,23 @@ endif
+ ifeq ($(USE_OPENCV), 1)
+ CFLAGS += -DMXNET_USE_OPENCV=1
+ ifneq ($(filter-out NONE, $(USE_OPENCV_INC_PATH)),)
+- CFLAGS += -I$(USE_OPENCV_INC_PATH)/include
++ ifneq ($(wildcard $(USE_OPENCV_INC_PATH)/include/opencv4/opencv2/opencv*),)
++ opencv_inc = -I$(USE_OPENCV_INC_PATH)/include/opencv4
++ endif
++ ifneq ($(wildcard $(USE_OPENCV_INC_PATH)/include/opencv2/opencv*),)
++ opencv_inc = -I$(USE_OPENCV_INC_PATH)/include
++ endif
++ ifneq ($(wildcard $(USE_OPENCV_INC_PATH)/opencv4/opencv2/opencv*),)
++ opencv_inc = -I$(USE_OPENCV_INC_PATH)/opencv4
++ endif
++ ifneq ($(wildcard $(USE_OPENCV_INC_PATH)/opencv2/opencv*),)
++ opencv_inc = -I$(USE_OPENCV_INC_PATH)
++ endif
++ ifneq ($(filter-out NONE, $(opencv_inc)),)
++ CFLAGS += $(opencv_inc)
++ else
++$(error Cannot determine OpenCV include path)
++ endif
+ ifeq ($(filter-out NONE, $(USE_OPENCV_LIB_PATH)),)
+ $(error Please add the path of OpenCV shared library path into `USE_OPENCV_LIB_PATH`, when `USE_OPENCV_INC_PATH` is not NONE)
+ endif
diff --git a/var/spack/repos/builtin/packages/mxnet/package.py b/var/spack/repos/builtin/packages/mxnet/package.py
index 492a2573bc..2ff65265a7 100644
--- a/var/spack/repos/builtin/packages/mxnet/package.py
+++ b/var/spack/repos/builtin/packages/mxnet/package.py
@@ -15,6 +15,7 @@ class Mxnet(MakefilePackage):
maintainers = ['adamjstewart']
+ version('1.6.0', sha256='01eb06069c90f33469c7354946261b0a94824bbaf819fd5d5a7318e8ee596def')
version('1.3.0', sha256='c00d6fbb2947144ce36c835308e603f002c1eb90a9f4c5a62f4d398154eed4d2')
variant('cuda', default=False, description='Enable CUDA support')
@@ -33,14 +34,18 @@ class Mxnet(MakefilePackage):
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:3.4.99', when='@1.3.0 +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')
+ depends_on('py-numpy@:1.15.0', type=('build', 'run'), when='@1.3.0 +python')
+ depends_on('py-numpy@1.16:', type=('build', 'run'), when='@1.6.0 +python')
extends('python', when='+python')
patch('makefile.patch', when='@0.10:0.11')
+ patch('makefile.opencv.patch', when='@1.6.0')
def build(self, spec, prefix):
# copy template configuration file
@@ -73,13 +78,25 @@ class Mxnet(MakefilePackage):
]
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)
+ if spec.satisfies('@1.3.0'):
+ filter_file(
+ '$(shell pkg-config --cflags opencv)',
+ spec['opencv'].headers.include_flags,
+ 'Makefile', string=True
+ )
+ filter_file(
+ '$(filter-out -lopencv_ts, '
+ '$(shell pkg-config --libs opencv))',
+ spec['opencv'].libs.link_flags,
+ 'Makefile', string=True
+ )
+ else:
+ args.extend(
+ ['USE_OPENCV_INC_PATH=' +
+ spec['opencv'].headers.directories[0],
+ 'USE_OPENCV_LIB_PATH=' +
+ spec['opencv'].libs.directories[0]]
+ )
if 'openblas' in spec:
args.extend(['USE_BLAS=openblas'])