Skip to content

Commit 1f95c07

Browse files
author
liubo
committed
add gpu example
1 parent d7bd036 commit 1f95c07

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

examples/disp_gpu.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from pythonlsf import lsf
2+
if __name__ == '__main__':
3+
print("LSF Clustername is : {}".format(lsf.ls_getclustername()))
4+
if lsf.lsb_init("test") > 0:
5+
exit -1;
6+
host_names = None
7+
num_hosts = lsf.new_intp()
8+
lsf.intp_assign(num_hosts, 0)
9+
host_data = lsf.lsb_hostinfo_ex(host_names, num_hosts, "", 4096)
10+
all_host_data = lsf.hostInfoEntArray_frompointer(host_data)
11+
for i in range(0, lsf.intp_value(num_hosts)):
12+
hostname = all_host_data[i].host
13+
print(hostname)
14+
gpudata = all_host_data[i].gpuData
15+
print("ngpus avail_shared_gpus avail_excl_gpus")
16+
print(" {} {} {}". \
17+
format(gpudata.ngpus, gpudata.avail_shared_ngpus, gpudata.avail_excl_ngpus))

0 commit comments

Comments
 (0)