Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SDE
vaesoft
Commits
de3ba570
Commit
de3ba570
authored
Jun 07, 2022
by
Dmytro Kresan
Browse files
Backport py-pythran.
parent
13213293
Changes
2
Hide whitespace changes
Inline
Side-by-side
repos/vae-backports/packages/py-pythran/omp.patch
0 → 100644
View file @
de3ba570
diff --git a/omp/__init__.py b/omp/__init__.py
index bddae3063..10a4cc995 100644
--- a/omp/__init__.py
+++ b/omp/__init__.py
@@ -69,10 +69,16 @@
class OpenMP(object):
def init_not_msvc(self):
""" Find OpenMP library and try to load if using ctype interface. """
- # find_library() does not search automatically LD_LIBRARY_PATH
+ # find_library() does not automatically search LD_LIBRARY_PATH
+ # until Python 3.6+, so we explicitly add it.
+ # LD_LIBRARY_PATH is used on Linux, while macOS uses DYLD_LIBRARY_PATH
+ # and DYLD_FALLBACK_LIBRARY_PATH.
paths = os.environ.get('LD_LIBRARY_PATH', '').split(':')
+ paths += os.environ.get('DYLD_LIBRARY_PATH', '').split(':')
+ paths += os.environ.get('DYLD_FALLBACK_LIBRARY_PATH', '').split(':')
- for libomp_name in self.get_libomp_names():
+ libomp_names = self.get_libomp_names()
+ for libomp_name in libomp_names:
if cxx is None or sys.platform == 'win32':
# Note: Clang supports -print-file-name, but not yet for
# clang-cl as of v12.0.0 (April '21)
@@ -87,25 +93,27 @@
class OpenMP(object):
except (OSError, CalledProcessError):
pass
- # Try to load find libgomp shared library using loader search dirs
- libgomp_path = find_library("gomp")
-
- # Try to use custom paths if lookup failed
- for path in paths:
- if libgomp_path:
- break
- path = path.strip()
- if os.path.isdir(path):
- libgomp_path = find_library(os.path.join(str(path), "libgomp"))
-
- if not libgomp_path:
- raise ImportError("I can't find a shared library for libgomp,"
- " you may need to install it or adjust the "
- "LD_LIBRARY_PATH environment variable.")
- else:
- # Load the library (shouldn't fail with an absolute path right?)
- self.libomp = ctypes.CDLL(libgomp_path)
- self.version = 45
+ for libomp_name in libomp_names:
+ # Try to load find libomp shared library using loader search dirs
+ libomp_path = find_library(libomp_name)
+
+ # Try to use custom paths if lookup failed
+ for path in paths:
+ if libomp_path:
+ break
+ path = path.strip()
+ if os.path.isfile(os.path.join(path, libomp_name)):
+ libomp_path = os.path.join(path, libomp_name)
+
+ if libomp_path:
+ # Load the library (shouldn't fail with an absolute path right?)
+ self.libomp = ctypes.CDLL(libomp_path)
+ self.version = 45
+ return
+
+ raise ImportError("I can't find a shared library for libomp,"
+ " you may need to install it or adjust the "
+ "LD_LIBRARY_PATH environment variable.")
def __getattr__(self, name):
"""
repos/vae-backports/packages/py-pythran/package.py
0 → 100644
View file @
de3ba570
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import
sys
from
spack.package
import
*
class
PyPythran
(
PythonPackage
):
"""Ahead of Time compiler for numeric kernels."""
homepage
=
"https://github.com/serge-sans-paille/pythran"
pypi
=
"pythran/pythran-0.9.11.tar.gz"
version
(
'0.11.0'
,
sha256
=
'0b2cba712e09f7630879dff69f268460bfe34a6d6000451b47d598558a92a875'
)
version
(
'0.10.0'
,
sha256
=
'9dac8e1d50f33d4676003e350b1f0c878ce113e6f907920e92dc103352cac5bf'
)
version
(
'0.9.12'
,
sha256
=
'5d50dc74dca1d3f902941865acbae981fc24cceeb9d54673d68d6b5c8c1b0001'
)
version
(
'0.9.11'
,
sha256
=
'a317f91e2aade9f6550dc3bf40b5caeb45b7e012daf27e2b3e4ad928edb01667'
)
version
(
'0.9.10'
,
sha256
=
'8fa1d19624cb2950e5a18974fdcb0dffc57e1a821049dc95df09563edd673915'
)
version
(
'0.9.9'
,
sha256
=
'aaabc97f30ad46d1d62303323de6697d2933779afa4666c15b0f433cb50825b1'
)
version
(
'0.9.8'
,
sha256
=
'81c10a16fce9ed41211fb70e82fda6984e93f4602a164934648db8cbb08156b3'
)
version
(
'0.9.7'
,
sha256
=
'ac36a94bd862e3c80dae585158b90d3e7c5c05fd252819f3ca7d880a1c7c1012'
)
version
(
'0.9.6'
,
sha256
=
'2d102a55d9d53f77cf0f4a904eeb5cbaa8fe76e4892319a859fc618401e2f6ba'
)
version
(
'0.9.5'
,
sha256
=
'815a778d6889593c0b8ddf08052cff36a504ce4cc8bd8d7bfb856a212f91486e'
)
version
(
'0.9.4'
,
sha256
=
'ec9c91f5331454263b064027292556a184a9f55a50f8615e09b08f57a4909855'
)
version
(
'0.9.3'
,
sha256
=
'217427a8225a331fdc8f3efe57871aed775cdf2c6e847a0a83df0aaae4b02493'
)
depends_on
(
'python@3:'
,
when
=
'@0.9.6:'
,
type
=
(
'build'
,
'run'
))
depends_on
(
'python@2.7:'
,
when
=
'@:0.9.5'
,
type
=
(
'build'
,
'run'
))
depends_on
(
'py-setuptools'
,
type
=
'build'
)
depends_on
(
'py-pytest-runner'
,
type
=
'build'
,
when
=
'@:0.9'
)
depends_on
(
'py-ply@3.4:'
,
type
=
(
'build'
,
'run'
))
depends_on
(
'py-networkx@2:'
,
when
=
'@:0.9.11'
,
type
=
(
'build'
,
'run'
))
depends_on
(
'py-decorator'
,
when
=
'@:0.9.11'
,
type
=
(
'build'
,
'run'
))
depends_on
(
'py-gast@0.5.0:0.5'
,
when
=
'@0.9.12:'
,
type
=
(
'build'
,
'run'
))
depends_on
(
'py-gast@0.4.0:0.4'
,
when
=
'@0.9.7:0.9.11'
,
type
=
(
'build'
,
'run'
))
depends_on
(
'py-gast@0.3.3:0.3'
,
when
=
'@0.9.6'
,
type
=
(
'build'
,
'run'
))
depends_on
(
'py-gast@0.3.0:'
,
when
=
'@0.9.4:0.9.5'
,
type
=
(
'build'
,
'run'
))
depends_on
(
'py-gast'
,
when
=
'@:0.9.3'
,
type
=
(
'build'
,
'run'
))
depends_on
(
'py-six'
,
when
=
'@:0.9.11'
,
type
=
(
'build'
,
'run'
))
depends_on
(
'py-numpy'
,
type
=
(
'build'
,
'run'
))
depends_on
(
'py-beniget@0.4.0:0.4'
,
when
=
'@0.9.12:'
,
type
=
(
'build'
,
'run'
))
depends_on
(
'py-beniget@0.3.0:0.3'
,
when
=
'@0.9.7:0.9.11'
,
type
=
(
'build'
,
'run'
))
depends_on
(
'py-beniget@0.2.1:0.2'
,
when
=
'@0.9.6'
,
type
=
(
'build'
,
'run'
))
depends_on
(
'py-beniget@0.2.0:'
,
when
=
'@0.9.4:0.9.5'
,
type
=
(
'build'
,
'run'
))
depends_on
(
'py-beniget'
,
when
=
'@:0.9.3'
,
type
=
(
'build'
,
'run'
))
depends_on
(
'llvm-openmp'
,
when
=
'%apple-clang'
,
type
=
(
'build'
,
'run'
))
# https://github.com/serge-sans-paille/pythran/pull/1856
patch
(
'omp.patch'
,
when
=
'@0.9.10:0.9.12'
)
# https://github.com/serge-sans-paille/pythran/issues/1937
conflicts
(
'%apple-clang@13:'
,
when
=
'@:0.10'
)
def
patch
(
self
):
# Compiler is used at run-time to determine name of OpenMP library to search for
cfg_file
=
join_path
(
'pythran'
,
'pythran-{0}.cfg'
.
format
(
sys
.
platform
))
filter_file
(
'CXX='
,
'CXX='
+
self
.
compiler
.
cxx
,
cfg_file
)
def
setup_build_environment
(
self
,
env
):
# Needed for `spack install --test=root py-pythran`
if
self
.
spec
.
satisfies
(
'%apple-clang'
):
env
.
prepend_path
(
'DYLD_FALLBACK_LIBRARY_PATH'
,
self
.
spec
[
'llvm-openmp'
].
libs
.
directories
[
0
]
)
def
setup_run_environment
(
self
,
env
):
# Needed for `spack test run py-pythran`
self
.
setup_build_environment
(
env
)
def
setup_dependent_build_environment
(
self
,
env
,
dependent_spec
):
# Needed for `spack install py-scipy`
self
.
setup_build_environment
(
env
)
def
setup_dependent_run_environment
(
self
,
env
,
dependent_spec
):
# Probably needed for something?
self
.
setup_build_environment
(
env
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment