Skip to content

Commit

Permalink
Use psutil to get memory info on Windows (#1700)
Browse files Browse the repository at this point in the history
  • Loading branch information
zcbenz authored Dec 14, 2024
1 parent 635117c commit dfccd17
Showing 1 changed file with 12 additions and 2 deletions.
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

0 comments on commit dfccd17

Please sign in to comment.