Skip to content

Commit 070cf15

Browse files
committed
polyMPO changes to do increments completely on GPUs
1 parent bba4699 commit 070cf15

3 files changed

Lines changed: 41 additions & 4 deletions

File tree

src/pmpo_c.cpp

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1667,11 +1667,20 @@ void polympo_reconstruct_velocity_with_MPI_f(MPMesh_ptr p_mpmesh){
16671667
mpmesh->assemblyVtx1<polyMPO::MeshF_Vel>();
16681668
}
16691669

1670-
void polympo_init_deluDyn_f(MPMesh_ptr p_mpmesh){
1670+
void polympo_init_deludelvDyn_f(MPMesh_ptr p_mpmesh){
16711671
checkMPMeshValid(p_mpmesh);
16721672
auto p_mesh = ((polyMPO::MPMesh*)p_mpmesh)->p_mesh;
16731673
auto vtxField = p_mesh->getMeshField<polyMPO::MeshF_OnSurfDispIncr>();
16741674
Kokkos::deep_copy(vtxField, 0.0);
1675+
1676+
auto vtxFieldVel = p_mesh->getMeshField<polyMPO::MeshF_Vel>();
1677+
auto vtxFieldVel_incr = p_mesh->getMeshField<polyMPO::MeshF_OnSurfVeloIncr>();
1678+
auto nVertices = p_mesh->getNumVertices();
1679+
1680+
Kokkos::parallel_for("set_VelIncr", nVertices, KOKKOS_LAMBDA(const int vtx){
1681+
vtxFieldVel_incr(vtx, 0) = vtxFieldVel(vtx, 0);
1682+
vtxFieldVel_incr(vtx, 1) = vtxFieldVel(vtx, 1);
1683+
});
16751684
}
16761685

16771686
void polympo_aggregate_deluDyn_f(MPMesh_ptr p_mpmesh){
@@ -1680,6 +1689,27 @@ void polympo_aggregate_deluDyn_f(MPMesh_ptr p_mpmesh){
16801689
p_mesh->aggregateDeluDyn();
16811690
}
16821691

1692+
void polympo_finalize_deludelvDyn_f(MPMesh_ptr p_mpmesh){
1693+
1694+
checkMPMeshValid(p_mpmesh);
1695+
auto p_mesh = ((polyMPO::MPMesh*)p_mpmesh)->p_mesh;
1696+
1697+
auto nVertices = p_mesh->getNumVertices();
1698+
auto elasticTimeStep = p_mesh->getElasticTimeStep();
1699+
auto dynamicTimeStep = p_mesh->getDynamicTimeStep();
1700+
1701+
auto vtxField = p_mesh->getMeshField<polyMPO::MeshF_OnSurfDispIncr>();
1702+
auto vtxFieldVel = p_mesh->getMeshField<polyMPO::MeshF_Vel>();
1703+
auto vtxFieldVel_incr = p_mesh->getMeshField<polyMPO::MeshF_OnSurfVeloIncr>();
1704+
1705+
Kokkos::parallel_for("Finalize_increments", nVertices, KOKKOS_LAMBDA(const int vtx){
1706+
vtxField(vtx, 0) = vtxField(vtx, 0) * elasticTimeStep;
1707+
vtxField(vtx, 1) = vtxField(vtx, 1) * elasticTimeStep;
1708+
vtxFieldVel_incr(vtx, 0) = vtxFieldVel(vtx, 0) - vtxFieldVel_incr(vtx, 0);
1709+
vtxFieldVel_incr(vtx, 1) = vtxFieldVel(vtx, 1) - vtxFieldVel_incr(vtx, 1);
1710+
});
1711+
}
1712+
16831713
//Timing
16841714
void polympo_enableTiming_f(){
16851715
pumipic::EnableTiming();

src/pmpo_c.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,9 @@ void polympo_reconstruct_coeff_with_MPI_f(MPMesh_ptr p_mpmesh);
134134
void polympo_reconstruct_iceArea_with_MPI_f(MPMesh_ptr p_mpmesh);
135135
void polympo_reconstruct_velocity_with_MPI_f(MPMesh_ptr p_mpmesh);
136136

137-
void polympo_init_deluDyn_f(MPMesh_ptr p_mpmesh);
137+
void polympo_init_deludelvDyn_f(MPMesh_ptr p_mpmesh);
138138
void polympo_aggregate_deluDyn_f(MPMesh_ptr p_mpmesh);
139+
void polympo_finalize_deludelvDyn_f(MPMesh_ptr p_mpmesh);
139140

140141
// Timing
141142
void polympo_enableTiming_f();

src/pmpo_fortran.f90

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,8 +1194,8 @@ subroutine polympo_reconstruct_velocity_with_MPI(mpMesh) &
11941194
type(c_ptr), value :: mpMesh
11951195
end subroutine
11961196

1197-
subroutine polympo_init_deluDyn(mpMesh) &
1198-
bind(C, NAME='polympo_init_deluDyn_f')
1197+
subroutine polympo_init_deludelvDyn(mpMesh) &
1198+
bind(C, NAME='polympo_init_deludelvDyn_f')
11991199
use :: iso_c_binding
12001200
type(c_ptr), value :: mpMesh
12011201
end subroutine
@@ -1206,6 +1206,12 @@ subroutine polympo_aggregate_deluDyn(mpMesh) &
12061206
type(c_ptr), value :: mpMesh
12071207
end subroutine
12081208

1209+
subroutine polympo_finalize_deludelvDyn(mpMesh) &
1210+
bind(C, NAME='polympo_finalize_deludelvDyn_f')
1211+
use :: iso_c_binding
1212+
type(c_ptr), value :: mpMesh
1213+
end subroutine
1214+
12091215
!---------------------------------------------------------------------------
12101216
!> @brief directly call the reconstruct of the MP fields to mesh fields
12111217
!> @param mpmesh(in/out) MPMesh object

0 commit comments

Comments
 (0)