Skip to content

Commit e2b29d6

Browse files
committed
Fix threaded ring isend test: Use master's communicator for all threads.
1 parent 7e91f24 commit e2b29d6

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

threaded/tst_threaded_ring_isend.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "mpi_test_suite.h"
1515
#include "tst_threads.h"
1616
#include "tst_output.h"
17+
#include "tst_comm.h"
1718

1819

1920
int tst_threaded_ring_isend_init (struct tst_env * env)
@@ -32,8 +33,8 @@ int tst_threaded_ring_isend_init (struct tst_env * env)
3233
/*
3334
* Now, initialize the send_buffer
3435
*/
35-
comm = tst_comm_getcomm (env->comm);
36-
MPI_CHECK (MPI_Comm_rank (comm, &comm_rank));
36+
comm = tst_comm_getmastercomm(env->comm);
37+
MPI_CHECK (MPI_Comm_rank(comm, &comm_rank));
3738

3839
if ( (env->status_buffer = malloc (sizeof (MPI_Status) * 2)) == NULL )
3940
ERROR (errno, "malloc");
@@ -61,16 +62,13 @@ int tst_threaded_ring_isend_run (struct tst_env * env)
6162
MPI_Status * statuses;
6263
MPI_Request * requests;
6364

64-
int num_threads;
65-
int thread_num;
66-
67-
num_threads = tst_thread_num_threads();
68-
thread_num = tst_thread_get_num();
65+
int num_threads = 1 + tst_thread_num_threads(); /* we have to add 1 for the master thread */
66+
int thread_num = (tst_thread_get_num() + num_threads) % num_threads;
6967

7068
statuses = env->status_buffer;
7169
requests = tst_thread_get_global_request (0);
7270

73-
comm = tst_comm_getcomm (env->comm);
71+
comm = tst_comm_getmastercomm (env->comm);
7472
type = tst_type_getdatatype (env->type);
7573

7674
if (tst_comm_getcommclass (env->comm) & TST_MPI_COMM_SELF)

0 commit comments

Comments
 (0)