Parallel kernels are not reading the init.m files in $UserBaseDirectory/Autoload since version 11.2. The master kernel reads it fine. In earlier versions of Mathematica parallel kernels read these init.m files. Any suggestions?
Asked
Active
Viewed 175 times
6
Szabolcs
- 234,956
- 30
- 623
- 1,263
Chris Degnen
- 30,927
- 2
- 54
- 108
1 Answers
4
This works
Parallel`Developer`$InitCode=Hold[Get[FileNameJoin[{$BaseDirectory,"Kernel","init.m"}]]]
c/o Register "initialization code" to run on any newly started parallel kernel
However, it is undocumented.
Chris Degnen
- 30,927
- 2
- 54
- 108
init.mis definitely not evaluated on parallel kernels. – Szabolcs Jan 17 '18 at 16:39FileNameJoin[{$InstallationDirectory, "AddOns", "Autoload", "Kernel", "init.m"}]in 11.0 and 11.1. The key could be theAutoloadpart. I realise this is a non-standard (or very old) location but it worked, up until 11.2. – Chris Degnen Jan 17 '18 at 16:57Kernel/init.m. A package itself may (and should) contain aKernel/init.m. Thisinit.mhas nothing to do with$UserBaseDirectory/Kernel/init.m—it's not an alternative for it. When you putKernel/init.min Autoload it considered that a package. – Szabolcs Jan 17 '18 at 17:55sysinit.mfile used to have a check for the-noinitoption, which would control ifKernel/init.mshould load. It also contained the code to load Autoload stuff (unconditionally). None of this is present insysinit.manymore in 11.2. These files must be loading by another mechanism. – Szabolcs Jan 17 '18 at 18:05$(User)BaseDirectory/Kernel/init.mis read, but howAutoloadpackages are read? – Szabolcs Jan 18 '18 at 10:23Autoloadworks, and the documentation isn't great. I tried putting the init.m inC:\ProgramData\Mathematica\Autoloadbut it didn't work, (not even for the main kernel). I'll try again later. – Chris Degnen Jan 18 '18 at 16:44init.mwithin Autload will be loaded, but I haven't had time to look at it in detail yet. I found the file where the loading code was moved to. It's notsysinit.mbutInitialization....m, forgot the exact name. – Szabolcs Jan 19 '18 at 15:26$(User)BaseDirectory/Kernel/init.mhas never been read by the parallel kernels. What changed in 11.2 is that nowinit.mfiles in various locations within theAutoloaddirectory also don't load on parallel kernels. – Szabolcs Mar 14 '18 at 12:21