Skip to content

Commit 7c5c2b2

Browse files
authored
Merge pull request #13231 from jsquyres/pr/convert-some-perl-scripts-to-python
Convert some Perl build scripts to Python
2 parents ac925b4 + ec2b164 commit 7c5c2b2

19 files changed

+1207
-1103
lines changed

autogen.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
# Copyright (c) 2015-2022 IBM Corporation. All rights reserved.
1111
# Copyright (c) 2020 Amazon.com, Inc. or its affiliates.
1212
# All Rights reserved.
13-
#
1413
# Copyright (c) 2025 Nanook Consulting All rights reserved.
14+
# Copyright (c) 2025 Jeffrey M. Squyres. All rights reserved.
1515
# $COPYRIGHT$
1616
#
1717
# Additional copyrights may follow
@@ -1609,7 +1609,7 @@ sub replace_config_sub_guess {
16091609
# sync).
16101610

16111611
my @scripts;
1612-
push(@scripts, "ompi/include/mpif-values.pl");
1612+
push(@scripts, "ompi/include/mpif-values.py");
16131613

16141614
foreach my $s (@scripts) {
16151615
verbose "=== $s\n";

config/ompi_fortran_get_alignment.m4

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
1010
dnl University of Stuttgart. All rights reserved.
1111
dnl Copyright (c) 2004-2005 The Regents of the University of California.
1212
dnl All rights reserved.
13+
dnl Copyright (c) 2025 Research Organization for Information Science
14+
dnl and Technology (RIST). All rights reserved.
1315
dnl Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved.
1416
dnl $COPYRIGHT$
1517
dnl
@@ -178,3 +180,41 @@ end program]])],
178180
AS_VAR_COPY([$2], [type_var])
179181
AS_VAR_POPDEF([type_var])dnl
180182
])dnl
183+
184+
# OMPI_FORTRAN_GET_COMMON_ALIGNMENT(variable to set)
185+
# ------------------------------------------
186+
AC_DEFUN([OMPI_FORTRAN_GET_COMMON_ALIGNMENT],[
187+
AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -gt $OMPI_FORTRAN_NO_BINDINGS],
188+
[AC_CACHE_CHECK([alignment of Fortran common], ompi_cv_fortran_common_alignment,
189+
[AC_LANG_PUSH([Fortran])
190+
AC_LINK_IFELSE([AC_LANG_SOURCE([[ program falignment
191+
CHARACTER A,B
192+
COMMON /AA/A
193+
COMMON /BB/B
194+
OPEN(UNIT=10, FILE="conftestval")
195+
if (LOC(A) > LOC(B)) then
196+
write (10,'(I5)') LOC(A)-LOC(B)
197+
else
198+
write (10,'(I5)') LOC(B)-LOC(A)
199+
endif
200+
CLOSE(10)
201+
202+
end program]])],
203+
[AS_IF([test "$cross_compiling" = "yes"],
204+
[AC_MSG_ERROR([Can not determine common alignment when cross-compiling])],
205+
[OPAL_LOG_COMMAND([./conftest],
206+
[AS_VAR_SET(ompi_cv_fortran_common_alignment, [`cat conftestval`])],
207+
[AC_MSG_ERROR([Could not determine common alignment])])])],
208+
209+
[AC_MSG_WARN([Could not determine common alignment])
210+
AC_MSG_WARN([See config.log for details])
211+
AC_MSG_ERROR([Cannot continue])])
212+
rm -rf conftest* *.mod 2> /dev/null
213+
AC_LANG_POP([Fortran])])
214+
215+
AS_VAR_COPY([$1], [ompi_cv_fortran_common_alignment])],
216+
[AC_MSG_CHECKING([Fortran common alignment])
217+
$1=0
218+
AC_MSG_RESULT([skipped])])
219+
220+
])dnl

