English 中文(简体)
什么是?
原标题:What is _IO_wfile on a gprof output of a fortran code?

我有一些专栏编码,如果是简编者,则由专栏汇编成。 当我用提夫进行情况简介测试时,我发现,大部分时间用于国际交易日志的运作,我想到档案的终结,但我不能再找到这方面的文件:

index % time    self  children    called     name
                                                 <spontaneous>
[1]     20.6    0.07    0.00                 _IO_wfile_seekoff [1]
-----------------------------------------------
                                                 <spontaneous>
[2]     20.6    0.07    0.00                 sforcepf_ [2]
-----------------------------------------------
                                                 <spontaneous>
[3]     20.6    0.02    0.05                 _IO_wfile_underflow [3]
                0.01    0.04  258716/258717      strncmp [4]
-----------------------------------------------
                0.00    0.00       1/258717      _IO_wdefault_doallocate [15]
                0.01    0.04  258716/258717      _IO_wfile_underflow [3]
[4]     14.7    0.01    0.04  258717         strncmp [4]
                0.04    0.00 3104592/3109256     strerror_r [5]
-----------------------------------------------
                0.00    0.00    4664/3109256     __strcmp_sse42 [14]
                0.04    0.00 3104592/3109256     strncmp [4]
[5]     11.8    0.04    0.00 3109256         strerror_r [5]
-----------------------------------------------

因此,问题是,这种国际交易日志是否具体针对于六氯环己烷,还是指向于否,还是属于排期? 我正试图优化这一法典,并发现这条术语在角度上毫无用处。

最佳回答

页: 1 《英特尔论坛》的汇编者将这些声明翻译成组装,包括要求系统运作。 例如,<代码>strncmp是一种ISO C标准功能,可比较部分指示。 因此,我想到的是,为比较插图撰写了定本说明,而英特尔Fortran汇编者则要求具备实施比较的现有职能。 其中一些系统职能本身将(部分)通过呼吁在你的平台上提供更为基本的职能来执行。

<代码>gprof正在显示您对您汇编产品中所提及的功能的呼声。 你们所看到的大多数具体内容是:在Windows机器上,I/O将使用具有不同名称的类似功能。 您认为的某些内容是英特尔汇编者所特有的,所有英特尔汇编者都使用同一功能(通过电话传送)进行某些业务,而且这一功能使用平台特定较低层次的职能。

除非你准备重新履行这些低级职能,并冒着你利用同样职能为其他方案而施压的风险,否则,你能够作出的唯一选择就是要少报。 例如,如果你有理由认为,阅读档案的过去是一项昂贵的I/O操作,如果你的方案战略要读到文件,直到你阅读过去,然后处理所产生的错误,那么你可能希望执行上级方案战略。 这比重写处理贵战略后果的低层次的I/O常规更为容易。

问题回答

附录一

loop for a long time
  write something to somewhere

页: 1

gprof suspends sampling during IO or any other blocked state. This program does very little, period, but of the cycles it does spend, most of them are spent going in and out of the built-in library routines that start IO and wait for it to finish.

因此,如果你的方案如此,那就毫不奇怪了。

这个问题还有很多。

就像你一样,看到了Fortran I/O的行动。 <代码>ifort格式相当缓慢。 如果使用标准投入/标准产出重新定向,则更糟;而且管道——英特尔公司,特别警告不要这样做。 <>p>gfortran/code>并非差不多,但依然很缓慢。

某些可能性是:

  • try to do as few I/O calls as possible (e.g. move them out of loops)
  • avoid redirection and read/write files directly instead
  • check blocksize, buffercount and other I/O related options in open()

If this is insufficient, and I/O is your major bottleneck, you may consider:

  • looking into stream I/O in ifort, it is faster, and you can do things like buffering yourself, to avoid making multiple calls. It may, however, introduce portability problems since other compilers may not support it yet or do it differently. Don t do it on standard input/output (might work in ifort, but it s undocumented, and won t work with other compilers).
  • using iso_c_binding to call a C function -- e.g. if you are writing to standard output, you can call puts() from libc. This is even faster and actually quite portable since it s standard, and in fact every compiler on every OS I ve done it on (Win32/linux64/sparc solaris) requires (and automatically links) libc anyway; but it s rather ugly, and you have to take care of things like null-termination yourself (e.g. by writing a wrapper function), which obscures code and can induce bugs.
  • Don t mix any of these methods with regular I/O on the same file!!

如果你在你的法典中明确作比较,这些比较最终也将称作strncmp(>。 如果ort(尽管与I/O一样,没有处处差),那么,如果你做比较的话,你可以直接打电话<条码>>(<>strncmp(>),获得几秒,但我要就此提出建议——这一收益不是很大,而且再次掩盖了该法典。





相关问题
How do I fix this Fortran text parser for Lapack within Gem5

After about an hour, I need to ask for some help. I ve downloaded the math benchmark Lapack to run within a few CPU configurations for the simulation tool Gem5, which lets you build X86 computers and ...

gfortran, DLL, underscore

I want to access some subroutines from a third party DLL. The functions use STDCALL as the calling convention. Running dumpbin /export foo.dll gives me something like: ... 7 6 ...

Getting started with a new code in an unfamiliar language

I m starting a new project in a language I m less familiar with (FORTRAN) and am in the discovery phase. Normally reading through and figuring out code is a fairly simple task, however, this code ...

assigning values to an integer array within a Fortran module

I have a module in Fortran called QFoo. It defines a type QFooType. I want to initialize all the elements of integer array is_n to 0 and want to do it within the module. Could someone help? Thank ...

WinDbg and Intel Visual Fortran

Has anyone used WinDbg to debug an Intel Visual Fortran routine? If I have the Fortran source file that crashes with an AccViol, how can I use WinDbg to determine the line that is crashing?

converting MATLAB code to Fortran [closed]

I a medical researcher with code written in MATLAB 2009b that runs very slowly because of a self-referential loop (not sure of the programming lingo here), i.e., the results of the first iteration is ...

热门标签