Upcxx package: remove warning, add version 2019.9.0 (#12880)

A function added to this package ran as part of importing it and
printed a warning for most Spack invocations, this removes the
warning message.

Also:

* Use compilers directly instead of Spack compiler wrappers (since
  references to the compiler are embedded in text and binary files
  of the installation)
* Add 'cross' variant for setting CROSS environment variable for
  build
* Set UPCXX_INSTALL for generated module files
* Set UPCXX_GASNET_CONDUIT/UPCXX_NETWORK in generated module files
  on Cray systems
* Also set UPCXX_NETWORK in build environment for Cray systems
This commit is contained in:
Mathias Jacquelin 2019-09-24 13:25:06 -07:00 committed by Peter Scheibel
parent 065cbe89fe
commit 7a11a2ccdb

View File

@ -4,31 +4,15 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import * from spack import *
import llnl.util.tty as tty
import os
def detect_scheduler(): def cross_detect():
if (os.environ.get('CROSS') is None): if spack.architecture.platform().name == 'cray':
srunbin = which('srun') if which('srun'):
if srunbin is None: return 'cray-aries-slurm'
aprunbin = which('aprun') if which('alps'):
if aprunbin is None: return 'cray-aries-alps'
tty.warn("CROSS has not been set, however " return 'none'
"cannot detect scheduler.")
return 'none'
else:
tty.warn("CROSS has not been set, however "
"aprun has been found, assuming alps scheduler.")
return 'alps'
else:
tty.warn("CROSS has not been set, however "
"srun has been found, assuming slurm scheduler.")
return 'slurm'
else:
tty.warn("CROSS has been set to %s by the user."
% os.environ.get('CROSS'))
return 'user'
class Upcxx(Package): class Upcxx(Package):
@ -40,15 +24,16 @@ class Upcxx(Package):
homepage = "https://upcxx.lbl.gov" homepage = "https://upcxx.lbl.gov"
version('2019.9.0', '7642877e05300e38f6fa0afbc6062788')
version('2019.3.2', '844722cb0e8c0bc649017fce86469457') version('2019.3.2', '844722cb0e8c0bc649017fce86469457')
variant('cuda', default=False, variant('cuda', default=False,
description='Builds a CUDA-enabled version of UPC++') description='Builds a CUDA-enabled version of UPC++')
variant('scheduler', values=('slurm', 'alps', 'user', 'none'), variant('cross', default=cross_detect(),
default=detect_scheduler(), description="UPC++ cross-compile target (autodetect by default)")
description="Resource manager to use")
conflicts('scheduler=none', when='platform=cray', conflicts('cross=none', when='platform=cray',
msg='None is unacceptable on Cray.') msg='None is unacceptable on Cray.')
depends_on('cuda', when='+cuda') depends_on('cuda', when='+cuda')
@ -63,18 +48,20 @@ def url_for_version(self, version):
def setup_environment(self, spack_env, run_env): def setup_environment(self, spack_env, run_env):
if 'platform=cray' in self.spec: if 'platform=cray' in self.spec:
spack_env.set('GASNET_CONFIGURE_ARGS', '--enable-mpi=probe') spack_env.set('GASNET_CONFIGURE_ARGS', '--enable-mpi=probe')
if "scheduler=slurm" in self.spec:
tty.warn("CROSS has been automatically set to %s." if 'cross=none' not in self.spec:
% 'cray-aries-slurm') spack_env.set('CROSS', self.spec.variants['cross'].value)
spack_env.set('CROSS', 'cray-aries-slurm')
elif "scheduler=alps" in self.spec:
tty.warn("CROSS has been automatically set to %s."
% 'cray-aries-alps')
spack_env.set('CROSS', 'cray-aries-alps')
if '+cuda' in self.spec: if '+cuda' in self.spec:
spack_env.set('UPCXX_CUDA', '1') spack_env.set('UPCXX_CUDA', '1')
spack_env.set('UPCXX_CUDA_NVCC', self.spec['cuda'].prefix.bin.nvcc) spack_env.set('UPCXX_CUDA_NVCC', self.spec['cuda'].prefix.bin.nvcc)
run_env.set('UPCXX_INSTALL', self.prefix)
run_env.set('UPCXX', self.prefix.bin.upcxx)
if 'platform=cray' in self.spec:
run_env.set('UPCXX_GASNET_CONDUIT', 'aries')
run_env.set('UPCXX_NETWORK', 'aries')
def setup_dependent_package(self, module, dep_spec): def setup_dependent_package(self, module, dep_spec):
dep_spec.upcxx = self.prefix.bin.upcxx dep_spec.upcxx = self.prefix.bin.upcxx
@ -83,7 +70,10 @@ def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
spack_env.set('UPCXX', self.prefix.bin.upcxx) spack_env.set('UPCXX', self.prefix.bin.upcxx)
if 'platform=cray' in self.spec: if 'platform=cray' in self.spec:
spack_env.set('UPCXX_GASNET_CONDUIT', 'aries') spack_env.set('UPCXX_GASNET_CONDUIT', 'aries')
spack_env.set('UPCXX_NETWORK', 'aries')
def install(self, spec, prefix): def install(self, spec, prefix):
installsh = Executable('./install') env['CC'] = self.compiler.cc
env['CXX'] = self.compiler.cxx
installsh = Executable("./install")
installsh(prefix) installsh(prefix)