From 11827f8614b9aa4644c6a94cb5f0d1ee30a8874e Mon Sep 17 00:00:00 2001 From: sunguoshuai Date: Sat, 7 Aug 2021 16:30:40 +0800 Subject: [PATCH] fix build error with gcc 10,include allow mismatched arguement and multiple definition --- fix-multiple-definition-error.patch | 114 ++++++++++++++++++ fix-psm2-multiple-definition.patch | 40 ++++++ fix-undefined-reference-in-psm2-files.patch | 28 +++++ fix-undefined-reference.patch | 89 ++++++++++++++ ...ran10-allows-mismatched-arguements-1.patch | 45 +++++++ ...ran10-allows-mismatched-arguements-2.patch | 45 +++++++ mvapich2.spec | 11 +- 7 files changed, 371 insertions(+), 1 deletion(-) create mode 100644 fix-multiple-definition-error.patch create mode 100644 fix-psm2-multiple-definition.patch create mode 100644 fix-undefined-reference-in-psm2-files.patch create mode 100644 fix-undefined-reference.patch create mode 100644 gfortran10-allows-mismatched-arguements-1.patch create mode 100644 gfortran10-allows-mismatched-arguements-2.patch diff --git a/fix-multiple-definition-error.patch b/fix-multiple-definition-error.patch new file mode 100644 index 0000000..803eb57 --- /dev/null +++ b/fix-multiple-definition-error.patch @@ -0,0 +1,114 @@ +From 6b9fa9eff2f3e313347294f54c0179582f70411d Mon Sep 17 00:00:00 2001 +From: sunguoshuai +Date: Fri, 6 Aug 2021 16:52:58 +0800 +Subject: [PATCH] fix multiple definition error + +--- + src/include/coll_shmem.h | 2 +- + src/include/coll_shmem_internal.h | 14 +++++++------- + src/mpi/coll/allgatherv_tuning.h | 2 +- + src/mpid/ch3/channels/common/include/mem_hooks.h | 2 +- + .../ch3/channels/mrail/include/mpidi_ch3_impl.h | 2 +- + .../channels/mrail/src/gen2/mpidi_ch3_rdma_post.h | 2 +- + 6 files changed, 12 insertions(+), 12 deletions(-) + +diff --git a/src/include/coll_shmem.h b/src/include/coll_shmem.h +index 1da9c7f..24ad19f 100644 +--- a/src/include/coll_shmem.h ++++ b/src/include/coll_shmem.h +@@ -382,7 +382,7 @@ int create_sharp_comm(MPI_Comm, int, int); + + + /*Fn pointers for collectives */ +-int (*reduce_fn)(const void *sendbuf, ++extern int (*reduce_fn)(const void *sendbuf, + void *recvbuf, + int count, + MPI_Datatype datatype, +diff --git a/src/include/coll_shmem_internal.h b/src/include/coll_shmem_internal.h +index 84bac47..54eb456 100644 +--- a/src/include/coll_shmem_internal.h ++++ b/src/include/coll_shmem_internal.h +@@ -30,12 +30,12 @@ extern int mv2_shmem_coll_num_comm; + extern int mv2_gather_status_alignment; + extern int mv2_bcast_status_alignment; + extern int mv2_max_limic_comms; +-volatile int *child_complete_bcast; /* use for initial synchro */ +-volatile int *child_complete_gather; /* use for initial synchro */ +-volatile int *root_complete_gather; +-volatile int *barrier_gather; +-volatile int *barrier_bcast; +-volatile int *shmem_coll_block_status; ++extern volatile int *child_complete_bcast; /* use for initial synchro */ ++extern volatile int *child_complete_gather; /* use for initial synchro */ ++extern volatile int *root_complete_gather; ++extern volatile int *barrier_gather; ++extern volatile int *barrier_bcast; ++extern volatile int *shmem_coll_block_status; + #if defined(_SMP_LIMIC_) + volatile int *limic_progress; + #endif +@@ -98,7 +98,7 @@ typedef struct { + SHMEM_COLL_STATUS_ARRAY_SIZE + LIMIC_COLL_SYNC_ARRAY_SIZE + \ + SHMEM_BCAST_SYNC_ARRAY_SIZE) + +-shmem_coll_region *shmem_coll; ++extern shmem_coll_region *shmem_coll; + + + +diff --git a/src/mpi/coll/allgatherv_tuning.h b/src/mpi/coll/allgatherv_tuning.h +index ee3bcbe..3a3a100 100644 +--- a/src/mpi/coll/allgatherv_tuning.h ++++ b/src/mpi/coll/allgatherv_tuning.h +@@ -37,7 +37,7 @@ + * use ring since 8192 bytes + */ + +-char *mv2_user_allgatherv_inter; ++extern char *mv2_user_allgatherv_inter; + + typedef struct { + int min; +diff --git a/src/mpid/ch3/channels/common/include/mem_hooks.h b/src/mpid/ch3/channels/common/include/mem_hooks.h +index 1d8256e..6a151cd 100644 +--- a/src/mpid/ch3/channels/common/include/mem_hooks.h ++++ b/src/mpid/ch3/channels/common/include/mem_hooks.h +@@ -39,7 +39,7 @@ typedef struct { + munmap_t munmap; + } mvapich2_malloc_info_t; + +-mvapich2_malloc_info_t mvapich2_minfo; ++extern mvapich2_malloc_info_t mvapich2_minfo; + + void mvapich2_mem_unhook(void *mem, size_t size); + int mvapich2_minit(void); +diff --git a/src/mpid/ch3/channels/mrail/include/mpidi_ch3_impl.h b/src/mpid/ch3/channels/mrail/include/mpidi_ch3_impl.h +index bb5401b..b188d33 100644 +--- a/src/mpid/ch3/channels/mrail/include/mpidi_ch3_impl.h ++++ b/src/mpid/ch3/channels/mrail/include/mpidi_ch3_impl.h +@@ -390,7 +390,7 @@ int MPIDI_CH3I_MRAIL_CM_Dealloc(MPIDI_PG_t * pg); + void MPIDI_CH3I_Cleanup_cqes(void); + + /*flag to check if cq_poll is success in the progressing loop*/ +-int cq_poll_completion; ++extern int cq_poll_completion; + + #ifdef CKPT + +diff --git a/src/mpid/ch3/channels/mrail/src/gen2/mpidi_ch3_rdma_post.h b/src/mpid/ch3/channels/mrail/src/gen2/mpidi_ch3_rdma_post.h +index ce1eb95..fecea16 100644 +--- a/src/mpid/ch3/channels/mrail/src/gen2/mpidi_ch3_rdma_post.h ++++ b/src/mpid/ch3/channels/mrail/src/gen2/mpidi_ch3_rdma_post.h +@@ -292,7 +292,7 @@ int MPIDI_CH3I_MRAILI_Get_next_vbuf(struct MPIDI_VC** vc_ptr, vbuf** vbuf_ptr); + + int MPIDI_CH3I_MRAILI_Waiting_msg(struct MPIDI_VC* vc, vbuf**, int blocking); + +-int (*MPIDI_CH3I_MRAILI_Cq_poll) (vbuf**, struct MPIDI_VC*, int, int); ++extern int (*MPIDI_CH3I_MRAILI_Cq_poll) (vbuf**, struct MPIDI_VC*, int, int); + + void MRAILI_Send_noop(struct MPIDI_VC* c, int rail); + +-- +2.30.0 + diff --git a/fix-psm2-multiple-definition.patch b/fix-psm2-multiple-definition.patch new file mode 100644 index 0000000..88d2575 --- /dev/null +++ b/fix-psm2-multiple-definition.patch @@ -0,0 +1,40 @@ +From 2a2bbf44e134a412df54f33c41d49b36f04c50e7 Mon Sep 17 00:00:00 2001 +From: sunguoshuai +Date: Sat, 7 Aug 2021 15:01:35 +0800 +Subject: [PATCH] for psm2 multiple definition + +--- + src/mpid/ch3/channels/psm/include/psmpriv.h | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/mpid/ch3/channels/psm/include/psmpriv.h b/src/mpid/ch3/channels/psm/include/psmpriv.h +index ee6848b..958c5f9 100644 +--- a/src/mpid/ch3/channels/psm/include/psmpriv.h ++++ b/src/mpid/ch3/channels/psm/include/psmpriv.h +@@ -212,10 +212,10 @@ + (_len < ipath_rndv_thresh)) + + int psm_no_lock(pthread_spinlock_t *); +-int (*psm_lock_fn)(pthread_spinlock_t *); +-int (*psm_unlock_fn)(pthread_spinlock_t *); +-int (*psm_progress_lock_fn)(pthread_spinlock_t *); +-int (*psm_progress_unlock_fn)(pthread_spinlock_t *); ++extern int (*psm_lock_fn)(pthread_spinlock_t *); ++extern int (*psm_unlock_fn)(pthread_spinlock_t *); ++extern int (*psm_progress_lock_fn)(pthread_spinlock_t *); ++extern int (*psm_progress_unlock_fn)(pthread_spinlock_t *); + + #define MAX_PROGRESS_HOOKS 4 + typedef int (*progress_func_ptr_t) (int* made_progress); +@@ -225,7 +225,7 @@ typedef struct progress_hook_slot { + int active; + } progress_hook_slot_t; + +-progress_hook_slot_t progress_hooks[MAX_PROGRESS_HOOKS]; ++extern progress_hook_slot_t progress_hooks[MAX_PROGRESS_HOOKS]; + + #define _psm_enter_ psm_lock_fn(&psmlock) + #define _psm_exit_ psm_unlock_fn(&psmlock) +-- +2.30.0 + diff --git a/fix-undefined-reference-in-psm2-files.patch b/fix-undefined-reference-in-psm2-files.patch new file mode 100644 index 0000000..8723a87 --- /dev/null +++ b/fix-undefined-reference-in-psm2-files.patch @@ -0,0 +1,28 @@ +From 13f002618fe9528d193869b6bccf9ddf00de9e84 Mon Sep 17 00:00:00 2001 +From: sunguoshuai +Date: Sat, 7 Aug 2021 15:48:15 +0800 +Subject: [PATCH] fix undefined reference in psm2 files + +--- + src/mpid/ch3/channels/psm/src/mpidi_calls.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/mpid/ch3/channels/psm/src/mpidi_calls.c b/src/mpid/ch3/channels/psm/src/mpidi_calls.c +index bdca286..d016ebf 100644 +--- a/src/mpid/ch3/channels/psm/src/mpidi_calls.c ++++ b/src/mpid/ch3/channels/psm/src/mpidi_calls.c +@@ -14,6 +14,11 @@ + #include "psmpriv.h" + #include + ++int (*psm_lock_fn)(pthread_spinlock_t *); ++int (*psm_unlock_fn)(pthread_spinlock_t *); ++int (*psm_progress_lock_fn)(pthread_spinlock_t *); ++int (*psm_progress_unlock_fn)(pthread_spinlock_t *); ++progress_hook_slot_t progress_hooks[MAX_PROGRESS_HOOKS]; + + #undef FUNCNAME + #define FUNCNAME MPIDI_CH3_Init +-- +2.30.0 + diff --git a/fix-undefined-reference.patch b/fix-undefined-reference.patch new file mode 100644 index 0000000..5de14f2 --- /dev/null +++ b/fix-undefined-reference.patch @@ -0,0 +1,89 @@ +From feb93bab18c9f70b33b480ae5c7878266f795f36 Mon Sep 17 00:00:00 2001 +From: sunguoshuai +Date: Sat, 7 Aug 2021 10:23:43 +0800 +Subject: [PATCH] test2 + +--- + src/mpi/coll/allreduce_osu.c | 7 +++++++ + src/mpi/coll/ch3_shmem_coll.c | 8 ++++++++ + src/mpid/ch3/channels/common/src/memory/mem_hooks.c | 1 + + src/mpid/ch3/channels/mrail/src/rdma/ch3_init.c | 1 + + src/mpid/ch3/channels/mrail/src/rdma/ch3_progress.c | 1 + + 5 files changed, 18 insertions(+) + +diff --git a/src/mpi/coll/allreduce_osu.c b/src/mpi/coll/allreduce_osu.c +index 611b199..dd5e192 100644 +--- a/src/mpi/coll/allreduce_osu.c ++++ b/src/mpi/coll/allreduce_osu.c +@@ -30,6 +30,13 @@ + extern int mv2_sharp_tuned_msg_size; + #endif + ++/*Fn pointers for collectives */ ++int (*reduce_fn)(const void *sendbuf, ++ void *recvbuf, ++ int count, ++ MPI_Datatype datatype, ++ MPI_Op op, int root, MPID_Comm * comm_ptr, MPIR_Errflag_t *errflag); ++ + MPIR_T_PVAR_ULONG2_COUNTER_DECL_EXTERN(MV2, mv2_coll_allreduce_sharp); + MPIR_T_PVAR_ULONG2_COUNTER_DECL_EXTERN(MV2, mv2_coll_allreduce_shm_rd); + MPIR_T_PVAR_ULONG2_COUNTER_DECL_EXTERN(MV2, mv2_coll_allreduce_shm_rs); +diff --git a/src/mpi/coll/ch3_shmem_coll.c b/src/mpi/coll/ch3_shmem_coll.c +index 94129e4..a53831c 100644 +--- a/src/mpi/coll/ch3_shmem_coll.c ++++ b/src/mpi/coll/ch3_shmem_coll.c +@@ -78,6 +78,14 @@ + #endif + #include "debug_utils.h" + ++shmem_coll_region *shmem_coll; ++volatile int *child_complete_bcast; /* use for initial synchro */ ++volatile int *child_complete_gather; /* use for initial synchro */ ++volatile int *root_complete_gather; ++volatile int *barrier_gather; ++volatile int *barrier_bcast; ++volatile int *shmem_coll_block_status; ++ + /* + === BEGIN_MPI_T_CVAR_INFO_BLOCK === + +diff --git a/src/mpid/ch3/channels/common/src/memory/mem_hooks.c b/src/mpid/ch3/channels/common/src/memory/mem_hooks.c +index 5b98b71..c2faf2f 100644 +--- a/src/mpid/ch3/channels/common/src/memory/mem_hooks.c ++++ b/src/mpid/ch3/channels/common/src/memory/mem_hooks.c +@@ -38,6 +38,7 @@ + + #define PT_TEST_ALLOC_SIZE (64) + static int mem_hook_init = 0; ++mvapich2_malloc_info_t mvapich2_minfo; + + #if !(defined(HAVE_SYSCALL) && defined(__NR_munmap)) + #include +diff --git a/src/mpid/ch3/channels/mrail/src/rdma/ch3_init.c b/src/mpid/ch3/channels/mrail/src/rdma/ch3_init.c +index ee31526..dc861fb 100644 +--- a/src/mpid/ch3/channels/mrail/src/rdma/ch3_init.c ++++ b/src/mpid/ch3/channels/mrail/src/rdma/ch3_init.c +@@ -32,6 +32,7 @@ int (*perform_blocking_progress) (int hca_num, int num_cqs); + void (*handle_multiple_cqs) (int num_cqs, int cq_choice, int is_send_completion); + extern int MPIDI_Get_local_host(MPIDI_PG_t *pg, int our_pg_rank); + extern void ib_finalize_rdma_cm(int pg_rank, MPIDI_PG_t *pg); ++int (*MPIDI_CH3I_MRAILI_Cq_poll) (vbuf**, struct MPIDI_VC*, int, int); + + #undef FUNCNAME + #define FUNCNAME split_type +diff --git a/src/mpid/ch3/channels/mrail/src/rdma/ch3_progress.c b/src/mpid/ch3/channels/mrail/src/rdma/ch3_progress.c +index b83bea2..53c56f6 100644 +--- a/src/mpid/ch3/channels/mrail/src/rdma/ch3_progress.c ++++ b/src/mpid/ch3/channels/mrail/src/rdma/ch3_progress.c +@@ -76,6 +76,7 @@ extern int MPIDI_CH3_PktHandler_Init_MV2(); + + extern volatile int *rdma_cm_iwarp_msg_count; + extern volatile int *rdma_cm_connect_count; ++int cq_poll_completion; + + #ifdef CKPT + static int cm_handle_reactivation_complete(); +-- +2.30.0 + diff --git a/gfortran10-allows-mismatched-arguements-1.patch b/gfortran10-allows-mismatched-arguements-1.patch new file mode 100644 index 0000000..162ec34 --- /dev/null +++ b/gfortran10-allows-mismatched-arguements-1.patch @@ -0,0 +1,45 @@ +From 397eba21b125a2cb99624d15ce2bc51100691321 Mon Sep 17 00:00:00 2001 +From: wang_yue111 <648774160@qq.com> +Date: Wed, 4 Aug 2021 17:32:50 +0800 +Subject: [PATCH] 2 + +--- + configure | 15 ++------------- + 1 file changed, 2 insertions(+), 13 deletions(-) + +diff --git a/configure b/configure +index 583cb7e..7ac0246 100755 +--- a/configure ++++ b/configure +@@ -33762,7 +33762,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + # The best solution is to turn off errors on particular routines + # if that isn't possible (e.g., too many of them), then + # just try arguments that turn off all checking +- for flags in "-mismatch" ; do ++ for flags in "-fallow-argument-mismatch" "-mismatch" ; do + testok=no + FFLAGS="$FFLAGS $flags" + cat > conftest.$ac_ext <<_ACEOF +@@ -33804,18 +33804,7 @@ the same routine with arguments of different types." "$LINENO" 5 + fi + + addarg=$pac_cv_prog_f77_mismatched_args_parm +- +- if test "X$addarg" != "X" ; then +- # We could add the names of all of the MPI routines that +- # accept different types. Instead, we fail cleanly. +- # Some Fortran compilers allow you to turn off checking for +- # mismatched arguments for *all* routines. Adding an argument +- # that turns off checking for *everything* is not something that +- # configure should do - if the user wants this, they can follow +- # the instructions in the following error message. +- as_fn_error $? "The Fortran compiler $F77 does not accept programs that call the same routine with arguments of different types without the option $addarg. Rerun configure with FFLAGS=$addarg" "$LINENO" 5 +- fi +- ++FFLAGS="$FFLAGS $addarg" + bindings="$bindings f77" + + $as_echo "#define HAVE_FORTRAN_BINDING 1" >>confdefs.h +-- +2.23.0 + diff --git a/gfortran10-allows-mismatched-arguements-2.patch b/gfortran10-allows-mismatched-arguements-2.patch new file mode 100644 index 0000000..9f5ae03 --- /dev/null +++ b/gfortran10-allows-mismatched-arguements-2.patch @@ -0,0 +1,45 @@ +From b4d68c731a19090f4fc7ba1843975a4b44059600 Mon Sep 17 00:00:00 2001 +From: wang_yue111 <648774160@qq.com> +Date: Wed, 4 Aug 2021 17:56:37 +0800 +Subject: [PATCH] 3 + +--- + test/mpi/configure | 15 ++------------- + 1 file changed, 2 insertions(+), 13 deletions(-) + +diff --git a/test/mpi/configure b/test/mpi/configure +index e31f966..9f056de 100755 +--- a/test/mpi/configure ++++ b/test/mpi/configure +@@ -9715,7 +9715,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + # The best solution is to turn off errors on particular routines + # if that isn't possible (e.g., too many of them), then + # just try arguments that turn off all checking +- for flags in "-mismatch" ; do ++ for flags in "-fallow-argument-mismatch" "-mismatch" ; do + testok=no + FFLAGS="$FFLAGS $flags" + cat > conftest.$ac_ext <<_ACEOF +@@ -9757,18 +9757,7 @@ the same routine with arguments of different types." "$LINENO" 5 + fi + + addarg=$pac_cv_prog_f77_mismatched_args_parm +- +- if test "X$addarg" != "X" ; then +- # We could add the names of all of the MPI routines that +- # accept different types. Instead, we fail cleanly. +- # Some Fortran compilers allow you to turn off checking for +- # mismatched arguments for *all* routines. Adding an argument +- # that turns off checking for *everything* is not something that +- # configure should do - if the user wants this, they can follow +- # the instructions in the following error message. +- as_fn_error $? "The Fortran compiler $F77 does not accept programs that call the same routine with arguments of different types without the option $addarg. Rerun configure with FFLAGS=$addarg" "$LINENO" 5 +- fi +- ++FFLAGS="$FFLAGS $addarg" + # Check whether we need -lU77 to get iargc and getarg, which + # are used for a few of the tests in spawn (U77 was needed with + # the native compilers on HPUX. See the aclocal_f77(old).m4 file, +-- +2.23.0 + diff --git a/mvapich2.spec b/mvapich2.spec index 7242c71..3f5c3c9 100644 --- a/mvapich2.spec +++ b/mvapich2.spec @@ -2,7 +2,7 @@ Name: mvapich2 Version: 2.3 -Release: 10 +Release: 11 Summary: OSU MVAPICH2 MPI package License: BSD and MIT URL: http://mvapich.cse.ohio-state.edu @@ -12,6 +12,12 @@ Source2: mvapich2.macros.in Patch0001: 0001-mvapich23-unbundle-contrib-hwloc.patch Patch0002: 0002-mvapich23-unbundle-osu_benchmarks.patch Patch0003: 0003-mvapich23-replace-deprecated-sys_siglist-with-strsignal.patch +Patch0004: gfortran10-allows-mismatched-arguements-1.patch +Patch0005: gfortran10-allows-mismatched-arguements-2.patch +Patch0006: fix-multiple-definition-error.patch +Patch0007: fix-undefined-reference.patch +Patch0008: fix-psm2-multiple-definition.patch +Patch0009: fix-undefined-reference-in-psm2-files.patch BuildRequires: gcc-gfortran python3-devel gcc-c++ BuildRequires: bison flex autoconf automake libtool BuildRequires: perl-Digest-MD5 hwloc-devel rdma-core-devel @@ -254,6 +260,9 @@ cd .. %changelog +* Sat 07 Aug 2021 sunguoshuai - 2.3-11 +- fix build error with gcc 10,include allow mismatched arguement and multiple definition + * Wed July 9 2021 zhaoyao - 2.3-10 - fix build error: Abording because C++ compiler does not work.