Detecting platform properties

Grigori Fursin edited this page Jun 5, 2018 · 6 revisions

[ Home ]

Table of Contents

CK platform widgets

We created various CK research widgets to help researchers detect features (properties) of various platforms (Linux, MacOS, Android, Windows) in a unified way.

They are available in the ck-env repos except platform.gpgpu which is available in ck-autotuning repos: You can obtain them via

 $ ck pull repo:ck-env
 $ ck pull repo:ck-autotuning

You can detect the following features:

OS features

 $ ck detect platform.os (--target= or --target_os=) (--device_id=)

For example, it is possible to detect OS features of an Android device via

 $ ck detect platorm.os --target_os=android21-arm

You can see JSON API (to be used in your CK modules, Python scripts or Jupyter notebooks) via

 $ ck detect platform.os --help

You can see JSON output via

 $ ck detect platform.os --out=json

CPU features

 $ ck detect platform.cpu (--target= or --target_os=) (--device_id=)

GPU features

 $ ck detect platform.gpu (--target= or --target_os=) (--device_id=)

GPGPU features

This feature detects GPGPU CUDA and OpenCL capabilities and may require CUDA compiler or OpenCL library installed (they will be automatically detected and installed by CK):

 $ ck detect platform.gpgpu (--target= or --target_os=) (--device_id=)

You can also specify which type of GPGPU you would like to detect

 $ ck detect platform.gpgpu (--opencl or --cuda)

You can also select from multiple devices and platforms via

 $ ck detect platform.gpgpu (--opencl or --cuda) --select

All platform features

 $ ck detect platform (--target= or --target_os=) (--device_id=)

Typical usage in CK modules or Jupyter notebooks

    # Get platform params
    hos='' # get from CK cmd: i.get('host_os','')
    tos='' # get from CK cmd: i.get('target_os', '')
    tdid='' # get from CK cmd: i.get('device_id', '')

    ii={'action':'detect',
        'module_uoa':'platform'
        'out':oo,
        'host_os':hos,
        'target_os':tos,
        'target_device_id':tdid}
    r=ck.access(ii)
    if r['return']>0: return r

    pft=r['features'] # all features

    hos=r['host_os_uoa'] # (auto-detected) host OS UOA
    hosd=r['host_os_dict'] # meta of host OS

    tos=r['os_uoa']  # (auto-detected) target OS UOA
    tosd=r['os_dict'] # meta of target OS

    tdid=r['device_id'] # Android device ID (if any)

    remote=tosd.get('remote','') # 'yes', if remote target such as Android

Questions and comments

You are welcome to get in touch with the CK community if you have questions or comments!

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.