Use this code for reference for parallelism on CPU.
from multiprocessing import Process, Manager

# Common function
def my_func(x, output_dict):
    out = x**2
    output_dict[x] = out

input = [1, 2, 3, 4]

# Create manager for shared variable (output_dict)
manager = Manager()
output_dict = manager.dict()

# Instantiate process with arguments
procs = []
for i in input:
    proc = Process(target=my_func, args=(i, output_dict))
    procs.append(proc)
    proc.start()
    
# Complete the processes
for proc in procs:
    proc.join()

print(output_dict.items())
# [(1, 1), (2, 4), (3, 9), (4, 16)]