Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small field_delete improvement #63

Merged
merged 3 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions field_RANKSUFF_factory_module.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ USE FIELD_STATISTICS_MODULE

CLASS(${ft.name}$), POINTER :: FIELD_PTR

IF(.NOT. ASSOCIATED(FIELD_PTR)) RETURN

IF (FIELD_STATISTICS_ENABLE) CALL FIELD_STATISTICS_DELETE ()

CALL FIELD_PTR%FINAL ()
Expand Down
27 changes: 14 additions & 13 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,6 @@ target_compile_definitions( main.x PRIVATE $<${HAVE_CUDA}:_CUDA> )

## Unit tests
list(APPEND TEST_FILES
test_legacy.F90
test_field_array.F90
gather_scatter_lastdim.F90
reshuffle_lastdim.F90
test_lastdim.F90
test_statistics.F90
test_sizeof.F90
test_bc.F90
reshuffle.F90
test_wrappernosynconfinal.F90
test_field1d.F90
test_pinned.F90
async_host.F90
cpu_to_gpu.F90
cpu_to_gpu_delayed_init_value.F90
Expand All @@ -47,6 +35,7 @@ list(APPEND TEST_FILES
final_wrapper.F90
final_wrapper_gpu.F90
gather_scatter.F90
gather_scatter_lastdim.F90
get_dims.F90
get_stats.F90
get_view.F90
Expand Down Expand Up @@ -75,15 +64,27 @@ list(APPEND TEST_FILES
no_transfer_get_device.F90
no_transfer_get_host.F90
pointer_to_owner_wrapper.F90
reshuffle.F90
reshuffle_lastdim.F90
resize_owner.F90
resize_owner2.F90
sync_device.F90
sync_host.F90
test_bc.F90
test_crc64.F90
wrapper_modify_gpu.F90
test_field1d.F90
test_field_array.F90
test_field_delete_on_null.F90
test_gang.F90
test_get_device_data_wronly.F90
test_host_mem_pool.F90
test_lastdim.F90
test_legacy.F90
test_pinned.F90
test_sizeof.F90
test_statistics.F90
test_wrappernosynconfinal.F90
wrapper_modify_gpu.F90
)

#Place-holder for failing tests
Expand Down
18 changes: 18 additions & 0 deletions tests/test_field_delete_on_null.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
! (C) Copyright 2022- ECMWF.
! (C) Copyright 2022- Meteo-France.
!
! This software is licensed under the terms of the Apache Licence Version 2.0
! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
! In applying this licence, ECMWF does not waive the privileges and immunities
! granted to it by virtue of its status as an intergovernmental organisation
! nor does it submit to any jurisdiction.

PROGRAM TEST_FIELD_DELETE_ON_NULL
!TEST IF CALLING FIELD_DELETE WITH A NULL POINTER IS WORKING AS IT SHOULD

USE FIELD_MODULE
USE FIELD_FACTORY_MODULE
IMPLICIT NONE
CLASS(FIELD_1RB), POINTER :: W => NULL()
CALL FIELD_DELETE(W)
END PROGRAM
Loading