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
Malleable_CG
Commits
5ea0baf4
Commit
5ea0baf4
authored
Sep 28, 2023
by
iker_martin
Browse files
Fixed minor errors for P2PA methods.
parent
0fb35135
Changes
3
Show whitespace changes
Inline
Side-by-side
Main/ConjugateGradient.c
View file @
5ea0baf4
...
...
@@ -61,13 +61,8 @@ void free_computeData(Compute_data *computeData, int terminate);
int
n_check
=
30
;
int
dist_old
(
struct
Dist_data
*
dist_data
,
Compute_data
*
computeData
,
int
num_children
,
int
sm
,
int
ss
,
int
rm
,
int
rs
);
void
send_matrix
(
struct
Dist_data
dist_data
,
Compute_data
computeData
,
int
rootBcast
,
int
numP_child
,
int
idI
,
int
idE
,
int
*
sendcounts
,
int
*
recvcounts
,
int
*
sdispls
,
int
*
rdispls
);
int
dist_old
(
struct
Dist_data
*
dist_data
,
Compute_data
*
computeData
,
int
num_children
,
int
sm
,
int
ss
,
int
rm
,
int
rs
,
int
send_sync
);
void
dist_new
(
struct
Dist_data
*
dist_data
,
Compute_data
*
computeData
);
void
recv_matrix
(
struct
Dist_data
*
dist_data
,
Compute_data
*
computeData
,
int
idI
,
int
idE
,
int
*
sendcounts
,
int
*
recvcounts
,
int
*
sdispls
,
int
*
rdispls
);
void
update_dist_data
(
struct
Dist_data
*
dist_data
);
//----------------------------------------------------------------------------------------------------
void
get_dist
(
int
total_r
,
int
id
,
int
numP
,
struct
Dist_data
*
dist_data
);
...
...
@@ -78,7 +73,7 @@ void getIds_intercomm(struct Dist_data dist_data, int numP_other, int **idS);
int
main
(
int
argc
,
char
*
argv
[])
{
int
terminate
;
int
req
,
num_nodes
,
num_cpus
=
20
;
int
sm
,
ss
,
rm
,
rs
;
int
sm
,
ss
,
rm
,
rs
,
send_sync
;
char
*
nodelist
=
NULL
;
Compute_data
computeData
;
...
...
@@ -89,19 +84,20 @@ int main (int argc, char *argv[]) {
computeData
.
subm
.
vptr
=
NULL
;
computeData
.
vlen
=
NULL
;
//FIXME Cambiar
send_sync
=
1
;
sm
=
1
;
ss
=
1
;
rm
=
0
;
rs
=
1
;
int
numP
,
myId
,
num_children
=
0
;
struct
Dist_data
dist_data
;
if
(
argc
>=
5
)
{
if
(
argc
>=
10
)
{
num_children
=
atoi
(
argv
[
2
]);
sm
=
atoi
(
argv
[
3
]);
ss
=
atoi
(
argv
[
4
]);
rm
=
atoi
(
argv
[
5
]);
rs
=
atoi
(
argv
[
6
]);
nodelist
=
argv
[
7
];
num_nodes
=
atoi
(
argv
[
8
]);
send_sync
=
atoi
(
argv
[
7
]);
nodelist
=
argv
[
8
];
num_nodes
=
atoi
(
argv
[
9
]);
num_cpus
=
num_nodes
*
num_cpus
;
}
...
...
@@ -116,7 +112,7 @@ int main (int argc, char *argv[]) {
if
(
!
new_group
)
{
//First set of processes
init_app
(
&
computeData
,
&
dist_data
,
argv
);
dist_old
(
&
dist_data
,
&
computeData
,
num_children
,
sm
,
ss
,
rm
,
rs
);
dist_old
(
&
dist_data
,
&
computeData
,
num_children
,
sm
,
ss
,
rm
,
rs
,
send_sync
);
}
else
{
dist_new
(
&
dist_data
,
&
computeData
);
}
...
...
@@ -438,7 +434,7 @@ int compute(Compute_data *computeData, struct Dist_data *dist_data, int sm) {
if
(
computeData
->
iter
==
3
)
reconfigure
=
1
;
if
(
reconfigure
)
{
state
=
malleability_checkpoint
();
if
((
state
==
MALL_COMPLETED
&&
sm
==
0
)
||
state
==
MALL_ZOMBIE
)
{
break
;}
if
((
state
==
MALL_COMPLETED
&&
sm
==
0
)
||
state
==
MALL_ZOMBIE
)
{
ended_loop
=
0
;
break
;
}
else
if
(
state
==
MALL_COMPLETED
)
{
reconfigure
=
0
;
//dumb(computeData,dist_data);
...
...
@@ -530,9 +526,8 @@ void free_computeData(Compute_data *computeData, int terminate) {
/*
*/
int
dist_old
(
struct
Dist_data
*
dist_data
,
Compute_data
*
computeData
,
int
num_children
,
int
sm
,
int
ss
,
int
rm
,
int
rs
)
{
int
dist_old
(
struct
Dist_data
*
dist_data
,
Compute_data
*
computeData
,
int
num_children
,
int
sm
,
int
ss
,
int
rm
,
int
rs
,
int
send_sync
)
{
int
phy_dist
=
2
;
int
send_synch
=
rs
==
1
?
1
:
0
;
set_malleability_configuration
(
sm
,
ss
,
phy_dist
,
rm
,
rs
);
set_children_number
(
num_children
);
...
...
@@ -550,9 +545,9 @@ int dist_old(struct Dist_data *dist_data, Compute_data *computeData, int num_chi
malleability_add_data
(
computeData
->
z
,
computeData
->
n
,
MAL_DOUBLE
,
MAL_DATA_ALONE
,
0
,
1
);
//FIXME SIguientes valores pueden ser asincronos
malleability_add_data
(
computeData
->
vlen
,
computeData
->
n
,
MAL_INT
,
1
+
MAL_DATA_INDEPENDENT
,
0
,
send_sync
h
);
malleability_add_data
(
computeData
->
subm
.
vpos
,
computeData
->
n
,
MAL_INT
,
1
+
MAL_DATA_DEPENDENT
,
0
,
send_sync
h
);
malleability_add_data
(
computeData
->
subm
.
vval
,
computeData
->
n
,
MAL_DOUBLE
,
1
+
MAL_DATA_DEPENDENT
,
0
,
send_sync
h
);
malleability_add_data
(
computeData
->
vlen
,
computeData
->
n
,
MAL_INT
,
1
+
MAL_DATA_INDEPENDENT
,
0
,
send_sync
);
malleability_add_data
(
computeData
->
subm
.
vpos
,
computeData
->
n
,
MAL_INT
,
1
+
MAL_DATA_DEPENDENT
,
0
,
send_sync
);
malleability_add_data
(
computeData
->
subm
.
vval
,
computeData
->
n
,
MAL_DOUBLE
,
1
+
MAL_DATA_DEPENDENT
,
0
,
send_sync
);
}
/*
...
...
malleability/CommDist.c
View file @
5ea0baf4
...
...
@@ -10,7 +10,7 @@ void check_requests(struct Counts s_counts, struct Counts r_counts, MPI_Request
void
sync_point2point
(
void
*
send
,
void
*
recv
,
int
mal_type
,
int
is_intercomm
,
int
myId
,
struct
Counts
s_counts
,
struct
Counts
r_counts
,
MPI_Comm
comm
);
void
async_point2point
(
void
*
send
,
void
*
recv
,
MPI_Datatype
data
type
,
struct
Counts
s_counts
,
struct
Counts
r_counts
,
MPI_Comm
comm
,
MPI_Request
*
requests
);
void
async_point2point
(
void
*
send
,
void
*
recv
,
int
mal_
type
,
struct
Counts
s_counts
,
struct
Counts
r_counts
,
MPI_Comm
comm
,
MPI_Request
*
requests
);
void
perform_manual_communication
(
void
*
send
,
void
*
recv
,
int
mal_type
,
int
myId
,
struct
Counts
s_counts
,
struct
Counts
r_counts
);
...
...
@@ -281,7 +281,7 @@ int async_communication(void *send, void **recv, int qty, int mal_type, int depe
/* PERFORM COMMUNICATION */
switch
(
red_method
)
{
case
MALL_RED_POINT
:
async_point2point
(
send
,
*
recv
,
data
type
,
s_counts
,
r_counts
,
comm
,
*
requests
);
async_point2point
(
send
,
*
recv
,
mal_
type
,
s_counts
,
r_counts
,
comm
,
*
requests
);
break
;
case
MALL_RED_BASELINE
:
default:
...
...
@@ -336,16 +336,34 @@ int async_communication(void *send, void **recv, int qty, int mal_type, int depe
* - requests (OUT): Pointer to array of requests to be used to determine if the communication has ended.
*
*/
void
async_point2point
(
void
*
send
,
void
*
recv
,
MPI_Datatype
data
type
,
struct
Counts
s_counts
,
struct
Counts
r_counts
,
MPI_Comm
comm
,
MPI_Request
*
requests
)
{
void
async_point2point
(
void
*
send
,
void
*
recv
,
int
mal_
type
,
struct
Counts
s_counts
,
struct
Counts
r_counts
,
MPI_Comm
comm
,
MPI_Request
*
requests
)
{
int
i
,
j
=
0
;
size_t
datasize
,
offset
;
MPI_Datatype
datatype
;
if
(
mal_type
==
MAL_INT
)
{
datatype
=
MPI_INT
;
datasize
=
sizeof
(
int
);
}
else
if
(
mal_type
==
MAL_DOUBLE
)
{
datatype
=
MPI_DOUBLE
;
datasize
=
sizeof
(
double
);
}
else
if
(
mal_type
==
MAL_CHAR
)
{
datatype
=
MPI_CHAR
;
datasize
=
sizeof
(
char
);
}
else
{
printf
(
"Malleability -- Redistribution type not recognised
\n
"
);
MPI_Abort
(
MPI_COMM_WORLD
,
-
1
);
}
for
(
i
=
s_counts
.
idI
;
i
<
s_counts
.
idE
;
i
++
)
{
MPI_Isend
(
send
+
s_counts
.
displs
[
i
],
s_counts
.
counts
[
i
],
datatype
,
i
,
99
,
comm
,
&
(
requests
[
j
]));
offset
=
s_counts
.
displs
[
i
]
*
datasize
;
MPI_Isend
(
send
+
offset
,
s_counts
.
counts
[
i
],
datatype
,
i
,
99
,
comm
,
&
(
requests
[
j
]));
j
++
;
}
for
(
i
=
r_counts
.
idI
;
i
<
r_counts
.
idE
;
i
++
)
{
MPI_Irecv
(
recv
+
r_counts
.
displs
[
i
],
r_counts
.
counts
[
i
],
datatype
,
i
,
99
,
comm
,
&
(
requests
[
j
]));
offset
=
s_counts
.
displs
[
i
]
*
datasize
;
MPI_Irecv
(
recv
+
offset
,
r_counts
.
counts
[
i
],
datatype
,
i
,
99
,
comm
,
&
(
requests
[
j
]));
j
++
;
}
}
...
...
malleability/malleabilityManager.c
View file @
5ea0baf4
...
...
@@ -430,7 +430,7 @@ void send_data(int numP_children, malleability_data_t *data_struct, int is_async
if
(
is_asynchronous
)
{
i
=
dep_not_send
?
0
:
data_struct
->
entries
-
2
;
//FIXME BORRAR
for
(;
i
<
data_struct
->
entries
;
i
++
)
{
if
(
data_struct
->
dependencies
[
i
]
==
1
+
MAL_DATA_DEPENDENT
&&
dep_not_send
)
break
;
//FIXME BORRAR dep_not_send
if
(
data_struct
->
dependencies
[
i
]
==
1
+
MAL_DATA_DEPENDENT
&&
dep_not_send
&&
mall_conf
->
spawn_method
==
MALL_SPAWN_MERGE
)
break
;
//FIXME BORRAR dep_not_send
aux_send
=
data_struct
->
arrays
[
i
];
aux_recv
=
NULL
;
async_communication
(
aux_send
,
&
aux_recv
,
data_struct
->
qty
[
i
],
data_struct
->
types
[
i
],
data_struct
->
dependencies
[
i
],
mall
->
myId
,
mall
->
numP
,
numP_children
,
MALLEABILITY_NOT_CHILDREN
,
mall_conf
->
red_method
,
mall_conf
->
red_strategies
,
mall
->
intercomm
,
...
...
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