Skip to content

Commit

Permalink
Merge pull request #6 from firedrakeproject/connorjward/upstream-update
Browse files Browse the repository at this point in the history
Upstream update
  • Loading branch information
JDBetteridge authored Jun 21, 2024
2 parents 2285b60 + 6a64b92 commit 7d44ead
Show file tree
Hide file tree
Showing 172 changed files with 1,594 additions and 4,292 deletions.
62 changes: 36 additions & 26 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,6 @@ gnu-cxx-int64:
pip-install:
extends: .test
stage: stage-2
allow_failure: true # set this after release before the new petsc4py version is uploaded to pypi
tags:
- pip, name:jepri
before_script:
Expand All @@ -433,34 +432,45 @@ pip-install:
- ccache --zero-stats
- printf "PYTHON:${PYTHON}\n"
script:
- unset PETSC_DIR PETSC_ARCH SLEPC_DIR
- |
if [ $(awk '/define SLEPC_VERSION_RELEASE/{print $3}' include/slepcversion.h) == 1 ]; then
pip install --user .;
pip install --user src/binding/slepc4py;
make -C src/binding/slepc4py/demo;
unset PETSC_DIR PETSC_ARCH SLEPC_DIR
slepc=$PWD
cd ..
if [ ! -d petsc ]; then git clone https://gitlab.com/petsc/petsc.git; fi
cd petsc
git clean ${GIT_CLEAN_FLAGS}
git fetch
if [ -z ${PETSC_BRANCH+x} ]; then
if [ $(awk '/define SLEPC_VERSION_RELEASE/{print $3}' $slepc/include/slepcversion.h) == 1 ]; then
git checkout origin/release
else
git checkout origin/main
fi
else
slepc=$PWD;
cd ..;
if [ ! -d petsc ]; then git clone https://gitlab.com/petsc/petsc.git; fi;
cd petsc;
petsc=$PWD;
git clean ${GIT_CLEAN_FLAGS}
git fetch;
if [ -z ${PETSC_BRANCH+x} ]; then git checkout origin/main; else git checkout origin/$PETSC_BRANCH; fi;
set -eu pipefail;
rm -rf /tmp/env;
python -m venv /tmp/env;
source /tmp/env/bin/activate;
set -x;
python -m pip install -U pip==23.0.1 # pin version due to issue with pip 23.1
pip install numpy;
pip install $petsc;
pip install $petsc/src/binding/petsc4py;
pip install $slepc;
pip install $slepc/src/binding/slepc4py;
make -C $slepc/src/binding/slepc4py/demo;
git checkout origin/$PETSC_BRANCH
fi
petsc=$PWD
cd ..
set -eu pipefail
rm -rf /tmp/venv
python -m venv /tmp/venv
source /tmp/venv/bin/activate
set -x
python -m pip install --upgrade pip
wheelhouse=$PWD/wheelhouse
rm -rf $wheelhouse
mkdir -p $wheelhouse
export PIP_WHEEL_DIR=$wheelhouse
export PIP_FIND_LINKS=$wheelhouse
python -m pip wheel $petsc
python -m pip wheel $petsc/src/binding/petsc4py
python -m pip wheel $slepc
python -m pip wheel $slepc/src/binding/slepc4py
python -m pip install --pre slepc4py
python -m pip list
python -m slepc --prefix
python -m slepc4py
make -C $slepc/src/binding/slepc4py/demo
after_script:
- date

Expand Down
21 changes: 19 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,25 @@

### Added

- `ST`: new function `STShellSetApplyHermitianTranspose` and other improvements for handling
- `BV`: new function `BVGetSplitRows()` to split a `BV` row-wise using index sets.

### Changed

- In slepc4py now `EPS.getEigenpair()` and `EPS.getEigenvalue()` will return a real value
instead of a complex, if the problem is of Hermitian or generalized Hermitian type.

## [3.21] - 2024-03-30

### Added

- `ST`: new function `STShellSetApplyHermitianTranspose()` and other improvements for handling
the conjugate transpose of the operator.

### Changed

