How to use ck - 10 common examples

To help you get started, we’ve selected a few ck examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ctuning / ck / tests / flatten_dict.py View on Github external
a={'dyn_features':{'ft1':'1', 'ft2':'2'}, 'static_features':{'ft3':'3','ft4':'4'}}

print ('Original array:')
print (a)

r=ck.flatten_dict({'dict':a})
if r['return']>0: 
   print ('Error:'+r['error'])
   sys.exit(1)

x=r['dict']
print ('')
print ('Flattened array:')
print (x)

r=ck.restore_flattened_dict({'dict':x})
print ('')
print ('Restored array:')
print (r['dict'])


                             
sys.exit(0)
github ctuning / ck / tests / flatten_dict.py View on Github external
# See CK COPYRIGHT.txt for copyright details.
#
# Developer: Grigori Fursin
#

# CK installation test

import ck.kernel as ck
import sys

a={'dyn_features':{'ft1':'1', 'ft2':'2'}, 'static_features':{'ft3':'3','ft4':'4'}}

print ('Original array:')
print (a)

r=ck.flatten_dict({'dict':a})
if r['return']>0: 
   print ('Error:'+r['error'])
   sys.exit(1)

x=r['dict']
print ('')
print ('Flattened array:')
print (x)

r=ck.restore_flattened_dict({'dict':x})
print ('')
print ('Restored array:')
print (r['dict'])
github ctuning / ck-crowdnode / run_tests.py View on Github external
ck_dir=args.ck_dir
if args.ck_dir is None:
    ck_dir='test-ck-master'
    shutil.rmtree(ck_dir, ignore_errors=True)
    r = subprocess.call('git clone https://github.com/ctuning/ck.git ' + ck_dir, shell=True)
    if 0 < r:
        print('Error: failed to clone CK!')
        die(1)

sys.path.append(ck_dir)

import ck.kernel as ck

test_repo_name = 'ck-crowdnode-auto-tests'
test_repo_cid = test_repo_name + '::'
r = ck.access({'module_uoa': 'repo', 'data_uoa': test_repo_name, 'action': 'remove', 'force': 'yes', 'all': 'yes'})
r = ck.access({'remote': 'yes', 'module_uoa': 'repo', 'url': 'http://localhost:3333', 'quiet': 'yes', 'data_uoa': test_repo_name, 'action': 'add'})
if r['return']>0:
    print('Unable to create test repo. ' + r.get('error', ''))
    die(1)

tests_dir = os.path.join(script_dir, 'tests')

module_cfg = {
    'secret_key': 'c4e239b4-8471-11e6-b24d-cbfef11692ca',
    'platform': platform.system(),
    'repo_name': test_repo_name,
    'cid': test_repo_cid
}

def access_test_repo(param_dict, checkFail=True):
    d = {'secretkey': module_cfg['secret_key'], 'cid': module_cfg['cid']}
github ctuning / ck-crowdnode / run_tests.py View on Github external
def loadTestsFromModule(self, module, pattern=None):
        module.ck = ck
        module.cfg = module_cfg
        module.access_test_repo = access_test_repo
        module.files_dir = files_dir
        return unittest.TestLoader.loadTestsFromModule(self, module, pattern)
github ctuning / ck-clsmith / script / explore-datasets / start_analysis.py View on Github external
ck.out('')
    ck.out('Dataset  UOA:    '+str(q[1]))
    ck.out('Dataset file:    '+str(q[2]))
    ck.out('Target OS:       '+str(q[4]))
    ck.out('OpenCL platform: '+str(q[5]))
    ck.out('OpenCL device:   '+str(q[6]))
    ck.out('Compiler:        '+str(q[8]))

# Convert to csv
ii={"action":"convert_table_to_csv",
    "module_uoa":"experiment",
    "table":table,
    "keys":real_keys,
    "file_name":"start_analysis_tmp.csv"}

r=ck.access(ii)
if r['return']>0: ck.err(r)

# Finish

ck.out('')
ck.out('Thank you for using CK!')

exit(0)
github ctuning / ctuning-programs / program / convert3.py View on Github external
import ck.kernel as ck

r=ck.access('list #* out=none')
if r['return']>0: 
   print 'Error: '+r['error']
   exit(1)

lst=r['lst']

r=ck.load_json_file({'json_file':'convert2.json'})
if r['return']>0:
   print 'Error: '+r['error']
   exit(1)
d1=r['dict']

dtags={}

for q in lst:
    m=q['module_uoa']
github ctuning / ck-clsmith / script / explore-datasets / start_analysis.py View on Github external
ck.out('OpenCL device:   '+str(q[6]))
    ck.out('Compiler:        '+str(q[8]))

# Convert to csv
ii={"action":"convert_table_to_csv",
    "module_uoa":"experiment",
    "table":table,
    "keys":real_keys,
    "file_name":"start_analysis_tmp.csv"}

r=ck.access(ii)
if r['return']>0: ck.err(r)

# Finish

ck.out('')
ck.out('Thank you for using CK!')

exit(0)
github ctuning / ck-clsmith / script / explore-datasets / start_analysis_from_remote.py View on Github external
ck.out('Dataset  UOA:    '+str(q[1]))
    ck.out('Dataset file:    '+str(q[2]))
    ck.out('Target OS:       '+str(q[4]))
    ck.out('OpenCL platform: '+str(q[5]))
    ck.out('OpenCL device:   '+str(q[6]))
    ck.out('Compiler:        '+str(q[8]))

# Convert to csv
ii={"action":"convert_table_to_csv",
    "module_uoa":"experiment",
    "table":table,
    "keys":real_keys,
    "file_name":"start_analysis_from_remote_tmp.csv"}

r=ck.access(ii)
if r['return']>0: ck.err(r)

# Finish

ck.out('')
ck.out('Thank you for using CK!')

exit(0)
github ctuning / ck / ck / repo / module / kernel / module.py View on Github external
ck.out('')
             ck.out('* Executing command "'+c+'" ...')
             os.system(c)

       installed=True
       try:
          import ck.kernel as ckx
       except Exception as e:
          installed=False

       if installed:
          ck.out('')
          ck.out('CK is now installed as python library. Testing ...')
          ck.out('')
          ckx.test()
       else:
          ck.out('')
          ck.out('CK was not installed as Python library.')

    # Content authorship options
    if param=='' or param=='update':
       ck.out(sep)
       ck.out('*** Check latest version ***')

       ck.out('')
       r=ck.inp({'text': 'Would you like to check if your version is up-to-date (Y/n): '})
       x=r['string'].lower()
       if x!='n' and x!='no':
          ck.out('')
          ck.status({'out':'con'})
github ctuning / ctuning-programs / program / convert3.py View on Github external
import ck.kernel as ck

r=ck.access('list #* out=none')
if r['return']>0: 
   print 'Error: '+r['error']
   exit(1)

lst=r['lst']

r=ck.load_json_file({'json_file':'convert2.json'})
if r['return']>0:
   print 'Error: '+r['error']
   exit(1)
d1=r['dict']

dtags={}

for q in lst:
    m=q['module_uoa']
    d=q['data_uoa']

    print ('***********************************')
    print (d)

    r=ck.access({'action':'load',
                 'module_uoa':m,

ck

Collective Knowledge - a lightweight knowledge manager to organize, cross-link, share and reuse artifacts and workflows based on FAIR principles

Apache-2.0
Latest version published 3 months ago

Package Health Score

78 / 100
Full package analysis

Similar packages