我的 Fortran 代码的输出被杀死了,有什么建议吗?

发布于 2024-09-16 11:54:48 字数 212 浏览 6 评论 0原文

我正在尝试在 ssh 上运行一个非常适合较小网格的代码,但由于新网格更大,我使用 ifort 命令来编译它, ifort -mcmodel=medium -i-dynamic -otest.out*.f

并且它符合要求,但是当我运行它时,输出是: 杀死了

我知道问题出在记忆中,有谁知道是否有任何方法可以运行它? 我如何理解代码中的何处导致内存问题?

谢谢 沙迪

I'm trying to run a code on ssh that works perfect for a smaller mesh , but since the new mesh is much bigger i used ifort command to compile it,
ifort -mcmodel=medium -i-dynamic -otest.out*.f

and it complies but when i run it , the output is:
killed

i know that problem is from memory, does anyone know if there's any way to run it?
how can i understand where in code cause memory problem?

Thanks
shadi

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

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

发布评论

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

评论(2

稳稳的幸福 2024-09-23 11:54:48

从 ifort 命令行,我认为您正在 Linux 上运行。

将“killed”视为输出通常是 Linux 内存不足杀手 (OOM) 介入以防止即将发生的崩溃的结果(因为应用程序请求更多内存的常见做法是,它们需要比当前可用的内存更多的请求)已接受 - 检查系统日志文件中是否有“内存不足:已终止进程 [PID] [进程名称]”。 OOM 杀手通常非常擅长处理负责使用所有内存的应用程序,因此从应用程序的内存使用情况开始。

首先要做的就是尝试估计(即使只是粗略地)您希望应用程序使用多少内存。一种方法是估计主要数组的大小并将其乘以每个元素所需的位数。另一种方法是考虑内存使用如何随着网格大小而增长。您可以通过实验(使用不同的网格大小运行,测量内存使用情况并推断)或通过一次测量和了解主要阵列如何缩放来研究这一点。您可能需要比机器上更多的内存:解决方案可能是访问更大的计算机。 (或者您可以尝试找到使用更少内存的替代算法。)

如果是内存泄漏,您应该会看到比预期更多的内存使用量,即使对于较小的网格尺寸也是如此。如果是这种情况,valgrind 应该会有所帮助。从静态存储转移到动态存储可能不会有帮助 - 如果您刚刚超出堆栈上的可用空间,我希望看到分段错误。

From the ifort command line, I think you are running on Linux.

Seeing "killed" as output is generally the result of Linux's Out Of Memory killer (OOM) getting involved to prevent an impending crash (because it's common practice for applications to ask for more memory then they need requests for more memory than is currently available are accepted - check for "Out of Memory: Killed process [PID] [process name]" in the system log files). The OOM killer is generally pretty good at disposing of the application responsible for using all the memory, so the place to start is your applications memory usage.

The first thing to do is try and estimate (even if it's only roughly) how much memory you expect your application to use. One approach is to guestimate the size of the major arrays and multiply them by the number of bits needed per element. Another approach is to think about how you would expect the memory use to grow with mesh size. You can study this by experiment (run with different mesh sizes, measure the memory use and extrapolate) or from one measurement and knowledge of how the major array scale. It may be that you are asking for much more memory then you have on the machine: and the solution to this is probably to get a access to bigger computer. (Or you could try and find an alternative algorithm which uses less memory.)

If their is a memory leak you should see more memory use than expected, even for the smaller mesh size. If this is the case, valgrind should help. Moving from static to dynamic storage probably isn't going to help here - I would expect to see a segmentation fault if you were just exceeding the available space on the stack.

泅人 2024-09-23 11:54:48

尝试使用 valgrind。我尝试用它来查找我的 Fortran 代码中的内存泄漏,并取得了很好的成功。

http://valgrind.org/

try using valgrind. i tried it to find memory leaks in my fortran code with good success.

http://valgrind.org/

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