11/*
2+ * Copyright (c) 2024 NVIDIA Corporation. All rights reserved.
23 * Copyright (c) 2004-2023 The University of Tennessee and The University
34 * of Tennessee Research Foundation. All rights
45 * reserved.
@@ -35,7 +36,7 @@ mca_coll_accelerator_reduce(const void *sbuf, void *rbuf, size_t count,
3536 mca_coll_base_module_t * module )
3637{
3738 mca_coll_accelerator_module_t * s = (mca_coll_accelerator_module_t * ) module ;
38- int rank = ompi_comm_rank (comm );
39+ int rank = ( comm == NULL ) ? -1 : ompi_comm_rank (comm );
3940 ptrdiff_t gap ;
4041 char * rbuf1 = NULL , * sbuf1 = NULL , * rbuf2 = NULL ;
4142 size_t bufsize ;
@@ -70,9 +71,15 @@ mca_coll_accelerator_reduce(const void *sbuf, void *rbuf, size_t count,
7071 rbuf2 = rbuf ; /* save away original buffer */
7172 rbuf = rbuf1 - gap ;
7273 }
73- rc = s -> c_coll .coll_reduce ((void * ) sbuf , rbuf , count ,
74- dtype , op , root , comm ,
75- s -> c_coll .coll_reduce_module );
74+
75+ if ((comm == NULL ) && (root == -1 )) {
76+ ompi_op_reduce (op , (void * )sbuf , rbuf , count , dtype );
77+ rc = OMPI_SUCCESS ;
78+ } else {
79+ rc = s -> c_coll .coll_reduce ((void * ) sbuf , rbuf , count ,
80+ dtype , op , root , comm ,
81+ s -> c_coll .coll_reduce_module );
82+ }
7683
7784 if (NULL != sbuf1 ) {
7885 free (sbuf1 );
@@ -84,3 +91,13 @@ mca_coll_accelerator_reduce(const void *sbuf, void *rbuf, size_t count,
8491 }
8592 return rc ;
8693}
94+
95+ int
96+ mca_coll_accelerator_reduce_local (const void * sbuf , void * rbuf , size_t count ,
97+ struct ompi_datatype_t * dtype ,
98+ struct ompi_op_t * op ,
99+ mca_coll_base_module_t * module )
100+ {
101+ return mca_coll_accelerator_reduce (sbuf , rbuf , count , dtype , op , -1 , NULL ,
102+ module );
103+ }
0 commit comments