Skip to content

Commit

Permalink
Merge pull request #20 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 272f13d + 671908e commit ba4e573
Show file tree
Hide file tree
Showing 1,546 changed files with 64,256 additions and 29,156 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ CMakeLists.txt
petsc-doc-env
doc/manualpages
src/binding/petsc4py/.eggs
src/binding/petsc4py/petsc4py.egg-info
src/binding/petsc4py/src/include/petsc4py/petsc4py.PETSc.h
src/binding/petsc4py/src/include/petsc4py/petsc4py.PETSc_api.h
src/binding/petsc4py/src/libpetsc4py/libpetsc4py.c
Expand Down Expand Up @@ -180,7 +181,6 @@ src/benchmarks/streams/CUDAVersion
src/benchmarks/streams/OpenMPVersion
src/benchmarks/streams/PthreadVersion
src/benchmarks/streams/scaling.png
horse.ply
/docs/
**/f90module*.f90
compile_commands.json
Expand Down
23 changes: 17 additions & 6 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ check-ci-settings:
- if [ ! -z ${INIT_SCRIPT+x} ]; then echo "sourcing ${INIT_SCRIPT}"; if [ -f ${HOME}/${INIT_SCRIPT} ]; then source ${HOME}/${INIT_SCRIPT}; else source ${INIT_SCRIPT}; fi; fi
- printf "PATH:$PATH\n"
- printf "PYTHONPATH:$PYTHONPATH\n"
- printf "python:${PYTHON}\n"
- ${PYTHON} -m pip list --user
- printf "CONFIG_OPTS:${CONFIG_OPTS}\n"
- printf "PETSC_OPTIONS:$PETSC_OPTIONS\n"
- if [ ! -z ${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME+x} ]; then printf "CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME\n" ;fi
Expand All @@ -83,7 +85,7 @@ check-ci-settings:
- make CFLAGS="${MAKE_TEST_CFLAGS}" CXXFLAGS="${MAKE_TEST_CXXFLAGS}" FFLAGS="${MAKE_TEST_FFLAGS}" CUDAFLAGS="${MAKE_CUDAFLAGS}" allgtests-tap gmakesearch="${TEST_SEARCH}" TIMEOUT=${TIMEOUT}
variables:
PYTHON: python3
MAKE_CFLAGS: -Werror
MAKE_CFLAGS: -Werror -Wmissing-field-initializers
MAKE_CXXFLAGS: -Werror -Wzero-as-null-pointer-constant
MAKE_FFLAGS: -Werror
MAKE_TEST_CFLAGS: -Werror
Expand Down Expand Up @@ -214,10 +216,17 @@ petsc4py-pip:
script:
- python3 -m venv pip-builds
- source pip-builds/bin/activate
- python3 -m pip install --upgrade pip==23.0.1
- python3 -m pip install .
- python3 -m pip install src/binding/petsc4py
- python3 -m petsc4py
- python -m pip install --upgrade pip
- unset PETSC_DIR PETSC_ARCH
- export PIP_WHEEL_DIR="${PWD}/wheelhouse"
- export PIP_FIND_LINKS="${PIP_WHEEL_DIR}"
- mkdir -p "${PIP_WHEEL_DIR}"
- python -m pip wheel .
- python -m pip wheel src/binding/petsc4py
- python -m pip install --pre --no-index --no-cache-dir petsc4py
- python -m pip list
- python -m petsc --prefix
- python -m petsc4py

