How to use multiprocessing with pytorch?

I'd like to know how to use multiprocessing in pytorch.

Here's my "normal" code:

import torch 
import time
dtype = torch.FloatTensor

N       = 10
rho     = 0.2
alpha   = 0.6;
epsilon = 0.001;
mu      = 2*torch.rand(1,1).type(dtype)-1; # init mu
sig     = 5;                               # initial std dev.
k       = 0;
while (sig > epsilon):
    x            = mu + sig*torch.randn(N,1).type(dtype)
    S            = -x**2 + 100
    sorted_v , I = torch.sort(S,0)
    mu           = alpha*torch.mean(x[I[int((1-rho)*N):N,0]]) + (1-alpha)*mu
    sig          = alpha*torch.std(x[I[int((1-rho)*N):N,0]])  + (1-alpha)*sig

xm=torch.mean(x)
ym=-xm**2+100

What I'd like to do is the calculation of mu and sig, inside the while loop, into different cores of my computer. Is that possible, how can I do it?

All I know is that I need to import multiprocessing library :

import torch.multiprocessing as mp

And to define the number of cores:

num_processes = 2 (in my case)

Thank you.