问题
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