Skip to content

Commit 5967d92

Browse files
author
Alessandro Fanfarillo
committed
Change team implemented
1 parent 282aaaf commit 5967d92

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

src/libcaf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ void PREFIX (error_stop) (int32_t) __attribute__ ((noreturn));
284284
void PREFIX (fail_image) (void) __attribute__ ((noreturn));
285285

286286
void PREFIX (form_team) (int, caf_team_t *, int);
287+
void PREFIX (change_team) (caf_team_t *, int);
287288

288289
int PREFIX (image_status) (int);
289290
void PREFIX (failed_images) (gfc_descriptor_t *, int, int *);

src/mpi/mpi_caf.c

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4811,15 +4811,39 @@ void PREFIX (form_team) (int team_id, caf_team_t *team, int index __attribute__
48114811
{
48124812
struct caf_teams_list *tmp;
48134813
void * tmp_team;
4814-
MPI_Comm newcomm;
4814+
MPI_Comm *newcomm;
48154815
MPI_Comm *current_comm = &current_team;
48164816

4817-
MPI_Comm_split(*current_comm, team_id, caf_this_image, &newcomm);
4817+
MPI_Barrier(CAF_COMM_WORLD);
4818+
newcomm = (MPI_Comm *)calloc(1,sizeof(MPI_Comm));
4819+
MPI_Comm_split(*current_comm, team_id, caf_this_image, newcomm);
48184820

48194821
tmp = calloc(1,sizeof(struct caf_teams_list));
48204822
tmp->prev = teams_list;
48214823
teams_list = tmp;
48224824
teams_list->team_id = team_id;
4823-
teams_list->team = &newcomm;
4824-
*team = &newcomm;
4825+
teams_list->team = newcomm;
4826+
*team = newcomm;
4827+
}
4828+
4829+
void PREFIX (change_team) (caf_team_t *team, int coselector __attribute__ ((unused)))
4830+
{
4831+
void *tmp_team;
4832+
MPI_Comm *tmp_comm;
4833+
MPI_Barrier(CAF_COMM_WORLD);
4834+
tmp_team = (void *)*team;
4835+
tmp_comm = (MPI_Comm *)tmp_team;
4836+
CAF_COMM_WORLD = *tmp_comm;
4837+
MPI_Comm_rank(*tmp_comm,&caf_this_image);
4838+
caf_this_image++;
4839+
MPI_Comm_size(*tmp_comm,&caf_num_images);
4840+
4841+
/* MPI_Comm_split(*current_comm, team_id, caf_this_image, &newcomm); */
4842+
4843+
/* tmp = calloc(1,sizeof(struct caf_teams_list)); */
4844+
/* tmp->prev = teams_list; */
4845+
/* teams_list = tmp; */
4846+
/* teams_list->team_id = team_id; */
4847+
/* teams_list->team = &newcomm; */
4848+
/* *team = &newcomm; */
48254849
}

0 commit comments

Comments
 (0)