Commit 48da29e6 authored by Mario Andres Serruya's avatar Mario Andres Serruya
Browse files

IMSS and Redis pipelines ready to be tested with multiple processes

parent 72ba01be
No related merge requests found
Showing with 29 additions and 5 deletions
+29 -5
tucan
compute-9-1
compute-9-2
compute-9-3
......@@ -8,6 +8,7 @@ import numpy as np
from mpi4py import MPI
from skimage.color import rgb2gray
from skimage import io, filters
from skimage.util import img_as_ubyte
##############################################
############## MPI ENVIRONMENT ###############
......@@ -75,6 +76,12 @@ datasetd = pyimss.create_dataset(dataset_uri, "LOCAL", num_pictures, 88, 1)
print("FIRST PIC: " +str(first_picture)+ " LAST PIC: " +str(last_picture)+ " NUM PICS: "+str(num_pictures))
if rank == 0:
print("STORE TIME,PROCESS TIME,TOTAL TIME")
store_pics = time.perf_counter()
#Store the images in the IMSS.
for pic_id in range(first_picture, last_picture):
......@@ -83,6 +90,8 @@ for pic_id in range(first_picture, last_picture):
covid_pic = pickle.dumps(covid_pic)
pyimss.set_data(datasetd, pic_id - first_picture, covid_pic);
process_pics = time.perf_counter()
##############################################
################# PIPELINE ###################
......@@ -97,11 +106,15 @@ for pic_id in range(first_picture, last_picture):
#Apply the former. SEGMENT.
image_thesholded = covid_pic_ret > threshold
#Save the files.
io.imsave("COVID_TEST/covid_test_"+str(pic_id)+".png", image_thesholded)
io.imsave("COVID_TEST/covid_test_"+str(pic_id)+".png", img_as_ubyte(image_thesholded))
##############################################
############# RELEASE RESOURCES ##############
end = time.perf_counter()
print(str(process_pics-store_pics)+","+str(end-process_pics)+","+str(end-store_pics))
#Release the used dataset.
pyimss.release_dataset(datasetd);
#Close the connection and release the resources required to handle the IMSS.
......
No preview for this file type
......@@ -36,7 +36,7 @@ t_init = time.clock()
##############################################
################ STORE IMAGES ################
total_pictures = 3616
total_pictures = 3617
#Discover the amount of pictures that this process shall deal with.
num_pictures = total_pictures // size
......@@ -57,6 +57,12 @@ if first_picture == 0:
first_picture = 1
if rank == 0:
print("STORE TIME,PROCESS TIME,TOTAL TIME")
store_pics = time.perf_counter()
for p_id in range(first_picture, last_picture):
#Construct the picture path.
......@@ -68,6 +74,8 @@ for p_id in range(first_picture, last_picture):
#Store the image in the Redis Cluster as bytes.
rc.set(p_id, pickle.dumps(clouds))
process_pics = time.perf_counter()
##############################################
############## RETRIEVE IMAGES ###############
......@@ -88,5 +96,6 @@ for p_id in range(first_picture, last_picture):
#Save the files.
io.imsave("COVID_TEST/covid_test_"+str(p_id)+".png", image_thesholded)
t_end = time.clock() - t_init
print(t_end)
end = time.perf_counter()
print(str(process_pics-store_pics)+","+str(end-process_pics)+","+str(end-store_pics))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment