From 86b7b84ddf2c9b31f0b1511e5fc79a66d294d580 Mon Sep 17 00:00:00 2001 From: Brian Van Essen Date: Wed, 1 Nov 2017 17:25:28 -0700 Subject: LBANN flags and OpenCV variant (#5951) * Fixed the datatype flag in the LBANN package. Fixed where the datatype flag should be set. * Added variant to OpenCV to disable building DNN support * Fixed a bug in how the elemental package tries to find its Fortran library. The current method does not work with Intel compilers. * Added necessary paths for cuDNN and CUB. * Addressed flake8 issues in Elemental package. * Fixed several flake8 errors. Added variant to build with or without support for arbitrary-precision floating point arithmetic. * Added the proper CMake flag when MPFR support is disabled. * Fixed a bug in how the cudnn path was being set when there was no cudnn requested. Also requested that OpenCV is built without eigen support. * Fixed another bug where a dependency may not be there and thus should not be always checked. --- .../repos/builtin/packages/elemental/package.py | 35 +++++++++++++++------- var/spack/repos/builtin/packages/lbann/package.py | 12 +++++++- var/spack/repos/builtin/packages/opencv/package.py | 5 +++- 3 files changed, 39 insertions(+), 13 deletions(-) diff --git a/var/spack/repos/builtin/packages/elemental/package.py b/var/spack/repos/builtin/packages/elemental/package.py index c12224cef7..472906621b 100644 --- a/var/spack/repos/builtin/packages/elemental/package.py +++ b/var/spack/repos/builtin/packages/elemental/package.py @@ -22,6 +22,7 @@ # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## +import os from spack import * from spack.spec import UnsupportedCompilerError @@ -67,6 +68,9 @@ class Elemental(CMakePackage): values=('Debug', 'Release')) variant('blas', default='openblas', values=('openblas', 'mkl'), description='Enable the use of OpenBlas/MKL') + variant('mpfr', default=False, + description='Support GNU MPFR\'s' + 'arbitrary-precision floating-point arithmetic') # Note that #1712 forces us to enumerate the different blas variants depends_on('blas', when='~openmp_blas ~int64_blas') @@ -87,9 +91,9 @@ class Elemental(CMakePackage): depends_on('scalapack', when='+scalapack ~int64_blas') extends('python', when='+python') depends_on('python@:2.8', when='+python') - depends_on('gmp') - depends_on('mpc') - depends_on('mpfr') + depends_on('gmp', when='+mpfr') + depends_on('mpc', when='+mpfr') + depends_on('mpfr', when='+mpfr') patch('elemental_cublas.patch', when='+cublas') patch('cmake_0.87.7.patch', when='@0.87.7') @@ -123,14 +127,23 @@ class Elemental(CMakePackage): '-DEL_DISABLE_PARMETIS:BOOL=%s' % ('~parmetis' in spec), '-DEL_DISABLE_QUAD:BOOL=%s' % ('~quad' in spec), '-DEL_USE_64BIT_INTS:BOOL=%s' % ('+int64' in spec), - '-DEL_USE_64BIT_BLAS_INTS:BOOL=%s' % ('+int64_blas' in spec)] - - # see /debian/rules as an example: - mpif77 = Executable(spec['mpi'].mpif77) - libgfortran = LibraryList(mpif77('--print-file-name', - 'libgfortran.%s' % dso_suffix, - output=str)) - args.append('-DGFORTRAN_LIB=%s' % libgfortran.libraries[0]) + '-DEL_USE_64BIT_BLAS_INTS:BOOL=%s' % ('+int64_blas' in spec), + '-DEL_DISABLE_MPFR:BOOL=%s' % ('~mpfr' in spec)] + + if self.spec.satisfies('%intel'): + ifort = env['SPACK_F77'] + intel_bin = os.path.dirname(ifort) + intel_root = os.path.dirname(intel_bin) + libfortran = LibraryList('{0}/lib/intel64/libifcoremt.{1}' + .format(intel_root, dso_suffix)) + elif self.spec.satisfies('%gcc'): + # see /debian/rules as an example: + mpif77 = Executable(spec['mpi'].mpif77) + libfortran = LibraryList(mpif77('--print-file-name', + 'libgfortran.%s' % dso_suffix, + output=str)) + if libfortran: + args.append('-DGFORTRAN_LIB=%s' % libfortran.libraries[0]) # If using 64bit int BLAS libraries, elemental has to build # them internally diff --git a/var/spack/repos/builtin/packages/lbann/package.py b/var/spack/repos/builtin/packages/lbann/package.py index 1e4c484c63..00c1c3b2e1 100644 --- a/var/spack/repos/builtin/packages/lbann/package.py +++ b/var/spack/repos/builtin/packages/lbann/package.py @@ -48,9 +48,11 @@ class Lbann(CMakePackage): depends_on('elemental +openmp_blas +shared +int64 build_type=Debug', when=('build_type=Debug')) depends_on('cuda', when='+gpu') + depends_on('cudnn', when='+gpu') + depends_on('cub', when='+gpu') depends_on('mpi') depends_on('hwloc') - depends_on('opencv@3.2.0: +openmp +core +highgui +imgproc +jpeg +png +tiff +zlib', when='+opencv') + depends_on('opencv@3.2.0: +openmp +core +highgui +imgproc +jpeg +png +tiff +zlib ~eigen', when='+opencv') depends_on('protobuf@3.0.2:') depends_on('cnpy') @@ -83,4 +85,12 @@ class Lbann(CMakePackage): args.extend(['-DOpenCV_DIR:STRING={0}'.format( spec['opencv'].prefix)]) + if '+cudnn' in spec: + args.extend(['-DcuDNN_DIR={0}'.format( + spec['cudnn'].prefix)]) + + if '+cudnn' in spec: + args.extend(['-DCUB_DIR={0}'.format( + spec['cub'].prefix)]) + return args diff --git a/var/spack/repos/builtin/packages/opencv/package.py b/var/spack/repos/builtin/packages/opencv/package.py index 52cc63b4a4..812b5cf122 100644 --- a/var/spack/repos/builtin/packages/opencv/package.py +++ b/var/spack/repos/builtin/packages/opencv/package.py @@ -75,6 +75,7 @@ class Opencv(CMakePackage): 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') depends_on('eigen~mpfr', when='+eigen', type='build') @@ -90,7 +91,7 @@ class Opencv(CMakePackage): depends_on('qt', when='+qt') depends_on('java', when='+java') depends_on('py-numpy', when='+python', type=('build', 'run')) - depends_on('protobuf@3.1.0', when='@3.3.0:') + depends_on('protobuf@3.1.0', when='@3.3.0: +dnn') extends('python', when='+python') @@ -127,6 +128,8 @@ class Opencv(CMakePackage): '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 -- cgit v1.2.3-70-g09d2