Skip to content

Commit

Permalink
Fix OpenMPI CUDA support (spack#4323)
Browse files Browse the repository at this point in the history
* Fix OpenMPI CUDA support

* Remove --with-cuda-libdir flag, not a real flag

* Fix PGI and CUDA 7 support
  • Loading branch information
adamjstewart authored Jun 16, 2017
1 parent f6e3ad4 commit 60db73a
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions var/spack/repos/builtin/packages/openmpi/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ class Openmpi(AutotoolsPackage):
depends_on('jdk', when='+java')
depends_on('sqlite', when='+sqlite3@:1.11')

conflicts('+cuda', when='@:1.6') # CUDA support was added in 1.7
conflicts('fabrics=psm2', when='@:1.8') # PSM2 support was added in 1.10.0
conflicts('fabrics=pmi', when='@:1.5.4') # PMI support was added in 1.5.5
conflicts('fabrics=mxm', when='@:1.5.3') # MXM support was added in 1.5.4
Expand Down Expand Up @@ -311,12 +312,29 @@ def configure_args(self):
config_args.append('--disable-mpi-thread-multiple')

# CUDA support
# See https://www.open-mpi.org/faq/?category=buildcuda
if spec.satisfies('@1.7:'):
if '+cuda' in spec:
# OpenMPI dynamically loads libcuda.so, requires dlopen
config_args.append('--enable-dlopen')
# Searches for header files in DIR/include
config_args.append('--with-cuda={0}'.format(
spec['cuda'].prefix))
config_args.append('--with-cuda-libdir={0}'.format(
spec['cuda'].libs.directories))
if spec.satisfies('@1.7:1.7.2'):
# This option was removed from later versions
config_args.append('--with-cuda-libdir={0}'.format(
spec['cuda'].libs.directories[0]))
if spec.satisfies('@1.7.2'):
# There was a bug in 1.7.2 when --enable-static is used
config_args.append('--enable-mca-no-build=pml-bfo')
if spec.satisfies('%pgi^cuda@7.0:7.999'):
# OpenMPI has problems with CUDA 7 and PGI
config_args.append(
'--with-wrapper-cflags=-D__LP64__ -ta:tesla')
if spec.satisfies('%pgi@:15.8'):
# With PGI 15.9 and later compilers, the
# CFLAGS=-D__LP64__ is no longer needed.
config_args.append('CFLAGS=-D__LP64__')
else:
config_args.append('--without-cuda')

Expand Down

0 comments on commit 60db73a

Please sign in to comment.