Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
solverstack
mini-examples
starpu_example_dgemm
Commits
50b4583a
Commit
50b4583a
authored
Dec 04, 2021
by
Antoine Jego
Browse files
typo
parent
3d6612b1
Changes
3
Hide whitespace changes
Inline
Side-by-side
dsmat.c
View file @
50b4583a
...
...
@@ -13,6 +13,7 @@ Matrix* alloc_matrix(int mb, int nb, int b, int p, int q, starpu_mpi_tag_t* tag)
X
=
malloc
(
sizeof
(
Matrix
));
X
->
blocks
=
malloc
(
mb
*
nb
*
sizeof
(
Block
));
int
i
,
j
;
// printf("[%d] allocating %d x %d B %d on %dx%d\n", comm_rank, mb, nb, b, p, q);
for
(
i
=
0
;
i
<
mb
;
i
++
)
{
for
(
j
=
0
;
j
<
nb
;
j
++
)
...
...
@@ -54,7 +55,7 @@ void free_matrix(Matrix* X)
free
(
X
);
}
void
register_matrix
(
Matrix
*
X
,
int
mb
,
int
nb
,
int
datatype
,
int
prune_handles
,
int
p
,
int
q
,
int
row
,
int
col
,
int
check
,
int
delay
)
void
register_matrix
(
Matrix
*
X
,
int
mb
,
int
nb
,
char
*
name
,
int
datatype
,
int
prune_handles
,
int
p
,
int
q
,
int
row
,
int
col
,
int
check
,
int
delay
)
{
starpu_mpi_comm_rank
(
MPI_COMM_WORLD
,
&
comm_rank
);
int
proc_row
,
proc_col
;
...
...
@@ -64,14 +65,15 @@ void register_matrix(Matrix* X, int mb, int nb, int datatype, int prune_handles,
// comm_rank = proc_row * q + proc_col
proc_col
=
comm_rank
%
q
;
proc_row
=
(
comm_rank
-
proc_col
)
/
q
;
// printf("[%d] delayed ? %d / check ? %d / dt ? %d / pr_hd ? %d\n", comm_rank, delay, check, datatype, prune_handles);
// printf("[%d = %d x %d | %d x %d] delayed ? %d / check ? %d / dt ? %d / pr_hd ? %d\n",
// comm_rank, proc_row, proc_col, row, col, delay, check, datatype, prune_handles);
for
(
b_row
=
0
;
b_row
<
mb
;
b_row
++
)
{
for
(
b_col
=
0
;
b_col
<
nb
;
b_col
++
)
{
Xij
=
&
X
->
blocks
[
b_row
*
nb
+
b_col
];
Xij
->
hdl
=
malloc
(
sizeof
(
starpu_data_handle_t
));
// printf("[%d]
X
_%d,%d | tag:%d\n",comm_rank,b_row,b_col,
Xij->tag
);
// printf("[%d]
%s
_%d,%d
=%dx%d
| tag:%d
| owned by %d
\n",comm_rank,
name,
b_row,b_col,
b_row%p,b_col%q,Xij->tag,Xij->owner
);
if
(
Xij
->
owner
==
comm_rank
)
{
if
(
datatype
)
{
...
...
@@ -90,7 +92,7 @@ void register_matrix(Matrix* X, int mb, int nb, int datatype, int prune_handles,
(
check
&&
comm_rank
==
0
))
)
{
block_starpu_register
(
Xij
,
datatype
);
}
else
{
// printf("[%d] pruned
X
_%d,%d\n",comm_rank,b_row,b_col);
// printf("[%d] pruned
%s
_%d,%d\n",comm_rank,
name,
b_row,b_col);
}
}
}
...
...
dsmat.h
View file @
50b4583a
...
...
@@ -19,7 +19,7 @@ typedef struct Matrices
Matrix
*
alloc_matrix
(
int
mb
,
int
nb
,
int
b
,
int
p
,
int
q
,
starpu_mpi_tag_t
*
tag
);
void
free_matrix
(
Matrix
*
X
);
void
register_matrix
(
Matrix
*
X
,
int
mb
,
int
nb
,
int
datatype
,
int
prune_handles
,
int
p
,
int
q
,
int
row
,
int
col
,
int
check
,
int
delay
);
void
register_matrix
(
Matrix
*
X
,
int
mb
,
int
nb
,
char
*
name
,
int
datatype
,
int
prune_handles
,
int
p
,
int
q
,
int
row
,
int
col
,
int
check
,
int
delay
);
void
unregister_matrix
(
Matrix
*
X
,
int
mb
,
int
nb
);
void
print_matrix
(
Matrix
*
X
,
char
*
name
);
void
block_starpu_register
(
Block
*
Xij
,
int
datatype
);
...
...
starpu_example_dgemm.c
View file @
50b4583a
...
...
@@ -214,15 +214,15 @@ static void register_matrices()
starpu_tile_interface_register
();
}
register_matrix
(
A
,
MB
,
KB
,
datatype
,
prune_handles
,
P
,
Q
,
1
,
0
,
check
,
delay
);
register_matrix
(
B
,
KB
,
NB
,
datatype
,
prune_handles
,
P
,
Q
,
0
,
1
,
check
,
delay
);
register_matrix
(
A
,
MB
,
KB
,
"A"
,
datatype
,
prune_handles
,
P
,
Q
,
1
,
0
,
check
,
delay
);
register_matrix
(
B
,
KB
,
NB
,
"B"
,
datatype
,
prune_handles
,
P
,
Q
,
0
,
1
,
check
,
delay
);
//register_matrix(C,C_h,&tag,MB,NB,datatype,prune_handles,P,Q,0,0);
// FIXME (starpu-side) :
// the previous one seems logical because we do not need to know
// about blocks of C we do not contribute to, however startPU seems to be
// pending on task_insertion if we do not know about blocks on our row/column even if we do not contribute to them)
// - This could happen because we are seeing a Write on a NULL handle and StarPU is waiting (for what ?)
register_matrix
(
C
,
MB
,
NB
,
datatype
,
prune_handles
,
P
,
Q
,
1
,
1
,
check
,
delay
);
register_matrix
(
C
,
MB
,
NB
,
"C"
,
datatype
,
prune_handles
,
P
,
Q
,
1
,
1
,
check
,
delay
);
}
/* Unregister matrices from the StarPU management. */
...
...
@@ -604,7 +604,7 @@ int main(int argc, char *argv[])
Matrix
*
Cwork
;
if
(
check
)
{
Cwork
=
alloc_matrix
(
MB
,
NB
,
BS
,
1
,
1
,
&
tag
);
register_matrix
(
Cwork
,
MB
,
NB
,
datatype
,
0
,
1
,
1
,
1
,
1
,
1
,
0
);
register_matrix
(
Cwork
,
MB
,
NB
,
"Cwork"
,
datatype
,
0
,
1
,
1
,
1
,
1
,
1
,
0
);
copy_matrix
(
Cwork
,
C
);
starpu_mpi_wait_for_all
(
MPI_COMM_WORLD
);
if
(
verbose
)
print_matrix
(
C
,
"Cinit"
);
...
...
@@ -625,7 +625,7 @@ int main(int argc, char *argv[])
{
Ail
=
&
A
->
blocks
[
b_row
*
KB
+
b_aisle
];
Blj
=
&
B
->
blocks
[
b_aisle
*
NB
+
b_col
];
Cij
=
&
C
->
blocks
[
b_
col
*
NB
+
b_
row
];
Cij
=
&
C
->
blocks
[
b_
row
*
NB
+
b_
col
];
a_local
=
Ail
->
owner
==
comm_rank
;
b_local
=
Blj
->
owner
==
comm_rank
;
c_local
=
Cij
->
owner
==
comm_rank
;
...
...
@@ -648,8 +648,14 @@ int main(int argc, char *argv[])
clargs
=
malloc
(
sizeof
(
struct
cl_zgemm_args_s
));
clargs
->
alpha
=
alpha
;
clargs
->
beta
=
b_aisle
==
0
?
beta
:
1
.
0
;
}
else
{
// printf("[%d] inserting %d,%d (l:%d)\n",comm_rank,b_row,b_col,b_aisle);
}
starpu_mpi_task_insert
(
MPI_COMM_WORLD
,
&
gemm_cl
,
/* printf("[%d] C_%d,%d (%d-%p-%d) += A_%d,%d (%d-%p-%d) B_%d,%d (%d-%p-%d)\n", comm_rank,
b_row,b_col, Cij->registered,Cij->hdl,Cij->owner,
b_row,b_aisle,Ail->registered,Ail->hdl,Ail->owner,
b_aisle,b_col,Blj->registered,Blj->hdl,Blj->owner);
*/
starpu_mpi_task_insert
(
MPI_COMM_WORLD
,
&
gemm_cl
,
STARPU_CL_ARGS
,
clargs
,
sizeof
(
struct
cl_zgemm_args_s
),
STARPU_R
,
*
Ail
->
hdl
,
STARPU_R
,
*
Blj
->
hdl
,
...
...
@@ -681,9 +687,9 @@ int main(int argc, char *argv[])
Bcheck
=
alloc_matrix
(
KB
,
NB
,
BS
,
1
,
1
,
&
tag
);
Ccheck
=
alloc_matrix
(
MB
,
NB
,
BS
,
1
,
1
,
&
tag
);
register_matrix
(
Acheck
,
MB
,
KB
,
datatype
,
0
,
1
,
1
,
1
,
1
,
1
,
0
);
register_matrix
(
Bcheck
,
KB
,
NB
,
datatype
,
0
,
1
,
1
,
1
,
1
,
1
,
0
);
register_matrix
(
Ccheck
,
MB
,
NB
,
datatype
,
0
,
1
,
1
,
1
,
1
,
1
,
0
);
register_matrix
(
Acheck
,
MB
,
KB
,
"Acheck"
,
datatype
,
0
,
1
,
1
,
1
,
1
,
1
,
0
);
register_matrix
(
Bcheck
,
KB
,
NB
,
"Bcheck"
,
datatype
,
0
,
1
,
1
,
1
,
1
,
1
,
0
);
register_matrix
(
Ccheck
,
MB
,
NB
,
"Check"
,
datatype
,
0
,
1
,
1
,
1
,
1
,
1
,
0
);
copy_matrix
(
Acheck
,
A
);
if
(
verbose
)
print_matrix
(
A
,
"A"
);
...
...
Write
Preview
Markdown
is supported
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