Skip to content

Commit

Permalink
fix memory check (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkupnicki authored Jan 31, 2024
1 parent 0e70de1 commit 370073b
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,23 +88,31 @@ def advertise_aio(framework_name):
def check_memory_settings():
if platform.processor() != "aarch64":
return
kernel_page_size = int(subprocess.check_output(
"""grep -ir KernelPageSize /proc/self/smaps | head -1 | awk '{split($0, a, " "); print a[2]}'""", shell=True))

try:
kernel_page_size = int(subprocess.check_output(
"""grep -ir KernelPageSize /proc/self/smaps | head -1 | awk '{split($0, a, " "); print a[2]}'""", shell=True))
if kernel_page_size != 64:
print_warning_message(f"KernelPageSize is {kernel_page_size} kB, consider using 64k pages.")
except ValueError:
pass

thp = subprocess.check_output(
r"""cat /sys/kernel/mm/transparent_hugepage/enabled | sed -n 's/.*\[\(.*\)\].*/\1/p'""", shell=True).decode(
'utf-8').strip()
sockets = int(
subprocess.check_output("""lscpu | grep Socket | awk '{split($0, a, " "); print a[2]}'""", shell=True))
nodes = int(
subprocess.check_output("""lscpu | grep 'NUMA node(s)' | awk '{split($0, a, " "); print a[3]}'""", shell=True))

if kernel_page_size != 64:
print_warning_message(f"KernelPageSize is {kernel_page_size} kB, consider using 64k pages.")
if thp != "always":
print_warning_message(f"Transparent_hugepage is set to {thp}. Consider using 'always'.")
if sockets != nodes:
print_warning_message(
f"Number of sockets detected is {sockets} and there are {nodes} NUMA nodes. Consider using 'Monolithic' mode.")

try:
sockets = int(
subprocess.check_output("""lscpu | grep Socket | awk '{split($0, a, " "); print a[2]}'""", shell=True))
nodes = int(
subprocess.check_output("""lscpu | grep 'NUMA node(s)' | awk '{split($0, a, " "); print a[3]}'""", shell=True))
if sockets != nodes:
print_warning_message(
f"Number of sockets detected is {sockets} and there are {nodes} NUMA nodes. Consider using 'Monolithic' mode.")
except ValueError:
pass


def download_squad_1_1_dataset():
Expand Down

0 comments on commit 370073b

Please sign in to comment.