Skip to content

Commit

Permalink
fix longstanding bug in OpenMP handling for concurrent ocean
Browse files Browse the repository at this point in the history
  • Loading branch information
bensonr committed Mar 31, 2022
1 parent 9ba466d commit 46b92ae
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion full/coupler_main.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1368,10 +1368,11 @@ subroutine coupler_init
!--- setting affinity
if (do_concurrent_radiation) then
!$ call fms_affinity_set('ATMOS', use_hyper_thread, atmos_nthreads + radiation_nthreads)
!$ call omp_set_num_threads(atmos_nthreads+radiation_nthreads)
else
!$ call fms_affinity_set('ATMOS', use_hyper_thread, atmos_nthreads)
!$ call omp_set_num_threads(atmos_nthreads)
endif
!$ call omp_set_num_threads(atmos_nthreads)
endif

!--- initialization clock
Expand Down Expand Up @@ -1732,8 +1733,10 @@ subroutine coupler_init
if (concurrent) then
call mpp_set_current_pelist( Ocean%pelist )
!$ call fms_affinity_set('OCEAN', use_hyper_thread, ocean_nthreads)
!$ call omp_set_num_threads(ocean_nthreads)
else
ocean_nthreads = atmos_nthreads
!--- omp_num_threads has already been set by the Atmos-pes, but set again to ensure
!$ call omp_set_num_threads(ocean_nthreads)
endif

Expand Down

0 comments on commit 46b92ae

Please sign in to comment.