Skip to content
Snippets Groups Projects
Commit 8715aaa5 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Merge branch 'develop' into feature/loadbalancing

parents bb50b9a6 fa321c14
No related branches found
No related tags found
1 merge request!204Remove m_cell_global_index from Connectivity
......@@ -90,7 +90,9 @@ PTScotchPartitioner::partition(const CRSGraph& graph)
SCOTCH_stratExit(&scotch_strategy);
}
if (partitioning_comm != MPI_COMM_NULL){
MPI_Comm_free(&partitioning_comm);
}
MPI_Group_free(&mesh_group);
MPI_Group_free(&world_group);
......
......@@ -87,7 +87,9 @@ ParMETISPartitioner::partition(const CRSGraph& graph)
// LCOV_EXCL_STOP
}
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,17 +66,10 @@ 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) {
static SlurmWrapper slurm_wrapper;
if (slurm_wrapper.mustStop()) {
stop = true;
}
slurm_fini();
}
// 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