Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix specifying path to SuiteSparse header files and libraries in numpy, Trilinos, PETSc easyblocks #3056

Merged
merged 3 commits into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 10 additions & 16 deletions easybuild/easyblocks/n/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,23 +183,17 @@ def get_libs_for_mkl(varname):

suitesparseroot = get_software_root('SuiteSparse')
if suitesparseroot:
amddir = os.path.join(suitesparseroot, 'AMD')
umfpackdir = os.path.join(suitesparseroot, 'UMFPACK')

if not os.path.exists(amddir) or not os.path.exists(umfpackdir):
raise EasyBuildError("Expected SuiteSparse subdirectories are not both there: %s, %s",
amddir, umfpackdir)
else:
extrasiteconfig += '\n'.join([
"[amd]",
"library_dirs = %s" % os.path.join(amddir, 'Lib'),
"include_dirs = %s" % os.path.join(amddir, 'Include'),
"amd_libs = amd",
"[umfpack]",
"library_dirs = %s" % os.path.join(umfpackdir, 'Lib'),
"include_dirs = %s" % os.path.join(umfpackdir, 'Include'),
"umfpack_libs = umfpack",
])
extrasiteconfig += '\n'.join([
"[amd]",
"library_dirs = %s" % os.path.join(suitesparseroot, 'lib'),
"include_dirs = %s" % os.path.join(suitesparseroot, 'include'),
"amd_libs = amd",
"[umfpack]",
"library_dirs = %s" % os.path.join(suitesparseroot, 'lib'),
"include_dirs = %s" % os.path.join(suitesparseroot, 'include'),
"umfpack_libs = umfpack",
])

self.sitecfg = '\n'.join([self.sitecfg, extrasiteconfig])

