@@ -177,7 +177,8 @@ static void uct_cuda_copy_event_desc_init(ucs_mpool_t *mp, void *obj, void *chun
177177 ucs_status_t status ;
178178
179179 memset (base , 0 , sizeof (* base ));
180- status = CUDA_FUNC (cudaEventCreateWithFlags (& (base -> event ), cudaEventDisableTiming ));
180+ status = UCT_CUDA_FUNC (cudaEventCreateWithFlags (& (base -> event ),
181+ cudaEventDisableTiming ));
181182 if (UCS_OK != status ) {
182183 ucs_error ("cudaEventCreateWithFlags Failed" );
183184 }
@@ -188,7 +189,7 @@ static void uct_cuda_copy_event_desc_cleanup(ucs_mpool_t *mp, void *obj)
188189 uct_cuda_copy_event_desc_t * base = (uct_cuda_copy_event_desc_t * ) obj ;
189190 ucs_status_t status ;
190191
191- status = CUDA_FUNC (cudaEventDestroy (base -> event ));
192+ status = UCT_CUDA_FUNC (cudaEventDestroy (base -> event ));
192193 if (UCS_OK != status ) {
193194 ucs_error ("cudaEventDestroy Failed" );
194195 }
@@ -215,7 +216,7 @@ static UCS_CLASS_INIT_FUNC(uct_cuda_copy_iface_t, uct_md_h md, uct_worker_h work
215216
216217 if (strncmp (params -> mode .device .dev_name ,
217218 UCT_CUDA_DEV_NAME , strlen (UCT_CUDA_DEV_NAME )) != 0 ) {
218- ucs_error ("No device was found: %s" , params -> mode .device .dev_name );
219+ ucs_error ("no device was found: %s" , params -> mode .device .dev_name );
219220 return UCS_ERR_NO_DEVICE ;
220221 }
221222
@@ -232,20 +233,12 @@ static UCS_CLASS_INIT_FUNC(uct_cuda_copy_iface_t, uct_md_h md, uct_worker_h work
232233 "CUDA EVENT objects" );
233234
234235 if (UCS_OK != status ) {
235- ucs_error ("Mpool creation failed" );
236+ ucs_error ("mpool creation failed" );
236237 return UCS_ERR_IO_ERROR ;
237238 }
238239
239- status = CUDA_FUNC (cudaStreamCreateWithFlags (& self -> stream_d2h , cudaStreamNonBlocking ));
240- if (UCS_OK != status ) {
241- ucs_error ("cudaStreamCreateWithFlags creation failed" );
242- return UCS_ERR_IO_ERROR ;
243- }
244- status = CUDA_FUNC (cudaStreamCreateWithFlags (& self -> stream_h2d , cudaStreamNonBlocking ));
245- if (UCS_OK != status ) {
246- ucs_error ("cudaStreamCreateWithFlags creation failed" );
247- return UCS_ERR_IO_ERROR ;
248- }
240+ self -> stream_d2h = 0 ;
241+ self -> stream_h2d = 0 ;
249242
250243 ucs_queue_head_init (& self -> outstanding_d2h_cuda_event_q );
251244 ucs_queue_head_init (& self -> outstanding_h2d_cuda_event_q );
@@ -257,6 +250,14 @@ static UCS_CLASS_CLEANUP_FUNC(uct_cuda_copy_iface_t)
257250{
258251 uct_base_iface_progress_disable (& self -> super .super ,
259252 UCT_PROGRESS_SEND | UCT_PROGRESS_RECV );
253+ if (self -> stream_h2d != 0 ) {
254+ UCT_CUDA_FUNC (cudaStreamDestroy (self -> stream_h2d ));
255+ }
256+
257+ if (self -> stream_d2h != 0 ) {
258+ UCT_CUDA_FUNC (cudaStreamDestroy (self -> stream_d2h ));
259+ }
260+
260261 ucs_mpool_cleanup (& self -> cuda_event_desc , 1 );
261262}
262263
0 commit comments