Skip to content

Commit

Permalink
avoid pyt package
Browse files Browse the repository at this point in the history
  • Loading branch information
fnrizzi committed Nov 18, 2023
1 parent f0af467 commit 2779b29
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions core/unit_test/TestDeviceAndThreads.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import unittest
import subprocess
import psutil
import os #psutil

PREFIX = "$<TARGET_FILE_DIR:Kokkos_CoreUnitTest_DeviceAndThreads>"
EXECUTABLE = "$<TARGET_FILE_NAME:Kokkos_CoreUnitTest_DeviceAndThreads>"
Expand All @@ -31,7 +31,16 @@ def GetFlag(flag, *extra_args):
return int(p.stdout)

def GetNumThreads(max_threads):
phys_cores_count = psutil.cpu_count(logical=False)
#phys_cores_count = psutil.cpu_count(logical=False)
args = ['sysctl', '-n', 'hw.physicalcpu_max']
if os.name == 'nt':
args = ['wmic', 'cpu', 'get', 'NumberOfCores']

result = subprocess.run(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output = result.stdout.decode('utf-8')
phys_cores_count = int(output)
print(phys_cores_count)

looplist = [1] + [i*phys_cores_count for i in [1,2,3,4,5,6,7]]
for x in looplist:
if x >= max_threads:
Expand Down

0 comments on commit 2779b29

Please sign in to comment.