work_queue = Queue() job_list = [] blocks_x = [i for i in range(0, nblocks_x)] blocks_y = [i for i in range(0, nblocks_y)] blocks_z = [i for i in range(0, nblocks_z)] random.shuffle(blocks_x) random.shuffle(blocks_y) random.shuffle(blocks_y) # Enqueue jobs for curr_kernel in range(0, len(kernel_list)): for i in range(0, len(blocks_x)): for j in range(0, len(blocks_y)): for k in range(0, len(blocks_z)): block_i = blocks_x[i] block_j = blocks_y[j] block_k = blocks_z[k] curr_kernel_path = kernel_path + "/" + \ kernel_list[curr_kernel] + ".txt" output_path = taylor_dir + "/" + kernel_list[curr_kernel] if not os.path.isdir(output_path + "/"): os.mkdir(output_path + "/") current_job = taylor_kernel_job(scene, curr_kernel_path, block_i, block_j, block_k, output_path) job_list.append(current_job) execute_jobs(job_list, num_cores)
scene= dbvalue(scene_id, scene_type); #Begin multiprocessing t1=time.time(); work_queue=Queue(); job_list=[]; blocks_x = [i for i in range(0,nblocks_x)]; blocks_y = [i for i in range(0,nblocks_y)]; blocks_z = [i for i in range(0,nblocks_z)]; random.shuffle(blocks_x); random.shuffle(blocks_y); random.shuffle(blocks_y); #Enqueue jobs for curr_kernel in range(0, len(kernel_list)): for i in range(0, len(blocks_x)): for j in range(0, len(blocks_y)): for k in range(0, len(blocks_z)): block_i = blocks_x[i]; block_j = blocks_y[j]; block_k = blocks_z[k]; curr_kernel_path = kernel_path + "/" + kernel_list[curr_kernel]+ ".txt"; output_path = taylor_dir + "/" + kernel_list[curr_kernel]; if not os.path.isdir( output_path + "/"): os.mkdir( output_path + "/"); current_job = taylor_kernel_job(scene, curr_kernel_path, block_i, block_j, block_k, output_path); job_list.append(current_job); execute_jobs(job_list, num_cores);
bvpl_octree_batch.init_process("boxmCreateSceneProcess"); bvpl_octree_batch.set_input_string(0, model_dir +"/mean_color_scene.xml"); bvpl_octree_batch.run_process(); (scene_id, scene_type) = bvpl_octree_batch.commit_output(0); scene= dbvalue(scene_id, scene_type); #Begin multiprocessing t1=time.time(); work_queue=Queue(); num_cores=8; job_list=[]; if __name__=="__main__": #Enqueue jobs for curr_kernel in range(0, len(kernel_list)): #for curr_kernel in range(0, 1): #curr_kernel = 1; for i in range(0, blocks_x): for j in range(0, blocks_y): for k in range(0, blocks_z): curr_kernel_path = kernel_path + "/" + kernel_list[curr_kernel]+ ".txt"; output_path = output_dir + "/" + kernel_list[curr_kernel]; if not os.path.isdir( output_path + "/"): os.mkdir( output_path + "/"); current_job = taylor_kernel_job(scene, curr_kernel_path, i, j, k, output_path); job_list.append(current_job); execute_jobs(job_list, num_cores);