<div dir='auto'>The time to rebuild Fortran modules, which is pretty much an entire lifetime. I disable Fortran in most arches that I rebuild frequently.</div><div class="gmail_extra"><br><div class="gmail_quote">On Jan 3, 2020 16:58, "Smith, Barry F." <bsmith@mcs.anl.gov> wrote:<br type="attribution" /><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">
<br>
And it you don't skip Fortran modules?
<br>
<br>
<br>
<br>
> On Jan 3, 2020, at 4:36 PM, jed@jedbrown.org wrote:
<br>
>
<br>
> A few seconds if you skip Fortran modules.
<br>
>
<br>
> I didn't realize there were any active developers not using ccache. We should add a note to the manual.
<br>
>
<br>
> On Jan 3, 2020 15:04, "Smith, Barry F." <bsmith@mcs.anl.gov> wrote:
<br>
>
<br>
>
<br>
> > On Jan 3, 2020, at 3:07 PM, Matthew Knepley <knepley@gmail.com> wrote:
<br>
> >
<br>
> > On Fri, Jan 3, 2020 at 3:52 PM Smith, Barry F. <bsmith@mcs.anl.gov> wrote:
<br>
> >
<br>
> > A long time ago Oana suggested a tool that allowed switching between PETSc configurations after pulls etc that didn't require waiting to recompile code or rerun configure. Based on her ideas I finally got something that has been behaving reasonably satisfactory for me. Note that it is only useful if you work with PETSc in a way that you have multiple branches and PETSc arches you are dealing with. If you are essentially always in one branch it offers no advantages. (Unfortunately since Fortran stubs are stored in the source for branch changes that
<br>
> > change the stubs the will require recompiles). This is my first public release so may have glitches. It saves me tons of time.
<br>
> >
<br>
> > Barry, I had the same problem, but it went away when I started using ccache in front of the compiler for every arch. Does
<br>
> > this not work for you?
<br>
>
<br>
> I don't know, never tried it. Still it must "compile" the code (that is generate all the .o) and rebuild the libraries which takes some time?
<br>
>
<br>
> Barry
<br>
>
<br>
> >
<br>
> > Thanks,
<br>
> >
<br>
> > Matt
<br>
> >
<br>
> > Put this in your .bashrc file and run source ~/.bashrc Docs are at the bottom.
<br>
> >
<br>
> > #
<br>
> > # Utility function used by gitcheckout bash function
<br>
> > # uses the basename of the branch to build the PETSC_ARCH
<br>
> > #
<br>
> > function branchtoarch () {
<br>
> > basename `echo $1 | sed s?/maint?-maint?g` | sed -e s?/?-?g -e s?^?arch-?g
<br>
> > }
<br>
> >
<br>
> > #
<br>
> > # Used by the git alias provided below; not used directly
<br>
> > #
<br>
> > # Implements a git checkout, but preserves any previously compiled (.o) code so it won't unneccessariy get recompiled
<br>
> > #
<br>
> > # Sets PETSC_ARCH automatically based on the branch name
<br>
> > #
<br>
> > # How it works:
<br>
> > # 1) before changing from the current PETSC_ARCH branch combination it deletes all out-dated .o files for that PETSC_ARCH (using make --dry-run to find these)
<br>
> > # 2) after checking into the new PETSC_ARCH branch combination it updates the time-stamps of all remaing .o files for the new PETSC_ARCH so they are
<br>
> > # more recent than any timestamps on the source files that git may have changed (it can do this because it knows from 1) that any out-of-date
<br>
> > # .o files have already been deleted)
<br>
> > #
<br>
> > # Does not change the timestamps or touch in any way the source code, only .o files
<br>
> > #
<br>
> > function gitcheckout {
<br>
> > new_branch=$1
<br>
> > current_branch=`command git rev-parse --abbrev-ref HEAD`
<br>
> >
<br>
> > if [ -f ${new_branch} ]; then
<br>
> > command git checkout ${new_branch}
<br>
> > return 0
<br>
> > fi
<br>
> >
<br>
> > if [ "${new_branch}" == "-b" ]; then
<br>
> > command git rev-parse --verify $2 > /dev/null 2>&1
<br>
> > if [ "$?" == "0" ]; then
<br>
> > echo "Branch you are trying to create $2 already exists, aborting"
<br>
> > return 9
<br>
> > else
<br>
> > # create the new branch, do not yet check it out
<br>
> > new_branch=$2
<br>
> > command git branch ${new_branch}
<br>
> > fi
<br>
> > else
<br>
> > if [ "${current_branch}" == "${new_branch}" ]; then
<br>
> > echo "Already in branch ${new_branch}"
<br>
> > return 0
<br>
> > fi
<br>
> > changes=`command git status --untracked-files=no --porcelain`
<br>
> > if [ "${changes}" != "" ]; then
<br>
> > echo "You have modified or new files; not changing branches"
<br>
> > echo ${changes}
<br>
> > return 5
<br>
> > fi
<br>
> > fi
<br>
> >
<br>
> > current_arch=`branchtoarch ${current_branch}`
<br>
> > new_arch=`branchtoarch ${new_branch}`
<br>
> >
<br>
> > isbranch=0
<br>
> > command git rev-parse --verify ${new_branch} > /dev/null 2>&1
<br>
> > if [ "$?" == "0" ]; then
<br>
> > isbranch=1
<br>
> > else
<br>
> > command git rev-parse --verify origin/${new_branch} > /dev/null 2>&1
<br>
> > if [ "$?" == "0" ]; then
<br>
> > isbranch=1
<br>
> > fi
<br>
> > fi
<br>
> > if [ "${isbranch}" == "0" ]; then
<br>
> > echo "Branch ${new_branch} does not exist"
<br>
> > return 3
<br>
> > fi
<br>
> >
<br>
> > echo "Checking out branch ${new_branch} and PETSC_ARCH ${new_arch}"
<br>
> >
<br>
> > if [ "${PETSC_ARCH}" != "${current_arch}" ]; then
<br>
> > echo "Current PETSC_ARCH ${PETSC_ARCH} not equal to expected value ${current_arch} unable to removed out-dated object files"
<br>
> > else
<br>
> > # delete all out-dated .o files
<br>
> > if [[ -f ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/petscvariables && -d ${PETSC_DIR}/${PETSC_ARCH}/obj ]]; then
<br>
> > pushd ${PETSC_DIR}
<br>
> > make --dry-run -f gmakefile | sed -n 's?[[:print:][:cntrl:]]*-o[[:blank:]]\([-[:alpha:]/]*\.o\)[[:print:][:cntrl:]]*?\1?gp' | xargs rm -f
<br>
> > popd
<br>
> > fi
<br>
> > fi
<br>
> >
<br>
> > command git checkout ${new_branch}
<br>
> > if [ "$?" != "0" ]; then
<br>
> > echo "Unable to checkout branch ${new_branch}"
<br>
> > return 4
<br>
> > fi
<br>
> >
<br>
> > export PETSC_ARCH=${new_arch}
<br>
> > # update the timestamps of all .o that remain for this PETSC_ARCH and the library
<br>
> > if [[ -f ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/petscvariables && -d ${PETSC_DIR}/${PETSC_ARCH}/obj ]]; then
<br>
> > find ${PETSC_DIR}/${PETSC_ARCH}/obj -type f -name *.o -exec touch -m {} +
<br>
> > touch -m ${PETSC_DIR}/${PETSC_ARCH}/lib/libpetsc*
<br>
> > # /usr/bin/dsymutil libpetsc.3.011.3.dylib
<br>
> > fi
<br>
> > }
<br>
> >
<br>
> > #
<br>
> > # An alias for git checkout that manages resetting the PETSC_ARCH to the branch name and preserving compiled code associated with the branch checked out
<br>
> > #
<br>
> > # Oana suggested the idea to save waiting for code to recompile after changing branches and the use of touch to force code to not get recompiled unnecessarily
<br>
> > #
<br>
> > # Usage:
<br>
> > # git checkout branchname
<br>
> > #
<br>
> > # Examples:
<br>
> > # $ git checkout next
<br>
> > # Checking out branch next and PETSC_ARCH arch-none
<br>
> > # Switched to branch 'next'
<br>
> > # ~/Src/petsc (next<) arch-next
<br>
> > #
<br>
> > # $ git checkout master
<br>
> > # Checking out branch master and PETSC_ARCH arch-master
<br>
> > # Switched to branch 'master'
<br>
> > # ~/Src/petsc (master=) arch-master
<br>
> > #
<br>
> > # $ git checkout -b barry/mynewbranch
<br>
> > # Switched to branch 'barry/mynewbranch'
<br>
> > # ~/Src/petsc (barry/mynewbranch=) arch-mynewbranch
<br>
> > #
<br>
> > # Uses the bash function gitcheckout
<br>
> > #
<br>
> > function git {
<br>
> > groot=`command git rev-parse --absolute-git-dir 2> /dev/null`
<br>
> > if [[ "$1" == "checkout" && "$@" != *"--help"* && "${PETSC_DIR}" != "" && "${PETSC_DIR}/.git" == "${groot}" ]]; then
<br>
> > shift 1
<br>
> > if [ "$1" == "git" ]; then
<br>
> > shift 2
<br>
> > fi
<br>
> > gitcheckout "$@"
<br>
> > else
<br>
> > command git "$@"
<br>
> > fi
<br>
> > }
<br>
> >
<br>
> >
<br>
> >
<br>
> >
<br>
> > --
<br>
> > What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
<br>
> > -- Norbert Wiener
<br>
> >
<br>
> > https://www.cse.buffalo.edu/~knepley/
<br>
>
<br>
>
<br>
>
<br>
<br>
</p>
</blockquote></div><br></div>