peer_matrix.py 440 Bytes
Newer Older
root's avatar
root committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import cupy


def main():
    gpus = cupy.cuda.runtime.getDeviceCount()
    for peerDevice in range(gpus):
        for device in range(gpus):
            if peerDevice == device:
                continue
            flag = cupy.cuda.runtime.deviceCanAccessPeer(device, peerDevice)
            print(
                f'Can access #{peerDevice} memory from #{device}: '
                f'{flag == 1}')


if __name__ == '__main__':
    main()