Warn used when something goes wrong with initialization

This commit is contained in:
Pietro Bonfa 2020-04-26 17:06:29 +02:00
parent c4c2417226
commit 23ec514f8d
1 changed files with 5 additions and 1 deletions

View File

@ -12,7 +12,7 @@ MODULE mp_world
USE mp, ONLY : mp_barrier, mp_start, mp_end, mp_stop, mp_count_nodes
USE io_global, ONLY : meta_ionode_id, meta_ionode
#if defined(__CUDA)
use cudafor, ONLY : cudaSetDevice, cudaGetDeviceCount
use cudafor, ONLY : cudaSetDevice, cudaGetDeviceCount, cudaDeviceSynchronize
#endif
!
USE parallel_include
@ -77,7 +77,11 @@ CONTAINS
!
#if defined(__CUDA)
ierr = cudaGetDeviceCount( ndev )
IF (ierr/=0) CALL mp_stop( 9000 + ierr )
ierr = cudaSetDevice(mod(key, ndev))
IF (ierr/=0) CALL mp_stop( 9100 + ierr )
ierr = cudaDeviceSynchronize()
IF (ierr/=0) CALL mp_stop( 9200 + ierr )
#if defined(__DEBUG)
write(*,*) "MPI ", key, " on node ", color, " is using GPU: ", mod(key, ndev)
#endif