Skip to content
Snippets Groups Projects
Commit b5d0a388 authored by Joseph Ciurej's avatar Joseph Ciurej
Browse files

Fixed a few linking/testing bugs in the METIS@:4 install method.

parent 064d3584
No related branches found
No related tags found
No related merge requests found
...@@ -58,8 +58,9 @@ def url_for_version(self, version): ...@@ -58,8 +58,9 @@ def url_for_version(self, version):
verdir = 'OLD/' if version < Version('4.0.3') else '' verdir = 'OLD/' if version < Version('4.0.3') else ''
return '%s/%smetis-%s.tar.gz' % (Metis.base_url, verdir, version) return '%s/%smetis-%s.tar.gz' % (Metis.base_url, verdir, version)
@when('@4') @when('@:4')
def install(self, spec, prefix): def install(self, spec, prefix):
# Process library spec and options
unsupp_vars = [v for v in ('+gdb', '+idx64', '+real64') if v in spec] unsupp_vars = [v for v in ('+gdb', '+idx64', '+real64') if v in spec]
if unsupp_vars: if unsupp_vars:
msg = 'Given variants %s are unsupported by METIS 4!' % unsupp_vars msg = 'Given variants %s are unsupported by METIS 4!' % unsupp_vars
...@@ -70,6 +71,7 @@ def install(self, spec, prefix): ...@@ -70,6 +71,7 @@ def install(self, spec, prefix):
options.append('OPTFLAGS=-g -O0') options.append('OPTFLAGS=-g -O0')
make(*options) make(*options)
# Compile and install library files
mkdir(prefix.bin) mkdir(prefix.bin)
binfiles = ('pmetis', 'kmetis', 'oemetis', 'onmetis', 'partnmesh', binfiles = ('pmetis', 'kmetis', 'oemetis', 'onmetis', 'partnmesh',
'partdmesh', 'mesh2nodal', 'mesh2dual', 'graphchk') 'partdmesh', 'mesh2nodal', 'mesh2dual', 'graphchk')
...@@ -88,7 +90,7 @@ def install(self, spec, prefix): ...@@ -88,7 +90,7 @@ def install(self, spec, prefix):
('Graphs', '4elt.graph'), ('Graphs', 'metis.mesh'), ('Graphs', '4elt.graph'), ('Graphs', 'metis.mesh'),
('Graphs', 'test.mgraph')) ('Graphs', 'test.mgraph'))
for sharefile in tuple(join_path(*sf) for sf in sharefiles): for sharefile in tuple(join_path(*sf) for sf in sharefiles):
install(f, prefix.share) install(sharefile, prefix.share)
if '+shared' in spec: if '+shared' in spec:
if sys.platform == 'darwin': if sys.platform == 'darwin':
...@@ -100,30 +102,38 @@ def install(self, spec, prefix): ...@@ -100,30 +102,38 @@ def install(self, spec, prefix):
load_flag = '-Wl,-whole-archive' load_flag = '-Wl,-whole-archive'
no_load_flag = '-Wl,-no-whole-archive' no_load_flag = '-Wl,-no-whole-archive'
flags = (self.compiler.cc, load_flag, no_load_flag, lib_dsuffix) os.system('%s -fPIC -shared %s libmetis.a %s -o libmetis.%s' % \
build_cmd = '%s -fPIC -shared %s libmetis.a %s libmetis.%s' % flags (self.compiler.cc, load_flag, no_load_flag, lib_dsuffix))
os.system(build_cmd)
install('libmetis.%s' % lib_dsuffix, prefix.lib) install('libmetis.%s' % lib_dsuffix, prefix.lib)
# Set up and run tests on installation # Set up and run tests on installation
inc_flags = '-I%s' % prefix.include
lib_flags = '-L%s' % prefix.lib
if '+shared' in spec:
lib_flags += ' -Wl,-rpath=%s' % prefix.lib
symlink(join_path(prefix.share, 'io.c'), 'io.c') symlink(join_path(prefix.share, 'io.c'), 'io.c')
symlink(join_path(prefix.share, 'mtest.c'), 'mtest.c') symlink(join_path(prefix.share, 'mtest.c'), 'mtest.c')
os.system(spack_cc + ' -I%s' % prefix.include + ' -c io.c')
os.system(spack_cc + ' -I%s' % prefix.include + os.system('%s %s -c io.c' % (self.compiler.cc, inc_flags))
' -L%s' % prefix.lib + ' -lmetis mtest.c io.o -o mtest') os.system('%s %s %s mtest.c io.o -o mtest -lmetis -lm' % \
_4eltgraph = join_path(prefix.share, '4elt.graph') (self.compiler.cc, inc_flags, lib_flags))
test_mgraph = join_path(prefix.share, 'test.mgraph')
metis_mesh = join_path(prefix.share, 'metis.mesh') test_bin = lambda testname: join_path(prefix.bin, testname)
kmetis = join_path(prefix.bin, 'kmetis') test_graph = lambda graphname: join_path(prefix.share, graphname)
os.system('./mtest ' + _4eltgraph)
os.system(kmetis + ' ' + _4eltgraph + ' 40') graph = test_graph('4elt.graph')
os.system(join_path(prefix.bin, 'onmetis') + ' ' + _4eltgraph) os.system('./mtest %s' % graph)
os.system(join_path(prefix.bin, 'pmetis') + ' ' + test_mgraph + ' 2') os.system('%s %s 40' % (test_bin('kmetis'), graph))
os.system(kmetis + ' ' + test_mgraph + ' 2') os.system('%s %s' % (test_bin('onmetis'), graph))
os.system(kmetis + ' ' + test_mgraph + ' 5') graph = test_graph('test.mgraph')
os.system(join_path(prefix.bin, 'partnmesh') + metis_mesh + ' 10') os.system('%s %s 2' % (test_bin('pmetis'), graph))
os.system(join_path(prefix.bin, 'partdmesh') + metis_mesh + ' 10') os.system('%s %s 2' % (test_bin('kmetis'), graph))
os.system(join_path(prefix.bin, 'mesh2dual') + metis_mesh) os.system('%s %s 5' % (test_bin('kmetis'), graph))
graph = test_graph('metis.mesh')
os.system('%s %s 10' % (test_bin('partnmesh'), graph))
os.system('%s %s 10' % (test_bin('partdmesh'), graph))
os.system('%s %s' % (test_bin('mesh2dual'), graph))
@when('@5:') @when('@5:')
def install(self, spec, prefix): def install(self, spec, prefix):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment