0
$\begingroup$

Is it possible to specify particular task to a particular kernel to be evaluated in parallel?

$\endgroup$

1 Answer 1

2
$\begingroup$
krs=LaunchKernels[]; (*It launches 6 kernels by default on my PC*)

ParallelEvaluate[a = 1 + 1, krs[[5]]];

ParallelEvaluate[Names["a"]]

The output is like:

{{}, {}, {}, {}, {"a"}, {}}

$\endgroup$
2
  • $\begingroup$ What I am looking for is to evaluate two expressions with each executed on different kernel in parallel. For example, I want to evaluate 1+1 on kernel 1, and 2+2 on kernel 2. $\endgroup$
    – SleekTitan
    May 23, 2020 at 13:34
  • $\begingroup$ @SleekTitan, I understood. Try ParallelEvaluate as I shown with corresponding second argument for choosing the kernel. The krs[[5]] means the fifth one. $\endgroup$
    – Rom38
    May 24, 2020 at 3:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.