Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am running Mathematica on a computer with mulicpu and every cpu has multicore. I am wondering if there exist a method to send different cell evaluation to different core? So if I already have a cell being evaluating for a long time, I can still add other cells into evaluation at the same time, while won't have to stop the current evaluation or wait until the current evaluation to be done.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You can use the Evaluator option of Cell for this. You should define several kernels through the Kernel Configuration Options... dialog, then you can use a name of configured kernel as value for the Evaluator option.

For example, create new local kernel with name "My". Then generate an Input Cell by the following code:

CellPrint@Cell[BoxData[MakeBoxes[Do[Print[n]; Pause[1], {n, 20}]]], "Input", Evaluator -> "My"]

In another Cell just type Do[Print[n]; Pause[1], {n, 20}] and evaluate both Cells with Do expressions simultaneously by selecting them and then pressing Shift+Enter. You will see that results of the evaluations are printed in parallel.

share|improve this answer
    
Hi, thank you for your reply. But I'm afraid that Evaluator doesn't related to my problem. I know the Kernel Configuration. But this option configure remote kernels. What I am talking about is multicore in one kernel. –  matheorem Aug 27 '13 at 6:26
    
@matheorem Multithreading is implemented in Mathematica through launching several kernels. It is not possible to force one kernel to perform several computations in parallel. And the Kernel Configuration Options... dialog allows to set up several local kernels, not only remote kernels. –  Alexey Popkov Aug 27 '13 at 7:28
    
What does several local kernel mean? I only have one local kernel –  matheorem Aug 27 '13 at 7:29
    
Local kernels are available on your local machine to perform computations. You can assign different kernels to different Noteboks and/or different Cells in one Notebook. You can also configure when these kernels should be launched: when Mathematica starts or only when you need them. See options in the Kernel Configuration Options... dialog (press the Add button). –  Alexey Popkov Aug 27 '13 at 7:33
    
I tried. But add a local kernel with a different name, doesn't work at all. Use`ExpressionCell[expr, "Input", Evaluator -> "Local"]`, two cell with different local evaluator still run in sequence. –  matheorem Aug 27 '13 at 7:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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