config/ompi_setup_mpi_fortran.m4

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dnl Copyright (c) 2006-2008 Sun Microsystems, Inc. All rights reserved.
1515
dnl Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights
1616
dnl reserved.
1717
dnl Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
18-
dnl Copyright (c) 2014-2021 Research Organization for Information Science
18+
dnl Copyright (c) 2014-2025 Research Organization for Information Science
1919
dnl and Technology (RIST). All rights reserved.
2020
dnl Copyright (c) 2016-2022 IBM Corporation. All rights reserved.
2121
dnl Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
@@ -138,6 +138,9 @@ AC_DEFUN([OMPI_SETUP_MPI_FORTRAN],[
138138
AC_DEFINE([ompi_fortran_bogus_type_t], [int],
139139
[A bogus type that allows us to have sentinel type values that are still valid])
140140

141+
OMPI_FORTRAN_GET_COMMON_ALIGNMENT([OMPI_FORTRAN_COMMON_ALIGNMENT])
142+
AC_SUBST([OMPI_FORTRAN_COMMON_ALIGNMENT])
143+
141144
# We want to set the #define's for all of these, so invoke the macros
142145
# regardless of whether we have F77 support or not.
143146
OMPI_FORTRAN_CHECK([CHARACTER], [yes],

ompi/communicator/comm_init.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
* reserved.
2828
* Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
2929
* Copyright (c) 2023 NVIDIA Corporation. All rights reserved.
30+
* Copyright (c) 2025 Jeffrey M. Squyres. All rights reserved.
3031
* $COPYRIGHT$
3132
*
3233
* Additional copyrights may follow
@@ -453,7 +454,7 @@ static void ompi_comm_construct(ompi_communicator_t* comm)
453454
comm->c_index_vec = NULL;
454455

455456
/*
456-
* magic numerology - see TOPDIR/ompi/include/mpif-values.pl
457+
* magic numerology - see TOPDIR/ompi/include/mpif-values.py
457458
*/
458459
idx = (comm == (ompi_communicator_t*)ompi_mpi_comm_world_addr) ? 0 :
459460
(comm == (ompi_communicator_t*)ompi_mpi_comm_self_addr) ? 1 :

ompi/datatype/ompi_datatype_module.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
* Copyright (c) 2016-2018 FUJITSU LIMITED. All rights reserved.
2121
* Copyright (c) 2018-2021 Triad National Security, LLC. All rights
2222
* reserved.
23+
* Copyright (c) 2025 Jeffrey M. Squyres. All rights reserved.
2324
* $COPYRIGHT$
2425
*
2526
* Additional copyrights may follow
@@ -566,7 +567,7 @@ int32_t ompi_datatype_init( void )
566567
} while(0)
567568

568569
/*
569-
* This MUST match the order of ompi/include/mpif-values.pl
570+
* This MUST match the order of ompi/include/mpif-values.py
570571
* Any change will break binary compatibility of Fortran programs.
571572
*/
572573
MOOG(datatype_null, 0);

ompi/include/Makefile.am

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111
# All rights reserved.
1212
# Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
1313
# Copyright (c) 2009-2011 Oak Ridge National Labs. All rights reserved.
14-
# Copyright (c) 2014-2021 Research Organization for Information Science
14+
# Copyright (c) 2014-2025 Research Organization for Information Science
1515
# and Technology (RIST). All rights reserved.
1616
# Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
1717
# Copyright (c) 2022 IBM Corporation. All rights reserved.
18+
# Copyright (c) 2025 Jeffrey M. Squyres. All rights reserved.
1819
# $COPYRIGHT$
1920
#
2021
# Additional copyrights may follow
@@ -66,7 +67,7 @@ endif
6667

6768
include ompi/Makefile.am
6869

69-
# This is complicated, but mpif-values.pl generates several
70+
# This is complicated, but mpif-values.py generates several
7071
# mpif-*.h files in this directory (during autogen.pl).
7172
# Hence, if any of those files change, it's safer to just force the
7273
# user to re-autogen.
@@ -75,17 +76,17 @@ include ompi/Makefile.am
7576
# @ echo "ERROR: you must re-run autogen.pl (sorry!)"
7677
# @ exit 1
7778

78-
EXTRA_DIST = $(headers) mpif-values.pl
79+
EXTRA_DIST = $(headers) mpif-values.py
7980

8081
#
8182
# mpif-sizeof.h is generated based on some results from configure tests.
8283
#
8384

84-
sizeof_pl=$(top_srcdir)/ompi/mpi/fortran/base/gen-mpi-sizeof.pl
85+
sizeof_py=$(top_srcdir)/ompi/mpi/fortran/base/gen-mpi-sizeof.py
8586
mpif-sizeof.h: $(top_builddir)/config.status
86-
mpif-sizeof.h: $(sizeof_pl)
87+
mpif-sizeof.h: $(sizeof_py)
8788
mpif-sizeof.h:
88-
$(OMPI_V_GEN) $(sizeof_pl) \
89+
$(OMPI_V_GEN) $(python) $(sizeof_py) \
8990
--header=$@ --ierror=mandatory \
9091
--maxrank=$(OMPI_FORTRAN_MAX_ARRAY_RANK) \
9192
--generate=$(OMPI_FORTRAN_BUILD_SIZEOF) \
@@ -102,15 +103,18 @@ mpif-sizeof.h:
102103
# results from configure tests.
103104
#
104105

105-
mpif_mangling_pl=$(top_srcdir)/ompi/mpi/fortran/base/gen-mpi-mangling.pl
106+
mpif_mangling_py=$(top_srcdir)/ompi/mpi/fortran/base/gen-mpi-mangling.py
106107
mpif-c-constants-decl.h: $(top_builddir)/config.status
107-
mpif-c-constants-decl.h: $(mpif_mangling_pl)
108+
mpif-c-constants-decl.h: $(mpif_mangling_py)
108109
mpif-c-constants-decl.h:
109-
$(OMPI_V_GEN) $(mpif_mangling_pl) \
110+
$(OMPI_V_GEN) $(python) $(mpif_mangling_py) \
110111
--caps $(OMPI_FORTRAN_CAPS) \
111112
--plain $(OMPI_FORTRAN_PLAIN) \
112113
--single $(OMPI_FORTRAN_SINGLE_UNDERSCORE) \
113-
--double $(OMPI_FORTRAN_DOUBLE_UNDERSCORE)
114+
--double $(OMPI_FORTRAN_DOUBLE_UNDERSCORE) \
115+
--status-size $(OMPI_FORTRAN_STATUS_SIZE) \
116+
--align $(OMPI_FORTRAN_COMMON_ALIGNMENT)
117+
114118

115119
if WANT_INSTALL_HEADERS
116120
ompidir = $(ompiincludedir)

ompi/include/mpi.h.in

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
* Copyright (c) 2018-2022 Triad National Security, LLC. All rights
2929
* reserved.
3030
* Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved
31+
* Copyright (c) 2025 Jeffrey M. Squyres. All rights reserved.
3132
* $COPYRIGHT$
3233
*
3334
* Additional copyrights may follow
@@ -538,9 +539,9 @@ typedef MPI_Win_errhandler_function MPI_Win_errhandler_fn
538539
* Miscellaneous constants
539540
*
540541
* NOTE: Many of the integer constants below *also* appear in
541-
* ompi/include/mpif-values.pl. If you change any of these integer
542+
* ompi/include/mpif-values.py. If you change any of these integer
542543
* values below, make sure to also change the corresponding values in
543-
* mpif-values.pl.
544+
* mpif-values.py.
544545
*/
545546
#define MPI_ANY_SOURCE -1 /* match any source rank */
546547
#define MPI_PROC_NULL -2 /* rank of null process */
@@ -583,7 +584,7 @@ typedef MPI_Win_errhandler_function MPI_Win_errhandler_fn
583584
* Constants for C code to access elements in Fortran MPI status array.
584585
*
585586
* NOTE: The MPI_F_SOURCE, MPI_F_TAG, MPI_F_ERROR are intentionally 1
586-
* smaller than their Fortran equivalents in mpif-values.pl (because C
587+
* smaller than their Fortran equivalents in mpif-values.py (because C
587588
* is 0-indexed and Fortran is 1-indexed).
588589
*/
589590
#define MPI_F_STATUS_SIZE OMPI_FORTRAN_STATUS_SIZE /* Size of Fortran MPI status array */
@@ -761,7 +762,7 @@ enum {
761762
* Comparison results. Don't change the order of these, the group
762763
* comparison functions rely on it.
763764
* Do not change the order of these without also modifying
764-
* mpif-values.pl.
765+
* mpif-values.py.
765766
*/
766767
enum {
767768
MPI_IDENT,
@@ -773,7 +774,7 @@ enum {
773774
/*
774775
* MPI_Init_thread constants
775776
* Do not change the order of these without also modifying
776-
* mpif-values.pl.
777+
* mpif-values.py.
777778
*/
778779
enum {
779780
MPI_THREAD_SINGLE,
@@ -785,7 +786,7 @@ enum {
785786
/*
786787
* Datatype combiners.
787788
* Do not change the order of these without also modifying
788-
* mpif-values.pl.
789+
* mpif-values.py.
789790
*/
790791
enum {
791792
MPI_COMBINER_NAMED,
@@ -837,7 +838,7 @@ enum {
837838
/*
838839
* Communicator split type constants.
839840
* Do not change the order of these without also modifying
840-
* mpif-values.pl.
841+
* mpif-values.py.
841842
*/
842843
enum {
843844
MPI_COMM_TYPE_SHARED,

ompi/include/mpif-sentinels.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
! All rights reserved.
1313
! Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved.
1414
! Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
15+
! Copyright (c) 2025 Jeffrey M. Squyres. All rights reserved.
1516
! $COPYRIGHT$
1617
!
1718
! Additional copyrights may follow
@@ -26,7 +27,7 @@
2627
!
2728
! - the "mpi" module bindings
2829
! - the "mpi_f08" module bindings
29-
! - ompi/mpi/fortran/base/gen-mpi-mangling.pl
30+
! - ompi/mpi/fortran/base/gen-mpi-mangling.py
3031
!
3132

3233
! MPI_BOTTOM is only used where choice buffers can be used (meaning

0 commit comments

Comments
 (0)