checksource:
extends: .test-basic
Expand All @@ -229,10 +238,12 @@ checksource:
- vermin --version
- make vermin
- PATH=/nfs/gce/projects/petsc/soft/u22.04/spack-2024-03-06/opt/spack/linux-ubuntu22.04-x86_64/gcc-11.4.0/llvm-18.1.0-7hsf4hzma6aebqsd4ifb5brchcooktkp/bin:$PATH make checkclangformat SHELL=bash
- PATH=/nfs/gce/projects/petsc/soft/u22.04/spack-2024-03-06/opt/spack/linux-ubuntu22.04-x86_64/gcc-11.4.0/llvm-18.1.5-ug2n4c7cb3xrf3dxn7fkffuvcgfdzzpk/bin:$PATH make checkclangformat SHELL=bash
- make checkbadSource SHELL=bash
- make checkbadFileChange SHELL=bash
- make -f gmakefile check_output SHELL=bash
- make check_petsc4py_rst
- make -C src/binding/petsc4py lint
artifacts:
name: "$CI_JOB_NAME"
when: always
Expand Down Expand Up @@ -1199,7 +1210,7 @@ analyze-pipeline:
python3 -m venv $VENV &&
. $VENV/bin/activate &&
cd doc &&
python3 -m pip install -r requirements.txt
python -m pip install -r requirements.txt

#
# Build documentation and make available for review using GitLab pages
Expand Down
1 change: 1 addition & 0 deletions .gitlab/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ src/ts/event/ @abhyshr @caidao22 @BarrySmith
/src/ksp/pc/impls/gamg/ @markadams4 @jedbrown
/src/ksp/pc/impls/hpddm/ @prj- @stefanozampini
/src/ksp/ksp/impls/hpddm/ @prj- @stefanozampini
/src/ksp/ksp/utils/lmvm/ @hsuh @tisaac

/src/binding/petsc4py/ @dalcinl @wence @pefarrell @joseroman @jedbrown @knepley @psanan @stefanozampini

Expand Down
18 changes: 17 additions & 1 deletion config/BuildSystem/config/compilers.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,15 @@ def checkCLibraries(self):
# Intel 11 has a bogus -long_double option
if arg == '-long_double':
continue
# if options of type -L foobar
if arg == '-lto_library':
lib = next(argIter)
self.logPrint('Skipping Apple LLVM linker option -lto_library '+lib)
continue
# ASan
if arg in ['-lasan', '-lubsan']:
self.logPrint('Skipping ASan libraries')
continue
# if options of type -L foobar
if arg == '-L':
lib = next(argIter)
self.logPrint('Found -L '+lib, 4, 'compilers')
Expand Down Expand Up @@ -581,6 +585,10 @@ def checkCxxLibraries(self):
if arg == '-long_double':
continue

# ASan
if arg in ['-lasan', '-lubsan']:
self.logPrint('Skipping ASan libraries')
continue
# if options of type -L foobar
if arg == '-L':
lib = next(argIter)
Expand Down Expand Up @@ -982,6 +990,7 @@ def checkFortranLibraries(self):
while 1:
arg = next(argIter)
self.logPrint( 'Checking arg '+arg, 4, 'compilers')

# Intel compiler sometimes puts " " around an option like "-lsomething"
if arg.startswith('"') and arg.endswith('"'):
arg = arg[1:-1]
Expand All @@ -990,6 +999,10 @@ def checkFortranLibraries(self):
if arg.endswith('"') and arg[:-1].find('"') == -1:
arg = arg[:-1]

# ASan
if arg in ['-lasan', '-lubsan']:
self.logPrint('Skipping ASan libraries')
continue
if arg == '-lto_library':
lib = next(argIter)
self.logPrint('Skipping Apple LLVM linker option -lto_library '+lib)
Expand Down Expand Up @@ -1077,6 +1090,9 @@ def checkFortranLibraries(self):
continue
elif arg == '-lLTO' and self.setCompilers.isDarwin(self.log):
self.logPrint('Skipping -lTO')
elif arg == '-lnvc':
self.logPrint('Skipping -lnvc: https://forums.developer.nvidia.com/t/failed-cuda-device-detection-when-explicitly-linking-libnvc/203225')
continue
elif arg.find('-libpath:')>=0:
self.logPrint('Skipping Intel oneAPI ifort (on Microsoft Windows) compiler option: '+arg)
continue
Expand Down
5 changes: 4 additions & 1 deletion config/BuildSystem/config/compilersFortran.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,11 @@ def checkFortranTypeInitialize(self):

