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

Juan 16/08/2021:move iswitch_cpu_gpu to mode_openacc_set_device.f90 & add mnh_device_type_current

parent 472b65f6
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,7 @@
MODULE MODE_OPENACC_SET_DEVICE
#ifndef _FAKEOPENACC
USE openacc , ONLY : acc_device_kind
USE openacc , ONLY : acc_device_kind , acc_device_nvidia, acc_device_host
#endif
IMPLICIT NONE
......@@ -15,8 +15,11 @@ MODULE MODE_OPENACC_SET_DEVICE
#ifndef _FAKEOPENACC
INTEGER(kind=acc_device_kind),dimension(1000) :: mnh_idevice_type_at_init = -1000
INTEGER :: nlevel_mnh_idevice_type = 1
INTEGER(kind=acc_device_kind) :: mnh_idevice_type_current = -1
#endif
integer :: iswitch_cpu_gpu = 5
CONTAINS
SUBROUTINE MNH_OPENACC_GET_DEVICE_AT_INIT()
......@@ -33,6 +36,7 @@ CONTAINS
if ( mnh_idevice_type_at_init(1) .EQ. -1000 ) then
mnh_idevice_type_at_init(1) = acc_get_device_type()
mnh_idevice_type_current = acc_get_device_type()
print*,'mnh_idevice_type_at_init=',mnh_idevice_type_at_init(1)
end if
#endif
......@@ -52,6 +56,7 @@ CONTAINS
SWAP_DEVICE_RETURN
idevice_type = acc_get_device_type()
mnh_idevice_type_current = idevice_type
print*,'idevice_type=',idevice_type
#endif
......@@ -70,6 +75,7 @@ CONTAINS
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)
mnh_idevice_type_current = acc_get_device_type()
#endif
END SUBROUTINE MNH_OPENACC_SET_DEVICE_HOST
......@@ -78,13 +84,14 @@ CONTAINS
#ifndef _FAKEOPENACC
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
SWAP_DEVICE_RETURN
call acc_set_device_type(acc_device_nvidia)
mnh_idevice_type_current = acc_get_device_type()
#endif
END SUBROUTINE MNH_OPENACC_SET_DEVICE_NVIDIA
......
......@@ -1185,8 +1185,6 @@ contains
real , dimension(:,:,:) , pointer , contiguous :: zu_level_1_m_st,zu_level_1_m_1_st
integer :: iswitch_cpu_gpu = 5
nlocalx = u(level,m)%ix_max-u(level,m)%ix_min+1
nlocaly = u(level,m)%iy_max-u(level,m)%iy_min+1
halo_size = u(level,m)%halo_size
......
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