summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2015-12-20 14:29:19 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2015-12-20 14:29:19 -0800
commitbb329d8a5c5c7a06683eb92172686b376f40968e (patch)
tree25c3b83127ee49b2c20b4abf724fae76e0792602 /var
parentd6edaa0970d8cac0cb4254b57793bce93fbda3ba (diff)
parent27d52badb18ed4281c69730de432c7d6dd5d3f67 (diff)
downloadspack-bb329d8a5c5c7a06683eb92172686b376f40968e.tar.gz
spack-bb329d8a5c5c7a06683eb92172686b376f40968e.tar.bz2
spack-bb329d8a5c5c7a06683eb92172686b376f40968e.tar.xz
spack-bb329d8a5c5c7a06683eb92172686b376f40968e.zip
Merge pull request #231 from epfl-scitas/packages/scotch
scotch: adding dependencies + variants for mpi, shared, compression and esmumps
Diffstat (limited to 'var')
-rw-r--r--var/spack/packages/scotch/package.py114
1 files changed, 100 insertions, 14 deletions
diff --git a/var/spack/packages/scotch/package.py b/var/spack/packages/scotch/package.py
index 79289ff2ad..8229ed8686 100644
--- a/var/spack/packages/scotch/package.py
+++ b/var/spack/packages/scotch/package.py
@@ -1,5 +1,4 @@
from spack import *
-import glob
import os
class Scotch(Package):
@@ -11,28 +10,115 @@ class Scotch(Package):
version('6.0.3', '10b0cc0f184de2de99859eafaca83cfc')
- depends_on('mpi')
+ 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')
+
+ def compiler_specifics(self, makefile_inc, defines):
+ if self.compiler.name == 'gcc':
+ defines.append('-Drestrict=__restrict')
+ elif self.compiler.name == 'intel':
+ defines.append('-restrict')
+
+ makefile_inc.append('CCS = $(CC)')
+
+ if '+mpi' in self.spec:
+ makefile_inc.extend([
+ 'CCP = %s' % os.path.join(self.spec['mpi'].prefix.bin, 'mpicc'),
+ 'CCD = $(CCP)'
+ ])
+ else:
+ makefile_inc.extend([
+ 'CCP = mpicc', # It is set but not used
+ 'CCD = $(CCS)'
+ ])
+
+
+
+ def library_build_type(self, makefile_inc, defines):
+ makefile_inc.extend([
+ 'LIB = .a',
+ 'CLIBFLAGS = ',
+ 'RANLIB = ranlib',
+ 'AR = ar',
+ 'ARFLAGS = -ruv '
+ ])
+
+ @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'
+ ])
+
+ def extra_features(self, makefile_inc, defines):
+ ldflags = []
+
+ if '+compression' in self.spec:
+ defines.append('-DCOMMON_FILE_COMPRESS_GZ')
+ ldflags.append('-L%s -lz' % (self.spec['zlib'].prefix.lib))
+
+ defines.append('-DCOMMON_PTHREAD')
+ ldflags.append('-lm -lrt -pthread')
+
+ makefile_inc.append('LDFLAGS = %s' % ' '.join(ldflags))
def patch(self):
- with working_dir('src/Make.inc'):
- makefiles = glob.glob('Makefile.inc.x86-64_pc_linux2*')
- filter_file(r'^CCS\s*=.*$', 'CCS = cc', *makefiles)
- filter_file(r'^CCD\s*=.*$', 'CCD = cc', *makefiles)
+ makefile_inc = []
+ defines = [
+ '-DCOMMON_RANDOM_FIXED_SEED',
+ '-DSCOTCH_DETERMINISTIC',
+ '-DSCOTCH_RENAME',
+ '-DIDXSIZE64' ]
+ self.library_build_type(makefile_inc, defines)
+ self.compiler_specifics(makefile_inc, defines)
+ self.extra_features(makefile_inc, defines)
+ makefile_inc.extend([
+ 'EXE =',
+ 'OBJ = .o',
+ 'MAKE = make',
+ 'CAT = cat',
+ 'LN = ln',
+ 'MKDIR = mkdir',
+ 'MV = mv',
+ 'CP = cp',
+ 'CFLAGS = -O3 %s' % (' '.join(defines)),
+ '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,
+ ''
+ ])
+
+ with working_dir('src'):
+ with open('Makefile.inc', 'w') as fh:
+ fh.write('\n'.join(makefile_inc))
+
def install(self, spec, prefix):
- # Currently support gcc and icc on x86_64 (maybe others with
- # vanilla makefile)
- makefile = 'Make.inc/Makefile.inc.x86-64_pc_linux2'
- if spec.satisfies('%icc'):
- makefile += '.icc'
+ targets = ['scotch']
+ if '+mpi' in self.spec:
+ targets.append('ptscotch')
+
+ if '+esmumps' in self.spec:
+ targets.append('esmumps')
+ if '+mpi' in self.spec:
+ targets.append('ptesmumps')
with working_dir('src'):
- force_symlink(makefile, 'Makefile.inc')
- for app in ('scotch', 'ptscotch'):
- make(app)
+ for app in targets:
+ make(app, parallel=(not app=='ptesmumps'))
+
install_tree('bin', prefix.bin)
install_tree('lib', prefix.lib)
install_tree('include', prefix.include)