def checkFortranTypeStar(self):
'''Determine whether the Fortran compiler handles type(*)'''
'''Newer nvfortran support (*) but they introduce extra arguments at the end that interfere with char * lengths'''
'''So it cannot be used in interface definitions'''
'''Not using type(*) :: b(:) prevents this compiler from certifying it has (*)'''
self.pushLanguage('FC')
if self.checkCompile(body = ' interface\n subroutine a(b)\n type(*) :: b(:)\n end subroutine\n end interface\n'):
if self.checkCompile(body = ' interface\n subroutine a(b)\n type(*) b\n end subroutine\n end interface\n'):
self.addDefine('HAVE_FORTRAN_TYPE_STAR', 1)
self.logPrint('Fortran compiler supports type(*)')
else:
Expand Down
2 changes: 2 additions & 0 deletions config/BuildSystem/config/framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,8 @@ def filterCompileOutput(self, output,flag = '', filterAlways = 0):
if output.find('warning: ISO C90 does not support') >= 0: return output
if output.find('warning: ISO C does not support') >= 0: return output
if output.find('warning #2650: attributes ignored here') >= 0: return output
if output.find('warning #3175: unrecognized gcc optimization level') >= 0: return output
if output.find('warning: unknown attribute') >= 0: return output
if output.find('Warning: attribute visibility is unsupported and will be skipped') >= 0: return output
if output.find('(E) Invalid statement found within an interface block. Executable statement, statement function or syntax error encountered.') >= 0: return output
elif self.argDB['ignoreCompileOutput'] and not filterAlways:
Expand Down
69 changes: 33 additions & 36 deletions config/BuildSystem/config/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def __init__(self, framework):
self.foundversion = '' # version of the package actually found
self.version_tuple = '' # version of the package actually found (tuple)
self.requiresversion = 0 # error if the version information is not found
self.requirekandr = 0 # package requires KandR compiler flags to build

# These are specified for the package
self.required = 0 # 1 means the package is required
Expand Down Expand Up @@ -407,11 +408,8 @@ def updatePackageCFlags(self,flags):
outflags = self.removeVisibilityFlag(flags.split())
outflags = self.removeWarningFlags(outflags)
outflags = self.removeCoverageFlag(outflags)
with self.Language('C'):
if config.setCompilers.Configure.isClang(self.getCompiler(), self.log):
outflags.append('-Wno-implicit-function-declaration')
if config.setCompilers.Configure.isDarwin(self.log):
outflags.append('-fno-common')
if self.requirekandr:
outflags += self.setCompilers.KandRFlags
return ' '.join(outflags)

def updatePackageFFlags(self,flags):
Expand Down Expand Up @@ -573,11 +571,11 @@ def generateLibList(self, directory, liblist = None):
alllibs.append(libs)
return alllibs

def getIncludeDirs(self, prefix, includeDir):
if isinstance(includeDir, list):
iDirs = [inc for inc in includeDir if os.path.isabs(inc)] + [os.path.join(prefix, inc) for inc in includeDir if not os.path.isabs(inc)]
return [inc for inc in iDirs if os.path.exists(inc)]
return os.path.join(prefix, includeDir)
def getIncludeDirs(self, prefix, includeDirs):
if not isinstance(includeDirs, list):
includeDirs = [includeDirs]
iDirs = [inc for inc in includeDirs if os.path.isabs(inc)] + [os.path.join(prefix, inc) for inc in includeDirs if not os.path.isabs(inc)]
return [inc for inc in iDirs if os.path.exists(inc)]

