Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Iker Martín Álvarez
Proteo
Commits
64edabe3
Commit
64edabe3
authored
Mar 21, 2023
by
iker_martin
Browse files
Minor refactor of malleability manager. Added function to update communicator after a resize.
parent
46733c2d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Codes/Main/Main.c
View file @
64edabe3
...
@@ -57,6 +57,8 @@ int main(int argc, char *argv[]) {
...
@@ -57,6 +57,8 @@ int main(int argc, char *argv[]) {
if
(
req
!=
MPI_THREAD_MULTIPLE
)
{
if
(
req
!=
MPI_THREAD_MULTIPLE
)
{
printf
(
"No se ha obtenido la configuración de hilos necesaria
\n
Solicitada %d -- Devuelta %d
\n
"
,
req
,
MPI_THREAD_MULTIPLE
);
printf
(
"No se ha obtenido la configuración de hilos necesaria
\n
Solicitada %d -- Devuelta %d
\n
"
,
req
,
MPI_THREAD_MULTIPLE
);
fflush
(
stdout
);
MPI_Abort
(
MPI_COMM_WORLD
,
-
50
);
}
}
init_group_struct
(
argv
,
argc
,
myId
,
numP
);
init_group_struct
(
argv
,
argc
,
myId
,
numP
);
...
...
Codes/malleability/malleabilityManager.c
View file @
64edabe3
...
@@ -30,6 +30,7 @@ int thread_check();
...
@@ -30,6 +30,7 @@ int thread_check();
void
*
thread_async_work
();
void
*
thread_async_work
();
void
print_comms_state
();
void
print_comms_state
();
void
malleability_comms_update
(
MPI_Comm
comm
);
typedef
struct
{
typedef
struct
{
int
spawn_method
;
int
spawn_method
;
...
@@ -551,13 +552,7 @@ void Children_init() {
...
@@ -551,13 +552,7 @@ void Children_init() {
// Guardar los resultados de esta transmision
// Guardar los resultados de esta transmision
comm_results
(
mall_conf
->
results
,
mall
->
root
,
mall_conf
->
config_file
->
n_resizes
,
mall
->
intercomm
);
comm_results
(
mall_conf
->
results
,
mall
->
root
,
mall_conf
->
config_file
->
n_resizes
,
mall
->
intercomm
);
if
(
!
is_intercomm
)
{
if
(
!
is_intercomm
)
{
if
(
mall
->
thread_comm
!=
MPI_COMM_WORLD
)
MPI_Comm_free
(
&
(
mall
->
thread_comm
));
malleability_comms_update
(
mall
->
intercomm
);
if
(
mall
->
comm
!=
MPI_COMM_WORLD
)
MPI_Comm_free
(
&
(
mall
->
comm
));
if
(
mall
->
user_comm
!=
MPI_COMM_WORLD
)
MPI_Comm_free
(
&
(
mall
->
user_comm
));
//TODO No es peligroso?
MPI_Comm_dup
(
mall
->
intercomm
,
&
(
mall
->
thread_comm
));
MPI_Comm_dup
(
mall
->
intercomm
,
&
(
mall
->
comm
));
MPI_Comm_dup
(
mall
->
intercomm
,
&
(
mall
->
user_comm
));
}
}
MPI_Comm_disconnect
(
&
(
mall
->
intercomm
));
MPI_Comm_disconnect
(
&
(
mall
->
intercomm
));
...
@@ -738,17 +733,7 @@ int end_redistribution() {
...
@@ -738,17 +733,7 @@ int end_redistribution() {
local_state
=
MALL_DIST_COMPLETED
;
local_state
=
MALL_DIST_COMPLETED
;
if
(
!
is_intercomm
)
{
// Merge Spawn
if
(
!
is_intercomm
)
{
// Merge Spawn
if
(
mall
->
numP
<
mall
->
numC
)
{
// Expand
if
(
mall
->
numP
<
mall
->
numC
)
{
// Expand
if
(
mall
->
thread_comm
!=
MPI_COMM_WORLD
)
MPI_Comm_free
(
&
(
mall
->
thread_comm
));
malleability_comms_update
(
mall
->
intercomm
);
if
(
mall
->
comm
!=
MPI_COMM_WORLD
)
MPI_Comm_free
(
&
(
mall
->
comm
));
if
(
mall
->
user_comm
!=
MPI_COMM_WORLD
)
MPI_Comm_free
(
&
(
mall
->
user_comm
));
//TODO No es peligroso?
MPI_Comm_dup
(
mall
->
intercomm
,
&
(
mall
->
thread_comm
));
MPI_Comm_dup
(
mall
->
intercomm
,
&
(
mall
->
comm
));
MPI_Comm_dup
(
mall
->
intercomm
,
&
(
mall
->
user_comm
));
MPI_Comm_set_name
(
mall
->
thread_comm
,
"MPI_COMM_MALL_THREAD"
);
MPI_Comm_set_name
(
mall
->
comm
,
"MPI_COMM_MALL"
);
MPI_Comm_set_name
(
mall
->
user_comm
,
"MPI_COMM_MALL_USER"
);
}
else
{
// Shrink || Merge Shrink requiere de mas tareas
}
else
{
// Shrink || Merge Shrink requiere de mas tareas
local_state
=
MALL_SPAWN_ADAPT_PENDING
;
local_state
=
MALL_SPAWN_ADAPT_PENDING
;
}
}
...
@@ -773,7 +758,7 @@ int shrink_redistribution() {
...
@@ -773,7 +758,7 @@ int shrink_redistribution() {
zombies_collect_suspended
(
mall
->
user_comm
,
mall
->
myId
,
mall
->
numP
,
mall
->
numC
,
mall
->
root
,
(
void
*
)
mall_conf
->
results
,
mall_conf
->
config_file
->
n_stages
);
zombies_collect_suspended
(
mall
->
user_comm
,
mall
->
myId
,
mall
->
numP
,
mall
->
numC
,
mall
->
root
,
(
void
*
)
mall_conf
->
results
,
mall_conf
->
config_file
->
n_stages
);
if
(
mall
->
myId
<
mall
->
numC
)
{
if
(
mall
->
myId
<
mall
->
numC
)
{
if
(
mall
->
thread_comm
!=
MPI_COMM_WORLD
)
MPI_Comm_free
(
&
(
mall
->
thread_comm
));
if
(
mall
->
thread_comm
!=
MPI_COMM_WORLD
)
MPI_Comm_free
(
&
(
mall
->
thread_comm
));
//FIXME Modificar a que se pida pro el usuario el cambio y se llama a comms_update
if
(
mall
->
comm
!=
MPI_COMM_WORLD
)
MPI_Comm_free
(
&
(
mall
->
comm
));
if
(
mall
->
comm
!=
MPI_COMM_WORLD
)
MPI_Comm_free
(
&
(
mall
->
comm
));
mall
->
dup_user_comm
=
1
;
mall
->
dup_user_comm
=
1
;
...
@@ -919,3 +904,17 @@ void print_comms_state() {
...
@@ -919,3 +904,17 @@ void print_comms_state() {
}
}
free
(
test
);
free
(
test
);
}
}
void
malleability_comms_update
(
MPI_Comm
comm
)
{
if
(
mall
->
thread_comm
!=
MPI_COMM_WORLD
)
MPI_Comm_free
(
&
(
mall
->
thread_comm
));
if
(
mall
->
comm
!=
MPI_COMM_WORLD
)
MPI_Comm_free
(
&
(
mall
->
comm
));
if
(
mall
->
user_comm
!=
MPI_COMM_WORLD
)
MPI_Comm_free
(
&
(
mall
->
user_comm
));
//TODO No es peligroso?
MPI_Comm_dup
(
comm
,
&
(
mall
->
thread_comm
));
MPI_Comm_dup
(
comm
,
&
(
mall
->
comm
));
MPI_Comm_dup
(
comm
,
&
(
mall
->
user_comm
));
MPI_Comm_set_name
(
mall
->
thread_comm
,
"MPI_COMM_MALL_THREAD"
);
MPI_Comm_set_name
(
mall
->
comm
,
"MPI_COMM_MALL"
);
MPI_Comm_set_name
(
mall
->
user_comm
,
"MPI_COMM_MALL_USER"
);
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment