-
Notifications
You must be signed in to change notification settings - Fork 67
Expand file tree
/
Copy pathdisp_gpu.py
More file actions
20 lines (20 loc) · 832 Bytes
/
disp_gpu.py
File metadata and controls
20 lines (20 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from pythonlsf import lsf
if __name__ == '__main__':
print("LSF Clustername is : {}".format(lsf.ls_getclustername()))
if lsf.lsb_init("test") > 0:
exit -1;
host_names = None
num_hosts = lsf.new_intp()
lsf.intp_assign(num_hosts, 0)
host_data = lsf.lsb_hostinfo_ex(host_names, num_hosts, "", 0)
all_host_data = lsf.hostInfoEntArray(lsf.intp_value(num_hosts))
all_host_data = all_host_data.frompointer(host_data)
for i in range(0, lsf.intp_value(num_hosts)):
hostname = all_host_data[i].host
print(hostname)
gpudata = all_host_data[i].gpuData
if gpudata is None:
continue
print("ngpus avail_shared_gpus avail_excl_gpus")
print(" {} {} {}". \
format(gpudata.ngpus, gpudata.avail_shared_ngpus, gpudata.avail_excl_ngpus))