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
1691b876
Commit
1691b876
authored
22 years ago
by
Moe Jette
Browse files
Options
Downloads
Patches
Plain Diff
Rename opt.cpus to opt.cpus_per_task, distributed tasks appropriately
for various values of cpus_per_task.
parent
2fd4f040
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/srun/launch.c
+2
-1
2 additions, 1 deletion
src/srun/launch.c
src/srun/opt.c
+16
-15
16 additions, 15 deletions
src/srun/opt.c
src/srun/opt.h
+3
-3
3 additions, 3 deletions
src/srun/opt.h
src/srun/srun.c
+3
-3
3 additions, 3 deletions
src/srun/srun.c
with
24 additions
and
22 deletions
src/srun/launch.c
+
2
−
1
View file @
1691b876
...
...
@@ -109,7 +109,8 @@ launch(void *arg)
taskid
=
0
;
if
(
opt
.
distribution
==
SRUN_DIST_BLOCK
)
{
for
(
i
=
0
;
((
i
<
job
->
nhosts
)
&&
(
taskid
<
opt
.
nprocs
));
i
++
)
{
for
(
j
=
0
;
((
j
<
job
->
cpus
[
i
])
&&
(
taskid
<
opt
.
nprocs
));
j
++
)
{
for
(
j
=
0
;
(((
j
*
opt
.
cpus_per_task
)
<
job
->
cpus
[
i
])
&&
(
taskid
<
opt
.
nprocs
));
j
++
)
{
task_ids
[
i
][
j
]
=
taskid
++
;
job
->
ntask
[
i
]
++
;
}
...
...
This diff is collapsed.
Click to expand it.
src/srun/opt.c
+
16
−
15
View file @
1691b876
...
...
@@ -151,7 +151,7 @@ struct poptOption runTable[] = {
{
"ntasks"
,
'n'
,
POPT_ARG_INT
,
&
opt
.
nprocs
,
OPT_NPROCS
,
"number of tasks to run"
,
"ntasks"
},
{
"cpus-per-task"
,
'c'
,
POPT_ARG_INT
,
&
opt
.
cpus
,
OPT_CPUS
,
{
"cpus-per-task"
,
'c'
,
POPT_ARG_INT
,
&
opt
.
cpus
_per_task
,
OPT_CPUS
,
"number of cpus required per task"
,
"ncpus"
},
{
"nodes"
,
'N'
,
POPT_ARG_INT
,
&
opt
.
nodes
,
OPT_NODES
,
...
...
@@ -252,7 +252,7 @@ typedef struct env_vars {
env_vars_t
env_vars
[]
=
{
{
"SLURM_DEBUG"
,
OPT_DEBUG
,
NULL
},
{
"SLURM_NPROCS"
,
OPT_INT
,
&
opt
.
nprocs
},
{
"SLURM_CPUS_PER_TASK"
,
OPT_INT
,
&
opt
.
cpus
},
{
"SLURM_CPUS_PER_TASK"
,
OPT_INT
,
&
opt
.
cpus
_per_task
},
{
"SLURM_NNODES"
,
OPT_INT
,
&
opt
.
nodes
},
{
"SLURM_PARTITION"
,
OPT_STRING
,
&
opt
.
partition
},
{
"SLURM_STDINMODE"
,
OPT_INPUT
,
&
opt
.
input
},
...
...
@@ -311,14 +311,6 @@ int initialize_and_process_args(int argc, char *argv[])
/* initialize options with argv */
opt_args
(
argc
,
argv
);
/* validate results */
if
(
opt
.
distribution
==
SRUN_DIST_UNKNOWN
)
{
if
(
opt
.
nprocs
<=
opt
.
nodes
)
opt
.
distribution
=
SRUN_DIST_CYCLIC
;
else
opt
.
distribution
=
SRUN_DIST_BLOCK
;
}
#if __DEBUG
opt_list
();
#endif
...
...
@@ -521,7 +513,7 @@ static void opt_default()
opt
.
progname
=
NULL
;
opt
.
nprocs
=
1
;
opt
.
cpus
=
1
;
opt
.
cpus
_per_task
=
1
;
opt
.
nodes
=
0
;
/* nodes need not be set */
opt
.
time_limit
=
-
1
;
opt
.
partition
=
NULL
;
...
...
@@ -836,7 +828,6 @@ static void opt_args(int ac, char **av)
}
}
if
(
!
opt_verify
(
optctx
,
nnodes_set
,
cpus_set
,
nprocs_set
))
{
poptPrintUsage
(
optctx
,
stderr
,
0
);
exit
(
1
);
...
...
@@ -861,6 +852,16 @@ opt_verify(poptContext optctx,
verified
=
false
;
}
if
(
opt
.
distribution
==
SRUN_DIST_UNKNOWN
)
{
if
(
opt
.
nprocs
<=
opt
.
nodes
)
opt
.
distribution
=
SRUN_DIST_CYCLIC
;
else
opt
.
distribution
=
SRUN_DIST_BLOCK
;
}
if
(
opt
.
mincpus
<
opt
.
cpus_per_task
)
opt
.
mincpus
=
opt
.
cpus_per_task
;
if
((
opt
.
job_name
==
NULL
)
&&
(
remote_argc
>
0
))
opt
.
job_name
=
base_name
(
remote_argv
[
0
]);
...
...
@@ -908,9 +909,9 @@ opt_verify(poptContext optctx,
verified
=
false
;
}
if
(
opt
.
cpus
<=
0
)
{
error
(
"%s: invalid number of cpus per
process
(-
n
%d)
\n
"
,
opt
.
progname
,
opt
.
cpus
);
if
(
opt
.
cpus
_per_task
<=
0
)
{
error
(
"%s: invalid number of cpus per
task
(-
c
%d)
\n
"
,
opt
.
progname
,
opt
.
cpus
_per_task
);
verified
=
false
;
}
...
...
This diff is collapsed.
Click to expand it.
src/srun/opt.h
+
3
−
3
View file @
1691b876
...
...
@@ -92,9 +92,9 @@ typedef struct srun_options {
char
*
cwd
;
/* current working directory */
int
nprocs
;
/* --nprocs=n, -n n */
int
cpus
;
/* --cpus
_
per
_
task=n, -c n */
int
cpus
_per_task
;
/* --cpus
-
per
-
task=n, -c n */
int
nodes
;
/* --nodes=n, -N n */
int
time_limit
;
/* --time, -t */
int
time_limit
;
/* --time, -t
*/
char
*
partition
;
/* --partition=n, -p n */
enum
distribution_t
distribution
;
/* --distribution=, -m dist */
...
...
@@ -113,7 +113,7 @@ typedef struct srun_options {
char
*
attach
;
/* --attach=id -a id */
bool
join
;
/* --join, -j */
/* no longer need these, they are set globally : */
/* no longer need these, they are set globally :
*/
/*int verbose;*/
/* -v, --verbose */
/*int debug;*/
/* -d, --debug */
...
...
This diff is collapsed.
Click to expand it.
src/srun/srun.c
+
3
−
3
View file @
1691b876
...
...
@@ -298,7 +298,7 @@ allocate_nodes(void)
job
.
req_nodes
=
opt
.
nodelist
;
job
.
num_procs
=
opt
.
nprocs
;
job
.
num_procs
=
opt
.
nprocs
*
opt
.
cpus_per_task
;
if
(
opt
.
nodes
>
-
1
)
job
.
num_nodes
=
opt
.
nodes
;
...
...
@@ -409,7 +409,7 @@ create_job_step(job_t *job)
req
.
job_id
=
job
->
jobid
;
req
.
user_id
=
opt
.
uid
;
req
.
node_count
=
job
->
nhosts
;
req
.
cpu_count
=
opt
.
nprocs
;
req
.
cpu_count
=
opt
.
nprocs
*
opt
.
cpus_per_task
;
req
.
node_list
=
job
->
nodelist
;
req
.
relative
=
false
;
if
(
opt
.
distribution
==
SRUN_DIST_BLOCK
)
...
...
@@ -594,7 +594,7 @@ run_batch_job(void)
job
.
req_nodes
=
opt
.
nodelist
;
job
.
num_procs
=
opt
.
nprocs
;
job
.
num_procs
=
opt
.
nprocs
*
opt
.
cpus_per_task
;
if
(
opt
.
nodes
>
-
1
)
job
.
num_nodes
=
opt
.
nodes
;
...
...
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