Skip to content
Snippets Groups Projects
Commit 6a1906b6 authored by MARMAJOU ISABELLE's avatar MARMAJOU ISABELLE
Browse files

Merge branch 'feature/reconstruction' into feature/variational-hydro

parents 3f96e465 4dbcfd48
No related branches found
No related tags found
No related merge requests found
......@@ -90,7 +90,9 @@ PTScotchPartitioner::partition(const CRSGraph& graph)
SCOTCH_stratExit(&scotch_strategy);
}
MPI_Comm_free(&partitioning_comm);
if (partitioning_comm != MPI_COMM_NULL){
MPI_Comm_free(&partitioning_comm);
}
MPI_Group_free(&mesh_group);
MPI_Group_free(&world_group);
......
......@@ -72,7 +72,9 @@ ParMETISPartitioner::partition(const CRSGraph& graph)
// LCOV_EXCL_STOP
}
MPI_Comm_free(&partitioning_comm);
if (partitioning_comm != MPI_COMM_NULL){
MPI_Comm_free(&partitioning_comm);
}
MPI_Group_free(&mesh_group);
MPI_Group_free(&world_group);
......
......@@ -9,6 +9,41 @@
#ifdef PUGS_HAS_SLURM
#include <slurm/slurm.h>
// LCOV_EXCL_START
class SlurmWrapper
{
private:
int m_slurm_job_id = -1;
public:
bool
mustStop() const
{
if (m_slurm_job_id == -1) {
return false;
} else {
return slurm_get_rem_time(m_slurm_job_id) < 150;
}
}
SlurmWrapper()
{
char* env = getenv("SLURM_JOB_ID");
if (env != nullptr) {
slurm_init(nullptr);
m_slurm_job_id = std::atoi(env);
}
}
~SlurmWrapper()
{
slurm_fini();
}
};
// LCOV_EXCL_STOP
#endif // PUGS_HAS_SLURM
bool
......@@ -31,16 +66,9 @@ stop()
#ifdef PUGS_HAS_SLURM
// LCOV_EXCL_START
char* env = getenv("SLURM_JOB_ID");
if (env != nullptr) {
slurm_init(nullptr);
int slurm_job_id = std::atoi(env);
if (slurm_get_rem_time(slurm_job_id) < 150) {
stop = true;
}
slurm_fini();
static SlurmWrapper slurm_wrapper;
if (slurm_wrapper.mustStop()) {
stop = true;
}
// LCOV_EXCL_STOP
#endif // PUGS_HAS_SLURM
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment