File: dump-properties.py

package info (click to toggle)
pyopencl 0.92.dfsg-1
  • links: PTS, VCS
  • area: contrib
  • in suites: squeeze
  • size: 572 kB
  • ctags: 843
  • sloc: python: 3,982; cpp: 3,333; makefile: 101; sh: 2
file content (24 lines) | stat: -rw-r--r-- 677 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
import pyopencl as cl

def print_info(obj, info_cls):
    for info_name in sorted(dir(info_cls)):
        if not info_name.startswith("_") and info_name != "to_string":
            info = getattr(info_cls, info_name)
            try:
                info_value = obj.get_info(info)
            except:
                info_value = "<error>"

            print "%s: %s" % (info_name, info_value)

for platform in cl.get_platforms():
    print 75*"="
    print platform
    print 75*"="
    print_info(platform, cl.platform_info)

    for device in platform.get_devices():
        print 75*"-"
        print device
        print 75*"-"
        print_info(device, cl.device_info)