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
ceeb83cd
Commit
ceeb83cd
authored
19 years ago
by
Moe Jette
Browse files
Options
Downloads
Patches
Plain Diff
Updates to pmi logic, next step will be to communicate between tasks.
parent
debd9ee2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/api/pmi.c
+40
-7
40 additions, 7 deletions
src/api/pmi.c
testsuite/expect/test7.2.prog.c
+34
-6
34 additions, 6 deletions
testsuite/expect/test7.2.prog.c
with
74 additions
and
13 deletions
src/api/pmi.c
+
40
−
7
View file @
ceeb83cd
...
@@ -93,9 +93,13 @@
...
@@ -93,9 +93,13 @@
#define PMI_MAX_KVSNAME_LEN 256
/* Maximum size of KVS name */
#define PMI_MAX_KVSNAME_LEN 256
/* Maximum size of KVS name */
#define PMI_MAX_VAL_LEN 256
/* Maximum size of a PMI value */
#define PMI_MAX_VAL_LEN 256
/* Maximum size of a PMI value */
#define KVS_STATE_LOCAL 0
#define KVS_STATE_DEFUNCT 1
/* default key names form is jobid.stepid[.sequence] */
/* default key names form is jobid.stepid[.sequence] */
struct
kvs_rec
{
struct
kvs_rec
{
char
*
kvs_name
;
char
*
kvs_name
;
int
kvs_state
;
/* see KVS_STATE_* */
int
kvs_cnt
;
int
kvs_cnt
;
int
kvs_inx
;
/* iteration index */
int
kvs_inx
;
/* iteration index */
char
**
kvs_keys
;
char
**
kvs_keys
;
...
@@ -267,7 +271,6 @@ static void _del_kvs_rec(struct kvs_rec *kvs_ptr)
...
@@ -267,7 +271,6 @@ static void _del_kvs_rec(struct kvs_rec *kvs_ptr)
}
}
if
(
kvs_ptr
->
kvs_name
)
if
(
kvs_ptr
->
kvs_name
)
free
(
kvs_ptr
->
kvs_name
);
free
(
kvs_ptr
->
kvs_name
);
free
(
kvs_ptr
);
return
;
return
;
}
}
...
@@ -807,13 +810,25 @@ parameter, kvsname, must be at least as long as the value returned by
...
@@ -807,13 +810,25 @@ parameter, kvsname, must be at least as long as the value returned by
@*/
@*/
int
PMI_KVS_Create
(
char
kvsname
[],
int
length
)
int
PMI_KVS_Create
(
char
kvsname
[],
int
length
)
{
{
int
size
,
rc
;
if
(
kvsname
==
NULL
)
if
(
kvsname
==
NULL
)
return
PMI_ERR_INVALID_ARG
;
return
PMI_ERR_INVALID_ARG
;
if
(
length
<
PMI_MAX_KVSNAME_LEN
)
if
(
(
pmi_jobid
<
0
)
||
(
pmi_stepid
<
0
)
)
return
PMI_
ERR_INVALID_LENGTH
;
return
PMI_
FAIL
;
/* FIXME */
pthread_mutex_lock
(
&
kvs_mutex
);
return
PMI_FAIL
;
size
=
snprintf
(
kvsname
,
length
,
"%ld.%ld.%d.%d"
,
pmi_jobid
,
pmi_stepid
,
pmi_rank
,
kvs_name_sequence
);
if
(
size
>=
length
)
/* truncated */
rc
=
PMI_ERR_INVALID_LENGTH
;
else
{
kvs_name_sequence
++
;
_init_kvs
(
kvsname
);
rc
=
PMI_SUCCESS
;
}
pthread_mutex_unlock
(
&
kvs_mutex
);
return
rc
;
}
}
/*@
/*@
...
@@ -833,11 +848,23 @@ This function destroys a keyval space created by 'PMI_KVS_Create()'.
...
@@ -833,11 +848,23 @@ This function destroys a keyval space created by 'PMI_KVS_Create()'.
@*/
@*/
int
PMI_KVS_Destroy
(
const
char
kvsname
[]
)
int
PMI_KVS_Destroy
(
const
char
kvsname
[]
)
{
{
int
i
,
found
=
0
;
if
(
kvsname
==
NULL
)
if
(
kvsname
==
NULL
)
return
PMI_ERR_INVALID_ARG
;
return
PMI_ERR_INVALID_ARG
;
/* FIXME */
pthread_mutex_lock
(
&
kvs_mutex
);
return
PMI_FAIL
;
for
(
i
=
0
;
i
<
kvs_rec_cnt
;
i
++
)
{
if
(
strncmp
(
kvs_recs
[
i
].
kvs_name
,
kvsname
,
PMI_MAX_KVSNAME_LEN
))
continue
;
kvs_recs
[
i
].
kvs_state
=
KVS_STATE_DEFUNCT
;
found
=
1
;
break
;
}
pthread_mutex_unlock
(
&
kvs_mutex
);
if
(
found
==
0
)
return
PMI_ERR_INVALID_ARG
;
return
PMI_SUCCESS
;
}
}
/*@
/*@
...
@@ -983,6 +1010,8 @@ int PMI_KVS_Get( const char kvsname[], const char key[], char value[], int lengt
...
@@ -983,6 +1010,8 @@ int PMI_KVS_Get( const char kvsname[], const char key[], char value[], int lengt
/* find the proper kvs record */
/* find the proper kvs record */
pthread_mutex_lock
(
&
kvs_mutex
);
pthread_mutex_lock
(
&
kvs_mutex
);
for
(
i
=
0
;
i
<
kvs_rec_cnt
;
i
++
)
{
for
(
i
=
0
;
i
<
kvs_rec_cnt
;
i
++
)
{
if
(
kvs_recs
[
i
].
kvs_state
==
KVS_STATE_DEFUNCT
)
continue
;
if
(
strncmp
(
kvs_recs
[
i
].
kvs_name
,
kvsname
,
PMI_MAX_KVSNAME_LEN
))
if
(
strncmp
(
kvs_recs
[
i
].
kvs_name
,
kvsname
,
PMI_MAX_KVSNAME_LEN
))
continue
;
continue
;
for
(
j
=
0
;
j
<
kvs_recs
[
i
].
kvs_cnt
;
j
++
)
{
for
(
j
=
0
;
j
<
kvs_recs
[
i
].
kvs_cnt
;
j
++
)
{
...
@@ -1049,6 +1078,8 @@ int PMI_KVS_Iter_first(const char kvsname[], char key[], int key_len, char val[]
...
@@ -1049,6 +1078,8 @@ int PMI_KVS_Iter_first(const char kvsname[], char key[], int key_len, char val[]
/* find the proper kvs record */
/* find the proper kvs record */
pthread_mutex_lock
(
&
kvs_mutex
);
pthread_mutex_lock
(
&
kvs_mutex
);
for
(
i
=
0
;
i
<
kvs_rec_cnt
;
i
++
)
{
for
(
i
=
0
;
i
<
kvs_rec_cnt
;
i
++
)
{
if
(
kvs_recs
[
i
].
kvs_state
==
KVS_STATE_DEFUNCT
)
continue
;
if
(
strncmp
(
kvs_recs
[
i
].
kvs_name
,
kvsname
,
PMI_MAX_KVSNAME_LEN
))
if
(
strncmp
(
kvs_recs
[
i
].
kvs_name
,
kvsname
,
PMI_MAX_KVSNAME_LEN
))
continue
;
continue
;
kvs_recs
[
i
].
kvs_inx
=
0
;
kvs_recs
[
i
].
kvs_inx
=
0
;
...
@@ -1121,6 +1152,8 @@ int PMI_KVS_Iter_next(const char kvsname[], char key[], int key_len,
...
@@ -1121,6 +1152,8 @@ int PMI_KVS_Iter_next(const char kvsname[], char key[], int key_len,
/* find the proper kvs record */
/* find the proper kvs record */
pthread_mutex_lock
(
&
kvs_mutex
);
pthread_mutex_lock
(
&
kvs_mutex
);
for
(
i
=
0
;
i
<
kvs_rec_cnt
;
i
++
)
{
for
(
i
=
0
;
i
<
kvs_rec_cnt
;
i
++
)
{
if
(
kvs_recs
[
i
].
kvs_state
==
KVS_STATE_DEFUNCT
)
continue
;
if
(
strncmp
(
kvs_recs
[
i
].
kvs_name
,
kvsname
,
PMI_MAX_KVSNAME_LEN
))
if
(
strncmp
(
kvs_recs
[
i
].
kvs_name
,
kvsname
,
PMI_MAX_KVSNAME_LEN
))
continue
;
continue
;
kvs_recs
[
i
].
kvs_inx
++
;
kvs_recs
[
i
].
kvs_inx
++
;
...
...
This diff is collapsed.
Click to expand it.
testsuite/expect/test7.2.prog.c
+
34
−
6
View file @
ceeb83cd
...
@@ -175,21 +175,49 @@ main (int argc, char **argv)
...
@@ -175,21 +175,49 @@ main (int argc, char **argv)
for
(
i
=
0
;
;
i
++
)
{
for
(
i
=
0
;
;
i
++
)
{
if
(
key
[
0
]
==
'\0'
)
{
if
(
key
[
0
]
==
'\0'
)
{
if
(
i
!=
(
pmi_size
*
2
))
{
if
(
i
!=
(
pmi_size
*
2
))
{
printf
(
"FAILURE: PMI_KVS_iter_next cycle count
(%d, %d)
\n
"
,
printf
(
"FAILURE: PMI_KVS_iter_next cycle count
"
i
,
pmi_size
);
"(%d, %d)
\n
"
,
i
,
pmi_size
);
}
}
break
;
break
;
}
}
printf
(
"PMI_KVS_Iter_next(%s,%d): %s=%s
\n
"
,
kvs_name
,
i
,
key
,
val
);
printf
(
"PMI_KVS_Iter_next(%s,%d): %s=%s
\n
"
,
kvs_name
,
i
,
key
,
if
((
rc
=
PMI_KVS_Iter_next
(
kvs_name
,
key
,
key_len
,
val
,
val_len
))
!=
val
);
PMI_SUCCESS
)
{
if
((
rc
=
PMI_KVS_Iter_next
(
kvs_name
,
key
,
key_len
,
val
,
val_len
))
!=
PMI_SUCCESS
)
{
printf
(
"FAILURE: PMI_KVS_iter_next: %d
\n
"
,
rc
);
printf
(
"FAILURE: PMI_KVS_iter_next: %d
\n
"
,
rc
);
exit
(
1
);
exit
(
1
);
}
}
}
}
/* create new keyspace and test it */
if
((
rc
=
PMI_KVS_Create
(
kvs_name
,
kvs_name_len
))
!=
PMI_SUCCESS
)
{
printf
(
"FAILURE: PMI_KVS_Create: %d
\n
"
,
rc
);
exit
(
1
);
}
printf
(
"PMI_KVS_Create %s
\n
"
,
kvs_name
);
if
((
rc
=
PMI_KVS_Put
(
kvs_name
,
"KVS_KEY"
,
"KVS_VAL"
))
!=
PMI_SUCCESS
)
{
printf
(
"FAILURE: PMI_KVS_Put: %d
\n
"
,
rc
);
exit
(
1
);
}
printf
(
"PMI_KVS_Put(%s,KVS_KEY,KVS_VAL)
\n
"
,
kvs_name
);
if
((
rc
=
PMI_KVS_Get
(
kvs_name
,
"KVS_KEY"
,
val
,
val_len
))
!=
PMI_SUCCESS
)
{
printf
(
"FAILURE: PMI_KVS_Get: %d
\n
"
,
rc
);
exit
(
1
);
}
printf
(
"PMI_KVS_Get(%s,%s) %s
\n
"
,
kvs_name
,
"KVS_KEY"
,
val
);
if
((
rc
=
PMI_KVS_Destroy
(
kvs_name
))
!=
PMI_SUCCESS
)
{
printf
(
"FAILURE: PMI_KVS_Destroy(%s): %d
\n
"
,
kvs_name
,
rc
);
exit
(
1
);
}
if
((
rc
=
PMI_KVS_Get
(
kvs_name
,
"KVS_KEY"
,
val
,
val_len
))
!=
PMI_ERR_INVALID_KVS
)
{
printf
(
"FAILURE: PMI_KVS_Get: %d
\n
"
,
rc
);
exit
(
1
);
}
if
((
rc
=
PMI_Finalize
())
!=
PMI_SUCCESS
)
{
if
((
rc
=
PMI_Finalize
())
!=
PMI_SUCCESS
)
{
printf
(
"FAILURE: PMI_Finalize: %
\n
"
,
rc
);
printf
(
"FAILURE: PMI_Finalize: %
d
\n
"
,
rc
);
exit
(
1
);
exit
(
1
);
}
}
...
...
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