LBANN OS X (#7105)

* Added a package for the MDAnalysis toolkit.

* Added some flags to fix the build RPATHs and OpenMP for LBANN on OS X.

* Fixed Hydrogen branch of Elemental to find OpenMP on OS X.
This commit is contained in:
Brian Van Essen 2018-01-31 10:38:53 -07:00 committed by becker33
parent 60cc0b0b90
commit 06758fe5cb
3 changed files with 34 additions and 1 deletions

View file

@ -24,6 +24,8 @@
############################################################################## ##############################################################################
from spack import * from spack import *
import sys
class Cnpy(CMakePackage): class Cnpy(CMakePackage):
"""cnpy: library to read/write .npy and .npz files in C/C++.""" """cnpy: library to read/write .npy and .npz files in C/C++."""
@ -32,3 +34,10 @@ class Cnpy(CMakePackage):
url = "https://github.com/rogersce/cnpy" url = "https://github.com/rogersce/cnpy"
version('master', git='https://github.com/rogersce/cnpy.git', branch="master") version('master', git='https://github.com/rogersce/cnpy.git', branch="master")
def cmake_args(self):
args = []
if sys.platform == 'darwin':
args.extend(['-DCMAKE_MACOSX_RPATH=ON'])
return args

View file

@ -23,6 +23,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
############################################################################## ##############################################################################
import os import os
import sys
from spack import * from spack import *
from spack.spec import UnsupportedCompilerError from spack.spec import UnsupportedCompilerError
@ -211,6 +212,15 @@ def cmake_args(self):
'-DHydrogen_GENERAL_LAPACK_FALLBACK=ON', '-DHydrogen_GENERAL_LAPACK_FALLBACK=ON',
] ]
# Add support for OS X to find OpenMP
if (self.spec.satisfies('%clang')):
if (sys.platform == 'darwin'):
clang = self.compiler.cc
clang_bin = os.path.dirname(clang)
clang_root = os.path.dirname(clang_bin)
args.extend([
'-DOpenMP_DIR={0}'.format(clang_root)])
if 'blas=openblas' in spec: if 'blas=openblas' in spec:
args.extend([ args.extend([
'-DHydrogen_USE_OpenBLAS:BOOL=%s' % ('blas=openblas' in spec), '-DHydrogen_USE_OpenBLAS:BOOL=%s' % ('blas=openblas' in spec),

View file

@ -22,6 +22,8 @@
# License along with this program; if not, write to the Free Software # License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
############################################################################## ##############################################################################
import os
import sys
from spack import * from spack import *
@ -50,7 +52,7 @@ class Lbann(CMakePackage):
values=('Debug', 'Release')) values=('Debug', 'Release'))
depends_on('elemental +openmp_blas +shared +int64') depends_on('elemental +openmp_blas +shared +int64')
depends_on('elemental +openmp_blas +shared +int64 build_type=Debug', depends_on('elemental +openmp_blas +shared +int64 build_type=Debug',
when=('build_type=Debug')) when=('build_type=Debug'))
depends_on('cuda', when='+gpu') depends_on('cuda', when='+gpu')
depends_on('cudnn', when='+gpu') depends_on('cudnn', when='+gpu')
@ -93,6 +95,18 @@ def cmake_args(self):
'-DLBANN_DATATYPE={0}'.format(spec.variants['dtype'].value), '-DLBANN_DATATYPE={0}'.format(spec.variants['dtype'].value),
'-DLBANN_VERBOSE=0']) '-DLBANN_VERBOSE=0'])
# Add support for OpenMP
if (self.spec.satisfies('%clang')):
if (sys.platform == 'darwin'):
clang = self.compiler.cc
clang_bin = os.path.dirname(clang)
clang_root = os.path.dirname(clang_bin)
args.extend([
'-DOpenMP_CXX_FLAGS=-fopenmp=libomp',
'-DOpenMP_CXX_LIB_NAMES=libomp',
'-DOpenMP_libomp_LIBRARY={0}/lib/libomp.dylib'.format(
clang_root)])
if '+opencv' in spec: if '+opencv' in spec:
args.extend(['-DOpenCV_DIR:STRING={0}'.format( args.extend(['-DOpenCV_DIR:STRING={0}'.format(
spec['opencv'].prefix)]) spec['opencv'].prefix)])