1
1

Merge pull request #6790 from ggouaillardet/topic/ompi_comm_spawn_f

fortran/mpif-h: correctly handle array_of_errcodes in ompi_comm_spawn…
Этот коммит содержится в:
Gilles Gouaillardet 2019-07-08 09:06:21 +09:00 коммит произвёл GitHub
родитель 5d51b2310d 07830d05a7
Коммит c2d35aaadc
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 16 добавлений и 19 удалений

Просмотреть файл

@ -10,8 +10,8 @@
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copyright (c) 2010-2018 Cisco Systems, Inc. All rights reserved * Copyright (c) 2010-2018 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2015-2017 Research Organization for Information Science * Copyright (c) 2015-2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -76,7 +76,7 @@ void ompi_comm_spawn_f(char *command, char *argv, MPI_Fint *maxprocs,
{ {
MPI_Comm c_comm, c_new_comm; MPI_Comm c_comm, c_new_comm;
MPI_Info c_info; MPI_Info c_info;
int size, c_ierr; int c_ierr;
int *c_errs; int *c_errs;
char **c_argv; char **c_argv;
char *c_command; char *c_command;
@ -84,7 +84,6 @@ void ompi_comm_spawn_f(char *command, char *argv, MPI_Fint *maxprocs,
c_comm = PMPI_Comm_f2c(*comm); c_comm = PMPI_Comm_f2c(*comm);
c_info = PMPI_Info_f2c(*info); c_info = PMPI_Info_f2c(*info);
PMPI_Comm_size(c_comm, &size);
ompi_fortran_string_f2c(command, cmd_len, &c_command); ompi_fortran_string_f2c(command, cmd_len, &c_command);
/* It's allowed to ignore the errcodes */ /* It's allowed to ignore the errcodes */
@ -92,7 +91,7 @@ void ompi_comm_spawn_f(char *command, char *argv, MPI_Fint *maxprocs,
if (OMPI_IS_FORTRAN_ERRCODES_IGNORE(array_of_errcodes)) { if (OMPI_IS_FORTRAN_ERRCODES_IGNORE(array_of_errcodes)) {
c_errs = MPI_ERRCODES_IGNORE; c_errs = MPI_ERRCODES_IGNORE;
} else { } else {
OMPI_ARRAY_FINT_2_INT_ALLOC(array_of_errcodes, size); OMPI_ARRAY_FINT_2_INT_ALLOC(array_of_errcodes, OMPI_FINT_2_INT(*maxprocs));
c_errs = OMPI_ARRAY_NAME_CONVERT(array_of_errcodes); c_errs = OMPI_ARRAY_NAME_CONVERT(array_of_errcodes);
} }
@ -119,9 +118,7 @@ void ompi_comm_spawn_f(char *command, char *argv, MPI_Fint *maxprocs,
opal_argv_free(c_argv); opal_argv_free(c_argv);
} }
if (!OMPI_IS_FORTRAN_ERRCODES_IGNORE(array_of_errcodes)) { if (!OMPI_IS_FORTRAN_ERRCODES_IGNORE(array_of_errcodes)) {
OMPI_ARRAY_INT_2_FINT(array_of_errcodes, size); OMPI_ARRAY_INT_2_FINT(array_of_errcodes, OMPI_FINT_2_INT(*maxprocs));
} else {
OMPI_ARRAY_FINT_2_INT_CLEANUP(array_of_errcodes);
} }
} }

Просмотреть файл

@ -10,8 +10,8 @@
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copyright (c) 2010-2018 Cisco Systems, Inc. All rights reserved * Copyright (c) 2010-2018 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2015-2017 Research Organization for Information Science * Copyright (c) 2015-2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2016 Los Alamos National Security, LLC. All rights * Copyright (c) 2016 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* $COPYRIGHT$ * $COPYRIGHT$
@ -82,25 +82,29 @@ void ompi_comm_spawn_multiple_f(MPI_Fint *count, char *array_commands,
{ {
MPI_Comm c_comm, c_new_comm; MPI_Comm c_comm, c_new_comm;
MPI_Info *c_info; MPI_Info *c_info;
int size, array_size, i, c_ierr; int array_size, i, c_ierr;
int *c_errs; int *c_errs;
char **c_array_commands; char **c_array_commands;
char ***c_array_argv; char ***c_array_argv;
int maxprocs;
OMPI_ARRAY_NAME_DECL(array_maxprocs); OMPI_ARRAY_NAME_DECL(array_maxprocs);
OMPI_ARRAY_NAME_DECL(array_errcds); OMPI_ARRAY_NAME_DECL(array_errcds);
c_comm = PMPI_Comm_f2c(*comm); c_comm = PMPI_Comm_f2c(*comm);
PMPI_Comm_size(c_comm, &size);
array_size = OMPI_FINT_2_INT(*count); array_size = OMPI_FINT_2_INT(*count);
OMPI_ARRAY_FINT_2_INT(array_maxprocs, array_size);
/* It's allowed to ignore the errcodes */ /* It's allowed to ignore the errcodes */
if (OMPI_IS_FORTRAN_ERRCODES_IGNORE(array_errcds)) { if (OMPI_IS_FORTRAN_ERRCODES_IGNORE(array_errcds)) {
c_errs = MPI_ERRCODES_IGNORE; c_errs = MPI_ERRCODES_IGNORE;
} else { } else {
OMPI_ARRAY_FINT_2_INT_ALLOC(array_errcds, size); maxprocs = 0;
for (i=0; i<array_size; i++) {
maxprocs += OMPI_ARRAY_NAME_CONVERT(array_maxprocs)[i];
}
OMPI_ARRAY_FINT_2_INT_ALLOC(array_errcds, maxprocs);
c_errs = OMPI_ARRAY_NAME_CONVERT(array_errcds); c_errs = OMPI_ARRAY_NAME_CONVERT(array_errcds);
} }
@ -113,8 +117,6 @@ void ompi_comm_spawn_multiple_f(MPI_Fint *count, char *array_commands,
argv_string_len, &c_array_argv); argv_string_len, &c_array_argv);
} }
OMPI_ARRAY_FINT_2_INT(array_maxprocs, array_size);
ompi_fortran_argv_count_f2c(array_commands, array_size, cmd_string_len, ompi_fortran_argv_count_f2c(array_commands, array_size, cmd_string_len,
cmd_string_len, &c_array_commands); cmd_string_len, &c_array_commands);
@ -138,9 +140,7 @@ void ompi_comm_spawn_multiple_f(MPI_Fint *count, char *array_commands,
} }
if (!OMPI_IS_FORTRAN_ERRCODES_IGNORE(array_errcds)) { if (!OMPI_IS_FORTRAN_ERRCODES_IGNORE(array_errcds)) {
OMPI_ARRAY_INT_2_FINT(array_errcds, size); OMPI_ARRAY_INT_2_FINT(array_errcds, maxprocs);
} else {
OMPI_ARRAY_FINT_2_INT_CLEANUP(array_errcds);
} }
OMPI_ARRAY_FINT_2_INT_CLEANUP(array_maxprocs); OMPI_ARRAY_FINT_2_INT_CLEANUP(array_maxprocs);