- `SVDGetSignature()` now takes a `Vec` argument instead of `Vec*`. The former interface
could not be used from Fortran.

## [3.20] - 2023-09-29

### Changed
Expand Down Expand Up @@ -454,7 +470,8 @@
- Classical and modified Gram-Schmidt orthogonalization use iterative refinement, with user options
for parameter adjustment.

[unreleased]: https://gitlab.com/slepc/slepc/compare/v3.20...main
[unreleased]: https://gitlab.com/slepc/slepc/compare/v3.21...main
[3.21]: https://gitlab.com/slepc/slepc/compare/v3.20...v3.21
[3.20]: https://gitlab.com/slepc/slepc/compare/v3.19...v3.20
[3.19]: https://gitlab.com/slepc/slepc/compare/v3.18...v3.19
[3.18]: https://gitlab.com/slepc/slepc/compare/v3.17...v3.18
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2002-2023, Universitat Politecnica de Valencia, Spain
Copyright (c) 2002-2024, Universitat Politecnica de Valencia, Spain
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
148 changes: 146 additions & 2 deletions config/install.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
from __future__ import print_function
import os, sys, shutil
import re, os, sys, shutil
import subprocess

try:
Expand Down Expand Up @@ -302,6 +302,144 @@ def fixConf(self):
self.fixConfFile(os.path.join(self.destIncludeDir,'slepcconf.h'))
return

def fixPythonWheel(self):
import glob
import shutil
#
for pattern in (
self.destLibDir + '/*.a',
self.destLibDir + '/*.la',
self.destLibDir + '/pkgconfig', # TODO: keep?
self.destConfDir + '/configure-hash',
self.destConfDir + '/uninstall.py',
self.destConfDir + '/reconfigure-*.py',
self.destConfDir + '/pkg.conf.*',
self.destConfDir + '/pkg.git*.*',
self.destConfDir + '/modules', # TODO: keep?
self.destShareDir + '/*/examples/src/*',
self.destShareDir + '/*/datafiles',
):
for pathname in glob.glob(pattern):
if os.path.isdir(pathname):
shutil.rmtree(pathname)
elif os.path.exists(pathname):
os.remove(pathname)
#
for filename in (
self.destIncludeDir + '/slepcconf.h',
self.destShareDir + '/slepc/examples/gmakefile.test',
self.destConfDir + '/slepc_rules_doc.mk',
self.destConfDir + '/slepc_rules_util.mk',
self.destConfDir + '/slepc_rules',
self.destConfDir + '/slepcrules',
self.destConfDir + '/slepc_variables',
self.destConfDir + '/slepcvariables',
):
with open(filename, 'r') as oldFile:
contents = oldFile.read()
contents = contents.replace(self.installDir, '${SLEPC_DIR}')
contents = contents.replace(self.rootDir, '${SLEPC_DIR}')
contents = contents.replace(self.petscDir, '${PETSC_DIR}')
with open(filename, 'w') as newFile:
newFile.write(contents)
#
def lsdir(dirname, *patterns):
return glob.glob(os.path.join(dirname, *patterns))
def shell(*args):
out = subprocess.check_output(list(args), universal_newlines=True)
return out[:-1] if out[-1:] == '\n' else out
plibdir = os.path.join(self.petscDir, 'lib')
slibdir = os.path.join(self.installDir, 'lib')
if sys.platform == 'linux':
libraries = [
lib for lib in lsdir(self.destLibDir, 'lib*.so*')
if not os.path.islink(lib)
]
for shlib in libraries:
# fix shared library rpath
rpath = shell('patchelf', '--print-rpath', shlib)
rpath = rpath.split(os.path.pathsep)
if plibdir in rpath:
rpath.insert(0, '$ORIGIN/../../petsc/lib')
while plibdir in rpath:
rpath.remove(plibdir)
if slibdir in rpath:
rpath.insert(0, '$ORIGIN')
while slibdir in rpath:
rpath.remove(slibdir)
if rpath:
rpath = os.path.pathsep.join(rpath)
shell('patchelf', '--set-rpath', rpath, shlib)
# fix shared library file and symlink
basename = os.path.basename(shlib)
libname, ext, _ = basename.partition('.so')
liblink = libname + ext
soname = shell('patchelf', '--print-soname', shlib)
for symlink in lsdir(self.destLibDir, liblink + '*'):
if os.path.islink(symlink):
os.unlink(symlink)
curdir = os.getcwd()
try:
os.chdir(os.path.dirname(shlib))
if soname != basename:
os.rename(basename, soname)
if soname != liblink:
os.symlink(soname, liblink)
finally:
os.chdir(curdir)
if sys.platform == 'darwin':
def otool(cmd, dylib):
pattern = r'''
^\s+ cmd \s %s$\n
^\s+ cmdsize \s \d+$\n
^\s+ (?:name|path) \s (.*) \s \(offset \s \d+\)$
''' % cmd
return re.findall(
pattern, shell('otool', '-l', dylib),
flags=re.VERBOSE | re.MULTILINE,
)
libraries = [
lib for lib in lsdir(self.destLibDir, 'lib*.dylib')
if not os.path.islink(lib)
]
for dylib in libraries:
install_name = otool('LC_ID_DYLIB', dylib)[0]
dependencies = otool('LC_LOAD_DYLIB', dylib)
runtime_path = otool('LC_RPATH', dylib)
# fix shared library install name and rpath
install_name = '@rpath/' + os.path.basename(install_name)
shell('install_name_tool', '-id', install_name, dylib)
for libdir in (plibdir, slibdir):
if libdir in runtime_path:
shell('install_name_tool', '-delete_rpath', libdir, dylib)
for rpath in ('@loader_path', '@loader_path/../../petsc/lib'):
if rpath not in runtime_path:
shell('install_name_tool', '-add_rpath', rpath, dylib)
for dep in dependencies:
if os.path.dirname(dep) in (plibdir, slibdir):
newid = '@rpath/' + os.path.basename(dep)
shell('install_name_tool', '-change', dep, newid, dylib)
# fix shared library file and symlink
basename = os.path.basename(dylib)
libname, ext = os.path.splitext(basename)
libname = libname.partition('.')[0]
liblink = libname + ext
dyname = os.path.basename(install_name)
for symlink in lsdir(self.destLibDir, libname + '*' + ext):
if os.path.islink(symlink):
os.unlink(symlink)
curdir = os.getcwd()
try:
os.chdir(os.path.dirname(dylib))
if dyname != basename:
os.rename(basename, dyname)
if dyname != liblink:
os.symlink(dyname, liblink)
finally:
os.chdir(curdir)
#
return

