-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reservoir coupling: Implement time stepping #5620
Conversation
Okay, in that case I'm going to mark this as "work in progress/draft" to avoid inadvertent merging. |
@bska Thanks. I was actually planning to get this merged, since it is becoming difficult to handle all the dependent PRs and keep them up to date. Is this a good idea, or should I wait until the complete reservoir coupling feature is ready? |
It is a very good idea. Do not wait for the complete feature, unless you expect significant changes to the parts you already did. This patch has grown to become quite large, so finishing and polishing the first PRs in the series so they can be merged should be a high priority. |
ac5ff0f
to
27a09b4
Compare
27a09b4
to
290f18e
Compare
892574a
to
21ded73
Compare
21ded73
to
2248fa4
Compare
jenkins build this serial please |
I think the jenkins failure is due to unconditional usage of MPI and unconditionally including mpi.h. Unfortunately, we require compiling without MPI to work. There is a subtle reason for this, but I fail to remember it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review of commit 3564e1d, files .../flow/ReservoirCoupling*
Do we really need the TimePoint class?
|
||
// Equality operator | ||
bool operator==(const TimePoint& other) const { | ||
return std::abs(time - other.time) < tol; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be very surprising to everybody else. I would really prefer to make this fuzzy comparison explicit where it
used. E.g. using a special free function or creating a wrapper for the comparison where it is used.
I also think that this might break quite some assumptions for the other comparison operators, e.g. if a==b
is true then a<b
can be true too, or even if a==b
is true a<=b
might be false.
int result = MPI_Recv( | ||
&slave_next_report_time_offset, | ||
/*count=*/1, | ||
/*datatype=*/MPI_DOUBLE, | ||
/*source_rank=*/0, | ||
/*tag=*/static_cast<int>(MessageTag::SlaveNextReportDate), | ||
*this->master_slave_comm_[i].get(), | ||
MPI_STATUS_IGNORE | ||
); | ||
if (result != MPI_SUCCESS) { | ||
OPM_THROW(std::runtime_error, "Failed to receive next report date from slave process"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we can wrap the communictar int a Communicator<MPI_Comm>
then you can simplify this to
this->master_slave_comm_[i].recv(slave_next_report_time_offset, 0, static_cast<int>(MessageTag::SlaveNextReportDate));
Please don't put extra throw clauses here. The default MPI error handler is MPI_ERRORS_ARE_FATAL which will call MPI_Abort. To get return codes one would have to reset it to something else. Hence the if branch will never be false of we do not reset it.
It is also not clear to me how our simulator will handle exceptions here. It might just cut the time step...
If we ever want exceptions for failing MPI calls we can use a custom throwing MPI_Errhandler. I do that in some of my tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't put extra throw clauses here.
I have added a custom error handler for each slave-master communicator that will eventually call MPI_Abort(). This way we do not need to check the return value for each MPI_Recv() and MPI_Send() call. See the latest commit.
@@ -53,10 +56,12 @@ class ReservoirCouplingMaster { | |||
|
|||
const Parallel::Communication &comm_; | |||
const Schedule& schedule_; | |||
std::time_t start_date_; // Master process' simulation start date |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a specific reason for the type or should we maybe use the same type for start date everywhere? Seems like it is boost::gregorian::date
is SimulationTimer.
@blattms How do I build locally without MPI? I tried cmake option |
jenkins build this serial please |
1 similar comment
jenkins build this serial please |
c46870e
to
7c15ec8
Compare
jenkins build this serial please |
7c15ec8
to
6565569
Compare
jenkins build this serial please |
6565569
to
b487a54
Compare
jenkins build this serial please |
b487a54
to
d68daa2
Compare
jenkins build this serial please |
d68daa2
to
a500868
Compare
Don't remove these entries from the map before reservoir coupling is completely supported.
Determine size of std::size_t correctly for all platforms using Dune::MPITraits<std::size_t>::getType()
It is safe to free the error handler after MPI_Comm_set_errhandler() has been called
Convert comment blocks into doxygen type comments
After rebasing on master some changes to AdaptiveTimeStepping.hpp and AdaptiveTimeStepping_impl.hpp were missed
1138a18
to
82d9d02
Compare
jenkins build this please |
82d9d02
to
43b1a1a
Compare
jenkins build this please |
43b1a1a
to
157cf97
Compare
jenkins build this please |
@blattms I think that would be detected by the master. Tested it now by purposely creating a segmentation fault in a slave. It was immediately noticed by the master, which called MPI_Abort() with: mpirun noticed that process rank 1 with PID 0 on node hakon-Precision-3570 exited on signal 11 (Segmentation fault). Similarly, I think the master will abort the slaves and itself if any slave exits without calling |
@blattms First thing to notice is that the parameter is hidden so it will not be known to the user that it exists, second if the user by accident gives the
and the simulation will be aborted. |
jenkins build this serial please |
Sorry, but building without MPI does not work. This prevents merging. |
157cf97
to
b4192b0
Compare
jenkins build this serial please |
@blattms Good idea. I have added a description in the latest commit. |
Adds developer documentation about the timestepping procedure.
f673483
to
18d35cb
Compare
jenkins build this please |
jenkins build this serial please |
Builds on #5521 which should be merged first.
Also refactors the original adaptive time stepping method.