set_memory

psi4.driver.p4util.set_memory(inputval, execute=True, quiet=False)[source]

Reset the total memory allocation.

Parameters:
  • inputval (Union[str, int, float]) – Memory value. An Integer or float is taken literally as bytes to be set. A string is taken as a unit-containing value (e.g., 30 mb), which is case-insensitive.

  • execute (bool) – When False, interpret inputval without setting in Psi4 core.

  • quiet (bool) – When True, do not print to the output file.

Returns:

Number of bytes of memory set.

Return type:

int

Raises:

ValidationError – When <500MiB or disallowed type or misformatted.

Examples

>>> # [1] Passing absolute number of bytes
>>> psi4.set_memory(600000000)
>>> psi4.get_memory()
Out[1]: 600000000L
>>> # [2] Passing memory value as string with units
>>> psi4.set_memory('30 GB')
>>> psi4.get_memory()
Out[2]: 30000000000L
>>> # Good examples
>>> psi4.set_memory(800000000)        # 800000000
>>> psi4.set_memory(2004088624.9)     # 2004088624
>>> psi4.set_memory(1.0e9)            # 1000000000
>>> psi4.set_memory('600 mb')         # 600000000
>>> psi4.set_memory('600.0 MiB')      # 629145600
>>> psi4.set_memory('.6 Gb')          # 600000000
>>> psi4.set_memory(' 100000000kB ')  # 100000000000
>>> psi4.set_memory('2 eb')           # 2000000000000000000
>>> # Bad examples
>>> psi4.set_memory({})         # odd type
>>> psi4.set_memory('')         # no info
>>> psi4.set_memory("8 dimms")  # unacceptable units
>>> psi4.set_memory("1e5 gb")   # string w/ exponent
>>> psi4.set_memory("5e5")      # string w/o units
>>> psi4.set_memory(2000)       # mem too small
>>> psi4.set_memory(-5e5)       # negative (and too small)