@@ -38,6 +38,7 @@ int mca_scoll_mpi_broadcast(struct oshmem_group_t *group,
3838 const void * source ,
3939 size_t nlong ,
4040 long * pSync ,
41+ bool nlong_type ,
4142 int alg )
4243{
4344 mca_scoll_mpi_module_t * mpi_module ;
@@ -54,34 +55,36 @@ int mca_scoll_mpi_broadcast(struct oshmem_group_t *group,
5455 }
5556 dtype = & ompi_mpi_char .dt ;
5657 root = oshmem_proc_group_find_id (group , PE_root );
57-
58- /* Do nothing on zero-length request */
59- if (OPAL_UNLIKELY (!nlong )) {
60- return OSHMEM_SUCCESS ;
61- }
62-
6358 /* Open SHMEM specification has the following constrains (page 85):
6459 * "If using C/C++, nelems must be of type integer. If you are using Fortran, it must be a
6560 * default integer value". And also fortran signature says "INTEGER".
6661 * Since ompi coll components doesn't support size_t at the moment,
6762 * and considering this contradiction, we cast size_t to int here
6863 * in case if the value is less than INT_MAX and fallback to previous module otherwise. */
64+ if (OPAL_UNLIKELY (!nlong_type || (INT_MAX < nlong ))) {
6965#ifdef INCOMPATIBLE_SHMEM_OMPI_COLL_APIS
70- if (INT_MAX < nlong ) {
7166 MPI_COLL_VERBOSE (20 ,"RUNNING FALLBACK BCAST" );
7267 PREVIOUS_SCOLL_FN (mpi_module , broadcast , group ,
7368 PE_root ,
7469 target ,
7570 source ,
7671 nlong ,
7772 pSync ,
73+ nlong_type ,
7874 SCOLL_DEFAULT_ALG );
7975 return rc ;
80- }
81- rc = mpi_module -> comm -> c_coll -> coll_bcast (buf , (int )nlong , dtype , root , mpi_module -> comm , mpi_module -> comm -> c_coll -> coll_bcast_module );
8276#else
83- rc = mpi_module -> comm -> c_coll -> coll_bcast (buf , nlong , dtype , root , mpi_module -> comm , mpi_module -> comm -> c_coll -> coll_bcast_module );
77+ MPI_COLL_ERROR (20 , "variable broadcast length, or exceeds INT_MAX: %zu" , nlong );
78+ return OSHMEM_ERR_NOT_SUPPORTED ;
8479#endif
80+ }
81+
82+ /* Do nothing on zero-length request */
83+ if (OPAL_UNLIKELY (!nlong )) {
84+ return OSHMEM_SUCCESS ;
85+ }
86+
87+ rc = mpi_module -> comm -> c_coll -> coll_bcast (buf , nlong , dtype , root , mpi_module -> comm , mpi_module -> comm -> c_coll -> coll_bcast_module );
8588 if (OMPI_SUCCESS != rc ){
8689 MPI_COLL_VERBOSE (20 ,"RUNNING FALLBACK BCAST" );
8790 PREVIOUS_SCOLL_FN (mpi_module , broadcast , group ,
@@ -90,6 +93,7 @@ int mca_scoll_mpi_broadcast(struct oshmem_group_t *group,
9093 source ,
9194 nlong ,
9295 pSync ,
96+ nlong_type ,
9397 SCOLL_DEFAULT_ALG );
9498 }
9599 return rc ;
@@ -111,12 +115,13 @@ int mca_scoll_mpi_collect(struct oshmem_group_t *group,
111115 MPI_COLL_VERBOSE (20 ,"RUNNING MPI ALLGATHER" );
112116 mpi_module = (mca_scoll_mpi_module_t * ) group -> g_scoll .scoll_collect_module ;
113117
114- /* Do nothing on zero-length request */
115- if (OPAL_UNLIKELY (!nlong )) {
116- return OSHMEM_SUCCESS ;
117- }
118-
119118 if (nlong_type == true) {
119+
120+ /* Do nothing on zero-length request */
121+ if (OPAL_UNLIKELY (!nlong )) {
122+ return OSHMEM_SUCCESS ;
123+ }
124+
120125 sbuf = (void * ) source ;
121126 rbuf = target ;
122127 stype = & ompi_mpi_char .dt ;
0 commit comments