Open BeverlyCrl opened 5 months ago
Do you mean code like this one
mesh%half_kds
But in Fortran, that means half_kds
is a member of mesh
.
mesh
here is like the struct
in C++
Here’s an example of a basic derived type:
type :: t_pair
integer :: i
real :: x
end type
The syntax to create a variable of type t_pair
and access its members is:
! Declare
type(t_pair) :: pair
! Initialize
pair%i = 1
pair%x = 0.5
The percentage symbol %
is used to access the members of a derived type.
Do you mean code like this one
mesh%half_kds
But in Fortran, that meanshalf_kds
is a member ofmesh
.mesh
here is like thestruct
in C++
I think I mistakenly recorded the meaning of the operator%
and let me modify my description of the problem
Here’s an example of a basic derived type:
type :: t_pair integer :: i real :: x end type
The syntax to create a variable of
type t_pair
and access its members is:! Declare type(t_pair) :: pair ! Initialize pair%i = 1 pair%x = 0.5
The percentage symbol
%
is used to access the members of a derived type.
I have rephrased the potential issues here, which may provide new ideas. Thank you for your help. I was not aware of this mistake.
在文件adv_mod.F90的末尾,有一个叫作
adv_accum_wind
的函数。其性能消耗如下:其中第一部分浅黄色运用了运算符
%
,大致含义类似于C语言中的.
。这里的消耗主要是来自于chen成员调用的复制与拷贝。 第二部分则是涉及到的下层函数adv_batch
。 可以考虑优化这两个部分。 其中第一部分可能需要对调用该函数的数据进行一些了解,可能存在类似于更换库函数之类的优化方法,但不是简单修改代码能够搞定的。 第二部分涉及到整个adv_batch_mod.F90
文件,在这个部分中能够找到一些类似迭代步进的代码,这往往是主要耗时的part,详细可以见下面的图片。整个文件中有一些算数运算和循环嵌套的情况,也许可考虑并行,访存优化,数学化简等方式。 (迭代步进指的是下面图片上提到的399~433,能够明显看出这里面的步进逻辑)以下是图片帮助你找到我描述的位置: