Leockl:

import numpy as np
import torch
from torch.multiprocessing import Pool

X = np.array([[1, 3, 2, 3], [2, 3, 5, 6], [1, 2, 3, 4]])
X = torch.DoubleTensor(X).cuda()

def X_power_func(j):
    X_power = X**j
    return X_power

if __name__ == '__main__':
  with Pool(processes = 2) as p:   # Paralleizing over 2 GPUs
    results = p.map(X_power_func, range(8))

results



By default, doing .cuda() will copy your tensor to device cuda:0. I do not see anywhere you have specified the device ids for multiple GPUs. Besides, results outside the scope of main will result in error. CUDA initialization error will be gone by using  mp.set_start_method('spawn', force=True) before spawning the process pool, however, that would still not give you a correct implementation for what you are trying to do.