Skip to content

Commit

Permalink
Merge branch 'main' into 632-receiving-keyerror-3-during-arc-restart
Browse files Browse the repository at this point in the history
  • Loading branch information
kfir4444 authored Apr 3, 2023
2 parents 1953aaf + fac0c4e commit 53559df
Show file tree
Hide file tree
Showing 7 changed files with 651 additions and 8 deletions.
2 changes: 1 addition & 1 deletion arc/job/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ def set_cpu_and_mem(self):
self.submit_script_memory = math.ceil(total_submit_script_memory) # in MB
if cluster_software in ['pbs']:
# In PBS, "#PBS -l select=1:ncpus=8:mem=12000000" specifies the memory for all cores to be 12 MB.
self.submit_script_memory = math.ceil(total_submit_script_memory) * 1E6 # in Bytes
self.submit_script_memory = math.ceil(total_submit_script_memory) * 1E8 # in Bytes
elif cluster_software in ['slurm']:
# In Slurm, "#SBATCH --mem-per-cpu=2000" specifies the memory **per cpu/thread** to be 2000 MB.
self.submit_script_memory = math.ceil(total_submit_script_memory / self.cpu_cores) # in MB
Expand Down
2 changes: 1 addition & 1 deletion arc/job/adapter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def test_set_cpu_and_mem(self):
self.job_4.server = 'server3'
self.job_4.cpu_cores = None
self.job_4.set_cpu_and_mem()
expected_memory = math.ceil(14 * 1024 * 1.1) * 1E6
expected_memory = math.ceil(14 * 1024 * 1.1) * 1E8
self.assertEqual(self.job_4.submit_script_memory, expected_memory)
self.job_4.server = 'local'

Expand Down
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 53559df

Please sign in to comment.