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
bf23ed58
Commit
bf23ed58
authored
19 years ago
by
Danny Auble
Browse files
Options
Downloads
Patches
Plain Diff
new host_ranged_string for bgl.
parent
e602f99e
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/common/hostlist.c
+85
-23
85 additions, 23 deletions
src/common/hostlist.c
with
85 additions
and
23 deletions
src/common/hostlist.c
+
85
−
23
View file @
bf23ed58
...
@@ -158,16 +158,18 @@ strong_alias(hostset_within, slurm_hostset_within);
...
@@ -158,16 +158,18 @@ strong_alias(hostset_within, slurm_hostset_within);
/* ----[ Internal Data Structures ]---- */
/* ----[ Internal Data Structures ]---- */
#ifdef HAVE_BGL
/* logic for block node description */
#ifdef HAVE_BGL
/* We allocate space for three digits,
/* logic for block node description */
* each with values 0 to 9 even if they are not all used */
/* We allocate space for three digits,
bool
axis
[
10
][
10
][
10
];
* each with values 0 to 9 even if they are not all used */
int
axis_min_x
,
axis_min_y
,
axis_min_z
;
bool
axis
[
10
][
10
][
10
];
int
axis_max_x
,
axis_max_y
,
axis_max_z
;
int
axis_min_x
,
axis_min_y
,
axis_min_z
;
int
axis_max_x
,
axis_max_y
,
axis_max_z
;
static
void
_clear_grid
(
void
);
static
void
_set_grid
(
unsigned
long
start
,
unsigned
long
end
);
static
int
_get_boxes
(
char
*
buf
);
static
bool
_test_box
(
void
);
static
void
_clear_grid
(
void
);
static
void
_set_grid
(
unsigned
long
start
,
unsigned
long
end
);
static
bool
_test_box
(
void
);
#endif
#endif
/* hostname type: A convenience structure used in parsing single hostnames */
/* hostname type: A convenience structure used in parsing single hostnames */
...
@@ -2184,7 +2186,66 @@ _get_bracketed_list(hostlist_t hl, int *start, const size_t n, char *buf)
...
@@ -2184,7 +2186,66 @@ _get_bracketed_list(hostlist_t hl, int *start, const size_t n, char *buf)
return
len
;
return
len
;
}
}
#ifdef HAVE_BGL
/* logic for block node description */
#ifdef HAVE_BGL
/* logic for block node description */
/* write the next bracketed hostlist, i.e. prefix[n-m,k,...]
* into buf, writing at most n chars including the terminating '\0'
*
* leaves start pointing to one past last range object in bracketed list,
* and returns the number of bytes written into buf.
*
* Assumes hostlist is locked.
*/
static
int
_get_boxes
(
char
*
buf
)
{
int
len
=
0
;
int
temp
;
int
x1
;
int
x2
=
-
1
;
int
found
=
0
;
x1
=
axis_min_x
;
while
(
x1
<=
axis_max_x
)
{
found
=
0
;
for
(
temp
=
x1
;
temp
<=
axis_max_x
;
temp
++
)
{
if
(
axis
[
temp
][
axis_min_y
][
axis_min_z
]
&&
!
found
)
{
x1
=
temp
;
found
=
1
;
}
else
if
(
!
axis
[
temp
][
axis_min_y
][
axis_min_z
]
&&
found
)
{
x2
=
temp
-
1
;
break
;
}
}
if
(
found
)
{
found
=
0
;
if
(
x2
==
-
1
)
x2
=
axis_max_x
;
sprintf
(
buf
+
len
,
"%d%d%dx%d%d%d,"
,
x1
,
axis_min_y
,
axis_min_z
,
x2
,
axis_max_y
,
axis_max_z
);
len
+=
8
;
}
else
if
(
x2
==
-
1
)
break
;
x1
=
x2
+
1
;
x2
=
-
1
;
}
buf
[
len
-
1
]
=
']'
;
/* NUL terminate for safety, but do not add terminator to len */
buf
[
len
]
=
'\0'
;
return
len
;
}
static
void
static
void
_clear_grid
(
void
)
_clear_grid
(
void
)
{
{
...
@@ -2222,7 +2283,6 @@ _set_grid(unsigned long start, unsigned long end)
...
@@ -2222,7 +2283,6 @@ _set_grid(unsigned long start, unsigned long end)
axis_max_x
=
MAX
(
axis_max_x
,
x2
);
axis_max_x
=
MAX
(
axis_max_x
,
x2
);
axis_max_y
=
MAX
(
axis_max_y
,
y2
);
axis_max_y
=
MAX
(
axis_max_y
,
y2
);
axis_max_z
=
MAX
(
axis_max_z
,
z2
);
axis_max_z
=
MAX
(
axis_max_z
,
z2
);
for
(
temp
=
x1
;
temp
<=
x2
;
temp
++
)
{
for
(
temp
=
x1
;
temp
<=
x2
;
temp
++
)
{
for
(
temp1
=
y1
;
temp1
<=
y2
;
temp1
++
)
{
for
(
temp1
=
y1
;
temp1
<=
y2
;
temp1
++
)
{
for
(
temp2
=
z1
;
temp2
<=
z2
;
temp2
++
)
{
for
(
temp2
=
z1
;
temp2
<=
z2
;
temp2
++
)
{
...
@@ -2277,20 +2337,22 @@ size_t hostlist_ranged_string(hostlist_t hl, size_t n, char *buf)
...
@@ -2277,20 +2337,22 @@ size_t hostlist_ranged_string(hostlist_t hl, size_t n, char *buf)
_clear_grid
();
_clear_grid
();
for
(
i
=
0
;
i
<
hl
->
nranges
;
i
++
)
for
(
i
=
0
;
i
<
hl
->
nranges
;
i
++
)
_set_grid
(
hl
->
hr
[
i
]
->
lo
,
hl
->
hr
[
i
]
->
hi
);
_set_grid
(
hl
->
hr
[
i
]
->
lo
,
hl
->
hr
[
i
]
->
hi
);
if
(
!
_test_box
())
if
(
!
_test_box
())
{
goto
notbox
;
sprintf
(
buf
,
"%s["
,
hl
->
hr
[
0
]
->
prefix
);
len
=
strlen
(
hl
->
hr
[
0
]
->
prefix
)
+
1
;
len
+=
snprintf
(
buf
,
n
,
"%s[%d%d%dx%d%d%d]"
,
len
+=
_get_boxes
(
buf
+
len
);
hl
->
hr
[
0
]
->
prefix
,
}
else
{
axis_min_x
,
axis_min_y
,
axis_min_z
,
len
+=
snprintf
(
buf
,
n
,
"%s[%d%d%dx%d%d%d]"
,
axis_max_x
,
axis_max_y
,
axis_max_z
);
hl
->
hr
[
0
]
->
prefix
,
if
((
len
<
0
)
||
(
len
>
n
))
axis_min_x
,
axis_min_y
,
axis_min_z
,
len
=
n
;
/* truncated */
axis_max_x
,
axis_max_y
,
axis_max_z
);
if
((
len
<
0
)
||
(
len
>
n
))
len
=
n
;
/* truncated */
}
box
=
true
;
box
=
true
;
notbox:
notbox:
#endif
#endif
if
(
!
box
)
{
if
(
!
box
)
{
i
=
0
;
i
=
0
;
while
(
i
<
hl
->
nranges
&&
len
<
n
)
{
while
(
i
<
hl
->
nranges
&&
len
<
n
)
{
...
...
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