from datetime import datetime
from time import sleep
import numpy as np
import multiprocessing
# from multiprocessing.dummy import Pool as ThreadPool


def func(x, y, z):
    sleep(3)
    return x+y, z


if __name__ == '__main__':
    pool = multiprocessing.Pool(processes=6)
    x = np.zeros((6, 1), dtype=int)
    y = np.zeros((6, 1), dtype=int)
    z = np.zeros((6, 1), dtype=int)
    result = []

    for i in range(6):
        x[i,0] = i
        y[i,0] = i
        z[i,0] = i

    xx = np.squeeze(x)
    yy = np.squeeze(y)
    zz = np.squeeze(z)
    c = list(zip(xx, yy, zz))
    print(c)
    cc = np.array(c)
    # print(cc)
    # d = [(0, 0, 0), (1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4), (5, 5, 5)]
    print(datetime.now())
    result = pool.starmap(func, c)
    print(result)
    print(datetime.now())