运行gfortran时巨大的Fort.#文件 [英] Huge fort.# files when running gfortran

查看:70
本文介绍了运行gfortran时巨大的Fort.#文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为应用程序使用gfortran,并通过Matlab mex 文件运行Fortran.我注意到在Mac上运行Fortran文件时,在当前目录中,它会创建一个 fort.9 fort.16 文件,其中9或16是一些任意数字.最近,我注意到这些 fort.文件可能很大(GB)!通常,它们很小,例如几kB.我只是想知道这些文件有什么目的?其次,我的代码中是否存在导致它们过大的错误?我只是觉得它们如此大而感到非常怀疑.

I am using gfortran for an application and running the Fortran through a Matlab mex file. I have noticed that in the current directory when I run the Fortran file, on my mac, it creates a fort.9 or fort.16 file, where the 9 or 16 are some arbitrary number. Recently, I have noticed that these fort. files can be GBs big! Generally they are quite small, like a few kBs. I was just wondering what purpose these files have? And second, is there some error I have in my code that is causing them to be so large? I just find it to be very suspicious that they are so large.

我正在从 http://hpc.sourceforge.net运行GNU Fortran(GCC)5.0.0 20140824(实验性)/,而我的Mac版本是OSX 10.8.5.

I am running GNU Fortran (GCC) 5.0.0 20140824 (experimental) from http://hpc.sourceforge.net/ and my version of mac is OSX 10.8.5.

推荐答案

在Fortran中,与大多数其他语言相反,无需先打开它就可以写入一个单元(〜=文件对象或某些其他语言的文件描述符)(将本机连接到文件).在这种情况下,gfortran会在当前工作目录中隐式创建一个名为"fort.N"的文件,其中N是单位编号(其他编译器可能会执行其他操作,但通常会执行类似操作).

In Fortran, contrary to most other languages, one can write to a unit (~=file object, or file descriptor in some other languages) without first opening it (connecting the unit to a file). In that case, gfortran will implicitly create a file in the current working directory called 'fort.N', where N is the unit number (other compilers may do something else, but generally do something similar).

因此,为了回答您的问题,您在代码中向这些单元编写了东西.为什么这样做,我很明显不能不看所讨论的代码而说.

So to answer your question, in your code you're writing stuff to those units. Why you're doing that I cannot obviously say without looking at the code in question.

这篇关于运行gfortran时巨大的Fort.#文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