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
f776cb6d
Commit
f776cb6d
authored
16 years ago
by
Moe Jette
Browse files
Options
Downloads
Patches
Plain Diff
This a thing of beauty, automatic task binding appears to be fully functional
parent
f9cceed7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/task/affinity/dist_tasks.c
+34
-17
34 additions, 17 deletions
src/plugins/task/affinity/dist_tasks.c
with
34 additions
and
17 deletions
src/plugins/task/affinity/dist_tasks.c
+
34
−
17
View file @
f776cb6d
...
@@ -49,7 +49,7 @@
...
@@ -49,7 +49,7 @@
static
char
*
_alloc_mask
(
launch_tasks_request_msg_t
*
req
,
static
char
*
_alloc_mask
(
launch_tasks_request_msg_t
*
req
,
int
*
whole_node_cnt
,
int
*
whole_socket_cnt
,
int
*
whole_node_cnt
,
int
*
whole_socket_cnt
,
int
*
whole_core_cnt
,
int
*
whole_thread_cnt
);
int
*
whole_core_cnt
,
int
*
whole_thread_cnt
,
int
*
part_socket_cnt
,
int
*
part_core_cnt
);
static
bitstr_t
*
_get_avail_map
(
launch_tasks_request_msg_t
*
req
,
static
bitstr_t
*
_get_avail_map
(
launch_tasks_request_msg_t
*
req
,
uint16_t
*
hw_sockets
,
uint16_t
*
hw_cores
,
uint16_t
*
hw_sockets
,
uint16_t
*
hw_cores
,
uint16_t
*
hw_threads
);
uint16_t
*
hw_threads
);
...
@@ -178,6 +178,7 @@ void lllp_distribution(launch_tasks_request_msg_t *req, uint32_t node_id)
...
@@ -178,6 +178,7 @@ void lllp_distribution(launch_tasks_request_msg_t *req, uint32_t node_id)
char
buf_type
[
100
];
char
buf_type
[
100
];
int
maxtasks
=
req
->
tasks_to_launch
[(
int
)
node_id
];
int
maxtasks
=
req
->
tasks_to_launch
[(
int
)
node_id
];
int
whole_nodes
,
whole_sockets
,
whole_cores
,
whole_threads
;
int
whole_nodes
,
whole_sockets
,
whole_cores
,
whole_threads
;
int
part_sockets
,
part_cores
;
const
uint32_t
*
gtid
=
req
->
global_task_ids
[(
int
)
node_id
];
const
uint32_t
*
gtid
=
req
->
global_task_ids
[(
int
)
node_id
];
uint16_t
bind_entity
,
bind_mode
;
uint16_t
bind_entity
,
bind_mode
;
...
@@ -186,8 +187,9 @@ void lllp_distribution(launch_tasks_request_msg_t *req, uint32_t node_id)
...
@@ -186,8 +187,9 @@ void lllp_distribution(launch_tasks_request_msg_t *req, uint32_t node_id)
CPU_BIND_LDMASK
|
CPU_BIND_LDRANK
|
CPU_BIND_LDMAP
;
CPU_BIND_LDMASK
|
CPU_BIND_LDRANK
|
CPU_BIND_LDMAP
;
if
(
req
->
cpu_bind_type
&
bind_mode
)
{
/* explicit user mapping */
if
(
req
->
cpu_bind_type
&
bind_mode
)
{
/* explicit user mapping */
char
*
avail_mask
=
_alloc_mask
(
req
,
char
*
avail_mask
=
_alloc_mask
(
req
,
&
whole_nodes
,
&
whole_sockets
,
&
whole_nodes
,
&
whole_sockets
,
&
whole_cores
,
&
whole_threads
);
&
whole_cores
,
&
whole_threads
,
&
part_sockets
,
&
part_cores
);
if
((
whole_nodes
==
0
)
&&
avail_mask
)
{
if
((
whole_nodes
==
0
)
&&
avail_mask
)
{
xfree
(
req
->
cpu_bind
);
xfree
(
req
->
cpu_bind
);
req
->
cpu_bind
=
avail_mask
;
req
->
cpu_bind
=
avail_mask
;
...
@@ -206,16 +208,18 @@ void lllp_distribution(launch_tasks_request_msg_t *req, uint32_t node_id)
...
@@ -206,16 +208,18 @@ void lllp_distribution(launch_tasks_request_msg_t *req, uint32_t node_id)
if
(
!
(
req
->
cpu_bind_type
&
bind_entity
))
{
if
(
!
(
req
->
cpu_bind_type
&
bind_entity
))
{
int
max_tasks
=
req
->
tasks_to_launch
[(
int
)
node_id
];
int
max_tasks
=
req
->
tasks_to_launch
[(
int
)
node_id
];
char
*
avail_mask
=
_alloc_mask
(
req
,
char
*
avail_mask
=
_alloc_mask
(
req
,
&
whole_nodes
,
&
whole_sockets
,
&
whole_nodes
,
&
whole_sockets
,
&
whole_cores
,
&
whole_threads
);
&
whole_cores
,
&
whole_threads
,
debug
(
"binding tasks:%d to nodes:%d sockets:%d cores:%d threads:%d"
,
&
part_sockets
,
&
part_cores
);
max_tasks
,
whole_nodes
,
whole_sockets
,
whole_cores
,
debug
(
"binding tasks:%d to "
whole_threads
);
"nodes:%d sockets:%d:%d cores:%d:%d threads:%d"
,
if
(
max_tasks
==
whole_sockets
)
{
max_tasks
,
whole_nodes
,
whole_sockets
,
part_sockets
,
whole_cores
,
part_cores
,
whole_threads
);
if
((
max_tasks
==
whole_sockets
)
&&
(
part_sockets
==
0
))
{
req
->
cpu_bind_type
|=
CPU_BIND_TO_SOCKETS
;
req
->
cpu_bind_type
|=
CPU_BIND_TO_SOCKETS
;
goto
make_auto
;
goto
make_auto
;
}
}
if
(
max_tasks
==
whole_cores
)
{
if
(
(
max_tasks
==
whole_cores
)
&&
(
part_cores
==
0
))
{
req
->
cpu_bind_type
|=
CPU_BIND_TO_CORES
;
req
->
cpu_bind_type
|=
CPU_BIND_TO_CORES
;
goto
make_auto
;
goto
make_auto
;
}
}
...
@@ -366,15 +370,18 @@ static void _enforce_limits(launch_tasks_request_msg_t *req, bitstr_t *mask,
...
@@ -366,15 +370,18 @@ static void _enforce_limits(launch_tasks_request_msg_t *req, bitstr_t *mask,
/* Determine which CPUs a job step can use.
/* Determine which CPUs a job step can use.
* OUT whole_<entity>_count - returns count of whole <entities> in this
* OUT whole_<entity>_count - returns count of whole <entities> in this
* allocation for this node
* allocation for this node
* OUT part__<entity>_count - returns count of partial <entities> in this
* allocation for this node
* RET - a string representation of the available mask or NULL on errlr
* RET - a string representation of the available mask or NULL on errlr
* NOTE: Caller must xfree() the return value. */
* NOTE: Caller must xfree() the return value. */
static
char
*
_alloc_mask
(
launch_tasks_request_msg_t
*
req
,
static
char
*
_alloc_mask
(
launch_tasks_request_msg_t
*
req
,
int
*
whole_node_cnt
,
int
*
whole_socket_cnt
,
int
*
whole_node_cnt
,
int
*
whole_socket_cnt
,
int
*
whole_core_cnt
,
int
*
whole_thread_cnt
)
int
*
whole_core_cnt
,
int
*
whole_thread_cnt
,
int
*
part_socket_cnt
,
int
*
part_core_cnt
)
{
{
uint16_t
sockets
,
cores
,
threads
;
uint16_t
sockets
,
cores
,
threads
;
int
c
,
s
,
t
,
i
,
mask
;
int
c
,
s
,
t
,
i
,
mask
;
int
c_miss
,
s_miss
,
t_miss
;
int
c_miss
,
s_miss
,
t_miss
,
c_hit
,
t_hit
;
bitstr_t
*
alloc_bitmap
;
bitstr_t
*
alloc_bitmap
;
char
*
str_mask
;
char
*
str_mask
;
...
@@ -382,6 +389,8 @@ static char *_alloc_mask(launch_tasks_request_msg_t *req,
...
@@ -382,6 +389,8 @@ static char *_alloc_mask(launch_tasks_request_msg_t *req,
*
whole_socket_cnt
=
0
;
*
whole_socket_cnt
=
0
;
*
whole_core_cnt
=
0
;
*
whole_core_cnt
=
0
;
*
whole_thread_cnt
=
0
;
*
whole_thread_cnt
=
0
;
*
part_socket_cnt
=
0
;
*
part_core_cnt
=
0
;
alloc_bitmap
=
_get_avail_map
(
req
,
&
sockets
,
&
cores
,
&
threads
);
alloc_bitmap
=
_get_avail_map
(
req
,
&
sockets
,
&
cores
,
&
threads
);
if
(
!
alloc_bitmap
)
if
(
!
alloc_bitmap
)
...
@@ -389,24 +398,32 @@ static char *_alloc_mask(launch_tasks_request_msg_t *req,
...
@@ -389,24 +398,32 @@ static char *_alloc_mask(launch_tasks_request_msg_t *req,
i
=
mask
=
0
;
i
=
mask
=
0
;
for
(
s
=
0
,
s_miss
=
false
;
s
<
sockets
;
s
++
)
{
for
(
s
=
0
,
s_miss
=
false
;
s
<
sockets
;
s
++
)
{
for
(
c
=
0
,
c_miss
=
false
;
c
<
cores
;
c
++
)
{
for
(
c
=
0
,
c_hit
=
c_miss
=
false
;
c
<
cores
;
c
++
)
{
for
(
t
=
0
,
t_miss
=
false
;
t
<
cores
;
t
++
)
{
for
(
t
=
0
,
t_hit
=
t_miss
=
false
;
t
<
cores
;
t
++
)
{
if
(
bit_test
(
alloc_bitmap
,
i
))
{
if
(
bit_test
(
alloc_bitmap
,
i
))
{
mask
|=
(
1
<<
i
);
mask
|=
(
1
<<
i
);
(
*
whole_thread_cnt
)
++
;
(
*
whole_thread_cnt
)
++
;
t_hit
=
true
;
c_hit
=
true
;
}
else
}
else
t_miss
=
true
;
t_miss
=
true
;
i
++
;
i
++
;
}
}
if
(
!
t_miss
)
if
(
!
t_miss
)
(
*
whole_core_cnt
)
++
;
(
*
whole_core_cnt
)
++
;
else
else
{
if
(
t_hit
)
(
*
part_core_cnt
)
++
;
c_miss
=
true
;
c_miss
=
true
;
}
}
}
if
(
!
c_miss
)
if
(
!
c_miss
)
(
*
whole_socket_cnt
)
++
;
(
*
whole_socket_cnt
)
++
;
else
else
{
if
(
c_hit
)
(
*
part_socket_cnt
)
++
;
s_miss
=
true
;
s_miss
=
true
;
}
}
}
if
(
!
s_miss
)
if
(
!
s_miss
)
(
*
whole_node_cnt
)
++
;
(
*
whole_node_cnt
)
++
;
...
...
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