def createUninstaller(self):
uninstallscript = os.path.join(self.destConfDir, 'uninstall.py')
f = open(uninstallscript, 'w')
Expand Down Expand Up @@ -441,14 +579,20 @@ def runcopy(self):
self.installBin()
self.installLib()
self.installShare()
self.createUninstaller()
return

def runfix(self):
self.fixConf()
using_build_backend = any(
os.environ.get(prefix + '_BUILD_BACKEND')
for prefix in ('_PYPROJECT_HOOKS', 'PEP517')
)
if using_build_backend:
self.fixPythonWheel()
return

def rundone(self):
self.createUninstaller()
if self.destDir == self.installDir:
self.outputInstallDone()
else:
Expand Down
2 changes: 1 addition & 1 deletion config/packages/elpa.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self,argdb,log):
self.packagetype = 'gnu'
self.installable = True
self.downloadable = True
self.version = '2023.11.001'
self.version = '2024.03.001'
self.archive = 'elpa-'+self.version+'.tar.gz'
self.url = 'https://elpa.mpcdf.mpg.de/software/tarball-archive/Releases/'+self.version+'/'+self.archive
self.supportssingle = True
Expand Down
4 changes: 2 additions & 2 deletions config/packages/hpddm.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def __init__(self,argdb,log):
package.Package.__init__(self,argdb,log)
self.packagename = 'hpddm'
self.downloadable = True
# self.gitcommit = 'a789a193f3c9c7c3c2674eb8d1f8db95cd1ae48c'
self.version = '2.2.5'
self.gitcommit = '66c82a45db9fb64ece5a69de8b4d27896b96c30e'
# self.version = '2.3.0'
obj = self.version if hasattr(self,'version') else self.gitcommit
self.url = 'https://github.com/hpddm/hpddm/archive/'+('v'+obj if hasattr(self,'version') else obj)+'.tar.gz'
self.archive = 'hpddm-'+obj+'.tar.gz'
Expand Down
34 changes: 21 additions & 13 deletions config/packages/slepc.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def Process(self,slepcconf,slepcvars,slepcrules,slepc,petsc,archdir=''):
self.AddDefine(slepcconf,'PETSC_ARCH',petsc.arch)
self.AddDefine(slepcconf,'DIR',slepc.dir)
self.AddDefine(slepcconf,'LIB_DIR',os.path.join(slepc.prefixdir,'lib'))
if slepc.isrepo:
if slepc.isrepo and slepc.gitrev != 'unknown':
self.AddDefine(slepcconf,'VERSION_GIT',slepc.gitrev)
self.AddDefine(slepcconf,'VERSION_DATE_GIT',slepc.gitdate)
self.AddDefine(slepcconf,'VERSION_BRANCH_GIT',slepc.branch)
Expand All @@ -69,7 +69,7 @@ def Process(self,slepcconf,slepcvars,slepcrules,slepc,petsc,archdir=''):

