1

我正在尝试执行应该只使用一个核心的 Matheamtica 脚本。在第一行我放了 LaunchKernels[1]; 然而,当脚本运行时,所有计算机的内核都被分配(总共 96 个)。当然,我想使用 bash 脚本运行 96 个脚本副本。

有没有办法设置 Mathematica 可以使用的 Mathematica 内核的最大数量关闭?

我按如下方式启动脚本(实际上我使用循环并将 16 存储在变量中,但我想这并不重要):

/usr/local/bin/MathKernel -script appr.m test_16.00/full.dat test_16.00/one.dat

最后两个字符串只是输入和输出文件名。

4

1 回答 1

1

You can configure the maximum number of Mathematica kernels that will be used with the dialog:
Edit > Preferences > Parallel in the Parallel Kernel Configuration section.

You can then limit the number of threads that will be used by the Intel Math Kernel Library, which Mathematica uses for a number of machine-precision operations, with the System Option setting:

SetSystemOptions["MKLThreads" -> 1]

Related question on the proper Mathematica Stack Exchange site:
How to force an evaluation to use only one core?

于 2013-09-18T06:10:47.327 回答