Algorithm 1 First sequential time () |
1: from mpi4py import MPI 2: import numpy as np 3: from PIL import Image 4: from decimal import * 5: comm=MPI.COMM_WORLD 6: size=comm.Get_size() # Number of processors 7: rank=comm.Get_rank() # Processor ID 8: if rank == 0: 9: imagen=Image.open(’image.png’) # Read original image 10: imagen=np.array(imagen) # Convert the object image into an array 11: ren=imagen.shape[0] # Size of the array (rows) 12: col=imagen.shape[1] # Size of the array (cols) 13: cap=imagen.shape[2] 14: n_ren=np.int(ren/size) # Resize the array 15: foto=np.reshape(imagen,(size,n_ren,col,cap)) # for scattering data |