def ShowInfo(self):
self.log.Println('\nSLEPc directory:\n '+self.dir)
if self.isrepo:
if self.isrepo and self.gitrev != 'unknown':
self.log.Println(' It is a git repository on branch: '+self.branch)
if self.isinstall:
self.log.Println('SLEPc prefix directory:\n '+self.prefixdir)
Expand Down Expand Up @@ -110,28 +110,36 @@ def LoadVersion(self):
# Check whether this is a working copy of the repository
self.isrepo = False
if os.path.exists(os.path.join(self.dir,'src','docs')):
self.log.write('This appears to be a repository clone - src/docs exists')
self.isrepo = True
(status, output) = self.RunCommand('git help')
if status:
self.log.Warn('SLEPC_DIR appears to be a git working copy, but git is not found in PATH')
self.gitrev = 'unknown'
self.gitdate = 'unknown'
self.branch = 'unknown'
else:
(status, output) = self.RunCommand('git rev-parse')
if os.path.exists(os.path.join(self.dir,'.git')):
self.log.write('.git directory exists')
(status, output) = self.RunCommand('git help')
if status:
self.log.Warn('SLEPC_DIR appears to be a git working copy, but the .git folder is missing')
self.log.Warn('SLEPC_DIR appears to be a git working copy, but git is not found in PATH')
self.gitrev = 'unknown'
self.gitdate = 'unknown'
self.branch = 'unknown'
else:
(status, self.gitrev) = self.RunCommand('git describe')
(status, self.gitrev) = self.RunCommand('git describe --match=v*')
if not self.gitrev:
(status, self.gitrev) = self.RunCommand('git log -1 --pretty=format:%H')
(status, self.gitdate) = self.RunCommand('git log -1 --pretty=format:%ci')
(status, self.branch) = self.RunCommand('git describe --contains --all HEAD')
if status:
self.branch = 'unknown'
(status, self.branch) = self.RunCommand('git rev-parse --abbrev-ref HEAD')
if status:
self.branch = 'unknown'
else:
self.log.write('This repository clone is obtained as a tarball as no .git dirs exist')
self.gitrev = 'unknown'
self.gitdate = 'unknown'
self.branch = 'unknown'
else:
if os.path.exists(os.path.join(self.dir,'.git')):
self.log.Exit('Your SLEPc source tree is broken. Use "git status" to check, or remove the entire directory and start all over again')
else:
self.log.write('This is a tarball installation')

def CreateFile(self,basedir,fname):
''' Create file basedir/fname and return path string '''
Expand Down
Loading

0 comments on commit 7d44ead

Please sign in to comment.