PyDev + mpi4py->通过 shellscript / mpirun 运行

发布于 2024-12-29 04:30:05 字数 376 浏览 2 评论 0原文

我想创建使用 mpi4py 的 python 程序,因此我想使用以下命令运行它们:

mpirun -np 4 python script.py

我尝试创建一个执行此操作的 shell 脚本并将其用作 python 解释器,但是eclipse 拒绝 shell 脚本。我尝试重定向输出(以便它不显示 mpi 内容,但仅打印第一个节点的 python 输出)。

如果我使用 interpreterinfo.py 脚本在控制台中运行脚本来测试解释器,它会提供与仅通过 python 运行它完全相同的输出。

不知怎的,脚本似乎没有被 Eclipse 正确执行,或者输出没有进入标准输出。

有人可以帮忙吗?

I'd like to create python programs that use mpi4py and thus I'd like to run them using the following command:

mpirun -np 4 python script.py

I tried to create a shell script which does this and use it as a python interpreter but eclipse rejects the shell script. I tried to redirect the output (so that it doesen't show the mpi-stuff but soley prints the python-output of the first node).

If I run the script in the console using the interpreterinfo.py script to test the interpreter it gives exactly the same output as if I run it only through python.

It somehow seems that the script isn't executed properly by eclipse or that the output is not going into stdout.

Can anyone help?

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

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

发布评论

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

评论(1

下雨或天晴 2025-01-05 04:30:05

我认为您不应该尝试将 mpirun 配置为 python 解释器...相反,像往常一样配置 python 解释器,然后创建一个 python 模块来为您启动并启动该模块...(或者在 run > external tools 中创建外部启动)

奇怪的是 mpirun 是实际的 python 解释器,因为这样当请求内置代码完成时,pydev 将启动 mpirun 并为代码创建 4 个进程 -完成?这同样适用于其他事情,例如调试、覆盖率等......

I don't think you should try to configure mpirun as the python interpreter... Instead, configure the python interpreter as usual and just create a python module that'll do the launching for you and launch that module instead... (or create an external launch in run > external tools)

It'd be strange that mpirun is the actual python interpreter, because that way when requesting a code completion for builtins, pydev would launch the mpirun and it'd create 4 processes for code-completion? The same would apply to other things such as debug, coverage, etc...

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