Skip to content

Commit

Permalink
undo gamess changes
Browse files Browse the repository at this point in the history
  • Loading branch information
loriab committed Aug 8, 2023
1 parent 09b3e19 commit ff4ab30
Showing 1 changed file with 36 additions and 39 deletions.
75 changes: 36 additions & 39 deletions qcengine/programs/gamess/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ def compute(self, input_model: AtomicInput, config: "TaskConfig") -> AtomicResul
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 @@ -123,43 +121,42 @@ def build_input(
# * int() rounds down
mwords_total = int(config.memory * (1024**3) / 8e6)

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"
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
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

# 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

0 comments on commit ff4ab30

Please sign in to comment.