1
1

Merge pull request #3894 from ggouaillardet/topic/pml_ob1_progress

pml/ob1: fix mca_pml_ob1_progress_needed usage
Этот коммит содержится в:
Gilles Gouaillardet 2017-07-18 10:43:44 +09:00 коммит произвёл GitHub
родитель bdb698a9b6 1b46fe2d9a
Коммит 6d6f5fdfb8

Просмотреть файл

@ -10,6 +10,8 @@
* University of Stuttgart. All rights reserved. * University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copyright (c) 2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -54,8 +56,8 @@ static inline int mca_pml_ob1_process_pending_cuda_async_copies(void)
static int mca_pml_ob1_progress_needed = 0; static int mca_pml_ob1_progress_needed = 0;
int mca_pml_ob1_enable_progress(int32_t count) int mca_pml_ob1_enable_progress(int32_t count)
{ {
int32_t old = OPAL_ATOMIC_ADD32(&mca_pml_ob1_progress_needed, count); int32_t progress_count = OPAL_ATOMIC_ADD32(&mca_pml_ob1_progress_needed, count);
if( 0 != old ) if( 1 < progress_count )
return 0; /* progress was already on */ return 0; /* progress was already on */
opal_progress_register(mca_pml_ob1_progress); opal_progress_register(mca_pml_ob1_progress);
@ -118,7 +120,7 @@ int mca_pml_ob1_progress(void)
if( 0 != completed_requests ) { if( 0 != completed_requests ) {
j = OPAL_ATOMIC_ADD32(&mca_pml_ob1_progress_needed, -completed_requests); j = OPAL_ATOMIC_ADD32(&mca_pml_ob1_progress_needed, -completed_requests);
if( j == completed_requests ) { if( 0 == j ) {
opal_progress_unregister(mca_pml_ob1_progress); opal_progress_unregister(mca_pml_ob1_progress);
} }
} }