Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use psutil to get memory info on Windows #1700

Merged
merged 1 commit into from
Dec 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions python/tests/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@

import gc
import operator
import os
import pickle
import resource
import platform
import sys
import unittest
import weakref
from copy import copy, deepcopy
from itertools import permutations

if platform.system() == "Windows":
import psutil
else:
import resource

import mlx.core as mx
import mlx_tests
import numpy as np
Expand Down Expand Up @@ -1932,7 +1938,11 @@ def test_deep_graphs(self):

def test_siblings_without_eval(self):
def get_mem():
return resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
if platform.system() == "Windows":
process = psutil.Process(os.getpid())
return process.memory_info().peak_wset
else:
return resource.getrusage(resource.RUSAGE_SELF).ru_maxrss

key = mx.array([1, 2])

Expand Down