並列性:メモリ制限しきい値を超えると、長期実行の進行を一時停止(スワップアウト)します。

並列性:メモリ制限しきい値を超えると、長期実行の進行を一時停止(スワップアウト)します。

10GBのRAMと無制限のスワップスペースがあるとしましょう。

10個のジョブを並列に実行したいです(gnu並列はオプションですが、必ずしも唯一ではありません)。これらの操作にはますます多くのメモリが必要ですが、最初は小さく開始されます。これは、それぞれ1つのコアで実行されるCPU集約的なタスクです。

たとえば、各ジョブが10時間実行され、起動時に500 MB、完了後に2 GBのメモリが必要であり、メモリが直線的に増加すると仮定します。したがって、線形的に増加すると仮定すると、6時間40分でこれらの操作は使用可能なメモリの10GBを超えることになります。

これらのタスクが常にRAMで実行されるようにどのように管理できますか?停止するそれらのいくつかは処刑され、残りは脱出させますか?

GNUパラレルはこれを行うことができますか?

ベストアンサー1

6月から状況が変わりました。

これでGitバージョンe81a0ebaが利用可能になりました。--memsuspend

--memsuspend size (alpha testing)

Suspend jobs when there is less than 2 * size memory free. The size can be
postfixed with K, M, G, T, P, k, m, g, t, or p which would multiply the size
with 1024, 1048576, 1073741824, 1099511627776, 1125899906842624, 1000,
1000000, 1000000000, 1000000000000, or 1000000000000000, respectively.

If the available memory falls below 2 * size, GNU parallel will suspend some
of the running jobs. If the available memory falls below size, only one job
will be running.

If a single job takes up at most size RAM, all jobs will complete without
running out of memory. If you have swap available, you can usually lower
size to around half the size of a single jobs - with the slight risk of
swapping a little.

Jobs will be resumed when more RAM is available - typically when the oldest
job completes.

おすすめ記事