Skip to content

Commit

Permalink
Add OpenACC and OpenMP directives
Browse files Browse the repository at this point in the history
  • Loading branch information
xylar committed May 11, 2024
1 parent add9e24 commit 6bfe4a6
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions components/mpas-framework/src/operators/mpas_vector_operations.F
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,16 @@ subroutine mpas_vector_cell_to_edge_anisotropic(zonalCell, meridionalCell, &

integer :: iEdge, cell1, cell2

#ifdef MPAS_OPENACC
!$acc parallel loop &
!$acc present(cellsOnEdge, zonalCell, meridionalCell, &
!$acc zonalEdge, meridionalEdge) &
!$acc private(cell1, cell2)
#else
!$omp parallel
!$omp do schedule(runtime) &
!$omp private(cell1, cell2)
#endif
do iEdge = 1, nEdges
cell1 = cellsOnEdge(1, iEdge)
cell2 = cellsOnEdge(2, iEdge)
Expand All @@ -351,6 +361,9 @@ subroutine mpas_vector_cell_to_edge_anisotropic(zonalCell, meridionalCell, &
meridionalEdge(iEdge) = 0.5_RKIND * (meridionalCell(cell1) + &
meridionalCell(cell2))
end do
#ifndef MPAS_OPENACC
!$omp end do
#endif

end subroutine mpas_vector_cell_to_edge_anisotropic!}}}

Expand Down Expand Up @@ -415,6 +428,17 @@ subroutine mpas_vector_cell_to_edge_isotropic(zonalCell, meridionalCell, &

real (kind=RKIND) :: area, areaSum, zonal, meridional

#ifdef MPAS_OPENACC
!$acc parallel loop gang vector &
!$acc present(verticesOnEdge, cellsOnVertex, kiteAreasOnVertex, &
!$acc zonalCell, meridionalCell, &
!$acc zonalEdge, meridionalEdge) &
!$acc private(areaSum, area, v, c, iVert, iCell)
#else
!$omp parallel
!$omp do schedule(runtime) &
!$omp private(areaSum, area, v, c, iVert, iCell)
#endif
do iEdge = 1, nEdges
zonalEdge(iEdge) = 0.0_RKIND
meridionalEdge(iEdge) = 0.0_RKIND
Expand All @@ -437,6 +461,9 @@ subroutine mpas_vector_cell_to_edge_isotropic(zonalCell, meridionalCell, &
zonalEdge(iEdge) = zonalEdge(iEdge) / areaSum
meridionalEdge(iEdge) = meridionalEdge(iEdge) / areaSum
end do
#ifndef MPAS_OPENACC
!$omp end do
#endif

end subroutine mpas_vector_cell_to_edge_isotropic!}}}

Expand Down

0 comments on commit 6bfe4a6

Please sign in to comment.