Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Slurm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tud-zih-energy
Slurm
Commits
d3d302b0
Commit
d3d302b0
authored
7 years ago
by
Felip Moll
Committed by
Danny Auble
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Check for current cwd in multi-prog when building file path Add cwd argument for when using --chdir
Bug 4621
parent
cf4d2145
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/plugins/launch/slurm/launch_slurm.c
+2
-1
2 additions, 1 deletion
src/plugins/launch/slurm/launch_slurm.c
src/srun/libsrun/multi_prog.c
+11
-5
11 additions, 5 deletions
src/srun/libsrun/multi_prog.c
src/srun/libsrun/multi_prog.h
+2
-1
2 additions, 1 deletion
src/srun/libsrun/multi_prog.h
with
15 additions
and
7 deletions
src/plugins/launch/slurm/launch_slurm.c
+
2
−
1
View file @
d3d302b0
...
@@ -844,7 +844,8 @@ extern int launch_p_step_launch(srun_job_t *job, slurm_step_io_fds_t *cio_fds,
...
@@ -844,7 +844,8 @@ extern int launch_p_step_launch(srun_job_t *job, slurm_step_io_fds_t *cio_fds,
*/
*/
if
(
srun_opt
->
multi_prog
)
{
if
(
srun_opt
->
multi_prog
)
{
mpir_set_multi_name
(
job
->
ntasks
,
mpir_set_multi_name
(
job
->
ntasks
,
launch_params
.
argv
[
0
]);
launch_params
.
argv
[
0
],
launch_params
.
cwd
);
}
else
{
}
else
{
mpir_set_executable_names
(
launch_params
.
argv
[
0
],
mpir_set_executable_names
(
launch_params
.
argv
[
0
],
job
->
pack_task_offset
,
job
->
pack_task_offset
,
...
...
This diff is collapsed.
Click to expand it.
src/srun/libsrun/multi_prog.c
+
11
−
5
View file @
d3d302b0
...
@@ -67,7 +67,7 @@
...
@@ -67,7 +67,7 @@
/* Given a program name, translate it to a fully qualified pathname
/* Given a program name, translate it to a fully qualified pathname
* as needed based upon the PATH environment variable */
* as needed based upon the PATH environment variable */
static
char
*
static
char
*
_build_path
(
char
*
fname
)
_build_path
(
const
char
*
cwd
,
char
*
fname
)
{
{
int
i
;
int
i
;
char
*
path_env
=
NULL
,
*
dir
=
NULL
,
*
ptrptr
=
NULL
;
char
*
path_env
=
NULL
,
*
dir
=
NULL
,
*
ptrptr
=
NULL
;
...
@@ -89,6 +89,12 @@ _build_path(char* fname)
...
@@ -89,6 +89,12 @@ _build_path(char* fname)
if
((
file_name
[
0
]
==
'/'
)
||
(
file_name
[
0
]
==
'.'
))
if
((
file_name
[
0
]
==
'/'
)
||
(
file_name
[
0
]
==
'.'
))
return
file_name
;
return
file_name
;
/* search for the file using cwd*/
snprintf
(
file_path
,
sizeof
(
file_path
),
"%s/%s"
,
cwd
,
file_name
);
if
((
stat
(
file_path
,
&
buf
)
==
0
)
&&
(
!
S_ISDIR
(
buf
.
st_mode
)))
return
file_path
;
/* search for the file using PATH environment variable */
/* search for the file using PATH environment variable */
dir
=
getenv
(
"PATH"
);
dir
=
getenv
(
"PATH"
);
if
(
!
dir
)
{
if
(
!
dir
)
{
...
@@ -135,12 +141,12 @@ _set_range(int low_num, int high_num, char *exec_name, bool ignore_duplicates)
...
@@ -135,12 +141,12 @@ _set_range(int low_num, int high_num, char *exec_name, bool ignore_duplicates)
}
}
static
void
static
void
_set_exec_names
(
char
*
ranks
,
char
*
exec_name
,
int
ntasks
)
_set_exec_names
(
char
*
ranks
,
const
char
*
cwd
,
char
*
exec_name
,
int
ntasks
)
{
{
char
*
ptrptr
=
NULL
,
*
exec_path
=
NULL
;
char
*
ptrptr
=
NULL
,
*
exec_path
=
NULL
;
int
low_num
,
high_num
,
num
,
i
;
int
low_num
,
high_num
,
num
,
i
;
exec_path
=
_build_path
(
exec_name
);
exec_path
=
_build_path
(
cwd
,
exec_name
);
if
((
ranks
[
0
]
==
'*'
)
&&
(
ranks
[
1
]
==
'\0'
))
{
if
((
ranks
[
0
]
==
'*'
)
&&
(
ranks
[
1
]
==
'\0'
))
{
low_num
=
0
;
low_num
=
0
;
high_num
=
ntasks
-
1
;
high_num
=
ntasks
-
1
;
...
@@ -180,7 +186,7 @@ _set_exec_names(char *ranks, char *exec_name, int ntasks)
...
@@ -180,7 +186,7 @@ _set_exec_names(char *ranks, char *exec_name, int ntasks)
}
}
extern
int
extern
int
mpir_set_multi_name
(
int
ntasks
,
const
char
*
config_fname
)
mpir_set_multi_name
(
int
ntasks
,
const
char
*
config_fname
,
const
char
*
cwd
)
{
{
FILE
*
config_fd
;
FILE
*
config_fd
;
char
line
[
BUF_SIZE
];
char
line
[
BUF_SIZE
];
...
@@ -245,7 +251,7 @@ mpir_set_multi_name(int ntasks, const char *config_fname)
...
@@ -245,7 +251,7 @@ mpir_set_multi_name(int ntasks, const char *config_fname)
fclose
(
config_fd
);
fclose
(
config_fd
);
return
-
1
;
return
-
1
;
}
}
_set_exec_names
(
ranks
,
exec_name
,
ntasks
);
_set_exec_names
(
ranks
,
cwd
,
exec_name
,
ntasks
);
}
}
fclose
(
config_fd
);
fclose
(
config_fd
);
return
0
;
return
0
;
...
...
This diff is collapsed.
Click to expand it.
src/srun/libsrun/multi_prog.h
+
2
−
1
View file @
d3d302b0
...
@@ -51,7 +51,8 @@ extern void mpir_init(int num_tasks);
...
@@ -51,7 +51,8 @@ extern void mpir_init(int num_tasks);
extern
void
mpir_set_executable_names
(
const
char
*
executable_name
,
extern
void
mpir_set_executable_names
(
const
char
*
executable_name
,
uint32_t
task_offset
,
uint32_t
task_offset
,
uint32_t
task_count
);
uint32_t
task_count
);
extern
int
mpir_set_multi_name
(
int
ntasks
,
const
char
*
config_fname
);
extern
int
mpir_set_multi_name
(
int
ntasks
,
const
char
*
config_fname
,
const
char
*
cwd
);
/*
/*
* Verify that we have a valid executable program specified for each task
* Verify that we have a valid executable program specified for each task
...
...
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