Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Commits
55856098
Commit
55856098
authored
1 month ago
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Call slurm_init only once
parent
c8b336e9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/utils/Stop.cpp
+38
-11
38 additions, 11 deletions
src/utils/Stop.cpp
with
38 additions
and
11 deletions
src/utils/Stop.cpp
+
38
−
11
View file @
55856098
...
...
@@ -9,6 +9,39 @@
#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
)
{
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
...
...
@@ -29,22 +62,16 @@ stop()
stop
=
elapse_time
>
stop_file_age
;
}
#ifdef PUGS_HAS_SLURM
#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
}
parallel
::
broadcast
(
stop
,
0
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment