Skip to main content
20 votes

Restarting Mathematica automatically

You could launch a different kernel and use that to run the computation. You will be controlling this "slave kernel" from another Mathematica session. This will allow you to script even quitting and ...
Szabolcs's user avatar
  • 236k
18 votes

What secrets are hidden away in your init.m and where do you place it? Please help me build the ideal init.m

I am an init.m ascetic. And I doubt after 30+ years of using Mathematica I will change. Everyone else, who wishes to, may proclaim how it is indispensable to their workflow, and I will accept their ...
16 votes
Accepted

Detecting kernel initialization

Apparently, Throw is deactivated during kernel initialization. The following function can determine if Throw is inoperative: <...
WReach's user avatar
  • 69.2k
14 votes

Detecting kernel initialization

After some spelunking, I found a file which contains a lot of initialization code, including reading the kernel init.m file, loading ...
Szabolcs's user avatar
  • 236k
11 votes

What secrets are hidden away in your init.m and where do you place it? Please help me build the ideal init.m

I tend to put a lot of little functions in my init.m file, functions that take arguments and use module variables. I found that I would now have Global symbols like ...
10 votes

Different strategies to get a clean Kernel. Quit, Exit, ClearAll, Remove, CleanSlate?

PREVENTION This is a Community Wiki answer, experienced users are welcome to add to it and correct mistakes. Best practice is to avoid the need to clean the kernel at all, by avoiding the creation ...
9 votes

Different strategies to get a clean Kernel. Quit, Exit, ClearAll, Remove, CleanSlate?

NEW KERNEL This is a Community Wiki answer, experienced users are welcome to add to it and correct mistakes. To get a fresh kernel for the current notebook, one can either kill the current kernel ...
9 votes

Restarting Mathematica automatically

On Windows you can run your cycles in a batch file like this: ...
Chris Degnen's user avatar
9 votes
Accepted

Parallel computing: cores vs threads

It seems I misunderstood the kind of threading you were addressing when writing my original reply (below). For internally multithreaded functions launched from a single kernel I you can limit the ...
Mr.Wizard's user avatar
  • 273k
9 votes

Choose the number of kernels used by ParallelTable

Another way from the menu (if accessible): Edit $ \rightarrow $ Preferences $ \rightarrow $ Parallel $ \rightarrow $ Local Kernels $ \rightarrow $ (Number of local kernels to use) Manual setting
Αλέξανδρος Ζεγγ's user avatar
8 votes
Accepted

How to automatically do a computation, Quit[], restart and do a new computation

You can start a fresh extra kernel programmatically from your current notebook using MathLink. You can then load packages in that kernel, perform necessary calculations, get the result back to your ...
Ray Shadow's user avatar
  • 7,876
8 votes
Accepted

Choose the number of kernels used by ParallelTable

You can launch as many or as few kernels as you like, see LaunchKernels and CloseKernels. Parallel functions will use as many as ...
Szabolcs's user avatar
  • 236k
7 votes

What secrets are hidden away in your init.m and where do you place it? Please help me build the ideal init.m

...
6 votes
Accepted

Package loading in init.m

Not all packages can be loaded on startup. There are some operations that simply do not work during startup, the most prominent one being Throw/...
Szabolcs's user avatar
  • 236k
6 votes
Accepted

Kernel starts up very slowly on Linux

I don’t know if the problem you encountered is the same as the problem described in this post. If the same, you need to disable automatic updates. This failure is caused by the paclet update system. ...
A little mouse on the pampas's user avatar
6 votes

What secrets are hidden away in your init.m and where do you place it? Please help me build the ideal init.m

...
6 votes
Accepted

Mathematica can't communicate with subkernels

So in case anyone else has the same problem in the future. It seems that it was a problem with the license-server of my workplace, which only allows a certain number of processes at the same time. ...
cmh99's user avatar
  • 91
5 votes
Accepted

How to set up Wolfram Language cluster with only the command line interface

I was able to get this working and it was simpler than I thought. The Parallel Computing Tools documentation was very helpful (specifically here for manual launching of the remote kernels). Note: I ...
Sean Lynch's user avatar
  • 1,079
5 votes

What secrets are hidden away in your init.m and where do you place it? Please help me build the ideal init.m

As I mentioned in a comment, I do not use an init.m file, I paste my frequently used functions from project notebook to project notebook as an initialization cell. That having been said, my ...
5 votes

How do I launch a kernel under Rosetta when I'm running the FrontEnd natively on Apple Silicon?

The more obvious way to do this is to create a script the launches the kernel and then point the FE to that. The following is a simple script for this purpose. Create it using your favourite text ...
Itai Seggev's user avatar
  • 14.2k
5 votes

How do I launch a kernel under Rosetta when I'm running the FrontEnd natively on Apple Silicon?

I'm adapting ihojnicki's comment into a second, independent answer, because this is more of a "grab and go" answer. I'll leave my original answer more or less unchanged for greater context. ...
Itai Seggev's user avatar
  • 14.2k
4 votes

Remote Kernel - Error = MLECONNECT

This solution is tested for M11.2 for macOS client and Linux server. Create a password-less ssh login. Generated a public and private ssh key on the local machine (mac) and then copy the public key ...
Karolis's user avatar
  • 1,639
4 votes

Seeking strategies to deploy a function securely without a front end

Contrary to what most people say (including people working at Wolfram), you do not need Mathematica to run Wolfram Language scripts. What you need is a MathKernel and the wolframscript interface. You ...
Fortsaint's user avatar
  • 2,060
4 votes
Accepted

Launching remote kernel--increase timeout time

You can use SetSystemOptions to increase the timeout used upon launching remote kernels: SetSystemOptions["ParallelOptions" -> "MathLinkTimeout" -> 20.]
sakra's user avatar
  • 5,230
4 votes

Different strategies to get a clean Kernel. Quit, Exit, ClearAll, Remove, CleanSlate?

The following may not be so useful in packages, but in open notebook evaluation the kernel can be repeatedly quit like so, using a tip from Arnoud Buzing. In this case the orange cells evaluate ...
Chris Degnen's user avatar
4 votes
Accepted

How to use deep clones in Mathematica

If you need to make a variable available for many threads in parallel computing, you should check out DistributeDefinitions. If you need parallel processing, you ...
Johu's user avatar
  • 4,968
4 votes
Accepted

Formatting error in Mathematica 12

Following the advice of the Wolfram Technical Support I have performed a clean start of Mathematica. All the preferences and history were removed in the process but the problem was solved.
B. Naskrecki's user avatar
4 votes

Mathematica never stop when running Needs["CCompilerDriver`"]

I solved this issue myself by accident. I usually put Needs["CCompilerDriver`"] in init.m file, and I found even if I closed the frozen Mathematica, I can not delete the init.m file. Then I ...
matheorem's user avatar
  • 17.3k
3 votes

Remote Kernel - Error = MLECONNECT

tl;dr If you use macOS and there are spaces in the path to (or name of) the Mathematica app, remove those spaces! I believe that this error is shown when the process started by the Front End (that is ...
Szabolcs's user avatar
  • 236k
3 votes

Different strategies to get a clean Kernel. Quit, Exit, ClearAll, Remove, CleanSlate?

Cleaning This is a Community Wiki answer, experienced users are welcome to add to it and correct mistakes. Most of the solutions are already listed in the question. ...

Only top scored, non community-wiki answers of a minimum length are eligible