How to continue an OpenMP directive on the next line in free-from Fortran? [duplicate]

蹲街弑〆低调 提交于 2021-01-28 11:16:36

问题


I have a line of a Fortran code, e.g.,

    !$omp do private(aa, bb, cc) schedule(dynamic) reduction(+:alpha, beta, gamma) 

Suppose this line contains several arguments and the length exceeds 132 characters, gfortran will lead to error message. I tried to use & to break the line. But I am not sure how to start the next line. As other case, directly start the next line without ! leads to Error: Syntax error in OpenMP variable list at (1).

How to break the 132 characters limit for omp line?


回答1:


You can write multiline omp statements by ending with & and staring a newline with $omp.

Example

!$omp do private(aa, bb, cc) &
!$omp schedule(dynamic)      &
!$omp reduction(+:alpha, beta, gamma) 
...
!$omp end do


来源:https://stackoverflow.com/questions/65370715/how-to-continue-an-openmp-directive-on-the-next-line-in-free-from-fortran

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!