summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2016-05-10 01:26:21 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2016-05-10 01:26:21 -0700
commitd2004a186cf35bd50f202b1df3b5d70cde96f1bf (patch)
treec920aa9376d97be04292e654110283c33d5aeb38 /var
parent69f6baf28e15eef59c0bbc854bfe86f59f57c876 (diff)
parentceab445b9fe371d50703c599ec2cf742f6199f41 (diff)
downloadspack-d2004a186cf35bd50f202b1df3b5d70cde96f1bf.tar.gz
spack-d2004a186cf35bd50f202b1df3b5d70cde96f1bf.tar.bz2
spack-d2004a186cf35bd50f202b1df3b5d70cde96f1bf.tar.xz
spack-d2004a186cf35bd50f202b1df3b5d70cde96f1bf.zip
Merge pull request #825 from xjrc/packages/scotch
Update Package : Scotch
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/scotch/Makefile.esmumps5
-rw-r--r--var/spack/repos/builtin/packages/scotch/package.py152
2 files changed, 99 insertions, 58 deletions
diff --git a/var/spack/repos/builtin/packages/scotch/Makefile.esmumps b/var/spack/repos/builtin/packages/scotch/Makefile.esmumps
new file mode 100644
index 0000000000..4bfc760197
--- /dev/null
+++ b/var/spack/repos/builtin/packages/scotch/Makefile.esmumps
@@ -0,0 +1,5 @@
+esmumps : scotch
+ (cd esmumps ; $(MAKE) scotch && $(MAKE) install)
+
+ptesmumps : ptscotch
+ (cd esmumps ; $(MAKE) ptscotch && $(MAKE) ptinstall)
diff --git a/var/spack/repos/builtin/packages/scotch/package.py b/var/spack/repos/builtin/packages/scotch/package.py
index 8229ed8686..8fad74b24f 100644
--- a/var/spack/repos/builtin/packages/scotch/package.py
+++ b/var/spack/repos/builtin/packages/scotch/package.py
@@ -1,88 +1,125 @@
from spack import *
-import os
+import os, re
class Scotch(Package):
"""Scotch is a software package for graph and mesh/hypergraph
partitioning, graph clustering, and sparse matrix ordering."""
+
homepage = "http://www.labri.fr/perso/pelegrin/scotch/"
- url = "http://gforge.inria.fr/frs/download.php/file/34099/scotch_6.0.3.tar.gz"
+ url = "http://gforge.inria.fr/frs/download.php/latestfile/298/scotch_6.0.3.tar.gz"
+ base_url = "http://gforge.inria.fr/frs/download.php/latestfile/298"
list_url = "http://gforge.inria.fr/frs/?group_id=248"
version('6.0.3', '10b0cc0f184de2de99859eafaca83cfc')
+ version('6.0.0', 'c50d6187462ba801f9a82133ee666e8e')
+ version('5.1.10b', 'f587201d6cf5cf63527182fbfba70753')
variant('mpi', default=False, description='Activate the compilation of PT-Scotch')
variant('compression', default=True, description='Activate the posibility to use compressed files')
variant('esmumps', default=False, description='Activate the compilation of the lib esmumps needed by mumps')
variant('shared', default=True, description='Build shared libraries')
- depends_on('mpi', when='+mpi')
- depends_on('zlib', when='+compression')
depends_on('flex')
depends_on('bison')
+ depends_on('mpi', when='+mpi')
+ depends_on('zlib', when='+compression')
- def compiler_specifics(self, makefile_inc, defines):
- if self.compiler.name == 'gcc':
- defines.append('-Drestrict=__restrict')
- elif self.compiler.name == 'intel':
- defines.append('-restrict')
+ # NOTE: Versions of Scotch up to version 6.0.0 don't include support for
+ # building with 'esmumps' in their default packages. In order to enable
+ # support for this feature, we must grab the 'esmumps' enabled archives
+ # from the Scotch hosting site. These alternative archives include a strict
+ # superset of the behavior in their default counterparts, so we choose to
+ # always grab these versions for older Scotch versions for simplicity.
+ @when('@:6.0.0')
+ def url_for_version(self, version):
+ return '%s/scotch_%s_esmumps.tar.gz' % (Scotch.base_url, version)
+
+ @when('@6.0.1:')
+ def url_for_version(self, version):
+ return super(Scotch, self).url_for_version(version)
+
+ # NOTE: Several of the 'esmumps' enabled Scotch releases up to version 6.0.0
+ # have broken build scripts that don't properly build 'esmumps' as a separate
+ # target, so we need a patch procedure to remove 'esmumps' from existing targets
+ # and to add it as a standalone target.
+ @when('@:6.0.0')
+ def patch(self):
+ makefile_path = os.path.join('src', 'Makefile')
+ with open(makefile_path, 'r') as makefile:
+ esmumps_enabled = any(re.search(r'^esmumps(\s*):(.*)$', line) for line in makefile.readlines())
- makefile_inc.append('CCS = $(CC)')
+ if not esmumps_enabled:
+ mff = FileFilter(makefile_path)
+ mff.filter(r'^.*((esmumps)|(ptesmumps)).*(install).*$', '')
- if '+mpi' in self.spec:
+ makefile_esmumps_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'Makefile.esmumps')
+ with open(makefile_path, 'a') as makefile:
+ makefile.write('\ninclude %s\n' % makefile_esmumps_path)
+
+ @when('@6.0.1:')
+ def patch(self):
+ pass
+
+ # NOTE: Configuration of Scotch is achieved by writing a 'Makefile.inc' file
+ # that contains all of the configuration variables and their desired values
+ # for the installation. This function writes this file based on the given
+ # installation variants.
+ def configure(self):
+ makefile_inc = []
+ cflags = [
+ '-O3',
+ '-DCOMMON_RANDOM_FIXED_SEED',
+ '-DSCOTCH_DETERMINISTIC',
+ '-DSCOTCH_RENAME',
+ '-DIDXSIZE64'
+ ]
+
+ ## Library Build Type ##
+
+ if '+shared' in self.spec:
makefile_inc.extend([
- 'CCP = %s' % os.path.join(self.spec['mpi'].prefix.bin, 'mpicc'),
- 'CCD = $(CCP)'
- ])
+ 'LIB = .so',
+ 'CLIBFLAGS = -shared -fPIC',
+ 'RANLIB = echo',
+ 'AR = $(CC)',
+ 'ARFLAGS = -shared $(LDFLAGS) -o'
+ ])
+ cflags.append('-fPIC')
else:
makefile_inc.extend([
- 'CCP = mpicc', # It is set but not used
- 'CCD = $(CCS)'
- ])
+ 'LIB = .a',
+ 'CLIBFLAGS = ',
+ 'RANLIB = ranlib',
+ 'AR = ar',
+ 'ARFLAGS = -ruv '
+ ])
+ ## Compiler-Specific Options ##
+ if self.compiler.name == 'gcc':
+ cflags.append('-Drestrict=__restrict')
+ elif self.compiler.name == 'intel':
+ cflags.append('-restrict')
- def library_build_type(self, makefile_inc, defines):
- makefile_inc.extend([
- 'LIB = .a',
- 'CLIBFLAGS = ',
- 'RANLIB = ranlib',
- 'AR = ar',
- 'ARFLAGS = -ruv '
- ])
+ makefile_inc.append('CCS = $(CC)')
+ makefile_inc.append('CCP = %s' %
+ (self.spec['mpi'].mpicc if '+mpi' in self.spec else 'mpicc'))
+ makefile_inc.append('CCD = $(CCS)')
- @when('+shared')
- def library_build_type(self, makefile_inc, defines):
- makefile_inc.extend([
- 'LIB = .so',
- 'CLIBFLAGS = -shared -fPIC',
- 'RANLIB = echo',
- 'AR = $(CC)',
- 'ARFLAGS = -shared $(LDFLAGS) -o'
- ])
+ ## Extra Features ##
- def extra_features(self, makefile_inc, defines):
ldflags = []
-
+
if '+compression' in self.spec:
- defines.append('-DCOMMON_FILE_COMPRESS_GZ')
+ cflags.append('-DCOMMON_FILE_COMPRESS_GZ')
ldflags.append('-L%s -lz' % (self.spec['zlib'].prefix.lib))
- defines.append('-DCOMMON_PTHREAD')
+ cflags.append('-DCOMMON_PTHREAD')
ldflags.append('-lm -lrt -pthread')
-
- makefile_inc.append('LDFLAGS = %s' % ' '.join(ldflags))
- def patch(self):
- makefile_inc = []
- defines = [
- '-DCOMMON_RANDOM_FIXED_SEED',
- '-DSCOTCH_DETERMINISTIC',
- '-DSCOTCH_RENAME',
- '-DIDXSIZE64' ]
+ makefile_inc.append('LDFLAGS = %s' % ' '.join(ldflags))
- self.library_build_type(makefile_inc, defines)
- self.compiler_specifics(makefile_inc, defines)
- self.extra_features(makefile_inc, defines)
+ ## General Features ##
makefile_inc.extend([
'EXE =',
@@ -93,18 +130,19 @@ class Scotch(Package):
'MKDIR = mkdir',
'MV = mv',
'CP = cp',
- 'CFLAGS = -O3 %s' % (' '.join(defines)),
+ 'CFLAGS = %s' % ' '.join(cflags),
'LEX = %s -Pscotchyy -olex.yy.c' % os.path.join(self.spec['flex'].prefix.bin , 'flex'),
'YACC = %s -pscotchyy -y -b y' % os.path.join(self.spec['bison'].prefix.bin, 'bison'),
- 'prefix = %s' % self.prefix,
- ''
+ 'prefix = %s' % self.prefix
])
with working_dir('src'):
with open('Makefile.inc', 'w') as fh:
fh.write('\n'.join(makefile_inc))
-
+
def install(self, spec, prefix):
+ self.configure()
+
targets = ['scotch']
if '+mpi' in self.spec:
targets.append('ptscotch')
@@ -115,12 +153,10 @@ class Scotch(Package):
targets.append('ptesmumps')
with working_dir('src'):
- for app in targets:
- make(app, parallel=(not app=='ptesmumps'))
+ for target in targets:
+ make(target, parallel=(target!='ptesmumps'))
-
install_tree('bin', prefix.bin)
install_tree('lib', prefix.lib)
install_tree('include', prefix.include)
install_tree('man/man1', prefix.share_man1)
-