Merge branch 'develop' of https://github.com/LLNL/spack into features/module_refresh
Conflicts: lib/spack/spack/test/__init__.py
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,7 +1,7 @@
|
|||||||
/var/spack/stage
|
/var/spack/stage
|
||||||
/var/spack/cache
|
/var/spack/cache
|
||||||
*.pyc
|
*.pyc
|
||||||
/opt/
|
/opt
|
||||||
*~
|
*~
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.idea
|
.idea
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
# 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
|
||||||
from subprocess import check_call
|
|
||||||
|
|
||||||
import llnl.util.tty as tty
|
import llnl.util.tty as tty
|
||||||
from llnl.util.filesystem import join_path, mkdirp
|
from llnl.util.filesystem import join_path, mkdirp
|
||||||
@@ -31,26 +30,49 @@
|
|||||||
import spack
|
import spack
|
||||||
from spack.util.executable import which
|
from spack.util.executable import which
|
||||||
|
|
||||||
|
_SPACK_UPSTREAM = 'https://github.com/llnl/spack'
|
||||||
|
|
||||||
description = "Create a new installation of spack in another prefix"
|
description = "Create a new installation of spack in another prefix"
|
||||||
|
|
||||||
|
|
||||||
def setup_parser(subparser):
|
def setup_parser(subparser):
|
||||||
subparser.add_argument('prefix', help="names of prefix where we should install spack")
|
subparser.add_argument(
|
||||||
|
'-r', '--remote', action='store', dest='remote',
|
||||||
|
help="name of the remote to bootstrap from", default='origin')
|
||||||
|
subparser.add_argument(
|
||||||
|
'prefix',
|
||||||
|
help="names of prefix where we should install spack")
|
||||||
|
|
||||||
|
|
||||||
def get_origin_url():
|
def get_origin_info(remote):
|
||||||
git_dir = join_path(spack.prefix, '.git')
|
git_dir = join_path(spack.prefix, '.git')
|
||||||
git = which('git', required=True)
|
git = which('git', required=True)
|
||||||
origin_url = git(
|
try:
|
||||||
'--git-dir=%s' % git_dir, 'config', '--get', 'remote.origin.url',
|
branch = git('symbolic-ref', '--short', 'HEAD', output=str)
|
||||||
output=str)
|
except ProcessError:
|
||||||
return origin_url.strip()
|
branch = 'develop'
|
||||||
|
tty.warn('No branch found; using default branch: %s' % branch)
|
||||||
|
if remote == 'origin' and \
|
||||||
|
branch not in ('master', 'develop'):
|
||||||
|
branch = 'develop'
|
||||||
|
tty.warn('Unknown branch found; using default branch: %s' % branch)
|
||||||
|
try:
|
||||||
|
origin_url = git(
|
||||||
|
'--git-dir=%s' % git_dir,
|
||||||
|
'config', '--get', 'remote.%s.url' % remote,
|
||||||
|
output=str)
|
||||||
|
except ProcessError:
|
||||||
|
origin_url = _SPACK_UPSTREAM
|
||||||
|
tty.warn('No git repository found; '
|
||||||
|
'using default upstream URL: %s' % origin_url)
|
||||||
|
return (origin_url.strip(), branch.strip())
|
||||||
|
|
||||||
|
|
||||||
def bootstrap(parser, args):
|
def bootstrap(parser, args):
|
||||||
origin_url = get_origin_url()
|
origin_url, branch = get_origin_info(args.remote)
|
||||||
prefix = args.prefix
|
prefix = args.prefix
|
||||||
|
|
||||||
tty.msg("Fetching spack from origin: %s" % origin_url)
|
tty.msg("Fetching spack from '%s': %s" % (args.remote, origin_url))
|
||||||
|
|
||||||
if os.path.isfile(prefix):
|
if os.path.isfile(prefix):
|
||||||
tty.die("There is already a file at %s" % prefix)
|
tty.die("There is already a file at %s" % prefix)
|
||||||
@@ -62,7 +84,8 @@ def bootstrap(parser, args):
|
|||||||
|
|
||||||
files_in_the_way = os.listdir(prefix)
|
files_in_the_way = os.listdir(prefix)
|
||||||
if files_in_the_way:
|
if files_in_the_way:
|
||||||
tty.die("There are already files there! Delete these files before boostrapping spack.",
|
tty.die("There are already files there! "
|
||||||
|
"Delete these files before boostrapping spack.",
|
||||||
*files_in_the_way)
|
*files_in_the_way)
|
||||||
|
|
||||||
tty.msg("Installing:",
|
tty.msg("Installing:",
|
||||||
@@ -73,8 +96,10 @@ def bootstrap(parser, args):
|
|||||||
git = which('git', required=True)
|
git = which('git', required=True)
|
||||||
git('init', '--shared', '-q')
|
git('init', '--shared', '-q')
|
||||||
git('remote', 'add', 'origin', origin_url)
|
git('remote', 'add', 'origin', origin_url)
|
||||||
git('fetch', 'origin', 'master:refs/remotes/origin/master', '-n', '-q')
|
git('fetch', 'origin', '%s:refs/remotes/origin/%s' % (branch, branch),
|
||||||
git('reset', '--hard', 'origin/master', '-q')
|
'-n', '-q')
|
||||||
|
git('reset', '--hard', 'origin/%s' % branch, '-q')
|
||||||
|
git('checkout', '-B', branch, 'origin/%s' % branch, '-q')
|
||||||
|
|
||||||
tty.msg("Successfully created a new spack in %s" % prefix,
|
tty.msg("Successfully created a new spack in %s" % prefix,
|
||||||
"Run %s/bin/spack to use this installation." % prefix)
|
"Run %s/bin/spack to use this installation." % prefix)
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ def setup_parser(subparser):
|
|||||||
'--keep-stage', action='store_true', dest='keep_stage',
|
'--keep-stage', action='store_true', dest='keep_stage',
|
||||||
help="Don't clean up staging area when command completes.")
|
help="Don't clean up staging area when command completes.")
|
||||||
subparser.add_argument(
|
subparser.add_argument(
|
||||||
'versions', nargs=argparse.REMAINDER, help='Versions to generate checksums for')
|
'versions', nargs=argparse.REMAINDER,
|
||||||
|
help='Versions to generate checksums for')
|
||||||
|
|
||||||
|
|
||||||
def get_checksums(versions, urls, **kwargs):
|
def get_checksums(versions, urls, **kwargs):
|
||||||
@@ -59,10 +60,10 @@ def get_checksums(versions, urls, **kwargs):
|
|||||||
with Stage(url, keep=keep_stage) as stage:
|
with Stage(url, keep=keep_stage) as stage:
|
||||||
stage.fetch()
|
stage.fetch()
|
||||||
if i == 0 and first_stage_function:
|
if i == 0 and first_stage_function:
|
||||||
first_stage_function(stage)
|
first_stage_function(stage, url)
|
||||||
|
|
||||||
hashes.append((version,
|
hashes.append((version, spack.util.crypto.checksum(
|
||||||
spack.util.crypto.checksum(hashlib.md5, stage.archive_file)))
|
hashlib.md5, stage.archive_file)))
|
||||||
i += 1
|
i += 1
|
||||||
except FailedDownloadError as e:
|
except FailedDownloadError as e:
|
||||||
tty.msg("Failed to fetch %s" % url)
|
tty.msg("Failed to fetch %s" % url)
|
||||||
@@ -79,12 +80,12 @@ def checksum(parser, args):
|
|||||||
# If the user asked for specific versions, use those.
|
# If the user asked for specific versions, use those.
|
||||||
if args.versions:
|
if args.versions:
|
||||||
versions = {}
|
versions = {}
|
||||||
for v in args.versions:
|
for version in args.versions:
|
||||||
v = ver(v)
|
version = ver(version)
|
||||||
if not isinstance(v, Version):
|
if not isinstance(version, Version):
|
||||||
tty.die("Cannot generate checksums for version lists or " +
|
tty.die("Cannot generate checksums for version lists or " +
|
||||||
"version ranges. Use unambiguous versions.")
|
"version ranges. Use unambiguous versions.")
|
||||||
versions[v] = pkg.url_for_version(v)
|
versions[version] = pkg.url_for_version(version)
|
||||||
else:
|
else:
|
||||||
versions = pkg.fetch_remote_versions()
|
versions = pkg.fetch_remote_versions()
|
||||||
if not versions:
|
if not versions:
|
||||||
@@ -111,5 +112,7 @@ def checksum(parser, args):
|
|||||||
if not version_hashes:
|
if not version_hashes:
|
||||||
tty.die("Could not fetch any versions for %s" % pkg.name)
|
tty.die("Could not fetch any versions for %s" % pkg.name)
|
||||||
|
|
||||||
version_lines = [" version('%s', '%s')" % (v, h) for v, h in version_hashes]
|
version_lines = [
|
||||||
|
" version('%s', '%s')" % (v, h) for v, h in version_hashes
|
||||||
|
]
|
||||||
tty.msg("Checksummed new versions of %s:" % pkg.name, *version_lines)
|
tty.msg("Checksummed new versions of %s:" % pkg.name, *version_lines)
|
||||||
|
|||||||
@@ -103,6 +103,64 @@ def install(self, spec, prefix):
|
|||||||
${install}
|
${install}
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
# Build dependencies and extensions
|
||||||
|
dependencies_dict = {
|
||||||
|
'autotools': "# depends_on('foo')",
|
||||||
|
'cmake': "depends_on('cmake')",
|
||||||
|
'scons': "depends_on('scons')",
|
||||||
|
'python': "extends('python')",
|
||||||
|
'R': "extends('R')",
|
||||||
|
'octave': "extends('octave')",
|
||||||
|
'unknown': "# depends_on('foo')"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Default installation instructions
|
||||||
|
install_dict = {
|
||||||
|
'autotools': """\
|
||||||
|
# FIXME: Modify the configure line to suit your build system here.
|
||||||
|
configure('--prefix={0}'.format(prefix))
|
||||||
|
|
||||||
|
# FIXME: Add logic to build and install here.
|
||||||
|
make()
|
||||||
|
make('install')""",
|
||||||
|
|
||||||
|
'cmake': """\
|
||||||
|
with working_dir('spack-build', create=True):
|
||||||
|
# FIXME: Modify the cmake line to suit your build system here.
|
||||||
|
cmake('..', *std_cmake_args)
|
||||||
|
|
||||||
|
# FIXME: Add logic to build and install here.
|
||||||
|
make()
|
||||||
|
make('install')""",
|
||||||
|
|
||||||
|
'scons': """\
|
||||||
|
# FIXME: Add logic to build and install here.
|
||||||
|
scons('prefix={0}'.format(prefix))
|
||||||
|
scons('install')""",
|
||||||
|
|
||||||
|
'python': """\
|
||||||
|
# FIXME: Add logic to build and install here.
|
||||||
|
python('setup.py', 'install', '--prefix={0}'.format(prefix))""",
|
||||||
|
|
||||||
|
'R': """\
|
||||||
|
# FIXME: Add logic to build and install here.
|
||||||
|
R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir),
|
||||||
|
self.stage.source_path)""",
|
||||||
|
|
||||||
|
'octave': """\
|
||||||
|
# FIXME: Add logic to build and install here.
|
||||||
|
octave('--quiet', '--norc',
|
||||||
|
'--built-in-docstrings-file=/dev/null',
|
||||||
|
'--texi-macros-file=/dev/null',
|
||||||
|
'--eval', 'pkg prefix {0}; pkg install {1}'.format(
|
||||||
|
prefix, self.stage.archive_file))""",
|
||||||
|
|
||||||
|
'unknown': """\
|
||||||
|
# FIXME: Unknown build system
|
||||||
|
make()
|
||||||
|
make('install')"""
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def make_version_calls(ver_hash_tuples):
|
def make_version_calls(ver_hash_tuples):
|
||||||
"""Adds a version() call to the package for each version found."""
|
"""Adds a version() call to the package for each version found."""
|
||||||
@@ -133,60 +191,17 @@ def setup_parser(subparser):
|
|||||||
setup_parser.subparser = subparser
|
setup_parser.subparser = subparser
|
||||||
|
|
||||||
|
|
||||||
class ConfigureGuesser(object):
|
class BuildSystemGuesser(object):
|
||||||
def __call__(self, stage):
|
def __call__(self, stage, url):
|
||||||
"""Try to guess the type of build system used by the project.
|
"""Try to guess the type of build system used by a project based on
|
||||||
Set any necessary build dependencies or extensions.
|
the contents of its archive or the URL it was downloaded from."""
|
||||||
Set the appropriate default installation instructions."""
|
|
||||||
|
|
||||||
# Build dependencies and extensions
|
# Most octave extensions are hosted on Octave-Forge:
|
||||||
dependenciesDict = {
|
# http://octave.sourceforge.net/index.html
|
||||||
'autotools': "# depends_on('foo')",
|
# They all have the same base URL.
|
||||||
'cmake': "depends_on('cmake', type='build')",
|
if 'downloads.sourceforge.net/octave/' in url:
|
||||||
'scons': "depends_on('scons', type='build')",
|
self.build_system = 'octave'
|
||||||
'python': "extends('python', type=nolink)",
|
return
|
||||||
'R': "extends('R')",
|
|
||||||
'unknown': "# depends_on('foo')"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Default installation instructions
|
|
||||||
installDict = {
|
|
||||||
'autotools': """\
|
|
||||||
# FIXME: Modify the configure line to suit your build system here.
|
|
||||||
configure('--prefix={0}'.format(prefix))
|
|
||||||
|
|
||||||
# FIXME: Add logic to build and install here.
|
|
||||||
make()
|
|
||||||
make('install')""",
|
|
||||||
|
|
||||||
'cmake': """\
|
|
||||||
with working_dir('spack-build', create=True):
|
|
||||||
# FIXME: Modify the cmake line to suit your build system here.
|
|
||||||
cmake('..', *std_cmake_args)
|
|
||||||
|
|
||||||
# FIXME: Add logic to build and install here.
|
|
||||||
make()
|
|
||||||
make('install')""",
|
|
||||||
|
|
||||||
'scons': """\
|
|
||||||
# FIXME: Add logic to build and install here.
|
|
||||||
scons('prefix={0}'.format(prefix))
|
|
||||||
scons('install')""",
|
|
||||||
|
|
||||||
'python': """\
|
|
||||||
# FIXME: Add logic to build and install here.
|
|
||||||
python('setup.py', 'install', '--prefix={0}'.format(prefix))""",
|
|
||||||
|
|
||||||
'R': """\
|
|
||||||
# FIXME: Add logic to build and install here.
|
|
||||||
R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir),
|
|
||||||
self.stage.source_path)""",
|
|
||||||
|
|
||||||
'unknown': """\
|
|
||||||
# FIXME: Unknown build system
|
|
||||||
make()
|
|
||||||
make('install')"""
|
|
||||||
}
|
|
||||||
|
|
||||||
# A list of clues that give us an idea of the build system a package
|
# A list of clues that give us an idea of the build system a package
|
||||||
# uses. If the regular expression matches a file contained in the
|
# uses. If the regular expression matches a file contained in the
|
||||||
@@ -224,12 +239,6 @@ def __call__(self, stage):
|
|||||||
|
|
||||||
self.build_system = build_system
|
self.build_system = build_system
|
||||||
|
|
||||||
# Set any necessary build dependencies or extensions.
|
|
||||||
self.dependencies = dependenciesDict[build_system]
|
|
||||||
|
|
||||||
# Set the appropriate default installation instructions
|
|
||||||
self.install = installDict[build_system]
|
|
||||||
|
|
||||||
|
|
||||||
def guess_name_and_version(url, args):
|
def guess_name_and_version(url, args):
|
||||||
# Try to deduce name and version of the new package from the URL
|
# Try to deduce name and version of the new package from the URL
|
||||||
@@ -334,8 +343,8 @@ def create(parser, args):
|
|||||||
# Fetch tarballs (prompting user if necessary)
|
# Fetch tarballs (prompting user if necessary)
|
||||||
versions, urls = fetch_tarballs(url, name, version)
|
versions, urls = fetch_tarballs(url, name, version)
|
||||||
|
|
||||||
# Try to guess what configure system is used.
|
# Try to guess what build system is used.
|
||||||
guesser = ConfigureGuesser()
|
guesser = BuildSystemGuesser()
|
||||||
ver_hash_tuples = spack.cmd.checksum.get_checksums(
|
ver_hash_tuples = spack.cmd.checksum.get_checksums(
|
||||||
versions, urls,
|
versions, urls,
|
||||||
first_stage_function=guesser,
|
first_stage_function=guesser,
|
||||||
@@ -344,13 +353,13 @@ def create(parser, args):
|
|||||||
if not ver_hash_tuples:
|
if not ver_hash_tuples:
|
||||||
tty.die("Could not fetch any tarballs for %s" % name)
|
tty.die("Could not fetch any tarballs for %s" % name)
|
||||||
|
|
||||||
# Prepend 'py-' to python package names, by convention.
|
# Add prefix to package name if it is an extension.
|
||||||
if guesser.build_system == 'python':
|
if guesser.build_system == 'python':
|
||||||
name = 'py-%s' % name
|
name = 'py-{0}'.format(name)
|
||||||
|
|
||||||
# Prepend 'r-' to R package names, by convention.
|
|
||||||
if guesser.build_system == 'R':
|
if guesser.build_system == 'R':
|
||||||
name = 'r-%s' % name
|
name = 'r-{0}'.format(name)
|
||||||
|
if guesser.build_system == 'octave':
|
||||||
|
name = 'octave-{0}'.format(name)
|
||||||
|
|
||||||
# Create a directory for the new package.
|
# Create a directory for the new package.
|
||||||
pkg_path = repo.filename_for_package_name(name)
|
pkg_path = repo.filename_for_package_name(name)
|
||||||
@@ -367,8 +376,8 @@ def create(parser, args):
|
|||||||
class_name=mod_to_class(name),
|
class_name=mod_to_class(name),
|
||||||
url=url,
|
url=url,
|
||||||
versions=make_version_calls(ver_hash_tuples),
|
versions=make_version_calls(ver_hash_tuples),
|
||||||
dependencies=guesser.dependencies,
|
dependencies=dependencies_dict[guesser.build_system],
|
||||||
install=guesser.install))
|
install=install_dict[guesser.build_system]))
|
||||||
|
|
||||||
# If everything checks out, go ahead and edit.
|
# If everything checks out, go ahead and edit.
|
||||||
spack.editor(pkg_path)
|
spack.editor(pkg_path)
|
||||||
|
|||||||
@@ -22,10 +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 re
|
|
||||||
import cgi
|
import cgi
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
import llnl.util.tty as tty
|
|
||||||
from llnl.util.tty.colify import *
|
from llnl.util.tty.colify import *
|
||||||
import spack
|
import spack
|
||||||
|
|
||||||
@@ -34,21 +32,22 @@
|
|||||||
|
|
||||||
def github_url(pkg):
|
def github_url(pkg):
|
||||||
"""Link to a package file on github."""
|
"""Link to a package file on github."""
|
||||||
return ("https://github.com/llnl/spack/blob/master/var/spack/packages/%s/package.py" %
|
url = "https://github.com/llnl/spack/blob/master/var/spack/packages/%s/package.py" # NOQA: ignore=E501
|
||||||
pkg.name)
|
return (url % pkg.name)
|
||||||
|
|
||||||
|
|
||||||
def rst_table(elts):
|
def rst_table(elts):
|
||||||
"""Print out a RST-style table."""
|
"""Print out a RST-style table."""
|
||||||
cols = StringIO()
|
cols = StringIO()
|
||||||
ncol, widths = colify(elts, output=cols, tty=True)
|
ncol, widths = colify(elts, output=cols, tty=True)
|
||||||
header = " ".join("=" * (w-1) for w in widths)
|
header = " ".join("=" * (w - 1) for w in widths)
|
||||||
return "%s\n%s%s" % (header, cols.getvalue(), header)
|
return "%s\n%s%s" % (header, cols.getvalue(), header)
|
||||||
|
|
||||||
|
|
||||||
def print_rst_package_list():
|
def print_rst_package_list():
|
||||||
"""Print out information on all packages in restructured text."""
|
"""Print out information on all packages in restructured text."""
|
||||||
pkgs = sorted(spack.repo.all_packages(), key=lambda s:s.name.lower())
|
pkgs = sorted(spack.repo.all_packages(), key=lambda s: s.name.lower())
|
||||||
|
pkg_names = [p.name for p in pkgs]
|
||||||
|
|
||||||
print ".. _package-list:"
|
print ".. _package-list:"
|
||||||
print
|
print
|
||||||
@@ -62,7 +61,7 @@ def print_rst_package_list():
|
|||||||
|
|
||||||
print "Spack currently has %d mainline packages:" % len(pkgs)
|
print "Spack currently has %d mainline packages:" % len(pkgs)
|
||||||
print
|
print
|
||||||
print rst_table("`%s`_" % p.name for p in pkgs)
|
print rst_table("`%s`_" % p for p in pkg_names)
|
||||||
print
|
print
|
||||||
print "-----"
|
print "-----"
|
||||||
|
|
||||||
@@ -79,14 +78,15 @@ def print_rst_package_list():
|
|||||||
print
|
print
|
||||||
if pkg.versions:
|
if pkg.versions:
|
||||||
print "Versions:"
|
print "Versions:"
|
||||||
print " " + ", ".join(str(v) for v in reversed(sorted(pkg.versions)))
|
print " " + ", ".join(str(v) for v in
|
||||||
|
reversed(sorted(pkg.versions)))
|
||||||
|
|
||||||
for deptype in ('build', 'link', 'run'):
|
for deptype in spack.alldeps:
|
||||||
deps = pkg.dependencies(deptype)
|
deps = pkg.dependencies_of_type(deptype)
|
||||||
if deps:
|
if deps:
|
||||||
print "%s Dependencies" % deptype.capitalize()
|
print "%s Dependencies" % deptype.capitalize()
|
||||||
print " " + ", ".join("`%s`_" % d if d != "mpi" else d
|
print " " + ", ".join("%s_" % d if d in pkg_names
|
||||||
for d in build_deps)
|
else d for d in deps)
|
||||||
print
|
print
|
||||||
|
|
||||||
print "Description:"
|
print "Description:"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
from spack.architecture import Platform, Target
|
from spack.architecture import Platform, Target
|
||||||
from spack.operating_systems.linux_distro import LinuxDistro
|
from spack.operating_systems.linux_distro import LinuxDistro
|
||||||
from spack.operating_systems.cnl import Cnl
|
from spack.operating_systems.cnl import Cnl
|
||||||
|
from spack.util.executable import which
|
||||||
|
|
||||||
class CrayXc(Platform):
|
class CrayXc(Platform):
|
||||||
priority = 20
|
priority = 20
|
||||||
@@ -42,5 +43,11 @@ def __init__(self):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def detect(self):
|
def detect(self):
|
||||||
return os.path.exists('/opt/cray/craype')
|
if os.path.exists('/cray_home'):
|
||||||
|
cc_verbose = which('cc')
|
||||||
|
cc_verbose.add_default_arg('-craype-verbose')
|
||||||
|
text = cc_verbose(output=str, error=str, ignore_errors=True).split()
|
||||||
|
if '-D__CRAYXC' in text:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|||||||
@@ -26,8 +26,10 @@
|
|||||||
import spack
|
import spack
|
||||||
from spack.version import *
|
from spack.version import *
|
||||||
|
|
||||||
|
|
||||||
class PreferredPackages(object):
|
class PreferredPackages(object):
|
||||||
_default_order = {'compiler' : [ 'gcc', 'intel', 'clang', 'pgi', 'xlc' ] } # Arbitrary, but consistent
|
# Arbitrary, but consistent
|
||||||
|
_default_order = {'compiler': ['gcc', 'intel', 'clang', 'pgi', 'xlc']}
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.preferred = spack.config.get_config('packages')
|
self.preferred = spack.config.get_config('packages')
|
||||||
@@ -35,24 +37,25 @@ def __init__(self):
|
|||||||
|
|
||||||
# Given a package name, sort component (e.g, version, compiler, ...), and
|
# Given a package name, sort component (e.g, version, compiler, ...), and
|
||||||
# a second_key (used by providers), return the list
|
# a second_key (used by providers), return the list
|
||||||
def _order_for_package(self, pkgname, component, second_key, test_all=True):
|
def _order_for_package(self, pkgname, component, second_key,
|
||||||
|
test_all=True):
|
||||||
pkglist = [pkgname]
|
pkglist = [pkgname]
|
||||||
if test_all:
|
if test_all:
|
||||||
pkglist.append('all')
|
pkglist.append('all')
|
||||||
for pkg in pkglist:
|
for pkg in pkglist:
|
||||||
order = self.preferred.get(pkg, {}).get(component, {})
|
order = self.preferred.get(pkg, {}).get(component, {})
|
||||||
if type(order) is dict:
|
if isinstance(order, dict) and second_key:
|
||||||
order = order.get(second_key, {})
|
order = order.get(second_key, {})
|
||||||
if not order:
|
if not order:
|
||||||
continue
|
continue
|
||||||
return [str(s).strip() for s in order]
|
return [str(s).strip() for s in order]
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
# A generic sorting function. Given a package name and sort
|
# A generic sorting function. Given a package name and sort
|
||||||
# component, return less-than-0, 0, or greater-than-0 if
|
# component, return less-than-0, 0, or greater-than-0 if
|
||||||
# a is respectively less-than, equal to, or greater than b.
|
# a is respectively less-than, equal to, or greater than b.
|
||||||
def _component_compare(self, pkgname, component, a, b, reverse_natural_compare, second_key):
|
def _component_compare(self, pkgname, component, a, b,
|
||||||
|
reverse_natural_compare, second_key):
|
||||||
if a is None:
|
if a is None:
|
||||||
return -1
|
return -1
|
||||||
if b is None:
|
if b is None:
|
||||||
@@ -84,92 +87,102 @@ def _component_compare(self, pkgname, component, a, b, reverse_natural_compare,
|
|||||||
else:
|
else:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
# A sorting function for specs. Similar to component_compare, but
|
# A sorting function for specs. Similar to component_compare, but
|
||||||
# a and b are considered to match entries in the sorting list if they
|
# a and b are considered to match entries in the sorting list if they
|
||||||
# satisfy the list component.
|
# satisfy the list component.
|
||||||
def _spec_compare(self, pkgname, component, a, b, reverse_natural_compare, second_key):
|
def _spec_compare(self, pkgname, component, a, b,
|
||||||
if not a or not a.concrete:
|
reverse_natural_compare, second_key):
|
||||||
|
if not a or (not a.concrete and not second_key):
|
||||||
return -1
|
return -1
|
||||||
if not b or not b.concrete:
|
if not b or (not b.concrete and not second_key):
|
||||||
return 1
|
return 1
|
||||||
specs = self._spec_for_pkgname(pkgname, component, second_key)
|
specs = self._spec_for_pkgname(pkgname, component, second_key)
|
||||||
a_index = None
|
a_index = None
|
||||||
b_index = None
|
b_index = None
|
||||||
reverse = -1 if reverse_natural_compare else 1
|
reverse = -1 if reverse_natural_compare else 1
|
||||||
for i, cspec in enumerate(specs):
|
for i, cspec in enumerate(specs):
|
||||||
if a_index == None and (cspec.satisfies(a) or a.satisfies(cspec)):
|
if a_index is None and (cspec.satisfies(a) or a.satisfies(cspec)):
|
||||||
a_index = i
|
a_index = i
|
||||||
if b_index:
|
if b_index:
|
||||||
break
|
break
|
||||||
if b_index == None and (cspec.satisfies(b) or b.satisfies(cspec)):
|
if b_index is None and (cspec.satisfies(b) or b.satisfies(cspec)):
|
||||||
b_index = i
|
b_index = i
|
||||||
if a_index:
|
if a_index:
|
||||||
break
|
break
|
||||||
|
|
||||||
if a_index != None and b_index == None: return -1
|
if a_index is not None and b_index is None:
|
||||||
elif a_index == None and b_index != None: return 1
|
return -1
|
||||||
elif a_index != None and b_index == a_index: return -1 * cmp(a, b)
|
elif a_index is None and b_index is not None:
|
||||||
elif a_index != None and b_index != None and a_index != b_index: return cmp(a_index, b_index)
|
return 1
|
||||||
else: return cmp(a, b) * reverse
|
elif a_index is not None and b_index == a_index:
|
||||||
|
return -1 * cmp(a, b)
|
||||||
|
elif (a_index is not None and b_index is not None and
|
||||||
|
a_index != b_index):
|
||||||
|
return cmp(a_index, b_index)
|
||||||
|
else:
|
||||||
|
return cmp(a, b) * reverse
|
||||||
|
|
||||||
# Given a sort order specified by the pkgname/component/second_key, return
|
# Given a sort order specified by the pkgname/component/second_key, return
|
||||||
# a list of CompilerSpecs, VersionLists, or Specs for that sorting list.
|
# a list of CompilerSpecs, VersionLists, or Specs for that sorting list.
|
||||||
def _spec_for_pkgname(self, pkgname, component, second_key):
|
def _spec_for_pkgname(self, pkgname, component, second_key):
|
||||||
key = (pkgname, component, second_key)
|
key = (pkgname, component, second_key)
|
||||||
if not key in self._spec_for_pkgname_cache:
|
if key not in self._spec_for_pkgname_cache:
|
||||||
pkglist = self._order_for_package(pkgname, component, second_key)
|
pkglist = self._order_for_package(pkgname, component, second_key)
|
||||||
if not pkglist:
|
if not pkglist:
|
||||||
if component in self._default_order:
|
if component in self._default_order:
|
||||||
pkglist = self._default_order[component]
|
pkglist = self._default_order[component]
|
||||||
if component == 'compiler':
|
if component == 'compiler':
|
||||||
self._spec_for_pkgname_cache[key] = [spack.spec.CompilerSpec(s) for s in pkglist]
|
self._spec_for_pkgname_cache[key] = \
|
||||||
|
[spack.spec.CompilerSpec(s) for s in pkglist]
|
||||||
elif component == 'version':
|
elif component == 'version':
|
||||||
self._spec_for_pkgname_cache[key] = [VersionList(s) for s in pkglist]
|
self._spec_for_pkgname_cache[key] = \
|
||||||
|
[VersionList(s) for s in pkglist]
|
||||||
else:
|
else:
|
||||||
self._spec_for_pkgname_cache[key] = [spack.spec.Spec(s) for s in pkglist]
|
self._spec_for_pkgname_cache[key] = \
|
||||||
|
[spack.spec.Spec(s) for s in pkglist]
|
||||||
return self._spec_for_pkgname_cache[key]
|
return self._spec_for_pkgname_cache[key]
|
||||||
|
|
||||||
|
|
||||||
def provider_compare(self, pkgname, provider_str, a, b):
|
def provider_compare(self, pkgname, provider_str, a, b):
|
||||||
"""Return less-than-0, 0, or greater than 0 if a is respecively less-than, equal-to, or
|
"""Return less-than-0, 0, or greater than 0 if a is respecively
|
||||||
greater-than b. A and b are possible implementations of provider_str.
|
less-than, equal-to, or greater-than b. A and b are possible
|
||||||
One provider is less-than another if it is preferred over the other.
|
implementations of provider_str. One provider is less-than another
|
||||||
For example, provider_compare('scorep', 'mpi', 'mvapich', 'openmpi') would return -1 if
|
if it is preferred over the other. For example,
|
||||||
mvapich should be preferred over openmpi for scorep."""
|
provider_compare('scorep', 'mpi', 'mvapich', 'openmpi') would
|
||||||
return self._spec_compare(pkgname, 'providers', a, b, False, provider_str)
|
return -1 if mvapich should be preferred over openmpi for scorep."""
|
||||||
|
return self._spec_compare(pkgname, 'providers', a, b, False,
|
||||||
|
provider_str)
|
||||||
|
|
||||||
def spec_has_preferred_provider(self, pkgname, provider_str):
|
def spec_has_preferred_provider(self, pkgname, provider_str):
|
||||||
"""Return True iff the named package has a list of preferred provider"""
|
"""Return True iff the named package has a list of preferred
|
||||||
return bool(self._order_for_package(pkgname, 'providers', provider_str, False))
|
providers"""
|
||||||
|
return bool(self._order_for_package(pkgname, 'providers',
|
||||||
|
provider_str, False))
|
||||||
|
|
||||||
def version_compare(self, pkgname, a, b):
|
def version_compare(self, pkgname, a, b):
|
||||||
"""Return less-than-0, 0, or greater than 0 if version a of pkgname is
|
"""Return less-than-0, 0, or greater than 0 if version a of pkgname is
|
||||||
respecively less-than, equal-to, or greater-than version b of pkgname.
|
respectively less-than, equal-to, or greater-than version b of
|
||||||
One version is less-than another if it is preferred over the other."""
|
pkgname. One version is less-than another if it is preferred over
|
||||||
|
the other."""
|
||||||
return self._spec_compare(pkgname, 'version', a, b, True, None)
|
return self._spec_compare(pkgname, 'version', a, b, True, None)
|
||||||
|
|
||||||
|
|
||||||
def variant_compare(self, pkgname, a, b):
|
def variant_compare(self, pkgname, a, b):
|
||||||
"""Return less-than-0, 0, or greater than 0 if variant a of pkgname is
|
"""Return less-than-0, 0, or greater than 0 if variant a of pkgname is
|
||||||
respecively less-than, equal-to, or greater-than variant b of pkgname.
|
respectively less-than, equal-to, or greater-than variant b of
|
||||||
One variant is less-than another if it is preferred over the other."""
|
pkgname. One variant is less-than another if it is preferred over
|
||||||
|
the other."""
|
||||||
return self._component_compare(pkgname, 'variant', a, b, False, None)
|
return self._component_compare(pkgname, 'variant', a, b, False, None)
|
||||||
|
|
||||||
|
|
||||||
def architecture_compare(self, pkgname, a, b):
|
def architecture_compare(self, pkgname, a, b):
|
||||||
"""Return less-than-0, 0, or greater than 0 if architecture a of pkgname is
|
"""Return less-than-0, 0, or greater than 0 if architecture a of pkgname
|
||||||
respecively less-than, equal-to, or greater-than architecture b of pkgname.
|
is respectively less-than, equal-to, or greater-than architecture b
|
||||||
One architecture is less-than another if it is preferred over the other."""
|
of pkgname. One architecture is less-than another if it is preferred
|
||||||
return self._component_compare(pkgname, 'architecture', a, b, False, None)
|
over the other."""
|
||||||
|
return self._component_compare(pkgname, 'architecture', a, b,
|
||||||
|
False, None)
|
||||||
|
|
||||||
def compiler_compare(self, pkgname, a, b):
|
def compiler_compare(self, pkgname, a, b):
|
||||||
"""Return less-than-0, 0, or greater than 0 if compiler a of pkgname is
|
"""Return less-than-0, 0, or greater than 0 if compiler a of pkgname is
|
||||||
respecively less-than, equal-to, or greater-than compiler b of pkgname.
|
respecively less-than, equal-to, or greater-than compiler b of
|
||||||
One compiler is less-than another if it is preferred over the other."""
|
pkgname. One compiler is less-than another if it is preferred over
|
||||||
|
the other."""
|
||||||
return self._spec_compare(pkgname, 'compiler', a, b, False, None)
|
return self._spec_compare(pkgname, 'compiler', a, b, False, None)
|
||||||
|
|||||||
@@ -32,17 +32,17 @@
|
|||||||
from spack.test.tally_plugin import Tally
|
from spack.test.tally_plugin import Tally
|
||||||
"""Names of tests to be included in Spack's test suite"""
|
"""Names of tests to be included in Spack's test suite"""
|
||||||
|
|
||||||
test_names = ['architecture', 'versions', 'url_parse', 'url_substitution',
|
test_names = [
|
||||||
'packages', 'stage',
|
'architecture', 'versions', 'url_parse', 'url_substitution', 'packages',
|
||||||
'spec_syntax', 'spec_semantics', 'spec_dag', 'concretize',
|
'stage', 'spec_syntax', 'spec_semantics', 'spec_dag', 'concretize',
|
||||||
'multimethod', 'install', 'package_sanity', 'config',
|
'multimethod', 'install', 'package_sanity', 'config', 'directory_layout',
|
||||||
'directory_layout', 'pattern', 'python_version', 'git_fetch',
|
'pattern', 'python_version', 'git_fetch', 'svn_fetch', 'hg_fetch',
|
||||||
'svn_fetch', 'hg_fetch', 'mirror', 'modules', 'url_extrapolate',
|
'mirror', 'modules', 'url_extrapolate', 'cc', 'link_tree', 'spec_yaml',
|
||||||
'cc', 'link_tree', 'spec_yaml', 'optional_deps',
|
'optional_deps', 'make_executable', 'build_system_guess', 'lock',
|
||||||
'make_executable', 'configure_guess', 'lock', 'database',
|
'database', 'namespace_trie', 'yaml', 'sbang', 'environment', 'cmd.find',
|
||||||
'namespace_trie', 'yaml', 'sbang', 'environment', 'cmd.find',
|
'cmd.uninstall', 'cmd.test_install', 'cmd.test_compiler_cmd',
|
||||||
'cmd.uninstall', 'cmd.test_install',
|
'cmd.module'
|
||||||
'cmd.test_compiler_cmd', 'cmd.module']
|
]
|
||||||
|
|
||||||
|
|
||||||
def list_tests():
|
def list_tests():
|
||||||
|
|||||||
@@ -28,14 +28,14 @@
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from llnl.util.filesystem import *
|
from llnl.util.filesystem import *
|
||||||
from spack.cmd.create import ConfigureGuesser
|
from spack.cmd.create import BuildSystemGuesser
|
||||||
from spack.stage import Stage
|
from spack.stage import Stage
|
||||||
from spack.test.mock_packages_test import *
|
from spack.test.mock_packages_test import *
|
||||||
from spack.util.executable import which
|
from spack.util.executable import which
|
||||||
|
|
||||||
|
|
||||||
class InstallTest(unittest.TestCase):
|
class InstallTest(unittest.TestCase):
|
||||||
"""Tests the configure guesser in spack create"""
|
"""Tests the build system guesser in spack create"""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.tar = which('tar')
|
self.tar = which('tar')
|
||||||
@@ -44,12 +44,10 @@ def setUp(self):
|
|||||||
os.chdir(self.tmpdir)
|
os.chdir(self.tmpdir)
|
||||||
self.stage = None
|
self.stage = None
|
||||||
|
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
shutil.rmtree(self.tmpdir, ignore_errors=True)
|
shutil.rmtree(self.tmpdir, ignore_errors=True)
|
||||||
os.chdir(self.orig_dir)
|
os.chdir(self.orig_dir)
|
||||||
|
|
||||||
|
|
||||||
def check_archive(self, filename, system):
|
def check_archive(self, filename, system):
|
||||||
mkdirp('archive')
|
mkdirp('archive')
|
||||||
touch(join_path('archive', filename))
|
touch(join_path('archive', filename))
|
||||||
@@ -60,24 +58,24 @@ def check_archive(self, filename, system):
|
|||||||
with Stage(url) as stage:
|
with Stage(url) as stage:
|
||||||
stage.fetch()
|
stage.fetch()
|
||||||
|
|
||||||
guesser = ConfigureGuesser()
|
guesser = BuildSystemGuesser()
|
||||||
guesser(stage)
|
guesser(stage, url)
|
||||||
self.assertEqual(system, guesser.build_system)
|
self.assertEqual(system, guesser.build_system)
|
||||||
|
|
||||||
|
|
||||||
def test_python(self):
|
|
||||||
self.check_archive('setup.py', 'python')
|
|
||||||
|
|
||||||
|
|
||||||
def test_autotools(self):
|
def test_autotools(self):
|
||||||
self.check_archive('configure', 'autotools')
|
self.check_archive('configure', 'autotools')
|
||||||
|
|
||||||
|
|
||||||
def test_cmake(self):
|
def test_cmake(self):
|
||||||
self.check_archive('CMakeLists.txt', 'cmake')
|
self.check_archive('CMakeLists.txt', 'cmake')
|
||||||
|
|
||||||
|
def test_scons(self):
|
||||||
|
self.check_archive('SConstruct', 'scons')
|
||||||
|
|
||||||
|
def test_python(self):
|
||||||
|
self.check_archive('setup.py', 'python')
|
||||||
|
|
||||||
|
def test_R(self):
|
||||||
|
self.check_archive('NAMESPACE', 'R')
|
||||||
|
|
||||||
def test_unknown(self):
|
def test_unknown(self):
|
||||||
self.check_archive('foobar', 'unknown')
|
self.check_archive('foobar', 'unknown')
|
||||||
|
|
||||||
|
|
||||||
@@ -27,7 +27,6 @@
|
|||||||
|
|
||||||
import StringIO
|
import StringIO
|
||||||
import spack.modules
|
import spack.modules
|
||||||
import unittest
|
|
||||||
from spack.test.mock_packages_test import MockPackagesTest
|
from spack.test.mock_packages_test import MockPackagesTest
|
||||||
|
|
||||||
FILE_REGISTRY = collections.defaultdict(StringIO.StringIO)
|
FILE_REGISTRY = collections.defaultdict(StringIO.StringIO)
|
||||||
@@ -266,7 +265,7 @@ def test_alter_environment(self):
|
|||||||
|
|
||||||
def test_blacklist(self):
|
def test_blacklist(self):
|
||||||
spack.modules.CONFIGURATION = configuration_blacklist
|
spack.modules.CONFIGURATION = configuration_blacklist
|
||||||
spec = spack.spec.Spec('mpileaks')
|
spec = spack.spec.Spec('mpileaks ^zmpi')
|
||||||
content = self.get_modulefile_content(spec)
|
content = self.get_modulefile_content(spec)
|
||||||
self.assertEqual(len([x for x in content if 'is-loaded' in x]), 1)
|
self.assertEqual(len([x for x in content if 'is-loaded' in x]), 1)
|
||||||
self.assertEqual(len([x for x in content if 'module load ' in x]), 1)
|
self.assertEqual(len([x for x in content if 'module load ' in x]), 1)
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class Cmake(Package):
|
|||||||
homepage = 'https://www.cmake.org'
|
homepage = 'https://www.cmake.org'
|
||||||
url = 'https://cmake.org/files/v3.4/cmake-3.4.3.tar.gz'
|
url = 'https://cmake.org/files/v3.4/cmake-3.4.3.tar.gz'
|
||||||
|
|
||||||
|
version('3.6.0', 'aa40fbecf49d99c083415c2411d12db9')
|
||||||
version('3.5.2', '701386a1b5ec95f8d1075ecf96383e02')
|
version('3.5.2', '701386a1b5ec95f8d1075ecf96383e02')
|
||||||
version('3.5.1', 'ca051f4a66375c89d1a524e726da0296')
|
version('3.5.1', 'ca051f4a66375c89d1a524e726da0296')
|
||||||
version('3.5.0', '33c5d09d4c33d4ffcc63578a6ba8777e')
|
version('3.5.0', '33c5d09d4c33d4ffcc63578a6ba8777e')
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
diff --git a/src/libjasper/jpc/jpc_dec.c b/src/libjasper/jpc/jpc_dec.c
|
||||||
|
index fa72a0e..1f4845f 100644
|
||||||
|
--- a/src/libjasper/jpc/jpc_dec.c
|
||||||
|
+++ b/src/libjasper/jpc/jpc_dec.c
|
||||||
|
@@ -1069,12 +1069,18 @@ static int jpc_dec_tiledecode(jpc_dec_t *dec, jpc_dec_tile_t *tile)
|
||||||
|
/* Apply an inverse intercomponent transform if necessary. */
|
||||||
|
switch (tile->cp->mctid) {
|
||||||
|
case JPC_MCT_RCT:
|
||||||
|
- assert(dec->numcomps == 3);
|
||||||
|
+ if (dec->numcomps != 3 && dec->numcomps != 4) {
|
||||||
|
+ jas_eprintf("bad number of components (%d)\n", dec->numcomps);
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
jpc_irct(tile->tcomps[0].data, tile->tcomps[1].data,
|
||||||
|
tile->tcomps[2].data);
|
||||||
|
break;
|
||||||
|
case JPC_MCT_ICT:
|
||||||
|
- assert(dec->numcomps == 3);
|
||||||
|
+ if (dec->numcomps != 3 && dec->numcomps != 4) {
|
||||||
|
+ jas_eprintf("bad number of components (%d)\n", dec->numcomps);
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
jpc_iict(tile->tcomps[0].data, tile->tcomps[1].data,
|
||||||
|
tile->tcomps[2].data);
|
||||||
|
break;
|
||||||
63
var/spack/repos/builtin/packages/jasper/package.py
Normal file
63
var/spack/repos/builtin/packages/jasper/package.py
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
##############################################################################
|
||||||
|
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
|
||||||
|
# Produced at the Lawrence Livermore National Laboratory.
|
||||||
|
#
|
||||||
|
# This file is part of Spack.
|
||||||
|
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
|
||||||
|
# LLNL-CODE-647188
|
||||||
|
#
|
||||||
|
# For details, see https://github.com/llnl/spack
|
||||||
|
# Please also see the LICENSE file for our notice and the LGPL.
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Lesser General Public License (as
|
||||||
|
# published by the Free Software Foundation) version 2.1, February 1999.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but
|
||||||
|
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
|
||||||
|
# conditions of the GNU Lesser General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Lesser General Public
|
||||||
|
# License along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
##############################################################################
|
||||||
|
from spack import *
|
||||||
|
|
||||||
|
|
||||||
|
class Jasper(Package):
|
||||||
|
"""Library for manipulating JPEG-2000 images"""
|
||||||
|
|
||||||
|
homepage = "https://www.ece.uvic.ca/~frodo/jasper/"
|
||||||
|
url = "https://www.ece.uvic.ca/~frodo/jasper/software/jasper-1.900.1.zip"
|
||||||
|
|
||||||
|
version('1.900.1', 'a342b2b4495b3e1394e161eb5d85d754')
|
||||||
|
|
||||||
|
variant('shared', default=True,
|
||||||
|
description='Builds shared versions of the libraries')
|
||||||
|
variant('debug', default=False,
|
||||||
|
description='Builds debug versions of the libraries')
|
||||||
|
|
||||||
|
depends_on('libjpeg-turbo')
|
||||||
|
|
||||||
|
# Fixes a bug (still in upstream as of v.1.900.1) where an assertion fails
|
||||||
|
# when certain JPEG-2000 files with an alpha channel are processed
|
||||||
|
# see: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=469786
|
||||||
|
patch('fix_alpha_channel_assert_fail.patch')
|
||||||
|
|
||||||
|
def install(self, spec, prefix):
|
||||||
|
configure_options = [
|
||||||
|
'--prefix={0}'.format(prefix),
|
||||||
|
'--mandir={0}'.format(spec.prefix.man),
|
||||||
|
]
|
||||||
|
|
||||||
|
if '+shared' in spec:
|
||||||
|
configure_options.append('--enable-shared')
|
||||||
|
|
||||||
|
if '+debug' not in spec:
|
||||||
|
configure_options.append('--disable-debug')
|
||||||
|
|
||||||
|
configure(*configure_options)
|
||||||
|
|
||||||
|
make()
|
||||||
|
make('install')
|
||||||
@@ -9,7 +9,13 @@ class Mkl(IntelInstaller):
|
|||||||
|
|
||||||
Note: You will have to add the download file to a
|
Note: You will have to add the download file to a
|
||||||
mirror so that Spack can find it. For instructions on how to set up a
|
mirror so that Spack can find it. For instructions on how to set up a
|
||||||
mirror, see http://software.llnl.gov/spack/mirrors.html"""
|
mirror, see http://software.llnl.gov/spack/mirrors.html.
|
||||||
|
|
||||||
|
To set the threading layer at run time set MKL_THREADING_LAYER
|
||||||
|
variable to one of the following values: INTEL, SEQUENTIAL, PGI.
|
||||||
|
To set interface layer at run time, use set the MKL_INTERFACE_LAYER
|
||||||
|
variable to LP64 or ILP64.
|
||||||
|
"""
|
||||||
|
|
||||||
homepage = "https://software.intel.com/en-us/intel-mkl"
|
homepage = "https://software.intel.com/en-us/intel-mkl"
|
||||||
|
|
||||||
@@ -18,6 +24,11 @@ class Mkl(IntelInstaller):
|
|||||||
version('11.3.3.210', 'f72546df27f5ebb0941b5d21fd804e34',
|
version('11.3.3.210', 'f72546df27f5ebb0941b5d21fd804e34',
|
||||||
url="file://%s/l_mkl_11.3.3.210.tgz" % os.getcwd())
|
url="file://%s/l_mkl_11.3.3.210.tgz" % os.getcwd())
|
||||||
|
|
||||||
|
# virtual dependency
|
||||||
|
provides('blas')
|
||||||
|
provides('lapack')
|
||||||
|
# TODO: MKL also provides implementation of Scalapack.
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
def install(self, spec, prefix):
|
||||||
|
|
||||||
self.intel_prefix = os.path.join(prefix, "pkg")
|
self.intel_prefix = os.path.join(prefix, "pkg")
|
||||||
@@ -26,3 +37,28 @@ def install(self, spec, prefix):
|
|||||||
mkl_dir = os.path.join(self.intel_prefix, "mkl")
|
mkl_dir = os.path.join(self.intel_prefix, "mkl")
|
||||||
for f in os.listdir(mkl_dir):
|
for f in os.listdir(mkl_dir):
|
||||||
os.symlink(os.path.join(mkl_dir, f), os.path.join(self.prefix, f))
|
os.symlink(os.path.join(mkl_dir, f), os.path.join(self.prefix, f))
|
||||||
|
|
||||||
|
def setup_dependent_package(self, module, dspec):
|
||||||
|
# For now use Single Dynamic Library:
|
||||||
|
# To set the threading layer at run time, use the
|
||||||
|
# mkl_set_threading_layer function or set MKL_THREADING_LAYER
|
||||||
|
# variable to one of the following values: INTEL, SEQUENTIAL, PGI.
|
||||||
|
# To set interface layer at run time, use the mkl_set_interface_layer
|
||||||
|
# function or set the MKL_INTERFACE_LAYER variable to LP64 or ILP64.
|
||||||
|
|
||||||
|
# Otherwise one would need to specify several libraries
|
||||||
|
# (e.g. mkl_intel_lp64;mkl_sequential;mkl_core), which reflect
|
||||||
|
# different interface and threading layers.
|
||||||
|
|
||||||
|
name = 'libmkl_rt.%s' % dso_suffix
|
||||||
|
libdir = find_library_path(name, self.prefix.lib64, self.prefix.lib)
|
||||||
|
|
||||||
|
self.spec.blas_shared_lib = join_path(libdir, name)
|
||||||
|
self.spec.lapack_shared_lib = self.spec.blas_shared_lib
|
||||||
|
|
||||||
|
def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
|
||||||
|
# set up MKLROOT for everyone using MKL package
|
||||||
|
spack_env.set('MKLROOT', self.prefix)
|
||||||
|
|
||||||
|
def setup_environment(self, spack_env, env):
|
||||||
|
env.set('MKLROOT', self.prefix)
|
||||||
|
|||||||
@@ -23,7 +23,10 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
##############################################################################
|
##############################################################################
|
||||||
from spack import *
|
from spack import *
|
||||||
import os, sys, glob
|
import os
|
||||||
|
import sys
|
||||||
|
import glob
|
||||||
|
|
||||||
|
|
||||||
class Mumps(Package):
|
class Mumps(Package):
|
||||||
"""MUMPS: a MUltifrontal Massively Parallel sparse direct Solver"""
|
"""MUMPS: a MUltifrontal Massively Parallel sparse direct Solver"""
|
||||||
@@ -44,13 +47,11 @@ class Mumps(Package):
|
|||||||
variant('idx64', default=False, description='Use int64_t/integer*8 as default index type')
|
variant('idx64', default=False, description='Use int64_t/integer*8 as default index type')
|
||||||
variant('shared', default=True, description='Build shared libraries')
|
variant('shared', default=True, description='Build shared libraries')
|
||||||
|
|
||||||
|
|
||||||
depends_on('scotch + esmumps', when='~ptscotch+scotch')
|
depends_on('scotch + esmumps', when='~ptscotch+scotch')
|
||||||
depends_on('scotch + esmumps + mpi', when='+ptscotch')
|
depends_on('scotch + esmumps + mpi', when='+ptscotch')
|
||||||
depends_on('metis@5:', when='+metis')
|
depends_on('metis@5:', when='+metis')
|
||||||
depends_on('parmetis', when="+parmetis")
|
depends_on('parmetis', when="+parmetis")
|
||||||
depends_on('blas')
|
depends_on('blas')
|
||||||
depends_on('lapack')
|
|
||||||
depends_on('scalapack', when='+mpi')
|
depends_on('scalapack', when='+mpi')
|
||||||
depends_on('mpi', when='+mpi')
|
depends_on('mpi', when='+mpi')
|
||||||
|
|
||||||
@@ -60,42 +61,52 @@ class Mumps(Package):
|
|||||||
# end before install
|
# end before install
|
||||||
# def patch(self):
|
# def patch(self):
|
||||||
def write_makefile_inc(self):
|
def write_makefile_inc(self):
|
||||||
if ('+parmetis' in self.spec or '+ptscotch' in self.spec) and '+mpi' not in self.spec:
|
if ('+parmetis' in self.spec or '+ptscotch' in self.spec) and '+mpi' not in self.spec: # NOQA: ignore=E501
|
||||||
raise RuntimeError('You cannot use the variants parmetis or ptscotch without mpi')
|
raise RuntimeError('You cannot use the variants parmetis or ptscotch without mpi') # NOQA: ignore=E501
|
||||||
|
|
||||||
makefile_conf = ["LIBBLAS = -L%s -lblas" % self.spec['blas'].prefix.lib]
|
makefile_conf = ["LIBBLAS = %s" % to_link_flags(
|
||||||
|
self.spec['blas'].blas_shared_lib)
|
||||||
|
]
|
||||||
|
|
||||||
orderings = ['-Dpord']
|
orderings = ['-Dpord']
|
||||||
|
|
||||||
if '+ptscotch' in self.spec or '+scotch' in self.spec:
|
if '+ptscotch' in self.spec or '+scotch' in self.spec:
|
||||||
join_lib = ' -l%s' % ('pt' if '+ptscotch' in self.spec else '')
|
join_lib = ' -l%s' % ('pt' if '+ptscotch' in self.spec else '')
|
||||||
makefile_conf.extend(
|
makefile_conf.extend([
|
||||||
["ISCOTCH = -I%s" % self.spec['scotch'].prefix.include,
|
"ISCOTCH = -I%s" % self.spec['scotch'].prefix.include,
|
||||||
"LSCOTCH = -L%s %s%s" % (self.spec['scotch'].prefix.lib,
|
"LSCOTCH = -L%s %s%s" % (self.spec['scotch'].prefix.lib,
|
||||||
join_lib,
|
join_lib,
|
||||||
join_lib.join(['esmumps', 'scotch', 'scotcherr']))])
|
join_lib.join(['esmumps',
|
||||||
|
'scotch',
|
||||||
|
'scotcherr']))
|
||||||
|
])
|
||||||
|
|
||||||
orderings.append('-Dscotch')
|
orderings.append('-Dscotch')
|
||||||
if '+ptscotch' in self.spec:
|
if '+ptscotch' in self.spec:
|
||||||
orderings.append('-Dptscotch')
|
orderings.append('-Dptscotch')
|
||||||
|
|
||||||
if '+parmetis' in self.spec and '+metis' in self.spec:
|
if '+parmetis' in self.spec and '+metis' in self.spec:
|
||||||
libname = 'parmetis' if '+parmetis' in self.spec else 'metis'
|
makefile_conf.extend([
|
||||||
makefile_conf.extend(
|
"IMETIS = -I%s" % self.spec['parmetis'].prefix.include,
|
||||||
["IMETIS = -I%s" % self.spec['parmetis'].prefix.include,
|
"LMETIS = -L%s -l%s -L%s -l%s" % (
|
||||||
"LMETIS = -L%s -l%s -L%s -l%s" % (self.spec['parmetis'].prefix.lib, 'parmetis',self.spec['metis'].prefix.lib, 'metis')])
|
self.spec['parmetis'].prefix.lib, 'parmetis',
|
||||||
|
self.spec['metis'].prefix.lib, 'metis')
|
||||||
|
])
|
||||||
|
|
||||||
orderings.append('-Dparmetis')
|
orderings.append('-Dparmetis')
|
||||||
elif '+metis' in self.spec:
|
elif '+metis' in self.spec:
|
||||||
makefile_conf.extend(
|
makefile_conf.extend([
|
||||||
["IMETIS = -I%s" % self.spec['metis'].prefix.include,
|
"IMETIS = -I%s" % self.spec['metis'].prefix.include,
|
||||||
"LMETIS = -L%s -l%s" % (self.spec['metis'].prefix.lib, 'metis')])
|
"LMETIS = -L%s -l%s" % (self.spec['metis'].prefix.lib, 'metis')
|
||||||
|
])
|
||||||
|
|
||||||
orderings.append('-Dmetis')
|
orderings.append('-Dmetis')
|
||||||
|
|
||||||
makefile_conf.append("ORDERINGSF = %s" % (' '.join(orderings)))
|
makefile_conf.append("ORDERINGSF = %s" % (' '.join(orderings)))
|
||||||
|
|
||||||
# when building shared libs need -fPIC, otherwise
|
# when building shared libs need -fPIC, otherwise
|
||||||
# /usr/bin/ld: graph.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
|
# /usr/bin/ld: graph.o: relocation R_X86_64_32 against `.rodata.str1.1'
|
||||||
|
# can not be used when making a shared object; recompile with -fPIC
|
||||||
fpic = '-fPIC' if '+shared' in self.spec else ''
|
fpic = '-fPIC' if '+shared' in self.spec else ''
|
||||||
# TODO: test this part, it needs a full blas, scalapack and
|
# TODO: test this part, it needs a full blas, scalapack and
|
||||||
# partitionning environment with 64bit integers
|
# partitionning environment with 64bit integers
|
||||||
@@ -104,7 +115,7 @@ def write_makefile_inc(self):
|
|||||||
# the fortran compilation flags most probably are
|
# the fortran compilation flags most probably are
|
||||||
# working only for intel and gnu compilers this is
|
# working only for intel and gnu compilers this is
|
||||||
# perhaps something the compiler should provide
|
# perhaps something the compiler should provide
|
||||||
['OPTF = %s -O -DALLOW_NON_INIT %s' % (fpic,'-fdefault-integer-8' if self.compiler.name == "gcc" else '-i8'),
|
['OPTF = %s -O -DALLOW_NON_INIT %s' % (fpic, '-fdefault-integer-8' if self.compiler.name == "gcc" else '-i8'), # NOQA: ignore=E501
|
||||||
'OPTL = %s -O ' % fpic,
|
'OPTL = %s -O ' % fpic,
|
||||||
'OPTC = %s -O -DINTSIZE64' % fpic])
|
'OPTC = %s -O -DINTSIZE64' % fpic])
|
||||||
else:
|
else:
|
||||||
@@ -113,7 +124,6 @@ def write_makefile_inc(self):
|
|||||||
'OPTL = %s -O ' % fpic,
|
'OPTL = %s -O ' % fpic,
|
||||||
'OPTC = %s -O ' % fpic])
|
'OPTC = %s -O ' % fpic])
|
||||||
|
|
||||||
|
|
||||||
if '+mpi' in self.spec:
|
if '+mpi' in self.spec:
|
||||||
makefile_conf.extend(
|
makefile_conf.extend(
|
||||||
["CC = %s" % join_path(self.spec['mpi'].prefix.bin, 'mpicc'),
|
["CC = %s" % join_path(self.spec['mpi'].prefix.bin, 'mpicc'),
|
||||||
@@ -134,16 +144,17 @@ def write_makefile_inc(self):
|
|||||||
|
|
||||||
if '+shared' in self.spec:
|
if '+shared' in self.spec:
|
||||||
if sys.platform == 'darwin':
|
if sys.platform == 'darwin':
|
||||||
# Building dylibs with mpif90 causes segfaults on 10.8 and 10.10. Use gfortran. (Homebrew)
|
# Building dylibs with mpif90 causes segfaults on 10.8 and
|
||||||
|
# 10.10. Use gfortran. (Homebrew)
|
||||||
makefile_conf.extend([
|
makefile_conf.extend([
|
||||||
'LIBEXT=.dylib',
|
'LIBEXT=.dylib',
|
||||||
'AR=%s -dynamiclib -Wl,-install_name -Wl,%s/$(notdir $@) -undefined dynamic_lookup -o ' % (os.environ['FC'],prefix.lib),
|
'AR=%s -dynamiclib -Wl,-install_name -Wl,%s/$(notdir $@) -undefined dynamic_lookup -o ' % (os.environ['FC'], prefix.lib), # NOQA: ignore=E501
|
||||||
'RANLIB=echo'
|
'RANLIB=echo'
|
||||||
])
|
])
|
||||||
else:
|
else:
|
||||||
makefile_conf.extend([
|
makefile_conf.extend([
|
||||||
'LIBEXT=.so',
|
'LIBEXT=.so',
|
||||||
'AR=$(FL) -shared -Wl,-soname -Wl,%s/$(notdir $@) -o' % prefix.lib,
|
'AR=$(FL) -shared -Wl,-soname -Wl,%s/$(notdir $@) -o' % prefix.lib, # NOQA: ignore=E501
|
||||||
'RANLIB=echo'
|
'RANLIB=echo'
|
||||||
])
|
])
|
||||||
else:
|
else:
|
||||||
@@ -153,9 +164,8 @@ def write_makefile_inc(self):
|
|||||||
'RANLIB = ranlib'
|
'RANLIB = ranlib'
|
||||||
])
|
])
|
||||||
|
|
||||||
|
makefile_inc_template = join_path(
|
||||||
makefile_inc_template = join_path(os.path.dirname(self.module.__file__),
|
os.path.dirname(self.module.__file__), 'Makefile.inc')
|
||||||
'Makefile.inc')
|
|
||||||
with open(makefile_inc_template, "r") as fh:
|
with open(makefile_inc_template, "r") as fh:
|
||||||
makefile_conf.extend(fh.read().split('\n'))
|
makefile_conf.extend(fh.read().split('\n'))
|
||||||
|
|
||||||
@@ -164,8 +174,6 @@ def write_makefile_inc(self):
|
|||||||
makefile_inc = '\n'.join(makefile_conf)
|
makefile_inc = '\n'.join(makefile_conf)
|
||||||
fh.write(makefile_inc)
|
fh.write(makefile_inc)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
def install(self, spec, prefix):
|
||||||
make_libs = []
|
make_libs = []
|
||||||
|
|
||||||
@@ -189,15 +197,15 @@ def install(self, spec, prefix):
|
|||||||
install_tree('lib', prefix.lib)
|
install_tree('lib', prefix.lib)
|
||||||
install_tree('include', prefix.include)
|
install_tree('include', prefix.include)
|
||||||
|
|
||||||
if '~mpi' in spec:
|
if '~mpi' in spec:
|
||||||
lib_dsuffix = '.dylib' if sys.platform == 'darwin' else '.so'
|
lib_dsuffix = '.dylib' if sys.platform == 'darwin' else '.so'
|
||||||
lib_suffix = lib_dsuffix if '+shared' in spec else '.a'
|
lib_suffix = lib_dsuffix if '+shared' in spec else '.a'
|
||||||
install('libseq/libmpiseq%s' % lib_suffix, prefix.lib)
|
install('libseq/libmpiseq%s' % lib_suffix, prefix.lib)
|
||||||
for f in glob.glob(join_path('libseq','*.h')):
|
for f in glob.glob(join_path('libseq', '*.h')):
|
||||||
install(f, prefix.include)
|
install(f, prefix.include)
|
||||||
|
|
||||||
# FIXME: extend the tests to mpirun -np 2 (or alike) when build with MPI
|
# FIXME: extend the tests to mpirun -np 2 when build with MPI
|
||||||
# FIXME: use something like numdiff to compare blessed output with the current
|
# FIXME: use something like numdiff to compare output files
|
||||||
with working_dir('examples'):
|
with working_dir('examples'):
|
||||||
if '+float' in spec:
|
if '+float' in spec:
|
||||||
os.system('./ssimpletest < input_simpletest_real')
|
os.system('./ssimpletest < input_simpletest_real')
|
||||||
|
|||||||
@@ -25,8 +25,10 @@
|
|||||||
from spack import *
|
from spack import *
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
class NetlibScalapack(Package):
|
class NetlibScalapack(Package):
|
||||||
"""ScaLAPACK is a library of high-performance linear algebra routines for parallel distributed memory machines"""
|
"""ScaLAPACK is a library of high-performance linear algebra routines for
|
||||||
|
parallel distributed memory machines"""
|
||||||
|
|
||||||
homepage = "http://www.netlib.org/scalapack/"
|
homepage = "http://www.netlib.org/scalapack/"
|
||||||
url = "http://www.netlib.org/scalapack/scalapack-2.0.2.tgz"
|
url = "http://www.netlib.org/scalapack/scalapack-2.0.2.tgz"
|
||||||
@@ -48,10 +50,22 @@ class NetlibScalapack(Package):
|
|||||||
|
|
||||||
def install(self, spec, prefix):
|
def install(self, spec, prefix):
|
||||||
options = [
|
options = [
|
||||||
"-DBUILD_SHARED_LIBS:BOOL=%s" % ('ON' if '+shared' in spec else 'OFF'),
|
"-DBUILD_SHARED_LIBS:BOOL=%s" % ('ON' if '+shared' in spec else
|
||||||
"-DBUILD_STATIC_LIBS:BOOL=%s" % ('OFF' if '+shared' in spec else 'ON'),
|
'OFF'),
|
||||||
"-DUSE_OPTIMIZED_LAPACK_BLAS:BOOL=ON", # forces scalapack to use find_package(LAPACK)
|
"-DBUILD_STATIC_LIBS:BOOL=%s" % ('OFF' if '+shared' in spec else
|
||||||
]
|
'ON'),
|
||||||
|
# forces scalapack to use find_package(LAPACK):
|
||||||
|
"-DUSE_OPTIMIZED_LAPACK_BLAS:BOOL=ON",
|
||||||
|
]
|
||||||
|
|
||||||
|
# Make sure we use Spack's Lapack:
|
||||||
|
options.extend([
|
||||||
|
'-DLAPACK_FOUND=true',
|
||||||
|
'-DLAPACK_INCLUDE_DIRS=%s' % spec['lapack'].prefix.include,
|
||||||
|
'-DLAPACK_LIBRARIES=%s' % (
|
||||||
|
spec['lapack'].lapack_shared_lib if '+shared' in spec else
|
||||||
|
spec['lapack'].lapack_static_lib),
|
||||||
|
])
|
||||||
|
|
||||||
if '+fpic' in spec:
|
if '+fpic' in spec:
|
||||||
options.extend([
|
options.extend([
|
||||||
@@ -66,16 +80,15 @@ def install(self, spec, prefix):
|
|||||||
make()
|
make()
|
||||||
make("install")
|
make("install")
|
||||||
|
|
||||||
# The shared libraries are not installed correctly on Darwin; correct this
|
# The shared libraries are not installed correctly on Darwin:
|
||||||
if (sys.platform == 'darwin') and ('+shared' in spec):
|
if (sys.platform == 'darwin') and ('+shared' in spec):
|
||||||
fix_darwin_install_name(prefix.lib)
|
fix_darwin_install_name(prefix.lib)
|
||||||
|
|
||||||
|
|
||||||
def setup_dependent_package(self, module, dependent_spec):
|
def setup_dependent_package(self, module, dependent_spec):
|
||||||
spec = self.spec
|
spec = self.spec
|
||||||
lib_dsuffix = '.dylib' if sys.platform == 'darwin' else '.so'
|
lib_suffix = dso_suffix if '+shared' in spec else 'a'
|
||||||
lib_suffix = lib_dsuffix if '+shared' in spec else '.a'
|
|
||||||
|
|
||||||
spec.fc_link = '-L%s -lscalapack' % spec.prefix.lib
|
spec.fc_link = '-L%s -lscalapack' % spec.prefix.lib
|
||||||
spec.cc_link = spec.fc_link
|
spec.cc_link = spec.fc_link
|
||||||
spec.libraries = [join_path(spec.prefix.lib, 'libscalapack%s' % lib_suffix)]
|
spec.libraries = [join_path(spec.prefix.lib,
|
||||||
|
'libscalapack.%s' % lib_suffix)]
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ class PyNumpy(Package):
|
|||||||
|
|
||||||
extends('python')
|
extends('python')
|
||||||
depends_on('py-nose', type='build')
|
depends_on('py-nose', type='build')
|
||||||
|
depends_on('py-setuptools', type='build')
|
||||||
depends_on('blas', when='+blas')
|
depends_on('blas', when='+blas')
|
||||||
depends_on('lapack', when='+lapack')
|
depends_on('lapack', when='+lapack')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user