Skip to content
Snippets Groups Projects
Commit d528c36c authored by ESCOBAR MUNOZ Juan's avatar ESCOBAR MUNOZ Juan
Browse files

Juan 25/08/2021:mode_openacc_set_device.f90 , correction for setting current device

parent 309c6f36
No related branches found
No related tags found
No related merge requests found
...@@ -13,8 +13,7 @@ MODULE MODE_OPENACC_SET_DEVICE ...@@ -13,8 +13,7 @@ MODULE MODE_OPENACC_SET_DEVICE
IMPLICIT NONE IMPLICIT NONE
#ifndef _FAKEOPENACC #ifndef _FAKEOPENACC
INTEGER(kind=acc_device_kind),dimension(1000) :: mnh_idevice_type_at_init = -1000 INTEGER(kind=acc_device_kind) :: mnh_idevice_type_at_init = -1000
INTEGER :: nlevel_mnh_idevice_type = 1
INTEGER(kind=acc_device_kind) :: mnh_idevice_type_current = -1 INTEGER(kind=acc_device_kind) :: mnh_idevice_type_current = -1
#endif #endif
...@@ -34,10 +33,10 @@ CONTAINS ...@@ -34,10 +33,10 @@ CONTAINS
SWAP_DEVICE_RETURN SWAP_DEVICE_RETURN
if ( mnh_idevice_type_at_init(1) .EQ. -1000 ) then if ( mnh_idevice_type_at_init .EQ. -1000 ) then
mnh_idevice_type_at_init(1) = acc_get_device_type() mnh_idevice_type_at_init = acc_get_device_type()
mnh_idevice_type_current = acc_get_device_type() mnh_idevice_type_current = mnh_idevice_type_at_init
print*,'mnh_idevice_type_at_init=',mnh_idevice_type_at_init(1) print*,'mnh_idevice_type_at_init=',mnh_idevice_type_at_init
end if end if
#endif #endif
...@@ -72,10 +71,9 @@ CONTAINS ...@@ -72,10 +71,9 @@ CONTAINS
SWAP_DEVICE_RETURN SWAP_DEVICE_RETURN
nlevel_mnh_idevice_type = nlevel_mnh_idevice_type + 1
mnh_idevice_type_at_init(nlevel_mnh_idevice_type) = acc_get_device_type()
call acc_set_device_type(acc_device_host) call acc_set_device_type(acc_device_host)
mnh_idevice_type_current = acc_get_device_type() mnh_idevice_type_current = acc_device_host
#endif #endif
END SUBROUTINE MNH_OPENACC_SET_DEVICE_HOST END SUBROUTINE MNH_OPENACC_SET_DEVICE_HOST
...@@ -91,7 +89,7 @@ CONTAINS ...@@ -91,7 +89,7 @@ CONTAINS
SWAP_DEVICE_RETURN SWAP_DEVICE_RETURN
call acc_set_device_type(acc_device_nvidia) call acc_set_device_type(acc_device_nvidia)
mnh_idevice_type_current = acc_get_device_type() mnh_idevice_type_current = acc_device_nvidia
#endif #endif
END SUBROUTINE MNH_OPENACC_SET_DEVICE_NVIDIA END SUBROUTINE MNH_OPENACC_SET_DEVICE_NVIDIA
...@@ -100,18 +98,14 @@ CONTAINS ...@@ -100,18 +98,14 @@ CONTAINS
#ifndef _FAKEOPENACC #ifndef _FAKEOPENACC
USE& USE&
openacc , ONLY : acc_set_device_type,acc_device_nvidia openacc , ONLY : acc_set_device_type,acc_device_nvidia,acc_get_device_type
IMPLICIT NONE IMPLICIT NONE
SWAP_DEVICE_RETURN SWAP_DEVICE_RETURN
IF ( nlevel_mnh_idevice_type == 1 ) THEN call acc_set_device_type(mnh_idevice_type_at_init)
print*,' MNH_OPENACC_SET_DEVICE_DEFAULT :: WARNING ALLREADY AT FIRST LEVEL !!! ' mnh_idevice_type_current = mnh_idevice_type_at_init
ELSE
nlevel_mnh_idevice_type = nlevel_mnh_idevice_type - 1
END IF
call acc_set_device_type(mnh_idevice_type_at_init(nlevel_mnh_idevice_type))
#endif #endif
END SUBROUTINE MNH_OPENACC_SET_DEVICE_DEFAULT END SUBROUTINE MNH_OPENACC_SET_DEVICE_DEFAULT
......
../../MNH/mode_openacc_set_device.f90
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment