Copied from Edison NERSC.