Skip to content

Commit

Permalink
Add nvidia jetson xavier agx and apple m2
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenarnst committed Jul 29, 2024
1 parent 5ae7452 commit f3be556
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/build.image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
with:
context: .
platforms: linux/amd64,linux/arm64
push: true #${{ github.ref == 'refs/heads/main' }}
push: ${{ github.ref == 'refs/heads/main' }}
file: docker/dockerfile
tags: '${{ needs.set_vars.outputs.CI_IMAGE }}:latest'
cache-from: type=registry,ref='${{ needs.set_vars.outputs.CI_IMAGE }}:latest'
Expand Down
64 changes: 64 additions & 0 deletions tests/test_topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,67 @@ def test_parse_dual_intel_xeon_gold_6126(self):

# All cores of the machine have the same number of PUs.
assert st.all_equal_num_pus_per_core()

def test_parse_single_nvidia_jetson_xavier_agx(self):
"""
The test reads an `xml` file with the output of `lstopo-no-graphics`
for a single Nvidia Jetson Xavier AGX machine.
"""
hwloc_calc_values = [
b'0,1,2,3',
b'0,1,2,3,4,5,6,7',
b'0,1,2,3,4,5,6,7'
]

with unittest.mock.patch(
target = 'subprocess.check_output',
side_effect = hwloc_calc_values,
):
st = SystemTopology(load = False)
st._parse(filename = 'tests/data/single-nvidia-jetson-xavier-agx.xml')

# There are 4 packages.
# This is how `hwloc` reports it. Physically, there is a single package, with 4 clusters of 2 cores each.
#
# See also:
# - https://www.anandtech.com/show/13584/nvidia-xavier-agx-hands-on-carmel-and-more
assert st.get_num_packages() == 4

# The machine has 8 cores in total.
assert st.get_num_cores() == 8

# The machine has 8 PUs in total.
assert st.get_num_pus() == 8

# All cores of the machine have the same number of PUs.
assert st.all_equal_num_pus_per_core()

def test_parse_single_apple_m2(self):
"""
The test reads an `xml` file with the output of `lstopo-no-graphics`
for a single Apple M2 machine.
"""
hwloc_calc_values = [
b'0',
b'0,1,2,3,4,5,6,7',
b'0,1,2,3,4,5,6,7'
]

with unittest.mock.patch(
target = 'subprocess.check_output',
side_effect = hwloc_calc_values,
):
st = SystemTopology(load = False)
st._parse(filename = 'tests/data/single-apple-m2.xml')

# The machine has 1 package.
assert st.get_num_packages() == 1

# The machine has 8 cores in total.
assert st.get_num_cores() == 8

# The machine has 8 PUs in total.
assert st.get_num_pus() == 8

# All cores of the machine have the same number of PUs.
assert st.all_equal_num_pus_per_core()

0 comments on commit f3be556

Please sign in to comment.