slrum 在多个节点上运行一项作业

发布于 2025-01-15 16:52:00 字数 303 浏览 2 评论 0原文

我有一个 R 脚本,它通过 parallel 和 future 包使用并行计算。在 R 脚本中设置并行配置的代码是:

cl <- parallel::makeCluster(100)
future::plan(cluster, workers=cl)

我正在 HPC 中运行 R 脚本,其中每个节点有 20 个 CPU。什么是 SLRUM 配置以将 R 脚本作为一项作业跨多个节点运行。会:

--cpus-per-task=100 

足够了吗?
谢谢

I have an R script that use parallel computing via the parallel and future packages. The code to set the parallel configuration in the R script is:

cl <- parallel::makeCluster(100)
future::plan(cluster, workers=cl)

I am running the R script in HPC where each node have 20 CPU. What is SLRUM configuration to run the R script as one job across multiple nodes. will:

--cpus-per-task=100 

be sufficient?
Thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

今天小雨转甜 2025-01-22 16:52:00

默认情况下,如果您请求 N 个节点并启动 M 个任务,slurm 会将 M 个任务分配到 N 个节点中。因此,如果您想跨 2 个节点启动 100 个任务,只需指定 --nodes 2--ntasks 100 即可。这 100 个任务(您的 R 脚本将启动 100 次)将分布在 2 个节点上。

但是,如果您只想启动 R 脚本两次(每个节点一次以利用共享内存,并在每个节点内为该单个任务分配 20 个 cpu),那么您可以执行 --nodes 2 <代码>--ntasks 2 --cpus-per-task 20

By default, if you request N nodes and launch M tasks, the slurm will distribute the M tasks in N nodes. So, if you want to launch 100 tasks across 2 Nodes, you just need to specify --nodes 2 and --ntasks 100. The 100 tasks (100 times your R script will be launched) will be spread across 2 Nodes.

But, if you only want to launch your R script twice (one per each node to utilize shared memory and inside each node allocate 20 cpus for that single task) then you can do, --nodes 2 --ntasks 2 --cpus-per-task 20.

缱倦旧时光 2025-01-22 16:52:00

阅读这篇帖子,我意识到我无法在多个节点上运行我的作业,因为它们不共享内存。

Reading this post, I realized that I can not run my job on multiple nodes since they do not share memory.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文