def addToArgs(self,args,key,value):
found = 0
Expand Down Expand Up @@ -1202,51 +1200,50 @@ def infinitePatch(str):
setattr(self.compilers, flagsArg, oldFlags+extraFlags+' '+self.headers.toString(self.dinclude))
self.compilers.saveLog()

# X.py uses a weird list of two headers.
# Multiple headers are tried in order
if not isinstance(self.versioninclude,list):
headerList = [self.versioninclude]
else:
headerList = self.versioninclude

includeLines = ''
for header in headerList:
includeLines += '#include "'+header+'"\n'
try:
# We once used '#include "'+self.versioninclude+'"\npetscpkgver('+self.versionname+');\n',
# but some preprocessors are picky (ex. dpcpp -E), reporting errors on the code above even
# it is just supposed to do preprocessing:
#
# error: C++ requires a type specifier for all declarations
# petscpkgver(__SYCL_COMPILER_VERSION);
# ^
#
# So we instead use this compilable code.
output = self.outputPreprocess(
try:
# We once used '#include "'+self.versioninclude+'"\npetscpkgver('+self.versionname+');\n',
# but some preprocessors are picky (ex. dpcpp -E), reporting errors on the code above even
# it is just supposed to do preprocessing:
#
# error: C++ requires a type specifier for all declarations
# petscpkgver(__SYCL_COMPILER_VERSION);
# ^
#
# So we instead use this compilable code.
output = self.outputPreprocess(
'''
{x}
#include "{x}"
#define PetscXstr_(s) PetscStr_(s)
#define PetscStr_(s) #s
const char *ver = "petscpkgver(" PetscXstr_({y}) ")";
'''.format(x=includeLines, y=self.versionname))
# Ex. char *ver = "petscpkgver(" "20211206" ")";
# But after stripping spaces, quotes etc below, it becomes char*ver=petscpkgver(20211206);
self.logWrite(self.compilers.restoreLog())
except:
self.log.write('For '+self.package+' unable to run preprocessor to obtain version information, skipping version check\n')
'''.format(x=header, y=self.versionname))
# Ex. char *ver = "petscpkgver(" "20211206" ")";
# But after stripping spaces, quotes etc below, it becomes char*ver=petscpkgver(20211206);
except:
output = None
self.logWrite(self.compilers.restoreLog())
self.popLanguage()
setattr(self.compilers, flagsArg,oldFlags)
self.version = ''
return
if output:
break
self.popLanguage()
setattr(self.compilers, flagsArg,oldFlags)
if not output:
self.log.write('For '+self.package+' unable to run preprocessor to obtain version information, skipping version check\n')
self.version = ''
return
# the preprocessor output might be very long, but the petscpkgver line should be at the end. Therefore, we partition it backwards
[mid, right] = output.rpartition('petscpkgver')[1:]
version = ''
if mid: # if mid is not empty, then it should be 'petscpkgver', meaning we found the version string
verLine = right.split(';',1)[0] # get the string before the first ';'. Preprocessor might dump multiline result.
self.log.write('Found the raw version string: ' + verLine +'\n')
# strip backslashs, spaces and quotes. Note Mumps' version macro has "" around it, giving output: (" "\"5.4.1\"" ")";
# strip backslashes, spaces, and quotes. Note MUMPS' version macro has "" around it, giving output: (" "\"5.4.1\"" ")";
for char in ['\\', ' ', '"']:
verLine = verLine.replace(char, '')
# get the string between the outer ()
Expand Down
2 changes: 1 addition & 1 deletion config/BuildSystem/config/packages/AMReX.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def formCMakeConfigureArgs(self):
if self.cuda.found:
GPUBackend = 'CUDA'
# Prefer cmake options instead of -DAMReX_CUDA_ARCH
args.append('-DCMAKE_CUDA_ARCHITECTURES:STRING="{}"'.format(self.cuda.cmakeArch()))
args.extend(self.cuda.getCmakeCUDAArchFlag())
elif self.hip.found:
GPUBackend = 'HIP'
args.append('-DCMAKE_HIP_ARCHITECTURES="'+self.hip.hipArch+'"')
Expand Down
3 changes: 2 additions & 1 deletion config/BuildSystem/config/packages/Chaco.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ def __init__(self, framework):
self.includes = [] #Chaco does not have an include file
self.liblist = [['libchaco.a']]
self.downloadonWindows = 1
self.requires32bitint = 1; # 1 means that the package will not work with 64-bit integers
self.requires32bitint = 1 # 1 means that the package will not work with 64-bit integers
self.hastests = 1
self.requirekandr = 1
return

def setupDependencies(self, framework):
Expand Down
7 changes: 7 additions & 0 deletions config/BuildSystem/config/packages/MFEM.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def __init__(self, framework):
self.skippackagewithoptions = 1
self.builtafterpetsc = 1
self.noMPIUni = 1
self.precisions = ['single', 'double']
return

def setupHelp(self, help):
Expand All @@ -35,6 +36,7 @@ def setupDependencies(self, framework):
self.cuda = framework.require('config.packages.cuda',self)
self.hip = framework.require('config.packages.hip',self)
self.openmp = framework.require('config.packages.openmp',self)
self.scalar = framework.require('PETSc.options.scalarTypes',self)
self.deps = [self.mpi,self.hypre,self.metis]
self.odeps = [self.slepc,self.ceed,self.cuda,self.openmp]
return
Expand Down Expand Up @@ -111,6 +113,8 @@ def Install(self):
g.write('MFEM_MPIEXEC = '+self.mpi.getMakeMacro('MPIEXEC')+'\n')
g.write('MFEM_USE_METIS_5 = YES\n')
g.write('MFEM_USE_METIS = YES\n')
if self.scalar.precision == 'single':
g.write('MFEM_PRECISION = single\n')
g.write('MFEM_USE_PETSC = YES\n')
g.write('HYPRE_OPT = '+self.headers.toString(self.hypre.include)+'\n')
g.write('HYPRE_LIB = '+self.libraries.toString(self.hypre.lib)+'\n')
Expand Down Expand Up @@ -218,6 +222,9 @@ def Install(self):
echo "Error installing MFEM. Check ${PETSC_ARCH}/lib/petsc/conf/mfem.log" && \\\n\
echo "********************************************************************" && \\\n\
exit 1)'])
exampleDirBuild = os.path.join(buildDir, 'examples', 'petsc')
self.addMakeRule('mfem-check', '', ['@echo "Running MFEM/PETSc check examples"',\
'-@cd '+exampleDirBuild+' ; ${OMAKE} ex1p-test-par'])

if self.argDB['prefix'] and not 'package-prefix-hash' in self.argDB:
self.addMakeRule('mfem-build','')
Expand Down
3 changes: 1 addition & 2 deletions config/BuildSystem/config/packages/MOAB.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
class Configure(config.package.GNUPackage):
def __init__(self, framework):
config.package.GNUPackage.__init__(self, framework)
self.download = ['https://web.cels.anl.gov/projects/petsc/download/externalpackages/moab-5.0.0.tar.gz']
self.download = ['https://web.cels.anl.gov/projects/sigma/downloads/moab/moab-5.5.0.tar.gz']
self.downloaddirnames = ['moab']
# Check for moab::Core and includes/libraries to verify build
self.functions = ['Core']
self.functionsCxx = [1, 'namespace moab {class Core {public: Core();};}','moab::Core *mb = new moab::Core()']
self.includes = ['moab/Core.hpp']
self.liblist = [['libiMesh.a', 'libMOAB.a'],['libMOAB.a']]
self.buildLanguages = ['Cxx']
self.maxCxxVersion = 'c++14'
self.precisions = ['single','double']
self.hastests = 1
self.useddirectly = 0
Expand Down
22 changes: 14 additions & 8 deletions config/BuildSystem/config/packages/MPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,17 +739,24 @@ def checkMPIDistro(self):
MPI_VER = ' '+MPICHPKG+'_VERSION: '+mpich_numversion
except:
self.logPrint('Unable to parse '+MPICHPKG+' version from header. Probably a buggy preprocessor')
for mpichpkg in ['i_mpi','mvapich2','mpich']:
MPICHPKG = mpichpkg.upper()
for MPICHPKG in ['MPICH', 'I_MPI', 'MVAPICH2']:
mpich_test = '#include <mpi.h>\nint mpich_ver = '+MPICHPKG+'_NUMVERSION;\n'
if self.checkCompile(mpich_test):
buf = self.outputPreprocess(mpich_test)
try:
mpich_numversion = re.compile('\nint mpich_ver ='+HASHLINESPACE+'([0-9]+)'+HASHLINESPACE+';').search(buf).group(1)
self.addDefine('HAVE_'+MPICHPKG+'_NUMVERSION',mpich_numversion)
MPI_VER += ' '+MPICHPKG+'_NUMVERSION: '+mpich_numversion
if mpichpkg == 'mpich': self.mpich_numversion = mpich_numversion
if mpichpkg == 'i_mpi': self.isIntelMPI = 1
self.addDefine('HAVE_'+MPICHPKG, 1)
# for I_MPI and MVAPICH2, we can not use petscpkg_version.h since they are not a petsc package yet.
# Anyway, we use PETSC_PKG_'MPICHPKG'_NUMVERSION to record the config time version for later compile time checking.
self.addDefine('PKG_'+MPICHPKG+'_NUMVERSION',mpich_numversion)
if MPICHPKG == 'MPICH':
self.mpich_numversion = mpich_numversion
MAJ = int(mpich_numversion)//10000000 # See comments in MPICH.py
MIN = int(mpich_numversion)//100000%100
REV = int(mpich_numversion)//1000%100
self.mpich.version_tuple = (MAJ, MIN, REV) # version_tuple makes mpich included in petscpkg_version.h
elif MPICHPKG == 'I_MPI': self.isIntelMPI = 1
except:
self.logPrint('Unable to parse '+MPICHPKG+' version from header. Probably a buggy preprocessor')
if MPI_VER:
Expand All @@ -774,11 +781,10 @@ def checkMPIDistro(self):
ompi_major_version = re.compile('\nint ompi_major ='+HASHLINESPACE+'([0-9]+)'+HASHLINESPACE+';').search(buf).group(1)
ompi_minor_version = re.compile('\nint ompi_minor ='+HASHLINESPACE+'([0-9]+)'+HASHLINESPACE+';').search(buf).group(1)
ompi_release_version = re.compile('\nint ompi_release ='+HASHLINESPACE+'([0-9]+)'+HASHLINESPACE+';').search(buf).group(1)
self.addDefine('HAVE_OMPI_MAJOR_VERSION',ompi_major_version)
self.addDefine('HAVE_OMPI_MINOR_VERSION',ompi_minor_version)
self.addDefine('HAVE_OMPI_RELEASE_VERSION',ompi_release_version)
self.ompi_major_version = ompi_major_version
self.ompi_version = tuple([int(i) for i in [ompi_major_version,ompi_minor_version,ompi_release_version]])
self.openmpi.version_tuple = self.ompi_version # version_tuple makes openmpi included by petscpkg_version.h, so one can uses macros defined there
self.addDefine('HAVE_OPENMPI', 1) # we have openmpi, though it is not necessarily installed by --download-openmpi
self.mpi_pkg_version = ' OMPI_VERSION: '+ompi_major_version+'.'+ompi_minor_version+'.'+ompi_release_version+'\n'
MPI_VER = ' OMPI_VERSION: '+ompi_major_version+'.'+ompi_minor_version+'.'+ompi_release_version
except:
Expand Down
Loading

0 comments on commit ba4e573

Please sign in to comment.