Expand Down
19 changes: 7 additions & 12 deletions easybuild/easyblocks/p/petsc.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
"""
import os
import re
from easybuild.tools import LooseVersion

import easybuild.tools.environment as env
import easybuild.tools.toolchain as toolchain
from easybuild.easyblocks.generic.configuremake import ConfigureMake
from easybuild.framework.easyconfig import BUILD, CUSTOM
from easybuild.tools import LooseVersion
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.filetools import symlink, apply_regex_substitutions
from easybuild.tools.modules import get_software_root, get_software_version
Expand Down Expand Up @@ -254,26 +254,21 @@ def configure_step(self):
ss_libs = ["UMFPACK", "KLU", "CHOLMOD", "BTF", "CCOLAMD", "COLAMD", "CAMD", "AMD"]
# More libraries added after version 3.17
if LooseVersion(self.version) >= LooseVersion("3.17"):
# specified order of libs matters!
ss_libs = ["UMFPACK", "KLU", "SPQR", "CHOLMOD", "BTF", "CCOLAMD",
"COLAMD", "CSparse", "CXSparse", "LDL", "RBio",
"SLIP_LU", "CAMD", "AMD"]
"COLAMD", "CXSparse", "LDL", "RBio", "SLIP_LU", "CAMD", "AMD"]

suitesparse_inc = [os.path.join(suitesparse, x, "Include")
for x in ss_libs]
suitesparse_inc.append(os.path.join(suitesparse, "SuiteSparse_config"))
inc_spec = "-include=[%s]" % ','.join(suitesparse_inc)
suitesparse_inc = os.path.join(suitesparse, "include")
inc_spec = "-include=[%s]" % suitesparse_inc

suitesparse_libs = [os.path.join(suitesparse, x, "Lib", "lib%s.a" % x.replace("_", "").lower())
suitesparse_libs = [os.path.join(suitesparse, "lib", "lib%s.so" % x.replace("_", "").lower())
for x in ss_libs]
suitesparse_libs.append(os.path.join(suitesparse, "SuiteSparse_config", "libsuitesparseconfig.a"))
lib_spec = "-lib=[%s]" % ','.join(suitesparse_libs)
else:
# CHOLMOD and UMFPACK are part of SuiteSparse (PETSc < 3.5)
withdep = "--with-umfpack"
inc_spec = "-include=%s" % os.path.join(suitesparse, "UMFPACK", "Include")
inc_spec = "-include=%s" % os.path.join(suitesparse, "include")
# specified order of libs matters!
umfpack_libs = [os.path.join(suitesparse, x, "Lib", "lib%s.a" % x.lower())
umfpack_libs = [os.path.join(suitesparse, "lib", "lib%s.a" % x.lower())
for x in ["UMFPACK", "CHOLMOD", "COLAMD", "AMD"]]
lib_spec = "-lib=[%s]" % ','.join(umfpack_libs)

Expand Down
21 changes: 9 additions & 12 deletions easybuild/easyblocks/t/trilinos.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@
import random
import re

from easybuild.tools import LooseVersion

import easybuild.tools.toolchain as toolchain
from easybuild.easyblocks.generic.cmakemake import CMakeMake
from easybuild.framework.easyconfig import CUSTOM
from easybuild.tools import LooseVersion
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.config import build_path
from easybuild.tools.filetools import mkdir, remove_dir, symlink
Expand Down Expand Up @@ -144,14 +143,12 @@ def configure_step(self):
if suitesparse:
self.cfg.update('configopts', "-DTPL_ENABLE_UMFPACK:BOOL=ON")
self.cfg.update('configopts', "-DTPL_ENABLE_Cholmod:BOOL=ON")
incdirs, libdirs, libnames = [], [], []
for lib in ["UMFPACK", "CHOLMOD", "COLAMD", "AMD", "CCOLAMD", "CAMD"]:
incdirs.append(os.path.join(suitesparse, lib, "Include"))
libdirs.append(os.path.join(suitesparse, lib, "Lib"))
libnames.append(lib.lower())
incdir = os.path.join(suitesparse, "include")
libdir = os.path.join(suitesparse, "lib")
libs = ["UMFPACK", "CHOLMOD", "COLAMD", "AMD", "CCOLAMD", "CAMD"]
libnames = [lib.lower() for lib in libs]

# add SuiteSparse config lib, it is in recent versions of suitesparse
libdirs.append(os.path.join(suitesparse, 'SuiteSparse_config'))
libnames.append('suitesparseconfig')
# because of "SuiteSparse_config.c:function SuiteSparse_tic: error: undefined reference to 'clock_gettime'"
libnames.append('rt')
Expand All @@ -162,11 +159,11 @@ def configure_step(self):
# see https://answers.launchpad.net/dorsal/+question/223167
libnames.append('libmetis.a')

self.cfg.update('configopts', '-DUMFPACK_INCLUDE_DIRS:PATH="%s"' % ';'.join(incdirs))
self.cfg.update('configopts', '-DUMFPACK_LIBRARY_DIRS:PATH="%s"' % ';'.join(libdirs))
self.cfg.update('configopts', '-DUMFPACK_INCLUDE_DIRS:PATH="%s"' % incdir)
self.cfg.update('configopts', '-DUMFPACK_LIBRARY_DIRS:PATH="%s"' % libdir)
self.cfg.update('configopts', '-DUMFPACK_LIBRARY_NAMES:STRING="%s"' % ';'.join(libnames))
self.cfg.update('configopts', '-DCholmod_INCLUDE_DIRS:PATH="%s"' % ';'.join(incdirs))
self.cfg.update('configopts', '-DCholmod_LIBRARY_DIRS:PATH="%s"' % ';'.join(libdirs))
self.cfg.update('configopts', '-DCholmod_INCLUDE_DIRS:PATH="%s"' % incdir)
self.cfg.update('configopts', '-DCholmod_LIBRARY_DIRS:PATH="%s"' % libdir)
self.cfg.update('configopts', '-DCholmod_LIBRARY_NAMES:STRING="%s"' % ';'.join(libnames))

# BLACS
Expand Down
Loading