1# 2# This is the makefile for compiling PETSc. See 3# http://www.mcs.anl.gov/petsc/documentation/installation.html for directions on installing PETSc. 4# See also conf for additional commands. 5# 6ALL: all 7DIRS = src include tutorials interfaces share/petsc/matlab 8 9# next line defines PETSC_DIR and PETSC_ARCH if they are not set 10include ././${PETSC_ARCH}/lib/petsc/conf/petscvariables 11include ${PETSC_DIR}/lib/petsc/conf/variables 12include ${PETSC_DIR}/lib/petsc/conf/rules 13include ${PETSC_DIR}/lib/petsc/conf/test.common 14 15# This makefile contains a lot of PHONY targets with improperly specified prerequisites 16# where correct execution instead depends on the targets being processed in the correct 17# order. This is gross, but this makefile doesn't really do any work. Sub-makes still 18# benefit from parallelism. 19.NOTPARALLEL: 20 21OMAKE_SELF = $(OMAKE) -f makefile 22OMAKE_SELF_PRINTDIR = $(OMAKE_PRINTDIR) -f makefile 23 24# 25# Basic targets to build PETSc libraries. 26# 27all: 28 +@${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} chk_petscdir chk_upgrade | tee ${PETSC_ARCH}/lib/petsc/conf/make.log 29 @ln -sf ${PETSC_ARCH}/lib/petsc/conf/make.log make.log 30 +@(${OMAKE_SELF_PRINTDIR} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} all-local; echo "$$?" > ${PETSC_ARCH}/lib/petsc/conf/error.log) 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log 31 +@if [ "`cat ${PETSC_ARCH}/lib/petsc/conf/error.log 2> /dev/null`" != "0" ]; then \ 32 grep -E '(out of memory allocating.*after a total of|gfortran: fatal error: Killed signal terminated program f951|f95: fatal error: Killed signal terminated program f951)' ${PETSC_ARCH}/lib/petsc/conf/make.log | tee ${PETSC_ARCH}/lib/petsc/conf/memoryerror.log > /dev/null; \ 33 if test -s ${PETSC_ARCH}/lib/petsc/conf/memoryerror.log; then \ 34 printf ${PETSC_TEXT_HILIGHT}"**************************ERROR*************************************\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log; \ 35 echo " Error during compile, you need to increase the memory allocated to the VM and rerun " 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log; \ 36 printf "********************************************************************"${PETSC_TEXT_NORMAL}"\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log;\ 37 else \ 38 printf ${PETSC_TEXT_HILIGHT}"**************************ERROR*************************************\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log; \ 39 echo " Error during compile, check ${PETSC_ARCH}/lib/petsc/conf/make.log" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log; \ 40 echo " Send it and ${PETSC_ARCH}/lib/petsc/conf/configure.log to petsc-maint@mcs.anl.gov" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log;\ 41 printf "********************************************************************"${PETSC_TEXT_NORMAL}"\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log;\ 42 fi \ 43 else \ 44 ${OMAKE_SELF} print_mesg_after_build PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log ;\ 45 fi #solaris make likes to print the whole command that gave error. So split this up into the smallest chunk below 46 @echo "Finishing make run at `date +'%a, %d %b %Y %H:%M:%S %z'`" >> ${PETSC_ARCH}/lib/petsc/conf/make.log 47 @if [ "`cat ${PETSC_ARCH}/lib/petsc/conf/error.log 2> /dev/null`" != "0" ]; then exit 1; fi 48 49all-local: info libs matlabbin petsc4py-build libmesh-build mfem-build slepc-build hpddm-build amrex-build bamg-build 50 51# 52# Prints information about the system and version of PETSc being compiled 53# 54info: 55 -@echo "==========================================" 56 -@echo " " 57 -@echo "See documentation/faq.html and documentation/bugreporting.html" 58 -@echo "for help with installation problems. Please send EVERYTHING" 59 -@echo "printed out below when reporting problems. Please check the" 60 -@echo "mailing list archives and consider subscribing." 61 -@echo " " 62 -@echo " https://petsc.org/release/community/mailing/" 63 -@echo " " 64 -@echo "==========================================" 65 -@echo Starting make run on `hostname` at `date +'%a, %d %b %Y %H:%M:%S %z'` 66 -@echo Machine characteristics: `uname -a` 67 -@echo "-----------------------------------------" 68 -@echo "Using PETSc directory: ${PETSC_DIR}" 69 -@echo "Using PETSc arch: ${PETSC_ARCH}" 70 -@echo "-----------------------------------------" 71 -@grep "define PETSC_VERSION" ${PETSC_DIR}/include/petscversion.h | ${SED} "s/........//" | head -n 7 72 -@echo "-----------------------------------------" 73 -@echo "Using configure Options: ${CONFIGURE_OPTIONS}" 74 -@echo "Using configuration flags:" 75 -@grep "\#define " ${PETSCCONF_H} | tail -n +2 76 -@echo "-----------------------------------------" 77 -@echo "Using C compile: ${PETSC_CCOMPILE_SINGLE}" 78 -@if [ "${MPICC_SHOW}" != "" ]; then \ 79 printf "mpicc -show: %b\n" "${MPICC_SHOW}";\ 80 fi; \ 81 printf "C compiler version: %b\n" "${C_VERSION}"; \ 82 if [ "${CXX}" != "" ]; then \ 83 echo "Using C++ compile: ${PETSC_CXXCOMPILE_SINGLE}";\ 84 if [ "${MPICXX_SHOW}" != "" ]; then \ 85 printf "mpicxx -show: %b\n" "${MPICXX_SHOW}"; \ 86 fi;\ 87 printf "C++ compiler version: %b\n" "${Cxx_VERSION}"; \ 88 fi 89 -@if [ "${FC}" != "" ]; then \ 90 echo "Using Fortran compile: ${PETSC_FCOMPILE_SINGLE}";\ 91 if [ "${MPIFC_SHOW}" != "" ]; then \ 92 printf "mpif90 -show: %b\n" "${MPIFC_SHOW}"; \ 93 fi; \ 94 printf "Fortran compiler version: %b\n" "${FC_VERSION}"; \ 95 fi 96 -@if [ "${CUDAC}" != "" ]; then \ 97 echo "Using CUDA compile: ${PETSC_CUCOMPILE_SINGLE}";\ 98 fi 99 -@if [ "${CLANGUAGE}" = "CXX" ]; then \ 100 echo "Using C++ compiler to compile PETSc";\ 101 fi 102 -@echo "-----------------------------------------" 103 -@echo "Using C/C++ linker: ${PCC_LINKER}" 104 -@echo "Using C/C++ flags: ${PCC_LINKER_FLAGS}" 105 -@if [ "${FC}" != "" ]; then \ 106 echo "Using Fortran linker: ${FC_LINKER}";\ 107 echo "Using Fortran flags: ${FC_LINKER_FLAGS}";\ 108 fi 109 -@echo "-----------------------------------------" 110 -@echo "Using system modules: ${LOADEDMODULES}" 111 -@if [ "${MPI_IS_MPIUNI}" = "1" ]; then \ 112 echo Using mpi.h: mpiuni; \ 113 else \ 114 TESTDIR=`mktemp -q -d -t petscmpi-XXXXXXXX` && \ 115 echo '#include <mpi.h>' > $${TESTDIR}/mpitest.c && \ 116 BUF=`${CPP} ${PETSC_CPPFLAGS} ${PETSC_CC_INCLUDES} $${TESTDIR}/mpitest.c |grep 'mpi\.h' | ( head -1 ; cat > /dev/null )` && \ 117 echo Using mpi.h: $${BUF}; ${RM} -rf $${TESTDIR}; \ 118 fi 119 -@echo "-----------------------------------------" 120 -@echo "Using libraries: ${PETSC_LIB}" 121 -@echo "------------------------------------------" 122 -@echo "Using mpiexec: ${MPIEXEC}" 123 -@echo "------------------------------------------" 124 -@echo "Using MAKE: ${MAKE}" 125 -@echo "Default MAKEFLAGS: MAKE_NP:${MAKE_NP} MAKE_LOAD:${MAKE_LOAD} MAKEFLAGS:${MAKEFLAGS}" 126 -@echo "==========================================" 127 128# 129# Build MatLab binaries 130# 131matlabbin: 132 -@if [ "${MATLAB_MEX}" != "" -a "${MATLAB_SOCKET}" != "" -a "${PETSC_SCALAR}" = "real" -a "${PETSC_PRECISION}" = "double" ]; then \ 133 echo "BEGINNING TO COMPILE MATLAB INTERFACE"; \ 134 if [ ! -d "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc" ] ; then ${MKDIR} ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc; fi; \ 135 if [ ! -d "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/matlab" ] ; then ${MKDIR} ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/matlab; fi; \ 136 cd src/sys/classes/viewer/impls/socket/mex-scripts && ${OMAKE_SELF} mex-scripts PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR}; \ 137 echo "========================================="; \ 138 fi 139# 140# Builds PETSc check examples for a given architecture 141# 142RUN_TEST = ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} DIFF=${PETSC_DIR}/lib/petsc/bin/petscdiff 143 144check_install: check 145check: 146 -@echo "Running check examples to verify correct installation" 147 -@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}" 148 @if [ "${PETSC_WITH_BATCH}" != "" ]; then \ 149 echo "Running with batch filesystem, cannot run make check"; \ 150 elif [ "${MPIEXEC}" = "/bin/false" ]; then \ 151 echo "*mpiexec not found*. cannot run make check"; \ 152 else \ 153 ${RM} -f check_error;\ 154 ${RUN_TEST} PETSC_OPTIONS="${PETSC_OPTIONS} ${PETSC_TEST_OPTIONS}" PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" check_build 2>&1 | tee ./${PETSC_ARCH}/lib/petsc/conf/check.log; \ 155 if [ -f check_error ]; then \ 156 echo "Error while running make check"; \ 157 ${RM} -f check_error;\ 158 exit 1; \ 159 fi; \ 160 ${RM} -f check_error;\ 161 fi; 162 163check_build: 164 +@cd src/snes/tutorials >/dev/null; ${RUN_TEST} clean-legacy 165 +@cd src/snes/tutorials >/dev/null; ${RUN_TEST} testex19 166 +@if [ ! "${MPI_IS_MPIUNI}" ]; then cd src/snes/tutorials >/dev/null; ${RUN_TEST} testex19_mpi; fi 167 +@if [ "${HYPRE_LIB}" != "" ] && [ "${PETSC_SCALAR}" = "real" ]; then \ 168 if [ "${CUDA_LIB}" != "" ]; then HYPRE_TEST=runex19_hypre_cuda; \ 169 elif [ "${HIP_LIB}" != "" ]; then HYPRE_TEST=runex19_hypre_hip; \ 170 else HYPRE_TEST=runex19_hypre; fi; \ 171 cd src/snes/tutorials >/dev/null; ${RUN_TEST} $${HYPRE_TEST}; \ 172 fi; 173 +@if [ "${CUDA_LIB}" != "" ]; then \ 174 cd src/snes/tutorials >/dev/null; ${RUN_TEST} runex19_cuda; \ 175 fi; 176 +@if [ "${MPI_IS_MPIUNI}" = "" ]; then \ 177 cd src/snes/tutorials >/dev/null; \ 178 if [ "${KOKKOS_KERNELS_LIB}" != "" ] && [ "${PETSC_SCALAR}" = "real" ] && [ "${PETSC_PRECISION}" = "double" ]; then \ 179 ${RUN_TEST} runex3k_kokkos; \ 180 fi;\ 181 if [ "${MUMPS_LIB}" != "" ]; then \ 182 ${RUN_TEST} runex19_fieldsplit_mumps; \ 183 fi;\ 184 if [ "${SUITESPARSE_LIB}" != "" ]; then \ 185 ${RUN_TEST} runex19_suitesparse; \ 186 fi;\ 187 if [ "${SUPERLU_DIST_LIB}" != "" ]; then \ 188 ${RUN_TEST} runex19_superlu_dist; \ 189 fi;\ 190 if ( [ "${ML_LIB}" != "" ] || [ "${TRILINOS_LIB}" != "" ] ); then \ 191 ${RUN_TEST} runex19_ml; \ 192 fi; \ 193 ${RUN_TEST} clean-legacy; \ 194 cd - > /dev/null; \ 195 if ( [ "${AMREX_LIB}" != "" ] && [ "${CUDA_LIB}" = "" ] ); then \ 196 echo "Running amrex test example to verify correct installation";\ 197 echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}";\ 198 cd src/ksp/ksp/tutorials/amrex >/dev/null;\ 199 ${RUN_TEST} clean-legacy; \ 200 ${RUN_TEST} testamrex; \ 201 ${RUN_TEST} clean-legacy; \ 202 cd - > /dev/null; \ 203 fi;\ 204 fi; 205 +@if [ "${HDF5_LIB}" != "" ]; then \ 206 cd src/vec/vec/tests >/dev/null;\ 207 ${RUN_TEST} clean-legacy; \ 208 ${RUN_TEST} runex47; \ 209 ${RUN_TEST} clean-legacy; \ 210 fi; 211 +@if [ "${MPI4PY}" = "yes" ]; then \ 212 cd src/sys/tests >/dev/null; \ 213 ${RUN_TEST} clean-legacy; \ 214 ${RUN_TEST} testex55; \ 215 ${RUN_TEST} clean-legacy; \ 216 fi; 217 +@if [ "${PETSC4PY}" = "yes" ]; then \ 218 cd src/ksp/ksp/tutorials >/dev/null; \ 219 ${RUN_TEST} clean-legacy; \ 220 ${RUN_TEST} testex100; \ 221 ${RUN_TEST} clean-legacy; \ 222 fi; 223 +@grep -E "^#define PETSC_HAVE_FORTRAN 1" ${PETSCCONF_H} | tee .ftn.log > /dev/null; \ 224 if test -s .ftn.log; then \ 225 cd src/snes/tutorials >/dev/null; \ 226 ${RUN_TEST} clean-legacy; \ 227 ${RUN_TEST} testex5f; \ 228 ${RUN_TEST} clean-legacy; \ 229 fi; ${RM} .ftn.log; 230 +@grep -E "^#define PETSC_HAVE_MATLAB 1" ${PETSCCONF_H} | tee .ftn.log > /dev/null; \ 231 if test -s .ftn.log; then \ 232 cd src/vec/vec/tutorials >/dev/null; \ 233 ${RUN_TEST} clean-legacy; \ 234 ${RUN_TEST} testex31; \ 235 ${RUN_TEST} clean-legacy; \ 236 fi; ${RM} .ftn.log; 237 -@echo "Completed test examples" 238 239check_usermakefile: 240 -@echo "Testing compile with user makefile" 241 -@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}" 242 @cd src/snes/tutorials; ${RUN_TEST} clean-legacy 243 @cd src/snes/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} -f ${PETSC_DIR}/share/petsc/Makefile.user ex19 244 @grep -E "^#define PETSC_HAVE_FORTRAN 1" ${PETSCCONF_H} | tee .ftn.log > /dev/null; \ 245 if test -s .ftn.log; then \ 246 cd src/snes/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} -f ${PETSC_DIR}/share/petsc/Makefile.user ex5f; \ 247 fi; ${RM} .ftn.log; 248 @cd src/snes/tutorials; ${RUN_TEST} clean-legacy 249 -@echo "Completed compile with user makefile" 250 251checkgitclean: 252 @if ! git diff --quiet; then \ 253 echo "The repository has uncommitted files, cannot run checkclangformat" ;\ 254 git status -s --untracked-files=no ;\ 255 false;\ 256 fi; 257 258checkclangformatversion: 259 @version=`clang-format --version | cut -d" " -f3 | cut -d"." -f 1` ;\ 260 if [ "$$version" == "version" ]; then version=`clang-format --version | cut -d" " -f4 | cut -d"." -f 1`; fi;\ 261 if [ $$version != 16 ]; then echo "Require clang-format version 16! Currently used clang-format version is $$version" ;false ; fi 262 263# Check that all the source code in the repository satisfies the .clang_format 264checkclangformat: checkclangformatversion checkgitclean clangformat 265 @if ! git diff --quiet; then \ 266 printf "The current commit has source code formatting problems\n" ;\ 267 if [ -z "${CI_PIPELINE_ID}" ]; then \ 268 printf "Please run 'git diff' to check\n"; \ 269 git diff --stat; \ 270 else \ 271 git diff --patch-with-stat > ${PETSC_ARCH}/lib/petsc/conf/checkclangformat.patch; \ 272 git diff --patch-with-stat --color=always | head -1000; \ 273 if [ `wc -l < ${PETSC_ARCH}/lib/petsc/conf/checkclangformat.patch` -gt 1000 ]; then \ 274 printf "The diff has been trimmed, check ${PETSC_ARCH}/lib/petsc/conf/checkclangformat.patch (in CI artifacts) for all changes\n"; \ 275 fi;\ 276 fi;\ 277 false;\ 278 fi; 279 280# Compare ABI/API of two versions of PETSc library with the old one defined by PETSC_{DIR,ARCH}_ABI_OLD 281abitest: 282 @if [ "${PETSC_DIR_ABI_OLD}" = "" ] || [ "${PETSC_ARCH_ABI_OLD}" = "" ]; \ 283 then printf "You must set environment variables PETSC_DIR_ABI_OLD and PETSC_ARCH_ABI_OLD to run abitest\n"; \ 284 exit 1; \ 285 fi; 286 -@echo "Comparing ABI/API of the following two PETSc versions (you must have already configured and built them using GCC and with -g):" 287 -@echo "=========================================================================================" 288 -@echo " Old: PETSC_DIR_ABI_OLD = ${PETSC_DIR_ABI_OLD}" 289 -@echo " PETSC_ARCH_ABI_OLD = ${PETSC_ARCH_ABI_OLD}" 290 -@pushd ${PETSC_DIR_ABI_OLD} >> /dev/null ; echo " Branch = "`git rev-parse --abbrev-ref HEAD` 291 -@echo " New: PETSC_DIR = ${PETSC_DIR}" 292 -@echo " PETSC_ARCH = ${PETSC_ARCH}" 293 -@echo " Branch = "`git rev-parse --abbrev-ref HEAD` 294 -@echo "=========================================================================================" 295 -@$(PYTHON) ${PETSC_DIR}/lib/petsc/bin/maint/abicheck.py -old_dir ${PETSC_DIR_ABI_OLD} -old_arch ${PETSC_ARCH_ABI_OLD} -new_dir ${PETSC_DIR} -new_arch ${PETSC_ARCH} -report_format html 296 297# Compare ABI/API of current PETSC_ARCH/PETSC_DIR with a previous branch 298abitestcomplete: 299 -@if [[ -f "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/configure.log" ]]; then \ 300 OPTIONS=`grep -h -m 1 "Configure Options: " ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/configure.log | sed "s!Configure Options: --configModules=PETSc.Configure --optionsModule=config.compilerOptions!!g"` ;\ 301echo $${OPTIONS} ;\ 302 fi ; \ 303 if [[ "${PETSC_DIR_ABI_OLD}" != "" ]]; then \ 304 PETSC_DIR_OLD=${PETSC_DIR_ABI_OLD}; \ 305 else \ 306 PETSC_DIR_OLD=${PETSC_DIR}/../petsc-abi; \ 307 fi ; \ 308 echo "=================================================================================================" ;\ 309 echo "Doing ABI/API comparison between" ${branch} " and " `git rev-parse --abbrev-ref HEAD` "using " $${OPTIONS} ;\ 310 echo "=================================================================================================" ;\ 311 if [[ ! -d $${PETSC_DIR_OLD} ]]; then \ 312 git clone ${PETSC_DIR} $${PETSC_DIR_OLD} ; \ 313 else \ 314 cd $${PETSC_DIR_OLD} ; \ 315 git pull ; \ 316 fi ; \ 317 cd $${PETSC_DIR_OLD} ; \ 318 git checkout ${branch} ; \ 319 PETSC_DIR=`pwd` PETSC_ARCH=arch-branch-`git rev-parse ${branch}` ./configure $${OPTIONS} ; \ 320 PETSC_DIR=`pwd` PETSC_ARCH=arch-branch-`git rev-parse ${branch}` make all test ; \ 321 cd ${PETSC_DIR} ; \ 322 ./configure $${OPTIONS}; \ 323 make all test ; \ 324 PETSC_DIR_ABI_OLD=$${PETSC_DIR_OLD} PETSC_ARCH_ABI_OLD=arch-branch-`git rev-parse ${branch}` make abitest 325 326# Deletes PETSc libraries 327deletelibs: 328 -${RM} -rf ${PETSC_LIB_DIR}/libpetsc*.* 329deletemods: 330 -${RM} -f ${PETSC_DIR}/${PETSC_ARCH}/include/petsc*.mod 331 332allclean: 333 -@${OMAKE} -f gmakefile clean 334 335clean:: allclean 336 337distclean: chk_petscdir 338 @if [ -f ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py ]; then \ 339 echo "*** Preserving ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py in ${PETSC_DIR} ***"; \ 340 mv -f ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py ${PETSC_DIR}/; fi 341 @echo "*** Deleting all build files in ${PETSC_DIR}/${PETSC_ARCH} ***" 342 -${RM} -rf ${PETSC_DIR}/${PETSC_ARCH}/ 343 344 345# 346reconfigure: allclean 347 @unset MAKEFLAGS && ${PYTHON} ${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py 348 349install: 350 @${PYTHON} ./config/install.py -destDir=${DESTDIR} 351 +${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} PETSC_INSTALL=$@ install-builtafterpetsc 352 353# A smaller install with fewer extras 354install-lib: 355 @${PYTHON} ./config/install.py -destDir=${DESTDIR} -no-examples 356 +${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} PETSC_INSTALL=$@ install-builtafterpetsc 357 358install-builtafterpetsc: 359 +${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} PETSC_INSTALL=${PETSC_INSTALL} petsc4py-install libmesh-install mfem-install slepc-install hpddm-install amrex-install bamg-install 360 361mpistreams: 362 +@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} mpistreams 363 364mpistream: 365 +@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} mpistream 366 367openmpstreams: 368 +@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} openmpstreams 369 370openmpstream: 371 +@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} openmpstream 372 373# for legacy reasons 374stream: mpistream 375 376streams: mpistreams 377 378# ------------------------------------------------------------------ 379# 380# All remaining actions are intended for PETSc developers only. 381# PETSc users should not generally need to use these commands. 382# 383# See the users manual for how the tags files may be used from Emacs and Vi/Vim 384# 385alletags: 386 -@${PYTHON} lib/petsc/bin/maint/generateetags.py 387 -@find config -type f -name "*.py" |grep -v SCCS | xargs etags -o TAGS_PYTHON 388 389# obtain gtags from https://www.gnu.org/software/global/ 390allgtags: 391 -@find ${PETSC_DIR}/include ${PETSC_DIR}/src -regex '\(.*makefile\|.*\.\(cc\|hh\|cpp\|cxx\|C\|hpp\|c\|h\|cu\|m\)$$\)' | grep -v ftn-auto | gtags -f - 392 393allfortranstubs: 394 -@${RM} -rf ${PETSC_ARCH}/include/petsc/finclude/ftn-auto/*-tmpdir 395 @${PYTHON} lib/petsc/bin/maint/generatefortranstubs.py ${BFORT} ${VERBOSE} 396 -@${PYTHON} lib/petsc/bin/maint/generatefortranstubs.py -merge ${VERBOSE} 397 -@${RM} -rf ${PETSC_ARCH}/include/petsc/finclude/ftn-auto/*-tmpdir 398deletefortranstubs: 399 -@find . -type d -name ftn-auto | xargs rm -rf 400 401# Build just manual pages + prerequisites 402# Also builds citations 403hloc=include/petsc/private 404allmanpages: chk_loc deletemanualpages 405 -echo " /* SUBMANSEC = PetscH */ " > ${hloc}/generated_khash.h 406 -sed -e 's?<T>?I?g' -e 's?<t>?i?g' -e 's?<KeyType>?PetscInt?g' ${hloc}/hashset.txt >> ${hloc}/generated_khash.h 407 -sed -e 's?<T>?IJ?g' -e 's?<t>?ij?g' -e 's?<KeyType>?struct {PetscInt i, j;}?g' ${hloc}/hashset.txt >> ${hloc}/generated_khash.h 408 -sed -e 's?<T>?I?g' -e 's?<t>?i?g' -e 's?<KeyType>?PetscInt?g' -e 's?<ValType>?PetscInt?g' ${hloc}/hashmap.txt >> ${hloc}/generated_khash.h 409 -sed -e 's?<T>?IJ?g' -e 's?<t>?ij?g' -e 's?<KeyType>?struct {PetscInt i, j;}?g' -e 's?<ValType>?PetscInt?g' ${hloc}/hashmap.txt >> ${hloc}/generated_khash.h 410 -sed -e 's?<T>?IJ?g' -e 's?<t>?ij?g' -e 's?<KeyType>?struct {PetscInt i, j;}?g' -e 's?<ValType>?PetscScalar?g' ${hloc}/hashmap.txt >> ${hloc}/generated_khash.h 411 -sed -e 's?<T>?IV?g' -e 's?<t>?iv?g' -e 's?<KeyType>?PetscInt?g' -e 's?<ValType>?PetscScalar?g' ${hloc}/hashmap.txt >> ${hloc}/generated_khash.h 412 -sed -e 's?<T>?Obj?g' -e 's?<t>?obj?g' -e 's?<KeyType>?PetscInt64?g' -e 's?<ValType>?PetscObject?g' ${hloc}/hashmap.txt >> ${hloc}/generated_khash.h 413 -${RM} ${PETSC_DIR}/${PETSC_ARCH}/manualpages.err 414 -${OMAKE_SELF} ACTION=manualpages tree_src LOC=${LOC} 415 -@sed -e s%man+../%man+manualpages/% ${LOC}/manualpages/manualpages.cit > ${LOC}/manualpages/htmlmap 416 -@cat ${PETSC_DIR}/doc/classic/mpi.www.index >> ${LOC}/manualpages/htmlmap 417 cat ${PETSC_DIR}/${PETSC_ARCH}/manualpages.err 418 a=`cat ${PETSC_DIR}/${PETSC_ARCH}/manualpages.err | wc -l`; test ! $$a -gt 0 419 420# Build just manual examples + prerequisites 421allmanexamples: chk_loc allmanpages 422 -${OMAKE_SELF} ACTION=manexamples tree_basic LOC=${LOC} 423 424# Build all classic docs except html sources 425alldoc1: chk_loc allmanpages allmanexamples 426 -${OMAKE_SELF} manimplementations LOC=${LOC} 427 -${PYTHON} lib/petsc/bin/maint/wwwindex.py ${PETSC_DIR} ${LOC} 428 429# Builds .html versions of the source 430# html overwrites some stuff - hence this is done later. 431alldoc2: chk_loc allmanpages 432 -${OMAKE_SELF} ACTION=html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC} 433 434# A version which presumes allmanpages has already been run 435alldoc_post: chk_loc 436 -${OMAKE_SELF} ACTION=html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC} 437 438alldocclean: deletemanualpages allcleanhtml 439 440# Deletes man pages (.md version) 441deletemanualpages: chk_loc 442 -@if [ -d ${LOC} -a -d ${LOC}/manualpages ]; then \ 443 find ${LOC}/manualpages -type f -name "*.md" -exec ${RM} {} \; ;\ 444 ${RM} ${LOC}/manualpages/manualpages.cit ;\ 445 fi 446 447allcleanhtml: 448 -${OMAKE_SELF} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} alltree 449 450########################################################### 451# targets to build distribution and update docs 452########################################################### 453 454# Creates ${HOME}/petsc.tar.gz [and petsc-with-docs.tar.gz] 455dist: 456 ${PETSC_DIR}/lib/petsc/bin/maint/builddist ${PETSC_DIR} main 457 458########################################################### 459# 460# See script for details 461# 462gcov: 463 output_file_base_name=${PETSC_ARCH}-gcovr-report.json; \ 464 petsc_arch_dir=${PETSC_DIR}/${PETSC_ARCH}; \ 465 tar_file=$${petsc_arch_dir}/$${output_file_base_name}.tar.bz2; \ 466 cd $${petsc_arch_dir}/obj && \ 467 gcovr --json --output $${petsc_arch_dir}/$${output_file_base_name} --exclude '.*/ftn-auto/.*' --exclude-lines-by-pattern '^\s*SETERR.*' --exclude-throw-branches --exclude-unreachable-branches -j 4 --gcov-executable "${PETSC_COVERAGE_EXEC}" --root ${PETSC_DIR} . ${PETSC_GCOV_OPTIONS} && \ 468 ${RM} -f $${tar_file} && \ 469 tar --bzip2 -cf $${tar_file} -C $${petsc_arch_dir} ./$${output_file_base_name} && \ 470 ${RM} $${petsc_arch_dir}/$${output_file_base_name} 471 472mergegcov: 473 $(PYTHON) ${PETSC_DIR}/lib/petsc/bin/maint/gcov.py --merge-branch `lib/petsc/bin/maint/check-merge-branch.sh` --html --xml ${PETSC_GCOV_OPTIONS} 474 475# 476# ------------------------------------------------------------------------------- 477# 478# Some macros to check if the fortran interface is up-to-date. 479# 480countfortranfunctions: 481 -@cd ${PETSC_DIR}/src/fortran; grep -E '^void' custom/*.c auto/*.c | \ 482 cut -d'(' -f1 | tr -s ' ' | cut -d' ' -f2 | uniq | grep -E -v "(^$$|Petsc)" | \ 483 sed "s/_$$//" | sort > /tmp/countfortranfunctions 484 485countcfunctions: 486 -@grep PETSC_EXTERN ${PETSC_DIR}/include/*.h | grep "(" | tr -s ' ' | \ 487 cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' | \ 488 tr 'A-Z' 'a-z' | sort | uniq > /tmp/countcfunctions 489 490difffortranfunctions: countfortranfunctions countcfunctions 491 -@echo -------------- Functions missing in the fortran interface --------------------- 492 -@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2 493 -@echo ----------------- Functions missing in the C interface ------------------------ 494 -@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2 495 -@${RM} /tmp/countcfunctions /tmp/countfortranfunctions 496 497checkbadfortranstubs: 498 -@echo "=========================================" 499 -@echo "Functions with MPI_Comm as an Argument" 500 -@echo "=========================================" 501 -@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \ 502 tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3 503 -@echo "=========================================" 504 -@echo "Functions with a String as an Argument" 505 -@echo "=========================================" 506 -@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \ 507 tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3 508 -@echo "=========================================" 509 -@echo "Functions with Pointers to PETSc Objects as Argument" 510 -@echo "=========================================" 511 -@cd ${PETSC_DIR}/src/fortran/auto; \ 512 _p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s ' ' | \ 513 cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \ 514 sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \ 515 for OBJ in $$_p_OBJ; do \ 516 grep "$$OBJ \*" *.c | tr -s ' ' | tr -s ':' ' ' | \ 517 cut -d'(' -f1 | cut -d' ' -f1,3; \ 518 done 519 520checkpackagetests: 521 -@echo "Missing package tests" 522 -@cat config/examples/*.py > configexamples; pushd config/BuildSystem/config/packages/; packages=`ls *.py | sed "s/\\.py//g"`;popd; for i in $${packages}; do j=`echo $${i} | tr '[:upper:]' '[:lower:]'`; printf $${j} ; grep -E "(with-$${j}|download-$${j})" configexamples | grep -v "=0" | wc -l ; done 523 -@echo "Missing download package tests" 524 -@cat config/examples/*.py > configexamples; pushd config/BuildSystem/config/packages/; packages=`grep -l "download " *.py | sed "s/\\.py//g"`;popd; for i in $${packages}; do j=`echo $${i} | tr '[:upper:]' '[:lower:]'`; printf $${j} ; grep -E "(download-$${j})" configexamples | grep -v "=0" | wc -l ; done 525 526.PHONY: info info_h all deletelibs allclean update \ 527 alletags etags etags_complete etags_noexamples etags_makefiles etags_examples etags_fexamples alldoc allmanpages \ 528 allcleanhtml countfortranfunctions \ 529 start_configure configure_petsc configure_clean matlabbin install 530