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
Thomas Jahns
yaxt
Commits
7a8e17de
Commit
7a8e17de
authored
Mar 26, 2020
by
Thomas Jahns
🤸
Browse files
Add adjustable exchangers to serial redist repeat tests.
parent
bdb38684
Changes
3
Hide whitespace changes
Inline
Side-by-side
tests/test_redist_repeat.c
View file @
7a8e17de
...
...
@@ -57,13 +57,14 @@
#include "test_redist_common.h"
int
main
(
void
)
{
int
main
(
int
argc
,
char
**
argv
)
{
// init mpi
xt_mpi_call
(
MPI_Init
(
NULL
,
NULL
),
MPI_COMM_WORLD
);
xt_initialize
(
MPI_COMM_WORLD
);
Xt_config
config
=
redist_exchanger_option
(
&
argc
,
&
argv
);
{
// general test with one redist
// set up data
...
...
@@ -76,13 +77,12 @@ int main(void) {
static
const
double
src_data
[]
=
{
1
,
2
,
3
,
4
,
5
};
double
dst_data
[
dst_slice_len
];
Xt_redist
redist_repeat
;
MPI_Aint
src_extent
=
(
MPI_Aint
)(
sizeof
(
src_data
)),
dst_extent
=
(
MPI_Aint
)(
sizeof
(
dst_data
));
int
displacements
[
1
]
=
{
0
};
redist_repeat
=
xt_redist_repeat_
new
(
redist
,
src_extent
,
dst_extent
,
1
,
displacements
);
Xt_redist
redist_repeat
=
xt_redist_repeat_
custom_new
(
redist
,
src_extent
,
dst_extent
,
1
,
displacements
,
config
);
// test communicator of redist
...
...
@@ -113,7 +113,6 @@ int main(void) {
// generate redist_repeatection
enum
{
num_repetitions
=
3
};
Xt_redist
redist_repeat
;
static
const
double
src_data
[
num_repetitions
][
src_slice_len
]
=
{{
1
,
2
,
3
,
4
,
5
},{
6
,
7
,
8
,
9
,
10
},{
11
,
12
,
13
,
14
,
15
}};
double
dst_data
[
num_repetitions
][
dst_slice_len
];
...
...
@@ -123,8 +122,9 @@ int main(void) {
(
MPI_Aint
)((
size_t
)(
dst_data
[
1
]
-
dst_data
[
0
])
*
sizeof
(
double
));
int
displacements
[
num_repetitions
]
=
{
0
,
1
,
2
};
redist_repeat
=
xt_redist_repeat_new
(
redist
,
src_extent
,
dst_extent
,
num_repetitions
,
displacements
);
Xt_redist
redist_repeat
=
xt_redist_repeat_custom_new
(
redist
,
src_extent
,
dst_extent
,
num_repetitions
,
displacements
,
config
);
// test communicator of redist
...
...
@@ -168,9 +168,9 @@ int main(void) {
int
dst_displacements
[
num_repetitions
]
=
{
2
,
1
,
0
};
Xt_redist
redist_repeat
=
xt_redist_repeat_asym_new
(
redist
,
src_extent
,
dst_extent
,
num_repetitions
,
src_displacements
,
dst_displacements
);
=
xt_redist_repeat_asym_
custom_
new
(
redist
,
src_extent
,
dst_extent
,
num_repetitions
,
src_displacements
,
dst_displacements
,
config
);
// test communicator of redist
...
...
@@ -203,8 +203,8 @@ int main(void) {
MPI_Aint
src_extent
=
(
MPI_Aint
)(
src_slice_len
*
sizeof
(
double
));
MPI_Aint
dst_extent
=
(
MPI_Aint
)(
dst_slice_len
*
sizeof
(
double
));
int
displacements
[
3
]
=
{
0
,
2
,
4
};
Xt_redist
redist_repeat
=
xt_redist_repeat_new
(
redist
,
src_extent
,
dst_extent
,
3
,
displacements
);
Xt_redist
redist_repeat
=
xt_redist_repeat_custom_new
(
redist
,
src_extent
,
dst_extent
,
3
,
displacements
,
config
);
// test communicator of redist
...
...
@@ -235,7 +235,8 @@ int main(void) {
Xt_xmap
xmap
=
build_odd_selection_xmap
(
6
);
static
const
int
src_pos
[
npt
]
=
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
};
static
const
int
dst_pos
[
npt
]
=
{
0
,
2
,
4
,
6
,
8
,
10
,
12
,
14
,
16
};
Xt_redist
redist
=
xt_redist_p2p_off_new
(
xmap
,
src_pos
,
dst_pos
,
MPI_DOUBLE
);
Xt_redist
redist
=
xt_redist_p2p_off_custom_new
(
xmap
,
src_pos
,
dst_pos
,
MPI_DOUBLE
,
config
);
xt_xmap_delete
(
xmap
);
...
...
@@ -273,8 +274,8 @@ int main(void) {
MPI_Aint
src_extent
=
(
MPI_Aint
)(
1
*
sizeof
(
double
));
MPI_Aint
dst_extent
=
(
MPI_Aint
)(
1
*
sizeof
(
double
));
int
displacements
[
2
]
=
{
0
,
1
};
Xt_redist
redist_repeat
=
xt_redist_repeat_new
(
redist
,
src_extent
,
dst_extent
,
2
,
displacements
);
Xt_redist
redist_repeat
=
xt_redist_repeat_custom_new
(
redist
,
src_extent
,
dst_extent
,
2
,
displacements
,
config
);
// test communicator of redist
if
(
!
communicators_are_congruent
(
xt_redist_get_MPI_Comm
(
redist_repeat
),
...
...
@@ -291,6 +292,7 @@ int main(void) {
}
xt_config_delete
(
config
);
xt_finalize
();
MPI_Finalize
();
...
...
tests/test_redist_repeat_f.f90
View file @
7a8e17de
...
...
@@ -53,34 +53,39 @@ PROGRAM test_redist_repeat
xt_redist
,
xt_redist_p2p_new
,
xt_redist_p2p_off_new
,
&
xt_redist_repeat_new
,
xt_redist_delete
,
&
xt_redist_s_exchange
,
xt_redist_a_exchange
,
&
xt_request
xt_request
,
xt_config
,
xt_config_delete
#if defined __PGI && ( __PGIC__ == 15 || __PGIC__ == 14 )
USE
xt_redist_real_sp
,
ONLY
:
xt_redist_s_exchange
,
xt_redist_a_exchange
USE
xt_redist_real_dp
,
ONLY
:
xt_redist_s_exchange
,
xt_redist_a_exchange
#endif
USE
test_redist_common
,
ONLY
:
build_odd_selection_xmap
,
check_redist
,
&
check_wait_request
check_wait_request
,
redist_exchanger_option
USE
iso_c_binding
,
ONLY
:
c_int
IMPLICIT
NONE
CHARACTER
(
len
=*
),
PARAMETER
::
filename
=
'test_redist_repeat_f.f90'
CHARACTER
(
len
=*
),
PARAMETER
::
exch1name
(
2
)
=
&
(/
"xt_redist_s_exchange1"
,
"xt_redist_a_exchange1"
/)
TYPE
(
xt_config
)
::
config
CALL
init_mpi
CALL
xt_initialize
(
mpi_comm_world
)
config
=
redist_exchanger_option
()
CALL
simple_test
CALL
test_repeated_redist
CALL
test_repeated_redist_with_gap
CALL
test_repeated_overlapping_redist
CALL
test_repeated_redist_asym
CALL
simple_test
(
mpi_comm_world
,
config
)
CALL
test_repeated_redist
(
mpi_comm_world
,
config
)
CALL
test_repeated_redist_with_gap
(
mpi_comm_world
,
config
)
CALL
test_repeated_overlapping_redist
(
mpi_comm_world
,
config
)
CALL
test_repeated_redist_asym
(
mpi_comm_world
,
config
)
IF
(
test_err_count
()
/
=
0
)
&
CALL
test_abort
(
"non-zero error count!"
,
filename
,
__
LINE__
)
CALL
xt_config_delete
(
config
)
CALL
xt_finalize
CALL
finish_mpi
CONTAINS
SUBROUTINE
simple_test
SUBROUTINE
simple_test
(
comm
,
config
)
INTEGER
,
INTENT
(
in
)
::
comm
TYPE
(
xt_config
),
INTENT
(
in
)
::
config
! general test with one redist
! set up data
TYPE
(
xt_xmap
)
::
xmap
...
...
@@ -110,7 +115,7 @@ CONTAINS
! generate redist_repeat
redist_repeat
=
xt_redist_repeat_new
(
redist
,
src_extent
,
dst_extent
,
1
,
&
displacements
)
displacements
,
config
)
CALL
xt_redist_delete
(
redist
)
...
...
@@ -171,7 +176,9 @@ CONTAINS
CALL
check_redist
(
redist_repeat
,
src_data
,
dst_data
,
ref_dst_data
)
END
SUBROUTINE
test_repeated_redist_ds2
SUBROUTINE
test_repeated_redist
SUBROUTINE
test_repeated_redist
(
comm
,
config
)
INTEGER
,
INTENT
(
in
)
::
comm
TYPE
(
xt_config
),
INTENT
(
in
)
::
config
! test with one redist used three times (with two different input data
! displacements -> test of cache) (with default cache size)
! set up data
...
...
@@ -201,7 +208,7 @@ CONTAINS
displacements
=
(/
0
,
1
,
2
/)
redist_repeat
=
xt_redist_repeat_new
(
redist
,
src_extent
,
dst_extent
,
&
num_slice
,
displacements
)
num_slice
,
displacements
,
config
)
CALL
xt_redist_delete
(
redist
)
! test exchange
...
...
@@ -212,7 +219,9 @@ CONTAINS
CALL
xt_redist_delete
(
redist_repeat
)
END
SUBROUTINE
test_repeated_redist
SUBROUTINE
test_repeated_redist_asym
SUBROUTINE
test_repeated_redist_asym
(
comm
,
config
)
INTEGER
,
INTENT
(
in
)
::
comm
TYPE
(
xt_config
),
INTENT
(
in
)
::
config
! test asymmetric variant of redist_repeat
INTEGER
,
PARAMETER
::
num_slice
=
3
...
...
@@ -252,14 +261,14 @@ CONTAINS
! connect to explicit shape interface:
redist_repeat
=
xt_redist_repeat_new
(
redist
,
src_extent
,
dst_extent
,
&
num_slice
,
src_displacements
,
dst_displacements
)
num_slice
,
src_displacements
,
dst_displacements
,
config
)
dst_data
=
-1.0_dp
CALL
check_redist
(
redist_repeat
,
src_data
,
dst_data
,
ref_dst_data
)
CALL
xt_redist_delete
(
redist_repeat
)
! connect to assumed shape interface:
redist_repeat
=
xt_redist_repeat_new
(
redist
,
src_extent
,
dst_extent
,
&
src_displacements
,
dst_displacements
)
src_displacements
,
dst_displacements
,
config
)
dst_data
=
-1.0_dp
CALL
check_redist
(
redist_repeat
,
src_data
,
dst_data
,
ref_dst_data
)
CALL
xt_redist_delete
(
redist_repeat
)
...
...
@@ -267,7 +276,10 @@ CONTAINS
CALL
xt_redist_delete
(
redist
)
END
SUBROUTINE
test_repeated_redist_asym
SUBROUTINE
test_repeated_redist_with_gap
SUBROUTINE
test_repeated_redist_with_gap
(
comm
,
config
)
INTEGER
,
INTENT
(
in
)
::
comm
TYPE
(
xt_config
),
INTENT
(
in
)
::
config
! test with one redist used three times (with two different input data
! displacements -> test of cache) (with default cache size)
! set up data
...
...
@@ -296,7 +308,7 @@ CONTAINS
dst_extent
=
temp_address
-
base_address
redist_repeat
=
xt_redist_repeat_new
(
redist
,
src_extent
,
dst_extent
,
&
num_slice
,
displacements
)
num_slice
,
displacements
,
config
)
CALL
xt_redist_delete
(
redist
)
! test exchange
...
...
@@ -305,7 +317,10 @@ CONTAINS
CALL
xt_redist_delete
(
redist_repeat
)
END
SUBROUTINE
test_repeated_redist_with_gap
SUBROUTINE
test_repeated_overlapping_redist
SUBROUTINE
test_repeated_overlapping_redist
(
comm
,
config
)
INTEGER
,
INTENT
(
in
)
::
comm
TYPE
(
xt_config
),
INTENT
(
in
)
::
config
! test with one redist used three times (with two different input data
! displacements -> test of cache) (with default cache size)
! set up data
...
...
@@ -329,7 +344,7 @@ CONTAINS
#endif
DOUBLE PRECISION
,
TARGET
::
src_template
(
2
),
dst_template
(
2
)
INTEGER
::
iexch
TYPE
(
xt_request
)
::
request
TYPE
(
xt_request
)
::
request
(
2
)
xmap
=
build_odd_selection_xmap
(
selection_len
)
...
...
@@ -359,10 +374,10 @@ CONTAINS
CALL
xt_redist_s_exchange
(
redist
,
src_data
,
dst_data
)
CALL
xt_redist_s_exchange
(
redist
,
src_data
(
2
:),
dst_data
(
2
:))
ELSE
CALL
xt_redist_a_exchange
(
redist
,
src_data
,
dst_data
,
request
)
CALL
check_wait_request
(
request
,
filename
,
__
LINE__
)
CALL
xt_redist_a_exchange
(
redist
,
src_data
(
2
:),
dst_data
(
2
:),
request
)
CALL
check_wait_request
(
request
,
filename
,
__
LINE__
)
CALL
xt_redist_a_exchange
(
redist
,
src_data
,
dst_data
,
request
(
1
)
)
CALL
xt_redist_a_exchange
(
redist
,
src_data
(
2
:),
dst_data
(
2
:),
request
(
2
)
)
CALL
check_wait_request
(
request
(
1
),
filename
,
__
LINE__
)
CALL
check_wait_request
(
request
(
2
)
,
filename
,
__
LINE__
)
ENDIF
! check individual redists to have desired effect
IF
(
cmp_arrays
(
dst_data
,
ref_dst_data
))
&
...
...
@@ -378,7 +393,7 @@ CONTAINS
dst_extent
=
temp_address
-
base_address
redist_repeat
=
xt_redist_repeat_new
(
redist
,
src_extent
,
dst_extent
,
&
displacements
)
displacements
,
config
)
CALL
xt_redist_delete
(
redist
)
! test exchange
...
...
tests/test_redist_repeat_run.in
View file @
7a8e17de
...
...
@@ -4,9 +4,9 @@ LIBC_FATAL_STDERR_=1
export LIBC_FATAL_STDERR_
[ x"@MPI_LAUNCH@" != xtrue ] || exit 77
@abs_top_builddir@/libtool --mode=execute \
@MPI_LAUNCH@ -n 1 @abs_builddir@/test_redist_repeat
@MPI_LAUNCH@ -n 1 @abs_builddir@/test_redist_repeat
"$@"
@abs_top_builddir@/libtool --mode=execute \
@MPI_LAUNCH@ -n 1 @abs_builddir@/test_redist_repeat_f
@MPI_LAUNCH@ -n 1 @abs_builddir@/test_redist_repeat_f
"$@"
#
# Local Variables:
# mode: sh
...
...
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