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 ...
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 ...
Community wiki
16
votes
Accepted
Detecting kernel initialization
Apparently, Throw is deactivated during kernel initialization. The following function can determine if Throw is inoperative:
<...
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 ...
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 ...
Community wiki
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 ...
Community wiki
9
votes
Restarting Mathematica automatically
On Windows you can run your cycles in a batch file like this:
...
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 ...
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
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 ...
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 ...
7
votes
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/...
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. ...
6
votes
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. ...
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 ...
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 ...
Community wiki
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 ...
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.
...
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 ...
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 ...
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.]
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 ...
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 ...
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.
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 ...
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 ...
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.
...
Community wiki
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
kernel-startup × 122kernel × 46
parallelization × 28
remote-access × 20
warning-messages × 9
front-end × 8
initialization × 8
notebooks × 7
packages × 6
crash × 6
linux × 6
evaluation × 5
mathlink-or-wstp × 5
files-and-directories × 4
windows × 4
system × 4
automation × 4
manipulate × 3
bugs × 3
programming × 3
performance-tuning × 2
export × 2
variable-definitions × 2
customization × 2
scripting × 2