Skip to content

Commit 6a64b92

Browse files
committed
Merge remote-tracking branch 'upstream/main' into connorjward/upstream-update
2 parents 99b6aaf + 70c1ca3 commit 6a64b92

File tree

97 files changed

+272
-3187
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+272
-3187
lines changed

config/install.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,11 @@ def runcopy(self):
584584

585585
def runfix(self):
586586
self.fixConf()
587-
if os.environ.get('PEP517_BUILD_BACKEND'):
587+
using_build_backend = any(
588+
os.environ.get(prefix + '_BUILD_BACKEND')
589+
for prefix in ('_PYPROJECT_HOOKS', 'PEP517')
590+
)
591+
if using_build_backend:
588592
self.fixPythonWheel()
589593
return
590594

config/packages/hpddm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def __init__(self,argdb,log):
1717
package.Package.__init__(self,argdb,log)
1818
self.packagename = 'hpddm'
1919
self.downloadable = True
20-
self.gitcommit = '28add19c6968c41497468f4f4ac156196b051ea9'
20+
self.gitcommit = '66c82a45db9fb64ece5a69de8b4d27896b96c30e'
2121
# self.version = '2.3.0'
2222
obj = self.version if hasattr(self,'version') else self.gitcommit
2323
self.url = 'https://github.com/hpddm/hpddm/archive/'+('v'+obj if hasattr(self,'version') else obj)+'.tar.gz'

config/packages/slepc.py

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def Process(self,slepcconf,slepcvars,slepcrules,slepc,petsc,archdir=''):
5555
self.AddDefine(slepcconf,'PETSC_ARCH',petsc.arch)
5656
self.AddDefine(slepcconf,'DIR',slepc.dir)
5757
self.AddDefine(slepcconf,'LIB_DIR',os.path.join(slepc.prefixdir,'lib'))
58-
if slepc.isrepo:
58+
if slepc.isrepo and slepc.gitrev != 'unknown':
5959
self.AddDefine(slepcconf,'VERSION_GIT',slepc.gitrev)
6060
self.AddDefine(slepcconf,'VERSION_DATE_GIT',slepc.gitdate)
6161
self.AddDefine(slepcconf,'VERSION_BRANCH_GIT',slepc.branch)
@@ -69,7 +69,7 @@ def Process(self,slepcconf,slepcvars,slepcrules,slepc,petsc,archdir=''):
6969

7070
def ShowInfo(self):
7171
self.log.Println('\nSLEPc directory:\n '+self.dir)
72-
if self.isrepo:
72+
if self.isrepo and self.gitrev != 'unknown':
7373
self.log.Println(' It is a git repository on branch: '+self.branch)
7474
if self.isinstall:
7575
self.log.Println('SLEPc prefix directory:\n '+self.prefixdir)
@@ -110,28 +110,36 @@ def LoadVersion(self):
110110
# Check whether this is a working copy of the repository
111111
self.isrepo = False
112112
if os.path.exists(os.path.join(self.dir,'src','docs')):
113+
self.log.write('This appears to be a repository clone - src/docs exists')
113114
self.isrepo = True
114-
(status, output) = self.RunCommand('git help')
115-
if status:
116-
self.log.Warn('SLEPC_DIR appears to be a git working copy, but git is not found in PATH')
117-
self.gitrev = 'unknown'
118-
self.gitdate = 'unknown'
119-
self.branch = 'unknown'
120-
else:
121-
(status, output) = self.RunCommand('git rev-parse')
115+
if os.path.exists(os.path.join(self.dir,'.git')):
116+
self.log.write('.git directory exists')
117+
(status, output) = self.RunCommand('git help')
122118
if status:
123-
self.log.Warn('SLEPC_DIR appears to be a git working copy, but the .git folder is missing')
119+
self.log.Warn('SLEPC_DIR appears to be a git working copy, but git is not found in PATH')
124120
self.gitrev = 'unknown'
125121
self.gitdate = 'unknown'
126122
self.branch = 'unknown'
127123
else:
128-
(status, self.gitrev) = self.RunCommand('git describe')
124+
(status, self.gitrev) = self.RunCommand('git describe --match=v*')
129125
if not self.gitrev:
130126
(status, self.gitrev) = self.RunCommand('git log -1 --pretty=format:%H')
131127
(status, self.gitdate) = self.RunCommand('git log -1 --pretty=format:%ci')
132128
(status, self.branch) = self.RunCommand('git describe --contains --all HEAD')
133129
if status:
134-
self.branch = 'unknown'
130+
(status, self.branch) = self.RunCommand('git rev-parse --abbrev-ref HEAD')
131+
if status:
132+
self.branch = 'unknown'
133+
else:
134+
self.log.write('This repository clone is obtained as a tarball as no .git dirs exist')
135+
self.gitrev = 'unknown'
136+
self.gitdate = 'unknown'
137+
self.branch = 'unknown'
138+
else:
139+
if os.path.exists(os.path.join(self.dir,'.git')):
140+
self.log.Exit('Your SLEPc source tree is broken. Use "git status" to check, or remove the entire directory and start all over again')
141+
else:
142+
self.log.write('This is a tarball installation')
135143

