summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Van Essen <vanessen1@llnl.gov>2018-05-08 17:55:12 -0700
committerscheibelp <scheibel1@llnl.gov>2018-05-08 17:55:12 -0700
commita9e47b763e8c78d948e7bf325cb98558605d0a58 (patch)
tree0668d3f1d2c5595c64e557fff6762ac5c8b4d2cd
parentb4859e10e2d1c61750474ae66fa36dd02b0906a4 (diff)
downloadspack-a9e47b763e8c78d948e7bf325cb98558605d0a58.tar.gz
spack-a9e47b763e8c78d948e7bf325cb98558605d0a58.tar.bz2
spack-a9e47b763e8c78d948e7bf325cb98558605d0a58.tar.xz
spack-a9e47b763e8c78d948e7bf325cb98558605d0a58.zip
opencv updates for lbann (#6502)
Add variants to control building of many 3rd-party modules in opencv. They are enabled by default, which matches the defaults chosen by opencv when these options are not set explicitly. This also updates the lbann opencv dependency to disable most of these new variants by default in order to build faster.
-rw-r--r--var/spack/repos/builtin/packages/lbann/package.py11
-rw-r--r--var/spack/repos/builtin/packages/opencv/package.py143
2 files changed, 122 insertions, 32 deletions
diff --git a/var/spack/repos/builtin/packages/lbann/package.py b/var/spack/repos/builtin/packages/lbann/package.py
index 5ebf90d1c4..0d9b6532a6 100644
--- a/var/spack/repos/builtin/packages/lbann/package.py
+++ b/var/spack/repos/builtin/packages/lbann/package.py
@@ -59,7 +59,16 @@ class Lbann(CMakePackage):
depends_on('cub', when='+gpu')
depends_on('mpi')
depends_on('hwloc ~pci ~libxml2')
- depends_on('opencv@3.2.0: +openmp +core +highgui +imgproc +jpeg +png +tiff +zlib ~eigen', when='+opencv')
+ # LBANN wraps OpenCV calls in OpenMP parallel loops, build without OpenMP
+ # Additionally disable video related options, they incorrectly link in a
+ # bad OpenMP library when building with clang or Intel compilers
+ depends_on('opencv@3.2.0: +core +highgui +imgproc +jpeg +png +tiff +zlib '
+ '+fast-math +powerpc +vsx ~calib3d ~cuda ~dnn ~eigen'
+ '~features2d ~flann ~gtk ~ipp ~ipp_iw ~jasper ~java ~lapack ~ml'
+ '~openmp ~opencl ~opencl_svm ~openclamdblas ~openclamdfft'
+ '~pthreads_pf ~python ~qt ~stitching ~superres ~ts ~video'
+ '~videostab ~videoio ~vtk', when='+opencv')
+
depends_on('protobuf@3.0.2:')
depends_on('cnpy')
depends_on('nccl', when='+gpu +nccl')
diff --git a/var/spack/repos/builtin/packages/opencv/package.py b/var/spack/repos/builtin/packages/opencv/package.py
index 7d0c4559b5..cfda9f0786 100644
--- a/var/spack/repos/builtin/packages/opencv/package.py
+++ b/var/spack/repos/builtin/packages/opencv/package.py
@@ -44,6 +44,8 @@ class Opencv(CMakePackage):
version('master', git="https://github.com/opencv/opencv.git", branch="master")
version('3.4.1', 'a0b7a47899e67b3490ea31edc4f6e8e6')
+ version('3.4.0', '170732dc760e5f7ddeccbe53ba5d16a6')
+ version('3.3.1', 'b1ed9aea030bb5bd9df28524d97de84c')
version('3.3.0', '98a4e4c6f23ec725e808a891dc11eec4')
version('3.2.0', 'a43b65488124ba33dde195fea9041b70')
version('3.1.0', '70e1dd07f0aa06606f1bc0e3fa15abd3')
@@ -54,29 +56,54 @@ class Opencv(CMakePackage):
version('2.4.12.2', 'bc0c60c2ea1cf4078deef99569912fc7')
version('2.4.12.1', '7192f51434710904b5e3594872b897c3')
+ # Standard variants
variant('shared', default=True,
description='Enables the build of shared libraries')
+ variant('lapack', default=True, description='Include Lapack library support')
+ variant('powerpc', default=False, description='Enable PowerPC for GCC')
+ variant('vsx', default=False, description='Enable POWER8 and above VSX (64-bit little-endian)')
+ variant('fast-math', default=False,
+ description='Enable -ffast-math (not recommended for GCC 4.6.x)')
+ # OpenCV modules
+ variant('calib3d', default=True, description='calib3d module')
+ variant('core', default=True, description='Include opencv_core module into the OpenCV build')
+ variant('dnn', default=True, description='Build DNN support')
+ variant('features2d', default=True, description='features2d module')
+ variant('flann', default=True, description='flann module')
+ variant('highgui', default=True, description='Include opencv_highgui module into the OpenCV build')
+ variant('imgproc', default=True, description='Include opencv_imgproc module into the OpenCV build')
+ variant('java', default=True,
+ description='Activates support for Java')
+ variant('ml', default=True, description='Build ML support')
+ variant('python', default=True,
+ description='Enables the build of Python extensions')
+ variant('stitching', default=True, description='stitching module')
+ variant('superres', default=True, description='superres module')
+ variant('ts', default=True, description='Include opencv_ts module into the OpenCV build')
+ variant('video', default=True, description='video module')
+ variant('videostab', default=True, description='videostab module')
+ variant('videoio', default=True, description='videoio module')
+
+ # Optional 3rd party components
+ variant('cuda', default=True, description='Activates support for CUDA')
variant('eigen', default=True, description='Activates support for eigen')
variant('ipp', default=True, description='Activates support for IPP')
+ variant('ipp_iw', default=True, description='Build IPP IW from source')
variant('jasper', default=True, description='Activates support for JasPer')
- variant('cuda', default=False, description='Activates support for CUDA')
- variant('gtk', default=False, description='Activates support for GTK')
- variant('vtk', default=False, description='Activates support for VTK')
+ variant('jpeg', default=True, description='Include JPEG support')
+ variant('opencl', default=True, description='Include OpenCL Runtime support')
+ variant('opencl_svm', default=True, description='Include OpenCL Shared Virtual Memory support')
+ variant('openclamdfft', default=True, description='Include OpenCL AMD OpenCL FFT library support')
+ variant('openclamdblas', default=True, description='Include OpenCL AMD OpenCL BLAS library support')
+ variant('openmp', default=True, description='Activates support for OpenMP threads')
+ variant('pthreads_pf', default=True, description='Use pthreads-based parallel_for')
+ variant('png', default=True, description='Include PNG support')
variant('qt', default=False, description='Activates support for QT')
- variant('python', default=False,
- description='Enables the build of Python extensions')
- variant('java', default=False,
- description='Activates support for Java')
- variant('openmp', default=False, description='Activates support for OpenMP threads')
- variant('core', default=True, description='Include opencv_core module into the OpenCV build')
- variant('highgui', default=False, description='Include opencv_highgui module into the OpenCV build')
- variant('imgproc', default=False, description='Include opencv_imgproc module into the OpenCV build')
- variant('jpeg', default=False, description='Include JPEG support')
- variant('png', default=False, description='Include PNG support')
- variant('tiff', default=False, description='Include TIFF support')
- variant('zlib', default=False, description='Build zlib from source')
- variant('dnn', default=False, description='Build DNN support')
+ variant('gtk', default=True, description='Activates support for GTK')
+ variant('tiff', default=True, description='Include TIFF support')
+ variant('vtk', default=True, description='Activates support for VTK')
+ variant('zlib', default=True, description='Build zlib from source')
depends_on('eigen~mpfr', when='+eigen', type='build')
@@ -94,44 +121,98 @@ class Opencv(CMakePackage):
depends_on('py-numpy', when='+python', type=('build', 'run'))
depends_on('protobuf@3.1.0', when='@3.3.0: +dnn')
+ depends_on('ffmpeg', when='+videoio')
+ depends_on('mpi', when='+videoio')
+
extends('python', when='+python')
def cmake_args(self):
spec = self.spec
+ # Standard variants
args = [
'-DBUILD_SHARED_LIBS:BOOL={0}'.format((
'ON' if '+shared' in spec else 'OFF')),
'-DENABLE_PRECOMPILED_HEADERS:BOOL=OFF',
- '-DWITH_IPP:BOOL={0}'.format((
- 'ON' if '+ipp' in spec else 'OFF')),
- '-DWITH_CUDA:BOOL={0}'.format((
- 'ON' if '+cuda' in spec else 'OFF')),
- '-DWITH_QT:BOOL={0}'.format((
- 'ON' if '+qt' in spec else 'OFF')),
- '-DWITH_VTK:BOOL={0}'.format((
- 'ON' if '+vtk' in spec else 'OFF')),
- '-DBUILD_opencv_java:BOOL={0}'.format((
- 'ON' if '+java' in spec else 'OFF')),
+ '-DWITH_LAPACK={0}'.format((
+ 'ON' if '+lapack' in spec else 'OFF')),
+ '-DENABLE_POWERPC={0}'.format((
+ 'ON' if '+powerpc' in spec else 'OFF')),
+ '-DENABLE_VSX={0}'.format((
+ 'ON' if '+vsx' in spec else 'OFF')),
+ '-DENABLE_FAST_MATH={0}'.format((
+ 'ON' if '+fast-math' in spec else 'OFF')),
+ ]
+
+ # modules
+ args.extend([
+ '-DBUILD_opencv_calib3d={0}'.format((
+ 'ON' if '+calib3d' in spec else 'OFF')),
'-DBUILD_opencv_core:BOOL={0}'.format((
'ON' if '+core' in spec else 'OFF')),
+ '-DBUILD_opencv_dnn:BOOL={0}'.format((
+ 'ON' if '+dnn' in spec else 'OFF')),
+ '-DBUILD_opencv_features2d={0}'.format((
+ 'ON' if '+features2d' in spec else 'OFF')),
+ '-DBUILD_opencv_flann={0}'.format((
+ 'ON' if '+flann' in spec else 'OFF')),
'-DBUILD_opencv_highgui:BOOL={0}'.format((
'ON' if '+highgui' in spec else 'OFF')),
'-DBUILD_opencv_imgproc:BOOL={0}'.format((
'ON' if '+imgproc' in spec else 'OFF')),
+ '-DBUILD_opencv_java:BOOL={0}'.format((
+ 'ON' if '+java' in spec else 'OFF')),
+ '-DBUILD_opencv_ml={0}'.format((
+ 'ON' if '+ml' in spec else 'OFF')),
+ '-DBUILD_opencv_stitching={0}'.format((
+ 'ON' if '+stitching' in spec else 'OFF')),
+ '-DBUILD_opencv_superres={0}'.format((
+ 'ON' if '+superres' in spec else 'OFF')),
+ '-DBUILD_opencv_ts={0}'.format((
+ 'ON' if '+ts' in spec else 'OFF')),
+ '-DBUILD_opencv_video={0}'.format((
+ 'ON' if '+video' in spec else 'OFF')),
+ '-DBUILD_opencv_videostab={0}'.format((
+ 'ON' if '+videostab' in spec else 'OFF')),
+ '-DBUILD_opencv_videoio={0}'.format((
+ 'ON' if '+videoio' in spec else 'OFF')),
+ ])
+
+ # 3rd party components
+ args.extend([
+ '-DWITH_CUDA:BOOL={0}'.format((
+ 'ON' if '+cuda' in spec else 'OFF')),
+ '-DWITH_EIGEN={0}'.format((
+ 'ON' if '+eigen' in spec else 'OFF')),
+ '-DWITH_IPP:BOOL={0}'.format((
+ 'ON' if '+ipp' in spec else 'OFF')),
+ '-DBUILD_IPP_IW:BOOL={0}'.format((
+ 'ON' if '+ipp_iw' in spec else 'OFF')),
'-DWITH_JPEG:BOOL={0}'.format((
'ON' if '+jpeg' in spec else 'OFF')),
+ '-DWITH_OPENCL={0}'.format((
+ 'ON' if '+opencl' in spec else 'OFF')),
+ '-DWITH_OPENCL_SVM={0}'.format((
+ 'ON' if '+opencl_svm' in spec else 'OFF')),
+ '-DWITH_OPENCLAMDFFT={0}'.format((
+ 'ON' if '+openclamdfft' in spec else 'OFF')),
+ '-DWITH_OPENCLAMDBLAS={0}'.format((
+ 'ON' if '+openclamdblas' in spec else 'OFF')),
+ '-DWITH_OPENMP:BOOL={0}'.format((
+ 'ON' if '+openmp' in spec else 'OFF')),
+ '-DWITH_PTHREADS_PF={0}'.format((
+ 'ON' if '+pthreads_pf' in spec else 'OFF')),
'-DWITH_PNG:BOOL={0}'.format((
'ON' if '+png' in spec else 'OFF')),
+ '-DWITH_QT:BOOL={0}'.format((
+ 'ON' if '+qt' in spec else 'OFF')),
'-DWITH_TIFF:BOOL={0}'.format((
'ON' if '+tiff' in spec else 'OFF')),
+ '-DWITH_VTK:BOOL={0}'.format((
+ 'ON' if '+vtk' in spec else 'OFF')),
'-DWITH_ZLIB:BOOL={0}'.format((
'ON' if '+zlib' in spec else 'OFF')),
- '-DWITH_OPENMP:BOOL={0}'.format((
- 'ON' if '+openmp' in spec else 'OFF')),
- '-DBUILD_opencv_dnn:BOOL={0}'.format((
- 'ON' if '+dnn' in spec else 'OFF')),
- ]
+ ])
# Media I/O
if '+zlib' in spec: