Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Master Thesis Custom SLURM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
becker29
Master Thesis Custom SLURM
Commits
d57f78d7
Commit
d57f78d7
authored
1 year ago
by
René Pascal Becker
Browse files
Options
Downloads
Patches
Plain Diff
Fix Pmix Store
parent
82c53374
Branches
NFC-Read_Bluetooth_connection
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/plugins/mpi/pmix/pmixp_client_v2.c
+1
-5
1 addition, 5 deletions
src/plugins/mpi/pmix/pmixp_client_v2.c
src/plugins/mpi/pmix/pmixp_spawn.c
+119
-40
119 additions, 40 deletions
src/plugins/mpi/pmix/pmixp_spawn.c
with
120 additions
and
45 deletions
src/plugins/mpi/pmix/pmixp_client_v2.c
+
1
−
5
View file @
d57f78d7
...
...
@@ -90,11 +90,7 @@ static pmix_status_t _client_finalized(const pmix_proc_t *proc,
void
*
server_object
,
pmix_op_cbfunc_t
cbfunc
,
void
*
cbdata
)
{
THESIS_LOG
/* don'n do anything by now */
if
(
NULL
!=
cbfunc
)
{
cbfunc
(
PMIX_SUCCESS
,
cbdata
);
}
return
PMIX_SUCCESS
;
return
PMIX_OPERATION_SUCCEEDED
;
}
static
pmix_status_t
_abort_fn
(
const
pmix_proc_t
*
pmix_proc
,
...
...
This diff is collapsed.
Click to expand it.
src/plugins/mpi/pmix/pmixp_spawn.c
+
119
−
40
View file @
d57f78d7
...
...
@@ -78,7 +78,7 @@ enum KeyStoreRequests { STORE_PUBLISH, STORE_LOOKUP, STORE_UNPUBLISH };
struct
PmixInfoData
{
char
*
key
;
char
*
value
;
pmix_value_t
value
;
int
timeout
;
pmix_persistence_t
persistance
;
};
...
...
@@ -197,7 +197,7 @@ struct PmixInfoData _parse_info_data(const pmix_info_t info[], size_t ninfo) {
// Setup default info data struct
struct
PmixInfoData
result
;
result
.
persistance
=
PMIX_PERSIST_APP
;
result
.
key
=
result
.
value
=
NULL
;
result
.
key
=
NULL
;
result
.
timeout
=
120
;
// Parse possible infos
...
...
@@ -214,14 +214,95 @@ struct PmixInfoData _parse_info_data(const pmix_info_t info[], size_t ninfo) {
result
.
persistance
=
current
->
value
.
data
.
persist
;
else
if
(
strcmp
(
current
->
key
,
PMIX_TIMEOUT
)
==
0
)
result
.
timeout
=
current
->
value
.
data
.
int32
;
else
if
(
current
->
value
.
type
==
PMIX_STRING
)
{
else
if
(
strncmp
(
current
->
key
,
"pmix."
,
5
)
!=
0
)
{
// This is the custom data
result
.
key
=
(
char
*
)
current
->
key
;
result
.
value
=
current
->
value
.
data
.
string
;
result
.
value
=
current
->
value
;
}
}
return
result
;
}
// Binary to Hex
char
*
_create_byte_array
(
char
*
data
,
size_t
in_sz
,
size_t
*
out_sz
)
{
*
out_sz
=
in_sz
*
2
;
char
*
arr
=
(
char
*
)
malloc
(
*
out_sz
);
memset
((
void
*
)
arr
,
0
,
*
out_sz
);
uint32_t
cursor
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
in_sz
;
i
++
,
cursor
+=
2
)
sprintf
(
&
arr
[
cursor
],
"%02X"
,
(
unsigned
int
)
data
[
i
]);
return
arr
;
}
// Hex to binary
char
*
_read_byte_array
(
const
char
*
byte_array
,
size_t
*
out_sz
)
{
*
out_sz
=
strlen
(
byte_array
)
/
2
;
char
*
arr
=
(
char
*
)
malloc
(
*
out_sz
);
memset
((
void
*
)
arr
,
0
,
*
out_sz
);
uint32_t
cursor
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
strlen
(
byte_array
);
i
+=
2
,
cursor
++
)
{
int
r
;
sscanf
(
&
byte_array
[
i
],
"%02X"
,
&
r
);
arr
[
cursor
]
=
r
;
}
return
arr
;
}
void
_get_sz_and_data
(
const
pmix_value_t
*
value
,
size_t
*
out_sz
,
char
**
out_data
)
{
switch
(
value
->
type
)
{
case
PMIX_STRING
:
*
out_sz
=
strlen
(
value
->
data
.
string
)
+
1
;
*
out_data
=
value
->
data
.
string
;
break
;
case
PMIX_BYTE_OBJECT
:
*
out_sz
=
value
->
data
.
bo
.
size
;
*
out_data
=
value
->
data
.
bo
.
bytes
;
break
;
default:
{
THESIS_LOG
*
out_sz
=
0
;
*
out_data
=
NULL
;
}
break
;
}
return
;
}
void
_set_value
(
pmix_value_t
*
value
,
char
*
data
,
size_t
data_size
,
size_t
type
)
{
value
->
type
=
type
;
switch
(
type
)
{
case
PMIX_STRING
:
value
->
data
.
string
=
data
;
break
;
case
PMIX_BYTE_OBJECT
:
value
->
data
.
bo
.
bytes
=
data
;
value
->
data
.
bo
.
size
=
data_size
;
break
;
default:
{
THESIS_LOG
value
->
type
=
0
;
}
break
;
}
return
;
}
char
*
encode_pmix_value
(
const
pmix_value_t
*
value
,
size_t
*
out_sz
)
{
char
*
data
;
_get_sz_and_data
(
value
,
out_sz
,
&
data
);
if
(
*
out_sz
==
0
)
return
NULL
;
return
_create_byte_array
(
data
,
*
out_sz
,
out_sz
);
}
pmix_value_t
decode_pmix_value
(
const
char
*
encoded
,
size_t
*
out_sz
,
size_t
type
)
{
char
*
binary_data
=
_read_byte_array
(
encoded
,
out_sz
);
pmix_value_t
value
;
_set_value
(
&
value
,
binary_data
,
*
out_sz
,
type
);
return
value
;
}
// PUBLISH ----
int
publish_to_dpm_agent
(
const
pmix_proc_t
*
proc
,
const
pmix_info_t
info
[],
...
...
@@ -233,7 +314,16 @@ int publish_to_dpm_agent(const pmix_proc_t *proc, const pmix_info_t info[],
return
0
;
struct
PmixInfoData
info_data
=
_parse_info_data
(
info
,
ninfo
);
if
(
!
info_data
.
key
||
!
info_data
.
value
)
{
if
(
!
info_data
.
key
)
{
close
(
socket_fd
);
THESIS_LOG
return
0
;
}
// Encode data
size_t
encoded_data_size
;
char
*
encoded_data
=
encode_pmix_value
(
&
info_data
.
value
,
&
encoded_data_size
);
if
(
encoded_data_size
==
0
||
encoded_data
==
NULL
)
{
close
(
socket_fd
);
THESIS_LOG
return
0
;
...
...
@@ -242,9 +332,10 @@ int publish_to_dpm_agent(const pmix_proc_t *proc, const pmix_info_t info[],
// Create data to send
char
data
[
max_publish_size
];
memset
((
void
*
)
data
,
0
,
max_publish_size
);
snprintf
(
data
,
max_publish_size
,
"%d,%s,%zu,%s,%s"
,
(
int
)
STORE_PUBLISH
,
snprintf
(
data
,
max_publish_size
,
"%d,%s,%zu,%s,%
hu,%
s"
,
(
int
)
STORE_PUBLISH
,
(
const
char
*
)
proc
->
nspace
,
(
size_t
)
proc
->
rank
,
info_data
.
key
,
info_data
.
value
);
info_data
.
value
.
type
,
encoded_data
);
free
(
encoded_data
);
if
(
!
_send_message
(
socket_fd
,
DPM_AGENT_KEYSTORE_MSG
,
data
))
{
close
(
socket_fd
);
...
...
@@ -282,12 +373,14 @@ struct ReceiverInfo {
void
_parse_next_data_val
(
pmix_pdata_t
*
data_obj
)
{
char
*
key
=
strtok
(
NULL
,
","
);
char
*
value_type
=
strtok
(
NULL
,
","
);
char
*
value
=
strtok
(
NULL
,
","
);
char
*
nspace
=
strtok
(
NULL
,
","
);
char
*
rank
=
strtok
(
NULL
,
","
);
data_obj
->
value
.
data
.
string
=
strdup
(
value
);
data_obj
->
value
.
type
=
PMIX_STRING
;
size_t
out_sz
,
type
;
sscanf
(
value_type
,
"%zu"
,
&
type
);
data_obj
->
value
=
decode_pmix_value
(
value
,
&
out_sz
,
type
);
strcpy
((
char
*
)
data_obj
->
key
,
key
);
strcpy
((
char
*
)
data_obj
->
proc
.
nspace
,
nspace
);
...
...
@@ -407,13 +500,8 @@ void _handle_dmodex_result(pmix_status_t status, char *data, size_t sz,
info
->
rank
,
info
->
node
,
info
->
transaction
);
// Sanitize data
char
*
sanitized_data
=
(
char
*
)
malloc
(
sz
*
6
);
// \u0001 etc.
memset
((
void
*
)
sanitized_data
,
0
,
sz
*
6
);
uint32_t
cursor
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
sz
;
i
++
)
{
sprintf
(
&
sanitized_data
[
cursor
],
"%02X"
,
(
unsigned
int
)
data
[
i
]);
cursor
+=
2
;
}
size_t
cursor
;
char
*
sanitized_data
=
_create_byte_array
(
data
,
sz
,
&
cursor
);
// Setup header in final message
uint32_t
msg_data_len
=
strlen
(
header
)
+
cursor
+
1
;
...
...
@@ -428,7 +516,6 @@ void _handle_dmodex_result(pmix_status_t status, char *data, size_t sz,
// ... and send the message!
_send_message
(
info
->
socket_fd
,
DPM_AGENT_DMODEX_RESP_MSG
,
msg_data
);
free
(
msg_data
);
close
(
info
->
socket_fd
);
free
(
info
->
node
);
free
(
info
);
}
...
...
@@ -443,20 +530,19 @@ void *dmodex_daemon(void *dpm_socket) {
struct
pollfd
fd
;
fd
.
fd
=
socket_fd
;
fd
.
events
=
POLLIN
;
while
(
!
stop_dmodex_daemon
)
{
FILE
*
ptr
=
fopen
(
"/home/dmodex"
,
"a"
);
fprintf
(
ptr
,
"
POLL %d
\n
"
,
socket_fd
);
fprintf
(
ptr
,
"
START
\n
"
);
fclose
(
ptr
);
while
(
!
stop_dmodex_daemon
)
{
int
rv
=
0
;
if
((
rv
=
poll
(
&
fd
,
1
,
100
)
>
0
))
{
FILE
*
ptr
=
fopen
(
"/home/dmodex"
,
"a"
);
ptr
=
fopen
(
"/home/dmodex"
,
"a"
);
fprintf
(
ptr
,
"RESULT: %d
\n
"
,
fd
.
revents
);
fclose
(
ptr
);
if
(
fd
.
revents
&
POLLIN
)
{
FILE
*
ptr
=
fopen
(
"/home/dmodex"
,
"a"
);
ptr
=
fopen
(
"/home/dmodex"
,
"a"
);
fprintf
(
ptr
,
"POLLIN
\n
"
);
fclose
(
ptr
);
// New message to be read
...
...
@@ -532,6 +618,10 @@ void *dmodex_daemon(void *dpm_socket) {
}
}
}
ptr
=
fopen
(
"/home/dmodex"
,
"a"
);
fprintf
(
ptr
,
"STOP
\n
"
);
fclose
(
ptr
);
close
(
socket_fd
);
return
NULL
;
}
...
...
@@ -654,35 +744,24 @@ void *_modex_data_receiver(void *data) {
// Fetch message string
char
*
result
=
_cpy_message_data
(
data_msg
);
FILE
*
ptr
=
fopen
(
"/home/dmodex"
,
"a"
);
fprintf
(
ptr
,
"
MODEX DATA:
%s
\n
"
,
result
);
FILE
*
ptr
=
fopen
(
"/home/dmodex
_recv
"
,
"a"
);
fprintf
(
ptr
,
"
RECEIVED
%s
\n
"
,
result
);
fclose
(
ptr
);
_destroy_message
(
data_msg
);
// Get modex data
ptr
=
fopen
(
"/home/dmodex"
,
"a"
);
fprintf
(
ptr
,
"MODEX DATA: %s
\n
"
,
result
);
fclose
(
ptr
);
strtok
(
result
,
","
);
// namespace
strtok
(
NULL
,
","
);
// rank
strtok
(
NULL
,
","
);
// node
strtok
(
NULL
,
","
);
// transaction
char
*
msg_modexData
=
strtok
(
NULL
,
","
);
// data
char
*
modexData
=
(
char
*
)
malloc
(
strlen
(
msg_modexData
)
/
2
);
for
(
unsigned
int
i
=
0
;
i
<
strlen
(
msg_modexData
)
/
2
;
i
++
)
{
int
r
;
sscanf
(
&
msg_modexData
[
i
*
2
],
"%02X"
,
&
r
);
modexData
[
i
]
=
r
;
}
size_t
modexDataSz
;
char
*
modexData
=
_read_byte_array
(
msg_modexData
,
&
modexDataSz
);
_destroy_message
(
result
);
ptr
=
fopen
(
"/home/dmodex"
,
"a"
);
fprintf
(
ptr
,
"MODEX DATA: %s
\n
"
,
modexData
);
fclose
(
ptr
);
// Pass to pmix
info
->
cbfunc
(
PMIX_SUCCESS
,
modexData
,
strlen
(
msg_
modexData
)
/
2
,
info
->
cbdata
,
free
,
modexData
);
info
->
cbfunc
(
PMIX_SUCCESS
,
modexData
,
modexData
Sz
,
info
->
cbdata
,
free
,
modexData
);
// Cleanup
modexCleanup:
...
...
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