136144
def CreateFile(self,basedir,fname):
137145
''' Create file basedir/fname and return path string '''

config/packages/sowing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ def __init__(self,argdb,log):
1818
self.packagename = 'sowing'
1919
self.downloadable = True
2020
self.inplace = False
21-
#self.gitcommit = '2fe1f1f12257b274cbb0b4425f2994965bcc9bde'
22-
self.version = '1.1.26.9'
21+
#self.gitcommit = '3a410fa51a7bb531676f16deb8bc0c1ded8293c3'
22+
self.version = '1.1.26.12'
2323
obj = self.version if hasattr(self,'version') else self.gitcommit
2424
self.url = 'https://bitbucket.org/petsc/pkg-sowing/get/'+('v'+obj if hasattr(self,'version') else obj)+'.tar.gz'
2525
self.archive = 'sowing-'+obj+'.tar.gz'
@@ -69,7 +69,7 @@ def Process(self,slepcconf,slepcvars,slepcrules,slepc,petsc,archdir=''):
6969
self.log.write('Using BFORT='+bfort)
7070
sys.path.insert(0, os.path.abspath(os.path.join('lib','slepc','bin','maint')))
7171
import generatefortranstubs
72-
generatefortranstubs.main(slepc.dir,'' if self.inplace else petsc.archname,bfort,os.path.join(slepc.dir,'src'),0)
72+
generatefortranstubs.main(slepc.dir,'' if self.inplace else petsc.archname,bfort,slepc.dir,0)
7373
generatefortranstubs.processf90interfaces(slepc.dir,'' if self.inplace else petsc.archname,0)
7474
except:
7575
self.log.Exit('Try configuring with --download-sowing or use a Git version of PETSc')

gmakefile.test

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,11 @@ $(foreach pkg, $(pkgs), $(call concattestlang,$(pkg),F F90)) : $(libslepcall)
289289
# Testing convenience targets
290290
.PHONY: test pre-clean
291291

292-
test: report_tests
292+
# The Fortran compiler may use out-dated module files in the tutorial and test directories so delete them all
293+
remove-test-mod-files:
294+
-@find src -name "*.mod" -not -path "src/binding/*" -delete
295+
296+
test: remove-test-mod-files report_tests
293297

294298
pre-clean:
295299
@$(RM) -rf $(TESTDIR)/counts $(TESTLOGTAPFILE) $(TESTLOGERRFILE)

include/slepc/private/slepcimpl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
SLEPC_INTERN PetscBool SlepcBeganPetsc;
1919

