Skip to content

Commit

Permalink
Fix atlas_fctest_field_gpu_device with gt storage
Browse files Browse the repository at this point in the history
  • Loading branch information
wdeconinck committed Apr 25, 2024
1 parent 535f036 commit bcfeadf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/tests/field/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ if( HAVE_FCTEST )
target_link_libraries( atlas_fctest_field_device ${ACC_Fortran_FLAGS} )
target_link_options( atlas_fctest_field_device PRIVATE "${ACC_Fortran_FLAGS}")
set_tests_properties ( atlas_fctest_field_device PROPERTIES LABELS "gpu;acc")
if( HAVE_GRIDTOOLS_STORAGE )
target_compile_definitions(atlas_fctest_field_device PUBLIC ATLAS_HAVE_GRIDTOOLS_STORAGE=1)
else()
target_compile_definitions(atlas_fctest_field_device PUBLIC ATLAS_HAVE_GRIDTOOLS_STORAGE=0)
endif()
endif()

add_fctest( TARGET atlas_fctest_field_wrap_device
Expand Down
9 changes: 6 additions & 3 deletions src/tests/field/fctest_field_gpu.F90
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ end subroutine external_acc_routine
fview(2,1) = 2.

call fset%set_host_needs_update(.false.)
FCTEST_CHECK_EQUAL(field%device_allocated(), .false.)
if (ATLAS_HAVE_GRIDTOOLS_STORAGE == 0) then
FCTEST_CHECK_EQUAL(field%device_allocated(), .false.)
endif
call fset%allocate_device()
FCTEST_CHECK_EQUAL(field%device_allocated(), .true.)
call fset%update_device()
Expand All @@ -141,8 +143,9 @@ end subroutine external_acc_routine
call fset%update_host()
FCTEST_CHECK_EQUAL( fview(2,1), 5. )
call fset%deallocate_device()
FCTEST_CHECK_EQUAL(field%device_allocated(), .false.)

if (ATLAS_HAVE_GRIDTOOLS_STORAGE == 0) then
FCTEST_CHECK_EQUAL(field%device_allocated(), .false.)
endif
print *, "... by name"
field = fset%field("f3")
call field%data(fview)
Expand Down

0 comments on commit bcfeadf

Please sign in to comment.