Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gamess memory changes #421

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gamess memory changes
  • Loading branch information
loriab committed Aug 8, 2023
commit 5267495fc59cc009746e6883695204bb34217c51
75 changes: 39 additions & 36 deletions qcengine/programs/gamess/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@
dexe["outfiles"]["stderr"] = dexe["stderr"]
dexe["outfiles"]["input"] = job_inputs["infiles"]["gamess.inp"]
return self.parse_output(dexe["outfiles"], input_model)
else:
raise ValueError("QCEngine execution of GAMESS failed:\n\n" + str(dexe))

def build_input(
self, input_model: AtomicInput, config: "TaskConfig", template: Optional[str] = None
Expand Down Expand Up @@ -121,42 +123,43 @@
# * int() rounds down
mwords_total = int(config.memory * (1024**3) / 8e6)

for mem_frac_replicated in (1, 0.5, 0.1, 0.75):
mwords, memddi = self._partition(mwords_total, mem_frac_replicated, config.ncores)
# DEBUG print(f"loop {mwords_total=} {mem_frac_replicated=} {config.ncores=} -> repl: {mwords=} dist: {memddi=} -> percore={memddi/config.ncores + mwords} tot={memddi + config.ncores * mwords}\n")
trial_opts = copy.deepcopy(opts)
trial_opts["contrl__exetyp"] = "check"
trial_opts["system__parall"] = not (config.ncores == 1)
trial_opts["system__mwords"] = mwords
trial_opts["system__memddi"] = memddi
trial_inp = format_keywords(trial_opts) + molcmd
trial_gamessrec = {
"infiles": {"trial_gamess.inp": trial_inp},
"command": [which("rungms"), "trial_gamess"],
"scratch_messy": False,
"scratch_directory": config.scratch_directory,
}
success, dexe = self.execute(trial_gamessrec)

# TODO: switch to KnownError and better handle clobbering of user ncores
# when the "need serial exe" messages show up compared to mem messages isn't clear
# this would be a lot cleaner if there was a unique or list of memory error strings
# if (
# ("ERROR: ONLY CCTYP=CCSD OR CCTYP=CCSD(T) CAN RUN IN PARALLEL." in dexe["stdout"])
# or ("ERROR: ROHF'S CCTYP MUST BE CCSD OR CR-CCL, WITH SERIAL EXECUTION" in dexe["stdout"])
# or ("CI PROGRAM CITYP=FSOCI DOES NOT RUN IN PARALLEL." in dexe["stdout"])
# ):
# print("RESTETTITNG TO 1")
# config.ncores = 1
# break
if "INPUT HAS AT LEAST ONE SPELLING OR LOGIC MISTAKE" in dexe["stdout"]:
raise InputError(error_stamp(trial_inp, dexe["stdout"], dexe["stderr"]))
elif "EXECUTION OF GAMESS TERMINATED -ABNORMALLY-" in dexe["stdout"]:
pass
else:
opts["system__mwords"] = mwords
opts["system__memddi"] = memddi
break
if "system__mwords" not in opts:
for mem_frac_replicated in (1, 0.5, 0.1, 0.75):
mwords, memddi = self._partition(mwords_total, mem_frac_replicated, config.ncores)
# DEBUG print(f"loop {mwords_total=} {mem_frac_replicated=} {config.ncores=} -> repl: {mwords=} dist: {memddi=} -> percore={memddi/config.ncores + mwords} tot={memddi + config.ncores * mwords}\n")
trial_opts = copy.deepcopy(opts)
trial_opts["contrl__exetyp"] = "check"

Check failure

Code scanning / CodeQL

Modification of parameter with default Error

This expression mutates a
default value
.
trial_opts["system__parall"] = not (config.ncores == 1)

Check failure

Code scanning / CodeQL

Modification of parameter with default Error

This expression mutates a
default value
.
trial_opts["system__mwords"] = mwords

Check failure

Code scanning / CodeQL

Modification of parameter with default Error

This expression mutates a
default value
.
trial_opts["system__memddi"] = memddi

Check failure

Code scanning / CodeQL

Modification of parameter with default Error

This expression mutates a
default value
.
trial_inp = format_keywords(trial_opts) + molcmd
trial_gamessrec = {
"infiles": {"trial_gamess.inp": trial_inp},
"command": [which("rungms"), "trial_gamess"],
"scratch_messy": False,
"scratch_directory": config.scratch_directory,
}
success, dexe = self.execute(trial_gamessrec)

# TODO: switch to KnownError and better handle clobbering of user ncores
# when the "need serial exe" messages show up compared to mem messages isn't clear
# this would be a lot cleaner if there was a unique or list of memory error strings
# if (
# ("ERROR: ONLY CCTYP=CCSD OR CCTYP=CCSD(T) CAN RUN IN PARALLEL." in dexe["stdout"])
# or ("ERROR: ROHF'S CCTYP MUST BE CCSD OR CR-CCL, WITH SERIAL EXECUTION" in dexe["stdout"])
# or ("CI PROGRAM CITYP=FSOCI DOES NOT RUN IN PARALLEL." in dexe["stdout"])
# ):
# print("RESTETTITNG TO 1")
# config.ncores = 1
# break
if "INPUT HAS AT LEAST ONE SPELLING OR LOGIC MISTAKE" in dexe["stdout"]:
raise InputError(error_stamp(trial_inp, dexe["stdout"], dexe["stderr"]))
elif "EXECUTION OF GAMESS TERMINATED -ABNORMALLY-" in dexe["stdout"]:
pass
else:
opts["system__mwords"] = mwords

Check failure

Code scanning / CodeQL

Modification of parameter with default Error

This expression mutates a
default value
.
opts["system__memddi"] = memddi

Check failure

Code scanning / CodeQL

Modification of parameter with default Error

This expression mutates a
default value
.
break

# TODO: "semget errno=ENOSPC -- check system limit for sysv semaphores." `ipcs -l`, can fix if too many gamess tests run at once by config.ncores = 4

Expand Down
Loading