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
7ea5eebb
Commit
7ea5eebb
authored
Sep 22, 2023
by
iker_martin
Browse files
Fixed minow bug inside malleability codes. Types were not correctly recognised
parent
e4e11cf5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Main/ConjugateGradient.c
View file @
7ea5eebb
...
@@ -50,7 +50,7 @@ void get_rows_dist(Compute_data *computeData, int numP, int n);
...
@@ -50,7 +50,7 @@ void get_rows_dist(Compute_data *computeData, int numP, int n);
void
mat_alloc
(
Compute_data
*
computeData
,
SparseMatrix
mat
,
struct
Dist_data
dist_data
);
void
mat_alloc
(
Compute_data
*
computeData
,
SparseMatrix
mat
,
struct
Dist_data
dist_data
);
void
computeSolution
(
Compute_data
computeData
,
double
**
subsol
,
SparseMatrix
mat
,
int
myId
,
double
**
full_vec
);
void
computeSolution
(
Compute_data
computeData
,
double
**
subsol
,
SparseMatrix
mat
,
int
myId
,
double
**
full_vec
);
void
pre_compute
(
Compute_data
*
computeData
,
struct
Dist_data
dist_data
,
double
*
subsol
,
double
*
full_vec
);
void
pre_compute
(
Compute_data
*
computeData
,
struct
Dist_data
dist_data
,
double
*
subsol
,
double
*
full_vec
);
int
compute
(
Compute_data
*
computeData
,
struct
Dist_data
*
dist_data
);
int
compute
(
Compute_data
*
computeData
,
struct
Dist_data
*
dist_data
,
int
sm
);
void
free_computeData
(
Compute_data
*
computeData
);
void
free_computeData
(
Compute_data
*
computeData
);
//===================================MALLEABILITY FUNCTIONS====================================================
//===================================MALLEABILITY FUNCTIONS====================================================
...
@@ -73,6 +73,7 @@ void getIds_intercomm(struct Dist_data dist_data, int numP_other, int **idS);
...
@@ -73,6 +73,7 @@ void getIds_intercomm(struct Dist_data dist_data, int numP_other, int **idS);
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
int
terminate
;
int
terminate
;
int
req
,
num_nodes
,
num_cpus
=
20
;
int
req
,
num_nodes
,
num_cpus
=
20
;
int
sm
,
ss
,
rm
,
rs
;
char
*
nodelist
=
NULL
;
char
*
nodelist
=
NULL
;
Compute_data
computeData
;
Compute_data
computeData
;
...
@@ -83,6 +84,9 @@ int main (int argc, char *argv[]) {
...
@@ -83,6 +84,9 @@ int main (int argc, char *argv[]) {
computeData
.
subm
.
vptr
=
NULL
;
computeData
.
subm
.
vptr
=
NULL
;
computeData
.
vlen
=
NULL
;
computeData
.
vlen
=
NULL
;
//FIXME Cambiar
sm
=
1
;
ss
=
1
;
rm
=
0
;
rs
=
1
;
int
numP
,
myId
,
num_children
=
0
;
int
numP
,
myId
,
num_children
=
0
;
struct
Dist_data
dist_data
;
struct
Dist_data
dist_data
;
if
(
argc
>=
5
)
{
if
(
argc
>=
5
)
{
...
@@ -105,14 +109,14 @@ int main (int argc, char *argv[]) {
...
@@ -105,14 +109,14 @@ int main (int argc, char *argv[]) {
if
(
!
new_group
)
{
//First set of processes
if
(
!
new_group
)
{
//First set of processes
init_app
(
&
computeData
,
&
dist_data
,
argv
);
init_app
(
&
computeData
,
&
dist_data
,
argv
);
dist_old
(
&
dist_data
,
&
computeData
,
num_children
,
0
,
1
,
0
,
1
);
dist_old
(
&
dist_data
,
&
computeData
,
num_children
,
sm
,
ss
,
rm
,
rs
);
}
else
{
}
else
{
dist_new
(
&
dist_data
,
&
computeData
);
dist_new
(
&
dist_data
,
&
computeData
);
}
}
if
(
computeData
.
iter
==
0
)
{
if
(
computeData
.
iter
==
0
)
{
terminate
=
compute
(
&
computeData
,
&
dist_data
);
terminate
=
compute
(
&
computeData
,
&
dist_data
,
sm
);
}
}
terminate
=
1
;
terminate
=
1
;
if
(
myId
==
ROOT
&&
terminate
)
{
if
(
myId
==
ROOT
&&
terminate
)
{
...
@@ -385,10 +389,10 @@ void pre_compute(Compute_data *computeData, struct Dist_data dist_data, double *
...
@@ -385,10 +389,10 @@ void pre_compute(Compute_data *computeData, struct Dist_data dist_data, double *
/*
/*
* Bucle de computo principal
* Bucle de computo principal
*/
*/
int
compute
(
Compute_data
*
computeData
,
struct
Dist_data
*
dist_data
)
{
int
compute
(
Compute_data
*
computeData
,
struct
Dist_data
*
dist_data
,
int
sm
)
{
int
IZERO
=
0
,
IONE
=
1
;
int
IZERO
=
0
,
IONE
=
1
;
double
DONE
=
1
.
0
,
DMONE
=
-
1
.
0
,
DZERO
=
0
.
0
;
double
DONE
=
1
.
0
,
DMONE
=
-
1
.
0
,
DZERO
=
0
.
0
;
int
state
=
MALL_NOT_STARTED
;
int
ended_loop
=
1
;
int
ended_loop
=
1
;
int
cnt
=
0
;
int
cnt
=
0
;
...
@@ -396,7 +400,9 @@ int compute(Compute_data *computeData, struct Dist_data *dist_data) {
...
@@ -396,7 +400,9 @@ int compute(Compute_data *computeData, struct Dist_data *dist_data) {
while
((
computeData
->
iter
<
computeData
->
maxiter
)
&&
(
computeData
->
tol
>
computeData
->
umbral
))
{
while
((
computeData
->
iter
<
computeData
->
maxiter
)
&&
(
computeData
->
tol
>
computeData
->
umbral
))
{
//while (computeData->tol > computeData->umbral) {
//while (computeData->tol > computeData->umbral) {
if
(
computeData
->
iter
==
3
)
{
malleability_checkpoint
();
}
if
(
computeData
->
iter
==
3
)
{
state
=
malleability_checkpoint
();
}
if
(
dist_data
->
myId
==
0
)
{
printf
(
"TEST %d
\n
"
,
computeData
->
iter
);}
if
((
state
==
MALL_COMPLETED
&&
sm
==
0
)
||
state
==
MALL_ZOMBIE
)
{
break
;}
// if(dist_data->myId == ROOT) printf ("(%d,%20.10e)\n", computeData->iter, computeData->tol);
// if(dist_data->myId == ROOT) printf ("(%d,%20.10e)\n", computeData->iter, computeData->tol);
...
...
malleability/malleabilityTypes.c
View file @
7ea5eebb
...
@@ -83,6 +83,7 @@ void modify_data(void *data, size_t index, size_t total_qty, int type, size_t re
...
@@ -83,6 +83,7 @@ void modify_data(void *data, size_t index, size_t total_qty, int type, size_t re
void
comm_data_info
(
malleability_data_t
*
data_struct_rep
,
malleability_data_t
*
data_struct_dist
,
int
is_children_group
,
int
myId
,
int
root
,
MPI_Comm
intercomm
)
{
void
comm_data_info
(
malleability_data_t
*
data_struct_rep
,
malleability_data_t
*
data_struct_dist
,
int
is_children_group
,
int
myId
,
int
root
,
MPI_Comm
intercomm
)
{
int
is_intercomm
,
rootBcast
=
MPI_PROC_NULL
;
int
is_intercomm
,
rootBcast
=
MPI_PROC_NULL
;
size_t
i
,
j
;
size_t
i
,
j
;
datatype
;
MPI_Datatype
entries_type
,
struct_type
;
MPI_Datatype
entries_type
,
struct_type
;
...
@@ -107,7 +108,15 @@ void comm_data_info(malleability_data_t *data_struct_rep, malleability_data_t *d
...
@@ -107,7 +108,15 @@ void comm_data_info(malleability_data_t *data_struct_rep, malleability_data_t *d
if
(
is_children_group
)
{
if
(
is_children_group
)
{
for
(
i
=
0
;
i
<
data_struct_rep
->
entries
;
i
++
)
{
for
(
i
=
0
;
i
<
data_struct_rep
->
entries
;
i
++
)
{
data_struct_rep
->
arrays
[
i
]
=
(
void
*
)
malloc
(
data_struct_rep
->
qty
[
i
]
*
sizeof
(
int
));
//TODO Tener en cuenta que no siempre es int
if
(
data_struct_rep
->
types
[
i
]
==
MAL_INT
)
{
data_struct_rep
->
arrays
[
i
]
=
(
void
*
)
malloc
(
data_struct_rep
->
qty
[
i
]
*
sizeof
(
int
));
}
else
if
(
data_struct_rep
->
types
[
i
]
==
MAL_DOUBLE
)
{
data_struct_rep
->
arrays
[
i
]
=
(
void
*
)
malloc
(
data_struct_rep
->
qty
[
i
]
*
sizeof
(
double
));
}
else
{
printf
(
"Malleability -- Redistribution data array type not recognised
\n
"
);
MPI_Abort
(
MPI_COMM_WORLD
,
-
1
);
}
data_struct_rep
->
requests
[
i
]
=
(
MPI_Request
*
)
malloc
(
data_struct_rep
->
request_qty
[
i
]
*
sizeof
(
MPI_Request
));
data_struct_rep
->
requests
[
i
]
=
(
MPI_Request
*
)
malloc
(
data_struct_rep
->
request_qty
[
i
]
*
sizeof
(
MPI_Request
));
for
(
j
=
0
;
j
<
data_struct_rep
->
request_qty
[
i
];
j
++
)
{
for
(
j
=
0
;
j
<
data_struct_rep
->
request_qty
[
i
];
j
++
)
{
data_struct_rep
->
requests
[
i
][
j
]
=
MPI_REQUEST_NULL
;
data_struct_rep
->
requests
[
i
][
j
]
=
MPI_REQUEST_NULL
;
...
...
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