20-
/*@C
20+
/*MC
2121
SlepcHeaderCreate - Creates a SLEPc object
2222
2323
Input Parameters:
@@ -37,7 +37,7 @@ SLEPC_INTERN PetscBool SlepcBeganPetsc;
3737
has been called.
3838
3939
Level: developer
40-
@*/
40+
M*/
4141
#define SlepcHeaderCreate(h,classid,class_name,descr,mansec,comm,destroy,view) \
4242
((PetscErrorCode)((!SlepcInitializeCalled && \
4343
PetscError(comm,__LINE__,PETSC_FUNCTION_NAME,__FILE__,PETSC_ERR_ORDER,PETSC_ERROR_INITIAL, \

lib/slepc/bin/maint/generatefortranstubs.py

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ def findLineCol(filename, string):
2828

2929
data = re.subn('\00','',data)[0]
3030
data = re.subn('\nvoid ','\nSLEPC_EXTERN void ',data)[0]
31-
data = re.subn('\nPetscErrorCode ','\nSLEPC_EXTERN void ',data)[0]
31+
data = re.subn('\n[ ]*PetscErrorCode ','\nSLEPC_EXTERN void ',data)[0]
3232
data = re.subn(r'Petsc([ToRm]*)Pointer\(int\)','Petsc\\1Pointer(void*)',data)[0]
33-
data = re.subn(r'PetscToPointer\(a\) \(a\)','PetscToPointer(a) (*(PetscFortranAddr *)(a))',data)[0]
33+
data = re.subn(r'PetscToPointer\(a\) \(a\)','PetscToPointer(a) (a ? *(PetscFortranAddr *)(a) : 0)',data)[0]
3434
data = re.subn(r'PetscFromPointer\(a\) \(int\)\(a\)','PetscFromPointer(a) (PetscFortranAddr)(a)',data)[0]
3535
data = re.subn(r'PetscToPointer\( \*\(int\*\)','PetscToPointer(',data)[0]
3636
data = re.subn('MPI_Comm comm','MPI_Comm *comm',data)[0]
@@ -46,6 +46,7 @@ def findLineCol(filename, string):
4646
with open(filename, 'w') as ff:
4747
ff.write('#include "petscsys.h"\n#include "petscfix.h"\n#include "petsc/private/fortranimpl.h"\n'+data)
4848

49+
# https://gitlab.com/petsc/petsc/-/issues/360#note_231598172
4950
l, c = findLineCol(filename, '\00')
5051
if l > 0: print('WARNING: Found null character in generated Fortran stub file after generatefortranstubs.py processing:\n %s:%d:%d\n' % (filename, l, c))
5152

@@ -96,7 +97,6 @@ def FixDir(petscdir,petscarch,parentdir,dir,verbose):
9697
inbuf = fd.read()
9798
fd.close()
9899
cppflags = ""
99-
libbase = ""
100100

101101
# new makefile will be created from outbuf
102102
outbuf = '\n'
@@ -115,6 +115,10 @@ def FixDir(petscdir,petscarch,parentdir,dir,verbose):
115115
if line.find('MANSEC') >=0 and not line.find('SUBMANSEC') >=0:
116116
mansec = line.split('=')[1].lower().strip()
117117

118+
# this is a hack for the include directory and will be wrong for any
119+
# non-sys static include functions
120+
if mansec == 'unknown': mansec = 'sys'
121+
if submansec == 'unknown': submansec = 'sys'
118122
if not bfortsubmansec == 'unknown':
119123
submansec = bfortsubmansec
120124

@@ -135,7 +139,6 @@ def FixDir(petscdir,petscarch,parentdir,dir,verbose):
135139
txt = fd.read()
136140
fd.close()
137141
if txt:
138-
if mansec == 'unknown': raise RuntimeError("Cannot have unknown mansec in " + parentdir)
139142
if mansec in ['bv','ds','fn','rg','st']:
140143
basedir = os.path.join(petscdir,petscarch,'src','sys','classes',mansec,'f90-mod','ftn-auto-interfaces')
141144
else:
@@ -165,6 +168,7 @@ def processDir(petscdir, petscarch, bfort, verbose, dirpath, dirnames, filenames
165168
''' Runs bfort on a directory and then fixes the files generated by bfort including moving generated F90 fortran interface files'''
166169
if not dirpath.startswith(petscdir): raise RuntimeError("Error, the directory being processed "+dirpath+" does not begin with SLEPC_DIR "+petscdir)
167170
sdirpath = dirpath.replace(petscdir+'/','')
171+
if sdirpath == 'include': sdirpath = os.path.join('src','sys')
168172
outdir = os.path.join(petscdir,petscarch,sdirpath,'ftn-auto')
169173
if filenames:
170174
PrepFtnDir(outdir)
@@ -247,22 +251,27 @@ def processf90interfaces(petscdir,petscarch,verbose):
247251
for sfile in os.listdir(tmpDir):
248252
if verbose: print(' Copying in '+sfile)
249253
with open(os.path.join(tmpDir,sfile),'r') as fdr:
250-
for ibuf in fdr.read().split(' subroutine')[1:]:
254+
buf = fdr.read()
255+
if buf.startswith('#if defined(PETSC_HAVE_FORTRAN_TYPE_STAR)'):
256+
fd.write('#if defined(PETSC_HAVE_FORTRAN_TYPE_STAR)\n')
257+
for ibuf in buf.split(' subroutine')[1:]:
251258
ibuf = ' subroutine'+ibuf
252259
ibuf = ibuf.replace('integer z','PetscErrorCode z')
253260
ibuf = ibuf.replace('integer a ! MPI_Comm','MPI_Comm a ! MPI_Comm')
254261
plist = [p for p in ptypes if ' '+p[1:]+' ' in ibuf]
262+
if 'PetscObject' in ibuf: plist.append('tPetscObject')
255263
if plist: ibuf = ibuf.replace(')',')\n import '+','.join(set(plist)),1)
256264
fd.write(ibuf)
257265
shutil.rmtree(tmpDir)
258266
# FixDir(petscdir,os.path.join(petscdir,'include','slepc','finclude','ftn-auto-interfaces'),verbose)
259267
return
260268

261269
def main(petscdir,petscarch,bfort,dir,verbose):
262-
for dirpath, dirnames, filenames in os.walk(dir, topdown=True):
263-
filenames = [i for i in filenames if not i.find('#') > -1 and os.path.splitext(i)[1] in ['.c','.h','.cxx','.cu']]
264-
dirnames[:] = [d for d in dirnames if d not in ['output','tutorials','tests','binding','benchmarks'] and not d.startswith('ftn-') and not d.startswith('f90-')]
265-
processDir(petscdir, petscarch,bfort, verbose, dirpath, dirnames, filenames)
270+
for p in [ os.path.join(dir,'include'), os.path.join(dir,'src') ]:
271+
for dirpath, dirnames, filenames in os.walk(p, topdown=True):
272+
filenames = [i for i in filenames if not i.find('#') > -1 and os.path.splitext(i)[1] in ['.c','.h','.cxx','.cu']]
273+
dirnames[:] = [d for d in dirnames if d not in ['output', 'binding', 'tests', 'tutorials', 'yaml']]
274+
processDir(petscdir, petscarch,bfort, verbose, dirpath, dirnames, filenames)
266275
return
267276
#
268277
# generatefortranstubs bfortexectuable -verbose ----- generates fortran stubs for a directory and all its children
@@ -308,5 +317,5 @@ def not_empty(v):
308317
assert isinstance(args.bfort, (list, tuple))
309318
bfort_exec = args.bfort[0]
310319
assert isinstance(bfort_exec, str)
311-
ret = main(args.slepc_dir, args.petsc_arch, bfort_exec, os.path.join(args.slepc_dir, 'src'), args.verbose)
320+
ret = main(args.slepc_dir, args.petsc_arch, bfort_exec, args.slepc_dir, args.verbose)
312321
sys.exit(ret)

lib/slepc/conf/bfort-petsc.txt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
# petscao.h
44
nativeptr AO
55

6-
# petscbag.h
6+
# petscbag.h This is not a PETSc object
77
nativeptr PetscBag
88

9+
# this is not a PETSc object
10+
native PetscSFNode
11+
912
# petscdt.h
1013
native PetscDTNodeType
1114

@@ -46,8 +49,6 @@ native DMDALocalInfo
4649
native DMDAInterpolationType
4750
native DMDAElementType
4851

49-
nativeptr PetscGLL
50-
5152
# dmlabel.h
5253
nativeptr DMLabel
5354

@@ -144,7 +145,6 @@ native MatSTRUMPACKCompressionType
144145

145146
# petscpc.h
146147
nativeptr PC
147-
nativeptr PCType
148148

149149
native PCSide
150150
native PCJacobiType
@@ -176,7 +176,7 @@ nativeptr PetscConvEst
176176
native SNESConvergedReason
177177
native SNESLineSearchReason
178178
nativeptr MatMFFD
179-
nativeptr MatMFFDType
179+
native MatMFFDType
180180
nativeptr SNESLineSearch
181181
native SNESLineSearchOrder
182182
native SNESNormSchedule
@@ -209,6 +209,9 @@ native PetscOffset
209209
native PetscFortranAddr
210210
native PetscCount
211211

212+
nativeptr PetscDevice
213+
nativeptr PetscDeviceContext
214+
212215
native PetscInt
213216
native PetscInt64
214217
native PetscObjectState
@@ -241,7 +244,7 @@ native PetscReal
241244

242245

243246
native MatScalar
244-
native PetscObject
247+
nativeptr PetscObject
245248
native PetscLogDouble
246249

247250
nativeptr PetscMatlabEngine

setup.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,32 @@ def config(prefix, dry_run=False):
156156
status = os.system(" ".join(command))
157157
if status != 0:
158158
raise RuntimeError(status)
159+
# Fix SLEPc configuration
160+
using_build_backend = any(
161+
os.environ.get(prefix + '_BUILD_BACKEND')
162+
for prefix in ('_PYPROJECT_HOOKS', 'PEP517')
163+
)
164+
if using_build_backend:
165+
pdir = os.environ['SLEPC_DIR']
166+
parch = os.environ['PETSC_ARCH']
167+
if not parch:
168+
makefile = os.path.join(pdir, 'lib', 'slepc', 'conf', 'slepcvariables')
169+
with open(makefile, 'r') as mfile:
170+
contents = mfile.readlines()
171+
for line in contents:
172+
if line.startswith('PETSC_ARCH'):
173+
parch = line.split('=')[1].strip()
174+
break
175+
include = os.path.join(pdir, parch, 'include')
176+
for filename in (
177+
'slepcconf.h',
178+
):
179+
filename = os.path.join(include, filename)
180+
with open(filename, 'r') as old_fh:
181+
contents = old_fh.read()
182+
contents = contents.replace(prefix, '${SLEPC_DIR}')
183+
with open(filename, 'w') as new_fh:
184+
new_fh.write(contents)
159185

160186

161187
def build(dry_run=False):

src/eps/f90-mod/slepceps.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
!
1212
#include "slepc/finclude/slepceps.h"
1313

14-
type tEPS
15-
PetscFortranAddr:: v PETSC_FORTRAN_TYPE_INITIALIZE
14+
type, extends(tPetscObject) :: tEPS
1615
end type tEPS
1716

1817
EPS, parameter :: SLEPC_NULL_EPS = tEPS(0)

0 commit comments

Comments
 (0)