Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
kwant
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Joseph Weston
kwant
Commits
2f82b693
Commit
2f82b693
authored
8 years ago
by
Bas Nijholt
Browse files
Options
Downloads
Patches
Plain Diff
make setup.py work with `conda` installed libs
parent
df4700ed
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
setup.py
+45
-16
45 additions, 16 deletions
setup.py
with
45 additions
and
16 deletions
setup.py
+
45
−
16
View file @
2f82b693
...
...
@@ -388,15 +388,7 @@ def long_description():
return
'
\n
'
.
join
(
text
)
def
search_mumps
():
"""
Return the configuration for MUMPS if it is available in a known way.
This is known to work with the MUMPS provided by the Debian package
libmumps-scotch-dev.
"""
libs
=
[
'
zmumps_scotch
'
,
'
mumps_common_scotch
'
,
'
pord
'
,
'
mpiseq_scotch
'
,
'
gfortran
'
]
def
search_libs
(
libs
):
cmd
=
[
'
gcc
'
]
cmd
.
extend
([
'
-l
'
+
lib
for
lib
in
libs
])
cmd
.
extend
([
'
-o/dev/null
'
,
'
-xc
'
,
'
-
'
])
...
...
@@ -407,8 +399,46 @@ def search_mumps():
else
:
p
.
communicate
(
input
=
b
'
int main() {}
\n
'
)
if
p
.
wait
()
==
0
:
return
{
'
libraries
'
:
libs
}
return
{}
return
libs
def
search_mumps
():
"""
Return the configuration for MUMPS if it is available in a known way.
This is known to work with the MUMPS provided by the Debian package
libmumps-scotch-dev and the MUMPS binaries in the conda-forge channel.
"""
lib_sets
=
[
# Debian
[
'
zmumps_scotch
'
,
'
mumps_common_scotch
'
,
'
mpiseq_scotch
'
],
# Conda (via conda-forge).
# TODO: remove dependency libs (scotch, metis...) when conda-forge
# packaged mumps/scotch are built as properly linked shared libs
[
'
zmumps
'
,
'
mumps_common
'
,
'
metis
'
,
'
esmumps
'
,
'
scotch
'
,
'
scotcherr
'
,
'
mpiseq
'
],
]
common_libs
=
[
'
pord
'
,
'
gfortran
'
]
for
libs
in
lib_sets
:
found_libs
=
search_libs
(
libs
+
common_libs
)
if
found_libs
:
return
found_libs
return
[]
def
search_lapack
():
"""
Return the BLAS variant that is installed.
"""
lib_sets
=
[
# Debian
[
'
blas
'
,
'
lapack
'
],
# Conda (via conda-forge). Openblas contains lapack symbols
[
'
openblas
'
,
'
gfortran
'
],
]
for
libs
in
lib_sets
:
found_libs
=
search_libs
(
libs
)
if
found_libs
:
return
found_libs
return
[]
def
configure_special_extensions
(
exts
,
build_summary
):
...
...
@@ -417,7 +447,7 @@ def configure_special_extensions(exts, build_summary):
if
'
libraries
'
in
lapack
:
build_summary
.
append
(
'
User-configured LAPACK and BLAS
'
)
else
:
lapack
[
'
libraries
'
]
=
[
'
lapack
'
,
'
blas
'
]
lapack
[
'
libraries
'
]
=
search_lapack
()
build_summary
.
append
(
'
Default LAPACK and BLAS
'
)
#### Special config for MUMPS.
...
...
@@ -425,10 +455,9 @@ def configure_special_extensions(exts, build_summary):
if
'
libraries
'
in
mumps
:
build_summary
.
append
(
'
User-configured MUMPS
'
)
else
:
kwargs
=
search_mumps
()
if
kwargs
:
for
key
,
value
in
kwargs
.
items
():
mumps
.
setdefault
(
key
,
[]).
extend
(
value
)
mumps_libs
=
search_mumps
()
if
mumps_libs
:
mumps
[
'
libraries
'
]
=
mumps_libs
build_summary
.
append
(
'
Auto-configured MUMPS
'
)
else
:
mumps
=
None
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment