Skip to content

Commit 77cde5b

Browse files
committed
Woking 2 proc case
1 parent 3988a6a commit 77cde5b

File tree

6 files changed

+355
-44
lines changed

6 files changed

+355
-44
lines changed

src/pmpo_MPMesh.cpp

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ void MPMesh::CVTTrackingElmCenterBased(const int printVTPIndex){
128128
auto MPs2Proc = p_MPs->getData<MPF_Tgt_Proc_ID>();
129129
auto elm2Process = p_mesh->getElm2Process();
130130
auto elm2global = p_mesh->getElmGlobal();
131-
131+
auto mpAppID = p_MPs->getData<polyMPO::MPF_MP_APP_ID>();
132+
132133
MPI_Comm comm = p_MPs->getMPIComm();
133134
int comm_rank;
134135
MPI_Comm_rank(comm, &comm_rank);
@@ -143,12 +144,14 @@ void MPMesh::CVTTrackingElmCenterBased(const int printVTPIndex){
143144

144145
//assert(cudaDeviceSynchronize()==cudaSuccess);
145146
//MPI_Barrier(MPI_COMM_WORLD);
146-
printf("NumMPs %d \n", numMPs);
147147
Vec3dView history("positionHistory",numMPs);
148148
Vec3dView resultLeft("positionResult",numMPs);
149149
Vec3dView resultRight("positionResult",numMPs);
150150
Vec3dView mpTgtPosArray("positionTarget",numMPs);
151151
Kokkos::View<int*> counter("counter",1);
152+
153+
assert(cudaDeviceSynchronize() == cudaSuccess);
154+
//printf("Rank %d Foo4 Begin\n", comm_rank);
152155

153156
auto CVTElmCalc = PS_LAMBDA(const int& elm, const int& mp, const int&mask){
154157
Vec3d MP(mpPositions(mp,0),mpPositions(mp,1),mpPositions(mp,2));
@@ -181,13 +184,15 @@ void MPMesh::CVTTrackingElmCenterBased(const int printVTPIndex){
181184

182185
if(closestElm<0){
183186
MPs2Elm(mp) = iElm;
184-
if (elm2Process.size() > 0)
185-
MPs2Proc(mp) = elm2Process(iElm);
187+
MPs2Proc(mp) = elm2Process(iElm);
186188
break;
187189
}else{
188190
iElm = closestElm;
189191
}
190192
}
193+
if(mpAppID(mp)==0 || mpAppID(mp)==191)
194+
printf("Pos %.15e %.15e %.15e => %.15e %.15e %.15e\n", mpPositions(mp,0), mpPositions(mp,1),
195+
mpPositions(mp,2), mpTgtPos(mp,0), mpTgtPos(mp,1), mpTgtPos(mp, 2));
191196

192197
if(printVTPIndex>=0 && numMPs>0){
193198
//printf("Rank %d mp %d counter %d \n", comm_rank, mp, counter);
@@ -211,6 +216,10 @@ void MPMesh::CVTTrackingElmCenterBased(const int printVTPIndex){
211216
}
212217
};
213218
p_MPs->parallel_for(CVTElmCalc,"CVTTrackingElmCenterBasedCalc");
219+
220+
assert(cudaDeviceSynchronize() == cudaSuccess);
221+
//printf("Rank %d Foo4 End\n", comm_rank);
222+
214223

215224
if(printVTPIndex>=0 && numMPs>0){
216225
Vec3dView::HostMirror h_history = Kokkos::create_mirror_view(history);
@@ -341,35 +350,44 @@ bool getAnyIsMigrating(MaterialPoints* p_MPs, bool isMigrating) {
341350
return anyIsMigrating;
342351
}
343352

344-
bool MPMesh::push1P(){
345-
346-
static int count=0;
347-
std::cout<<"Push1P"<<" "<<count<<std::endl;
348-
353+
void MPMesh::push_ahead(){
354+
static int count0=0;
355+
std::cout<<"Push_ahead"<<" "<<count0<<std::endl;
349356
//Latitude Longitude increment at mesh vertices and interpolate to particle position
350357
p_mesh->computeRotLatLonIncr();
351358
sphericalInterpolation<MeshF_RotLatLonIncr>(*this);
352-
353359
//Push the MPs
354360
p_MPs->updateRotLatLonAndXYZ2Tgt(p_mesh->getSphereRadius());
355-
356-
//Given target location find the new MP element and the process it belongs to
361+
count0 ++;
362+
}
363+
364+
bool MPMesh::push1P(){
365+
//Given target location find the new element or the last element in a partioned mesh
366+
//and the process it belongs to so that migration can be checked
367+
static int count_p=0;
357368
CVTTrackingElmCenterBased();
369+
358370
//From the above two inputs find if any particle needs to be migrated
359371
bool anyIsMigrating = getAnyIsMigrating(p_MPs, p_MPs->check_migrate());
372+
count_p=count_p+1;
373+
return anyIsMigrating;
360374

361-
//New element (maynot be final) so that MPAS can do the migration
375+
}
376+
377+
void MPMesh::push_swap(){
378+
//current becomes target, target becomes -1
362379
p_MPs->updateMPElmID();
363-
380+
}
364381

382+
383+
void MPMesh::push_swap_pos(){
384+
//current becomes target, target becomes -1
385+
//Making read for next push_ahead
365386
p_MPs->updateMPSlice<MPF_Cur_Pos_XYZ, MPF_Tgt_Pos_XYZ>();
366387
p_MPs->updateMPSlice<MPF_Cur_Pos_Rot_Lat_Lon, MPF_Tgt_Pos_Rot_Lat_Lon>();
367-
368-
count++;
369-
return anyIsMigrating;
370-
371388
}
372389

390+
373391
void MPMesh::push(){
374392

375393
static int count=0;

src/pmpo_MPMesh.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ class MPMesh{
4444
void CVTTrackingElmCenterBased(const int printVTPIndex = -1);
4545
void T2LTracking(Vec2dView dx);
4646
bool push1P();
47+
void push_ahead();
48+
void push_swap();
49+
void push_swap_pos();
4750
void push();
4851
void calcBasis();
4952

0 commit comments

Comments
 (0)