Skip to content

Commit

Permalink
Insufficient mem molpro (#599)
Browse files Browse the repository at this point in the history
Molpro can generate an error asking for more Mwords in multiple
different ways. One of the outputs can appear like so:

```console
For minimal I/O algorithm in triples, increase memory by 522.58 Mwords to 1522.63 Mwords.

 For full I/O caching in triples, increase memory by 3136.12 Mwords to 4136.17 Mwords.

 A further 111.29 Mwords of memory are needed for the triples to run. Increase memory to 1111.34 Mwords.

 GLOBAL ERROR fehler on processor   0  
```

Currently, our trsh.py will reverse search this test and pick up on the
line

```console
 A further 111.29 Mwords of memory are needed for the triples to run. Increase memory to 1111.34 Mwords.
```

And then break the loop and increase the memory by 111.29Mwords (in this
example). However, as it can be seen, there is suggestions for larger
Mword increases but they are not parsed. Therefore, I have added into
the trsh.py check to also look for the line
```console
 For full I/O caching in triples, increase memory by 3136.12 Mwords to 4136.17 Mwords.
```
  • Loading branch information
kfir4444 authored Apr 3, 2023
2 parents 5ae999b + 016a30f commit fac0c4e
Show file tree
Hide file tree
Showing 5 changed files with 649 additions and 6 deletions.
9 changes: 7 additions & 2 deletions arc/job/adapters/molpro.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,13 @@ def set_input_file_memory(self) -> None:
Set the input_file_memory attribute.
"""
# Molpro's memory is per cpu core and in MW (mega word; 1 MW ~= 8 MB; 1 GB = 128 MW)
self.input_file_memory = math.ceil(self.job_memory_gb * 128 / self.cpu_cores)

# https://www.molpro.net/pipermail/molpro-user/2010-April/003723.html
# In the link, they describe the conversion of 100,000,000 Words (100Mword) is equivalent to
# 800,000,000 bytes (800 mb).
# Formula - (100,000,000 [Words]/( 800,000,000 [Bytes] / (job mem in gb * 1000,000,000 [Bytes])))/ 1000,000 [Words -> MegaWords]
# The division by 1E6 is for converting into MWords
self.input_file_memory = math.ceil((1E8/(8E8 /(self.job_memory_gb * 1E9)))/1E6)

def execute_incore(self):
"""
Execute a job incore.
Expand Down
6 changes: 3 additions & 3 deletions arc/job/adapters/molpro_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ def test_set_cpu_and_mem(self):
"""Test assigning number of cpu's and memory"""
self.job_1.cpu_cores = 48
self.job_1.input_file_memory = None
self.job_1.submit_script_memory = None
self.job_1.submit_script_memory = 14
self.job_1.set_cpu_and_mem()
self.assertEqual(self.job_1.cpu_cores, 48)

def test_set_input_file_memory(self):
"""Test setting the input_file_memory argument"""
expected_memory = math.ceil(14 * 128 / 48)
expected_memory = math.ceil((1E8/(8E8 /(14 * 1E9)))/1E6)
self.assertEqual(self.job_1.input_file_memory, expected_memory)

def test_write_input_file(self):
Expand All @@ -55,7 +55,7 @@ def test_write_input_file(self):
with open(os.path.join(self.job_1.local_path, input_filenames[self.job_1.job_adapter]), 'r') as f:
content_1 = f.read()
job_1_expected_input_file = """***,spc1
memory,38,m;
memory,1750,m;
file,1,file1.int !allocate permanent integral file
file,2,file2.wfu !allocate permanent wave-function (dump) file
Expand Down
8 changes: 7 additions & 1 deletion arc/job/trsh.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import numpy as np
import pandas as pd
import re

from arc.common import (check_torsion_change,
determine_ess,
Expand Down Expand Up @@ -362,7 +363,12 @@ def determine_ess_status(output_path: str,
# e.g.: `A further 246.03 Mwords of memory are needed for the triples to run.
# Increase memory to 996.31 Mwords.` (w/o the line break)
keywords = ['Memory']
error = f'Additional memory required: {line.split()[2]} MW'
for line0 in reverse_lines:
if ' For full I/O' in line0 and 'increase memory by' in line0 and 'Mwords to' in line0:
memory_increase = re.findall(r"[\d.]+", line0)[0]
error = f"Additional memory required: {memory_increase} MW"
break
error = f'Additional memory required: {line.split()[2]} MW' if 'error' not in locals() else error
break
elif 'insufficient memory available - require' in line:
# e.g.: `insufficient memory available - require 228765625 have
Expand Down
13 changes: 13 additions & 0 deletions arc/job/trsh_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,19 @@ def test_trsh_ess_job(self):
num_heavy_atoms, cpu_cores, ess_trsh_methods)
self.assertIn('memory', ess_trsh_methods)
self.assertEqual(memory, 96.0)

# Molpro: Insuffienct Memory 3 Test
path = os.path.join(self.base_path['molpro'], 'insufficient_memory_3.out')
status, keywords, error, line = trsh.determine_ess_status(output_path=path,
species_label='TS',
job_type='sp')
job_status = {'keywords': keywords, 'error': error}
output_errors, ess_trsh_methods, remove_checkfile, level_of_theory, software, job_type, fine, trsh_keyword, \
memory, shift, cpu_cores, couldnt_trsh = trsh.trsh_ess_job(label, level_of_theory, server, job_status,
job_type, software, fine, memory_gb,
num_heavy_atoms, cpu_cores, ess_trsh_methods)
self.assertIn('memory', ess_trsh_methods)
self.assertEqual(memory, 62.0)

# Test Orca
# Orca: test 1
Expand Down
Loading

0 comments on commit fac0c4e

Please sign in to comment.