Assign the same GPU to all OpenMP threads.

This commit is contained in:
Pietro Bonfa 2020-06-23 23:30:37 +02:00
parent af01aa5c68
commit 84906d6c12
1 changed files with 2 additions and 0 deletions

View File

@ -78,7 +78,9 @@ CONTAINS
#if defined(__CUDA)
ierr = cudaGetDeviceCount( ndev )
IF (ierr/=0) CALL mp_stop( 9000 + ierr )
!$omp parallel firstprivate(key, ndev)
ierr = cudaSetDevice(mod(key, ndev))
!$omp end parallel
IF (ierr/=0) CALL mp_stop( 9100 + ierr )
ierr = cudaDeviceSynchronize()
IF (ierr/=0) CALL mp_stop( 9200 + ierr )