File: checkaffinity

package info (click to toggle)
numactl 2.0.5-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 532 kB
  • ctags: 632
  • sloc: ansic: 5,054; sh: 321; makefile: 139; perl: 59
file content (27 lines) | stat: -rwxr-xr-x 794 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
# check if affinity works

BASE=`pwd`/..
export LD_LIBRARY_PATH=$BASE
export PATH=$BASE:$PATH

numcpus=$(grep -c processor /proc/cpuinfo)
numnodes=$(ls -1d /sys/devices/system/node/node[0-9]* | wc -l )

for i in $(seq 0 $[$numcpus - 1]) ; do
    if [ "$(numactl --physcpubind=$i ./printcpu)" != "$i" ] ; then
       echo "--physcpubind for $i doesn't work"
       exit 1
    fi
    if [ "$(numactl --physcpubind=$i numactl --show | awk '/^physcpubind/ { print $2 }' )" != "$i" ] ; then
	echo "--show doesn't agree with physcpubind for cpu $i"
	exit 1
    fi
done

for i in $(seq 0 $[$numnodes - 1]) ; do
    if [ $(numactl --cpunodebind=$i numactl --show | awk '/nodebind/ { print $2 }' ) != $i ] ; then
	echo "--show doesn't agree with cpunodebind for node $i"
	exit 1
    fi
done