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.
This commit is contained in:
Brian Van Essen 2017-11-01 17:25:28 -07:00 committed by becker33
parent 0d624eac55
commit 86b7b84ddf
3 changed files with 38 additions and 12 deletions

View File

@ -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 @@ def cmake_args(self):
'-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)]
'-DEL_USE_64BIT_BLAS_INTS:BOOL=%s' % ('+int64_blas' in spec),
'-DEL_DISABLE_MPFR:BOOL=%s' % ('~mpfr' in spec)]
# see <stage_folder>/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])
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 <stage_folder>/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

View File

@ -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 @@ def cmake_args(self):
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

View File

@ -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 @@ def cmake_args(self):
'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