Skip to content

Commit f89a03f

Browse files
committed
Standard physics qualitative comparison, Kokkos fence before spherical interpolation of velocity increment, setget method of velocity increment with Timers
1 parent b439df6 commit f89a03f

File tree

2 files changed

+35
-19
lines changed

2 files changed

+35
-19
lines changed

src/pmpo_MPMesh.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ void MPMesh::push_ahead(){
329329
//Interploate mesh velocity increments to particle positions
330330
//Note that the basis fucntions are created twice and so need to avoid redeundant clualtions
331331
//Tried template lists Template_Type... maybe better option available
332+
Kokkos::fence();
332333
sphericalInterpolation<MeshF_OnSurfVeloIncr>(*this);
333334
//Push the MPs
334335
p_MPs->updateRotLatLonAndXYZ2Tgt(p_mesh->getSphereRadius());

src/pmpo_c.cpp

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,11 +1075,16 @@ void polympo_getMeshElmMass_f(MPMesh_ptr p_mpmesh, const int nCells, double* elm
10751075
pumipic::RecordTime("PolyMPO_getMeshElmMass", timer.seconds());
10761076
}
10771077

1078+
//Increments in vertex velcoity and displacement
10781079
void polympo_setMeshVtxOnSurfVeloIncr_f(MPMesh_ptr p_mpmesh, const int nComps, const int nVertices, const double* array) {
1080+
1081+
Kokkos::Timer timer;
10791082
//check mpMesh is valid
10801083
checkMPMeshValid(p_mpmesh);
10811084
auto p_mesh = ((polyMPO::MPMesh*)p_mpmesh)->p_mesh;
1082-
kkViewHostU<const double*[vec2d_nEntries]> arrayHost(array,nVertices);
1085+
kkViewHostU<const double**> arrayHost(array,nComps,nVertices);
1086+
Kokkos::View<double**> array_d("meshVelIncrDevice",nComps,nVertices);
1087+
Kokkos::deep_copy(array_d, arrayHost);
10831088

10841089
auto vtxField = p_mesh->getMeshField<polyMPO::MeshF_OnSurfVeloIncr>();
10851090

@@ -1088,24 +1093,11 @@ void polympo_setMeshVtxOnSurfVeloIncr_f(MPMesh_ptr p_mpmesh, const int nComps, c
10881093
PMT_ALWAYS_ASSERT(static_cast<size_t>(nVertices*vec2d_nEntries)==vtxField.size());
10891094

10901095
//copy the host array to the device
1091-
Kokkos::deep_copy(vtxField,arrayHost);
1092-
}
1093-
1094-
void polympo_getMeshVtxOnSurfVeloIncr_f(MPMesh_ptr p_mpmesh, const int nComps, const int nVertices, double* array) {
1095-
//check mpMesh is valid
1096-
checkMPMeshValid(p_mpmesh);
1097-
auto p_mesh = ((polyMPO::MPMesh*)p_mpmesh)->p_mesh;
1098-
kkVec2dViewHostU arrayHost(array,nVertices);
1099-
1100-
auto vtxField = p_mesh->getMeshField<polyMPO::MeshF_OnSurfVeloIncr>();
1101-
1102-
//check the size
1103-
PMT_ALWAYS_ASSERT(nComps == vec2d_nEntries);
1104-
PMT_ALWAYS_ASSERT(p_mesh->getNumVertices() == nVertices);
1105-
PMT_ALWAYS_ASSERT(static_cast<size_t>(nVertices*vec2d_nEntries)==vtxField.size());
1106-
1107-
//copy the device array to the host
1108-
Kokkos::deep_copy(arrayHost, vtxField);
1096+
Kokkos::parallel_for("set mesh dispIncr", nVertices, KOKKOS_LAMBDA(const int iVtx){
1097+
vtxField(iVtx,0) = array_d(0,iVtx);
1098+
vtxField(iVtx,1) = array_d(1,iVtx);
1099+
});
1100+
pumipic::RecordTime("PolyMPO_setMeshVtxOnSurfVelIncr", timer.seconds());
11091101
}
11101102

11111103
void polympo_setMeshVtxOnSurfDispIncr_f(MPMesh_ptr p_mpmesh, const int nComps, const int nVertices, const double* array) {
@@ -1131,6 +1123,29 @@ void polympo_setMeshVtxOnSurfDispIncr_f(MPMesh_ptr p_mpmesh, const int nComps, c
11311123
pumipic::RecordTime("PolyMPO_setMeshVtxOnSurfDispIncr", timer.seconds());
11321124
}
11331125

1126+
1127+
void polympo_getMeshVtxOnSurfVeloIncr_f(MPMesh_ptr p_mpmesh, const int nComps, const int nVertices, double* array) {
1128+
//check mpMesh is valid
1129+
checkMPMeshValid(p_mpmesh);
1130+
auto p_mesh = ((polyMPO::MPMesh*)p_mpmesh)->p_mesh;
1131+
kkDbl2dViewHostU arrayHost(array,nComps,nVertices);
1132+
Kokkos::View<double**> array_d("meshVelIncrDevice",nComps,nVertices);
1133+
1134+
auto vtxField = p_mesh->getMeshField<polyMPO::MeshF_OnSurfVeloIncr>();
1135+
1136+
//check the size
1137+
PMT_ALWAYS_ASSERT(nComps == vec2d_nEntries);
1138+
PMT_ALWAYS_ASSERT(p_mesh->getNumVertices() == nVertices);
1139+
PMT_ALWAYS_ASSERT(static_cast<size_t>(nVertices*vec2d_nEntries)==vtxField.size());
1140+
1141+
//copy the device array to the host
1142+
Kokkos::parallel_for("get mesh dispIncr", nVertices, KOKKOS_LAMBDA(const int iVtx){
1143+
array_d(0,iVtx) = vtxField(iVtx,0);
1144+
array_d(1,iVtx) = vtxField(iVtx,1);
1145+
});
1146+
Kokkos::deep_copy(arrayHost, array_d);
1147+
}
1148+
11341149
void polympo_getMeshVtxOnSurfDispIncr_f(MPMesh_ptr p_mpmesh, const int nComps, const int nVertices, double* array) {
11351150
//check mpMesh is valid
11361151
checkMPMeshValid(p_mpmesh);

0 commit comments

Comments
 (0)