Best Python code snippet using localstack_python
multiwren.py
Source: multiwren.py
1import wren2import time3import boto3 4import uuid5import numpy as np6import time7from multiprocessing.pool import ThreadPool8MAT_N = 40969def compute_flops(loopcount):10 11 A = np.arange(MAT_N**2, dtype=np.float64).reshape(MAT_N, MAT_N)12 B = np.arange(MAT_N**2, dtype=np.float64).reshape(MAT_N, MAT_N)13 t1 = time.time()14 for i in range(loopcount):15 c = np.sum(np.dot(A, B))16 FLOPS = 2 * MAT_N**3 * loopcount17 t2 = time.time()18 return FLOPS / (t2-t1)19if __name__ == "__main__":20 t1 = time.time()21 sdbclient = boto3.client('sdb', region_name='us-west-2')22 job_id = str(uuid.uuid1())23 print "job_id=", job_id24 N = 1025 LOOPCOUNT = 526 extra_env = {"OMP_NUM_THREADS" : "1"} 27 pool = ThreadPool(64)28 29 call_result_objs = []30 for i in range(N):31 def f():32 wren.call_async(compute_flops, LOOPCOUNT, job_id = job_id, 33 extra_env=extra_env)34 cb = pool.apply_async(f)35 call_result_objs.append(cb)36 invocation_done = False37 while not invocation_done:38 invocation_done = True39 for result_obj in call_result_objs:40 if not result_obj.ready() :41 invocation_done = False42 time.sleep(1)43 44 print "invocation done, dur=", time.time() - t145 result_count = 046 while result_count < N:47 r = sdbclient.select(SelectExpression="select count(*) from test_two where job_id='{}'".format(job_id))48 result_count = int(r['Items'][0]['Attributes'][0]['Value'])49 est_flop = 2 * result_count * LOOPCOUNT * MAT_N**350 51 est_gflops = est_flop / 1e9/(time.time() - t1)52 print "jobs done: {:5d} runtime: {:5.1f}s {:8.1f} GFLOPS ".format(result_count, 53 time.time()-t1, 54 est_gflops)55 if result_count == N:56 break57 58 time.sleep(1)59 all_done = time.time()60 total_time = all_done - t161 print "total time", total_time62 est_flop = result_count * 2 * LOOPCOUNT * MAT_N**363 ...
Check out the latest blogs from LambdaTest on this topic:
The fact is not alien to us anymore that cross browser testing is imperative to enhance your application’s user experience. Enhanced knowledge of popular and highly acclaimed testing frameworks goes a long way in developing a new app. It holds more significance if you are a full-stack developer or expert programmer.
QA testers have a unique role and responsibility to serve the customer. Serving the customer in software testing means protecting customers from application defects, failures, and perceived failures from missing or misunderstood requirements. Testing for known requirements based on documentation or discussion is the core of the testing profession. One unique way QA testers can both differentiate themselves and be innovative occurs when senseshaping is used to improve the application user experience.
Having a good web design can empower business and make your brand stand out. According to a survey by Top Design Firms, 50% of users believe that website design is crucial to an organization’s overall brand. Therefore, businesses should prioritize website design to meet customer expectations and build their brand identity. Your website is the face of your business, so it’s important that it’s updated regularly as per the current web design trends.
Enterprise resource planning (ERP) is a form of business process management software—typically a suite of integrated applications—that assists a company in managing its operations, interpreting data, and automating various back-office processes. The introduction of a new ERP system is analogous to the introduction of a new product into the market. If the product is not handled appropriately, it will fail, resulting in significant losses for the business. Most significantly, the employees’ time, effort, and morale would suffer as a result of the procedure.
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!