Skip to content

Commit

Permalink
Merge pull request #516 from llaniewski/fix/runr_globals
Browse files Browse the repository at this point in the history
Fixing the globals in RunR
  • Loading branch information
llaniewski authored May 30, 2024
2 parents 8500e3b + af456df commit 53e4cb1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Handlers/acSolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ int acSolve::Init () {
if (GenericAction::ExecuteInternal()) return -1;
int stop=0;
do {
int next_it = Next(solver->iter);
int my_next_it = Next(solver->iter);
int next_it = my_next_it;
for (size_t i=0; i<solver->hands.size(); i++) {
int it = solver->hands[i].Next(solver->iter);
if ((it > 0) && (it < next_it)) next_it = it;
}
solver->steps = next_it;
MPI_Bcast(&solver->steps, 1, MPI_INT, 0, MPMD.local);
solver->iter += solver->steps;
solver->lattice->Iterate(solver->steps, solver->iter_type);
int iter_type = solver->iter_type;
if (solver->steps == my_next_it) iter_type |= ITER_LASTGLOB;
solver->lattice->Iterate(solver->steps, iter_type);
CudaDeviceSynchronize();
MPI_Barrier(MPMD.local);
for (size_t i=0; i<solver->hands.size(); i++) {
Expand Down
7 changes: 7 additions & 0 deletions src/Handlers/cbRunR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,8 @@ int cbRunR::Init() {
output("%s\n",source.c_str());
output("--------------------------------\n");
}
old_iter_type = solver->iter_type;
solver->iter_type |= ITER_LASTGLOB;
return 0;
}

Expand Down Expand Up @@ -842,6 +844,11 @@ int cbRunR::DoIt() {
return 0;
}

int cbRunR::Finish () {
solver->iter_type = old_iter_type;
return Callback::Finish();
}


#endif // WITH_R

Expand Down
2 changes: 2 additions & 0 deletions src/Handlers/cbRunR.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ class cbRunR : public Callback {
bool python;
static int s_tag;
int tag;
int old_iter_type;
public:
int Init ();
int DoIt ();
int Finish ();
};

#endif // WITH_R
Expand Down

0 comments on commit 53e4cb1

Please sign in to comment.