Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Need-attention-to]about func "adv_accum_wind" in file "adv_mod.F90" #17

Open
BeverlyCrl opened this issue Mar 27, 2024 · 4 comments
Open
Assignees
Labels
help wanted Extra attention is needed

Comments

@BeverlyCrl
Copy link
Collaborator

BeverlyCrl commented Mar 27, 2024

在文件adv_mod.F90的末尾,有一个叫作adv_accum_wind的函数。其性能消耗如下:
image
其中第一部分浅黄色运用了运算符%,大致含义类似于C语言中的.。这里的消耗主要是来自于chen成员调用的复制与拷贝。
第二部分则是涉及到的下层函数adv_batch
可以考虑优化这两个部分。
其中第一部分可能需要对调用该函数的数据进行一些了解,可能存在类似于更换库函数之类的优化方法,但不是简单修改代码能够搞定的。
第二部分涉及到整个adv_batch_mod.F90文件,在这个部分中能够找到一些类似迭代步进的代码,这往往是主要耗时的part,详细可以见下面的图片。整个文件中有一些算数运算和循环嵌套的情况,也许可考虑并行,访存优化,数学化简等方式。
(迭代步进指的是下面图片上提到的399~433,能够明显看出这里面的步进逻辑)

以下是图片帮助你找到我描述的位置:
image
image

@BeverlyCrl BeverlyCrl added the help wanted Extra attention is needed label Mar 27, 2024
@BeverlyCrl BeverlyCrl self-assigned this Mar 27, 2024
@Jonathan523
Copy link
Collaborator

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++

@Jonathan523
Copy link
Collaborator

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.

@BeverlyCrl
Copy link
Collaborator Author

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++

I think I mistakenly recorded the meaning of the operator% and let me modify my description of the problem

@BeverlyCrl
Copy link
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants