How to use get_kernel_information method in lisa

Best Python code snippet using lisa_python

gpu_tracegen.py

Source: gpu_tracegen.py Github

copy

Full Screen

...191. Specify original command to run a benchmark. 202. If you have to change the version of compute capability, please modify21 ver and ver_env in this file.223. In some cases, you may need to add compiler flag (e.g. -I../​../​sdk) to get23 kernel information. Please edit 'inc' in get_kernel_information().24 e.g. inc = '-I../​../​sdk'.25* All possible changes that a user needs to make is marked with TO_CHANGE.26"""27## global variables28cwd = os.getcwd()29ver = 'sm_20' ## TO_CHANGE30ver_env = '2.0' ## TO_CHANGE31"""32Process arguments33"""34def process_options():35 parser = argparse.ArgumentParser(description='GPU trace generation for MacSim')36 parser.add_argument('-cmd', action='append', nargs='*', dest='cmd', 37 help='command to run a benchmark')38 return parser39"""40Generate kernel information file41"""42def get_kernel_information():43 inc = '' ## TO_CHANGE44 cmd = 'nvcc --cubin --ptxas-options=-v -arch %s *.cu -I. %s' % (ver, inc)45 print(cmd)46 p = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, 47 stderr=subprocess.PIPE, close_fds=True) 48 (fi, fo, fe) = (p.stdin, p.stdout, p.stderr)49 pattern_kernel = re.compile('ptxas info\s+: Compiling entry function \'(\S+)\' for \'%s\'' % ver)50 pattern_info = re.compile('ptxas info\s+: Used ([0-9]+) registers, ([0-9\+]+) bytes smem')51 filename = 'occupancy.txt'52 ofile = open(filename, 'w')53 kernel_dict = {}54 kernel_name = ''55 smem = ''56 register = ''57 for line in fe.readlines():58 match_kernel = pattern_kernel.match(line)59 match_info = pattern_info.match(line)60 if match_kernel != None:61 kernel_name = match_kernel.group(1)62 if match_info != None:63 register = match_info.group(1)64 smem = match_info.group(2)65 smem = smem.split('+')66 if len(smem) > 1:67 smem = str(int(smem[0]) + int(smem[1]));68 else:69 smem = smem[0]70 if kernel_name not in kernel_dict:71 ofile.write('%s %s %s\n' % (kernel_name, register, smem))72 kernel_dict[kernel_name] = True73 ofile.close()74"""75set environmental variables76"""77def set_env():78 trace_path = '%s/​trace' % cwd79 if os.path.exists(trace_path):80 os.system('rm -rf %s' % trace_path)81 os.system('mkdir -p %s' % trace_path)82 os.environ['TRACE_PATH'] = trace_path83 os.environ['USE_KERNEL_NAME'] = '1'84 os.environ['KERNEL_INFO_PATH'] = '%s/​occupancy.txt' % cwd85 os.environ['COMPUTE_VERSION'] = ver_env86"""87main routine88"""89def main():90 global args91 ## get arguments 92 parser = process_options()93 args = parser.parse_args()94 ## sanity check for command95 if args.cmd == None:96 print('please specify command to run')97 sys.exit(-1)98 ## setting for GPUOcelot trace generator99 get_kernel_information()100 set_env()101 ## execute the binary102 cmd = ' '.join(sum(args.cmd, []))103 os.system(cmd)104if __name__ == '__main__':...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

How To Handle Multiple Windows In Selenium Python

Automating testing is a crucial step in the development pipeline of a software product. In an agile development environment, where there is continuous development, deployment, and maintenance of software products, automation testing ensures that the end software products delivered are error-free.

Joomla Testing Guide: How To Test Joomla Websites

Before we discuss the Joomla testing, let us understand the fundamentals of Joomla and how this content management system allows you to create and maintain web-based applications or websites without having to write and implement complex coding requirements.

Starting & growing a QA Testing career

The QA testing career includes following an often long, winding road filled with fun, chaos, challenges, and complexity. Financially, the spectrum is broad and influenced by location, company type, company size, and the QA tester’s experience level. QA testing is a profitable, enjoyable, and thriving career choice.

The Art of Testing the Untestable

It’s strange to hear someone declare, “This can’t be tested.” In reply, I contend that everything can be tested. However, one must be pleased with the outcome of testing, which might include failure, financial loss, or personal injury. Could anything be tested when a claim is made with this understanding?

How To Create Custom Menus with CSS Select

When it comes to UI components, there are two versatile methods that we can use to build it for your website: either we can use prebuilt components from a well-known library or framework, or we can develop our UI components from scratch.

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run lisa automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful