|
19 | 19 | * Copyright (c) 2015 University of Houston. All rights reserved.
|
20 | 20 | * Copyright (c) 2015-2018 Research Organization for Information Science
|
21 | 21 | * and Technology (RIST). All rights reserved.
|
22 |
| - * Copyright (c) 2017-2018 IBM Corporation. All rights reserved. |
| 22 | + * Copyright (c) 2017-2019 IBM Corporation. All rights reserved. |
| 23 | + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. |
23 | 24 | * $COPYRIGHT$
|
24 | 25 | *
|
25 | 26 | * Additional copyrights may follow
|
|
279 | 280 | # define __mpi_interface_deprecated__(msg) __attribute__((__deprecated__))
|
280 | 281 | # endif
|
281 | 282 | # endif
|
282 |
| -# if (OMPI_ENABLE_MPI1_COMPAT && !OMPI_BUILDING) |
283 |
| -# define __mpi_interface_removed__(msg) __mpi_interface_deprecated__(msg) |
| 283 | +# endif |
| 284 | + |
| 285 | + /* For MPI removed APIs, there is no generally portable way to cause |
| 286 | + * the C compiler to error with a nice message, on the _usage_ of |
| 287 | + * one of these symbols. We've gone with tiered appraoch: |
| 288 | + * |
| 289 | + * If the user configured with --enable-mpi1-compatibility, |
| 290 | + * just emit a compiletime warning (via the deprecation function |
| 291 | + * attribute) that they're using an MPI1 removed function. |
| 292 | + * |
| 293 | + * Otherwise, we'd like to issue a fatal error directing the user |
| 294 | + * that they've used an MPI1 removed function. If the user's |
| 295 | + * compiler supports C11 _Static_assert feature, we #define |
| 296 | + * the MPI routines to instead be a call to _Static_assert |
| 297 | + * with an appropreate message suggesting the new MPI3 equivalent. |
| 298 | + * |
| 299 | + * Otherwise, if the user's compiler supports the error function |
| 300 | + * attribute, define the MPI routines with that error attribute. |
| 301 | + * This is supported by most modern GNU compilers. |
| 302 | + * |
| 303 | + * Finally if the compiler doesn't support any of those, just |
| 304 | + * Don't declare those MPI routines at all in mpi.h |
| 305 | + * |
| 306 | + * Don't do MACRO magic for building Profiling library as it |
| 307 | + * interferes with the above. |
| 308 | + */ |
| 309 | +# if (OMPI_ENABLE_MPI1_COMPAT || OMPI_BUILDING) |
| 310 | +# define OMPI_OMIT_MPI1_COMPAT_DECLS 0 |
| 311 | +# define OMPI_REMOVED_USE_STATIC_ASSERT 0 |
| 312 | +# define __mpi_interface_removed__(func, newfunc) __mpi_interface_deprecated__(#func " was removed in MPI-3.0. Use " #newfunc " instead. continuing...") |
| 313 | +# else |
| 314 | +# if (__STDC_VERSION__ >= 201112L) |
| 315 | +# define OMPI_OMIT_MPI1_COMPAT_DECLS 1 |
| 316 | +# define OMPI_REMOVED_USE_STATIC_ASSERT 1 |
| 317 | +# define OMPI_REMOVED_STATIC_ASSERT_MSG(func, newfunc) _Static_assert(0, #func " was removed in MPI-3.0. Use " #newfunc " instead.") |
| 318 | +# else |
| 319 | +# if OPAL_HAVE_ATTRIBUTE_ERROR |
284 | 320 | # define OMPI_OMIT_MPI1_COMPAT_DECLS 0
|
| 321 | +# define OMPI_REMOVED_USE_STATIC_ASSERT 0 |
| 322 | +# define __mpi_interface_removed__(func, newfunc) __attribute__((__error__(#func " was removed in MPI-3.0. Use " #newfunc " instead."))) |
| 323 | +# else |
| 324 | +# define OMPI_OMIT_MPI1_COMPAT_DECLS 1 |
| 325 | +# define OMPI_REMOVED_USE_STATIC_ASSERT 0 |
| 326 | +# endif |
285 | 327 | # endif
|
286 | 328 | # endif
|
287 | 329 | # endif
|
|
297 | 339 | #endif
|
298 | 340 |
|
299 | 341 | #if !defined(__mpi_interface_removed__)
|
300 |
| -# define __mpi_interface_removed__(msg) |
| 342 | +# define __mpi_interface_removed__(A,B) |
| 343 | +#endif |
| 344 | + |
| 345 | +#if !defined(OMPI_REMOVED_STATIC_ASSERT_MSG) |
| 346 | +# define OMPI_REMOVED_STATIC_ASSERT_MSG(func, newfunc) |
| 347 | +#endif |
| 348 | + |
| 349 | +#if !defined(OMPI_REMOVED_USE_STATIC_ASSERT) |
| 350 | +# define OMPI_REMOVED_USE_STATIC_ASSERT 0 |
301 | 351 | #endif
|
302 | 352 |
|
303 | 353 | #if !defined(OMPI_OMIT_MPI1_COMPAT_DECLS)
|
@@ -1010,22 +1060,32 @@ OMPI_DECLSPEC extern struct ompi_predefined_info_t ompi_mpi_info_env;
|
1010 | 1060 | OMPI_DECLSPEC extern MPI_Fint *MPI_F_STATUS_IGNORE;
|
1011 | 1061 | OMPI_DECLSPEC extern MPI_Fint *MPI_F_STATUSES_IGNORE;
|
1012 | 1062 |
|
1013 |
| -#if (!OMPI_OMIT_MPI1_COMPAT_DECLS || OMPI_BUILDING) |
1014 | 1063 | /*
|
1015 | 1064 | * Removed datatypes. These datatypes are only available if Open MPI
|
1016 | 1065 | * was configured with --enable-mpi1-compatibility.
|
1017 | 1066 | *
|
1018 | 1067 | * These datatypes were formally removed from the MPI specification
|
1019 | 1068 | * and should no longer be used in MPI applications.
|
1020 | 1069 | */
|
1021 |
| -#define MPI_UB OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_ub) |
1022 |
| -#define MPI_LB OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_lb) |
| 1070 | +#if (OMPI_ENABLE_MPI1_COMPAT || OMPI_BUILDING) |
| 1071 | +# define MPI_UB OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_ub) |
| 1072 | +# define MPI_LB OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_lb) |
| 1073 | + |
| 1074 | +OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_lb; |
| 1075 | +OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_ub; |
| 1076 | + |
| 1077 | +#else |
| 1078 | +/* If not building or configured --enable-mpi1-compatibility, then |
| 1079 | + * we don't want these datatypes, instead we define MPI_UB and |
| 1080 | + * MPI_LB to our Static Assert message if the compiler supports |
| 1081 | + * that staticly assert with a nice message. |
| 1082 | + */ |
| 1083 | +# if (OMPI_REMOVED_USE_STATIC_ASSERT) |
| 1084 | +# define MPI_UB OMPI_REMOVED_STATIC_ASSERT_MSG(MPI_UB, MPI_Type_create_resized); |
| 1085 | +# define MPI_LB OMPI_REMOVED_STATIC_ASSERT_MSG(MPI_LB, MPI_Type_create_resized); |
| 1086 | +# endif /* OMPI_REMOVED_USE_STATIC_ASSERT */ |
| 1087 | +#endif /* Removed datatypes */ |
1023 | 1088 |
|
1024 |
| -OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_lb |
1025 |
| - __mpi_interface_removed__("MPI_LB was removed in MPI-3.0; use MPI_Type_create_resized instead."); |
1026 |
| -OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_ub |
1027 |
| - __mpi_interface_removed__("MPI_UB was removed in MPI-3.0; use MPI_Type_create_resized instead."); |
1028 |
| -#endif /* !OMPI_OMIT_MPI1_COMPAT_DECLS */ |
1029 | 1089 |
|
1030 | 1090 | /*
|
1031 | 1091 | * MPI predefined handles
|
@@ -2695,61 +2755,74 @@ typedef void (MPI_Handler_function)(MPI_Comm *, int *, ...);
|
2695 | 2755 | * and should no longer be used in MPI applications.
|
2696 | 2756 | */
|
2697 | 2757 | OMPI_DECLSPEC int MPI_Address(void *location, MPI_Aint *address)
|
2698 |
| - __mpi_interface_removed__("MPI_Address was removed in MPI-3.0; use MPI_Get_address instead."); |
| 2758 | + __mpi_interface_removed__(MPI_Address, MPI_Get_address); |
2699 | 2759 | OMPI_DECLSPEC int PMPI_Address(void *location, MPI_Aint *address)
|
2700 |
| - __mpi_interface_removed__("PMPI_Address was removed in MPI-3.0; use MPI_Get_address instead."); |
| 2760 | + __mpi_interface_removed__(PMPI_Address, PMPI_Get_address); |
2701 | 2761 | OMPI_DECLSPEC int MPI_Errhandler_create(MPI_Handler_function *function,
|
2702 | 2762 | MPI_Errhandler *errhandler)
|
2703 |
| - __mpi_interface_removed__("MPI_Errhandler_create was removed in MPI-3.0; use MPI_Comm_create_errhandler instead."); |
| 2763 | + __mpi_interface_removed__(MPI_Errhandler_create, MPI_Comm_create_errhandler); |
2704 | 2764 | OMPI_DECLSPEC int PMPI_Errhandler_create(MPI_Handler_function *function,
|
2705 | 2765 | MPI_Errhandler *errhandler)
|
2706 |
| - __mpi_interface_removed__("PMPI_Errhandler_create was removed in MPI-3.0; use PMPI_Comm_create_errhandler instead."); |
| 2766 | + __mpi_interface_removed__(PMPI_Errhandler_create, PMPI_Comm_create_errhandler); |
2707 | 2767 | OMPI_DECLSPEC int MPI_Errhandler_get(MPI_Comm comm, MPI_Errhandler *errhandler)
|
2708 |
| - __mpi_interface_removed__("MPI_Errhandler_get was removed in MPI-3.0; use MPI_Comm_get_errhandler instead."); |
| 2768 | + __mpi_interface_removed__(MPI_Errhandler_get, MPI_Comm_get_errhandler); |
2709 | 2769 | OMPI_DECLSPEC int PMPI_Errhandler_get(MPI_Comm comm, MPI_Errhandler *errhandler)
|
2710 |
| - __mpi_interface_removed__("PMPI_Errhandler_get was removed in MPI-3.0; use PMPI_Comm_get_errhandler instead."); |
| 2770 | + __mpi_interface_removed__(PMPI_Errhandler_get, PMPI_Comm_get_errhandler); |
2711 | 2771 | OMPI_DECLSPEC int MPI_Errhandler_set(MPI_Comm comm, MPI_Errhandler errhandler)
|
2712 |
| - __mpi_interface_removed__("MPI_Errhandler_set was removed in MPI-3.0; use MPI_Comm_set_errhandler instead."); |
| 2772 | + __mpi_interface_removed__(MPI_Errhandler_set, MPI_Comm_set_errhandler); |
2713 | 2773 | OMPI_DECLSPEC int PMPI_Errhandler_set(MPI_Comm comm, MPI_Errhandler errhandler)
|
2714 |
| - __mpi_interface_removed__("PMPI_Errhandler_set was removed in MPI-3.0; use PMPI_Comm_set_errhandler instead."); |
| 2774 | + __mpi_interface_removed__(PMPI_Errhandler_set, PMPI_Comm_set_errhandler); |
2715 | 2775 | OMPI_DECLSPEC int MPI_Type_extent(MPI_Datatype type, MPI_Aint *extent)
|
2716 |
| - __mpi_interface_removed__("MPI_Type_extent was removed in MPI-3.0; use MPI_Type_get_extent instead."); |
| 2776 | + __mpi_interface_removed__(MPI_Type_extent, MPI_Type_get_extent); |
2717 | 2777 | OMPI_DECLSPEC int PMPI_Type_extent(MPI_Datatype type, MPI_Aint *extent)
|
2718 |
| - __mpi_interface_removed__("PMPI_Type_extent was removed in MPI-3.0; use PMPI_Type_get_extent instead."); |
| 2778 | + __mpi_interface_removed__(PMPI_Type_extent, PMPI_Type_get_extent); |
2719 | 2779 | OMPI_DECLSPEC int MPI_Type_hindexed(int count, int array_of_blocklengths[],
|
2720 | 2780 | MPI_Aint array_of_displacements[],
|
2721 | 2781 | MPI_Datatype oldtype, MPI_Datatype *newtype)
|
2722 |
| - __mpi_interface_removed__("MPI_Type_hindexed was removed in MPI-3.0; use MPI_Type_create_hindexed instead."); |
| 2782 | + __mpi_interface_removed__(MPI_Type_hindexed, MPI_Type_create_hindexed); |
2723 | 2783 | OMPI_DECLSPEC int PMPI_Type_hindexed(int count, int array_of_blocklengths[],
|
2724 | 2784 | MPI_Aint array_of_displacements[],
|
2725 | 2785 | MPI_Datatype oldtype, MPI_Datatype *newtype)
|
2726 |
| - __mpi_interface_removed__("PMPI_Type_hindexed was removed in MPI-3.0; use PMPI_Type_create_hindexed instead."); |
| 2786 | + __mpi_interface_removed__(PMPI_Type_hindexed, PMPI_Type_create_hindexed); |
2727 | 2787 | OMPI_DECLSPEC int MPI_Type_hvector(int count, int blocklength, MPI_Aint stride,
|
2728 | 2788 | MPI_Datatype oldtype, MPI_Datatype *newtype)
|
2729 |
| - __mpi_interface_removed__("MPI_Type_hvector was removed in MPI-3.0; use MPI_Type_create_hvector instead."); |
| 2789 | + __mpi_interface_removed__(MPI_Type_hvector, MPI_Type_create_hvector); |
2730 | 2790 | OMPI_DECLSPEC int PMPI_Type_hvector(int count, int blocklength, MPI_Aint stride,
|
2731 | 2791 | MPI_Datatype oldtype, MPI_Datatype *newtype)
|
2732 |
| - __mpi_interface_removed__("PMPI_Type_hvector was removed in MPI-3.0; use PMPI_Type_create_hvector instead."); |
| 2792 | + __mpi_interface_removed__(PMPI_Type_hvector, PMPI_Type_create_hvector); |
2733 | 2793 | OMPI_DECLSPEC int MPI_Type_lb(MPI_Datatype type, MPI_Aint *lb)
|
2734 |
| - __mpi_interface_removed__("MPI_Type_lb has been removed in MPI-3.0; use MPI_Type_get_extent instead."); |
| 2794 | + __mpi_interface_removed__(MPI_Type_lb, MPI_Type_get_extent); |
2735 | 2795 | OMPI_DECLSPEC int PMPI_Type_lb(MPI_Datatype type, MPI_Aint *lb)
|
2736 |
| - __mpi_interface_removed__("PMPI_Type_lb has been removed in MPI-3.0; use PMPI_Type_get_extent instead."); |
| 2796 | + __mpi_interface_removed__(PMPI_Type_lb, PMPI_Type_get_extent); |
2737 | 2797 | OMPI_DECLSPEC int MPI_Type_struct(int count, int array_of_blocklengths[],
|
2738 | 2798 | MPI_Aint array_of_displacements[],
|
2739 | 2799 | MPI_Datatype array_of_types[],
|
2740 | 2800 | MPI_Datatype *newtype)
|
2741 |
| - __mpi_interface_removed__("MPI_Type_struct was removed in MPI-3.0; use MPI_Type_create_struct instead."); |
| 2801 | + __mpi_interface_removed__(MPI_Type_struct, MPI_Type_create_struct); |
2742 | 2802 | OMPI_DECLSPEC int PMPI_Type_struct(int count, int array_of_blocklengths[],
|
2743 | 2803 | MPI_Aint array_of_displacements[],
|
2744 | 2804 | MPI_Datatype array_of_types[],
|
2745 | 2805 | MPI_Datatype *newtype)
|
2746 |
| - __mpi_interface_removed__("PMPI_Type_struct was removed in MPI-3.0; use PMPI_Type_create_struct instead."); |
| 2806 | + __mpi_interface_removed__(PMPI_Type_struct, PMPI_Type_create_struct); |
2747 | 2807 | OMPI_DECLSPEC int MPI_Type_ub(MPI_Datatype mtype, MPI_Aint *ub)
|
2748 |
| - __mpi_interface_removed__("MPI_Type_ub has been removed in MPI-3.0; use MPI_Type_get_extent instead."); |
| 2808 | + __mpi_interface_removed__(MPI_Type_ub, MPI_Type_get_extent); |
2749 | 2809 | OMPI_DECLSPEC int PMPI_Type_ub(MPI_Datatype mtype, MPI_Aint *ub)
|
2750 |
| - __mpi_interface_removed__("PMPI_Type_ub has been removed in MPI-3.0; use PMPI_Type_get_extent instead."); |
| 2810 | + __mpi_interface_removed__(PMPI_Type_ub, PMPI_Type_get_extent); |
2751 | 2811 | #endif /* !OMPI_OMIT_MPI1_COMPAT_DECLS */
|
2752 | 2812 |
|
| 2813 | +#if OMPI_REMOVED_USE_STATIC_ASSERT |
| 2814 | +#define MPI_Address(...) OMPI_REMOVED_STATIC_ASSERT_MSG(MPI_Address, MPI_Get_address) |
| 2815 | +#define MPI_Errhandler_create(...) OMPI_REMOVED_STATIC_ASSERT_MSG(MPI_Errhandler_create, MPI_Comm_create_errhandler) |
| 2816 | +#define MPI_Errhandler_get(...) OMPI_REMOVED_STATIC_ASSERT_MSG(MPI_Errhandler_get, MPI_Comm_get_errhandler) |
| 2817 | +#define MPI_Errhandler_set(...) OMPI_REMOVED_STATIC_ASSERT_MSG(MPI_Errhandler_set, MPI_Comm_set_errhandler) |
| 2818 | +#define MPI_Type_extent(...) OMPI_REMOVED_STATIC_ASSERT_MSG(MPI_Type_extent, MPI_Type_get_extent) |
| 2819 | +#define MPI_Type_hindexed(...) OMPI_REMOVED_STATIC_ASSERT_MSG(MPI_Type_hindexed, MPI_Type_create_hindexed) |
| 2820 | +#define MPI_Type_hvector(...) OMPI_REMOVED_STATIC_ASSERT_MSG(MPI_Type_hvector, MPI_Type_create_hvector) |
| 2821 | +#define MPI_Type_lb(...) OMPI_REMOVED_STATIC_ASSERT_MSG(MPI_Type_lb, MPI_Type_get_extent) |
| 2822 | +#define MPI_Type_struct(...) OMPI_REMOVED_STATIC_ASSERT_MSG(MPI_Type_struct, MPI_Type_create_struct) |
| 2823 | +#define MPI_Type_ub(...) OMPI_REMOVED_STATIC_ASSERT_MSG(MPI_Type_ub, MPI_Type_get_extent) |
| 2824 | +#endif |
| 2825 | + |
2753 | 2826 | #if defined(c_plusplus) || defined(__cplusplus)
|
2754 | 2827 | }
|
2755 | 2828 | #endif
|
|
0 commit comments