Skip to content

Commit

Permalink
Changed the conversion of MB to Bytes to 1E6 (#598)
Browse files Browse the repository at this point in the history
Originally in the code, the memory for PBS was being converted by
multiplying by 1E3. This has been corrected now to 1E6
  • Loading branch information
kfir4444 committed Feb 2, 2023
2 parents 91b1bfe + d830db2 commit 37f11a4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion arc/job/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,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) * 1E3 # in Bytes
self.submit_script_memory = math.ceil(total_submit_script_memory) * 1E6 # 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) * 1000
expected_memory = math.ceil(14 * 1024 * 1.1) * 1E6
self.assertEqual(self.job_4.submit_script_memory, expected_memory)
self.job_4.server = 'local'

Expand Down

0 comments on commit 37f11a4

Please sign in to comment.