Skip to content

Commit

Permalink
Unified calls to fs_allocate in replay templates
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Hovy committed Sep 11, 2017
1 parent 5e954d8 commit 3afb141
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 53 deletions.
20 changes: 6 additions & 14 deletions templates/icon_standalone/replay.test.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ PROGRAM ftg_${subroutine.name}_test

USE ${module.name}, ONLY: ${subroutine.name}, ftg_${subroutine.name}_capture_input_enabled, ftg_${subroutine.name}_capture_output_enabled, ftg_${subroutine.name}_capture_round, ftg_${subroutine.name}_output_dir

USE m_serialize, ONLY: t_serializer, t_savepoint, fs_create_serializer, fs_create_savepoint, fs_destroy_serializer, fs_destroy_savepoint, fs_get_field_bounds, fs_read_field, fs_write_field, fs_allocate_allocatable, fs_allocate_pointer, fs_field_exists, fs_print_debuginfo
USE m_serialize, ONLY: t_serializer, t_savepoint, fs_create_serializer, fs_create_savepoint, fs_destroy_serializer, fs_destroy_savepoint, fs_get_field_bounds, fs_read_field, fs_write_field, fs_allocate, fs_field_exists, fs_print_debuginfo

${globals.imports}

Expand Down Expand Up @@ -92,7 +92,7 @@ CONTAINS
! BASIC ARGUMENTS
#for $argument in $arguments.all.basic
#if $isArray($argument)
CALL fs_allocate_allocatable(serializer, "$argument", $argument)
CALL fs_allocate(serializer, "$argument", $argument)
#end if
CALL fs_read_field(serializer, savepoint, "$argument", $argument)
#end for
Expand All @@ -101,7 +101,7 @@ CONTAINS
#for $argument in $arguments.all.optional
IF (PRESENT($argument)) THEN
#if $isArray($argument)
CALL fs_allocate_allocatable(serializer, "$argument", $argument)
CALL fs_allocate(serializer, "$argument", $argument)
#end if
CALL fs_read_field(serializer, savepoint, "$argument", $argument)
END IF
Expand Down Expand Up @@ -138,13 +138,9 @@ END PROGRAM ftg_${subroutine.name}_test
#end if
#end for
#if $needsAllocation($var)
#if $isAllocatable($var)
CALL fs_allocate_allocatable(serializer, "$var", $var)
#else
CALL fs_allocate_pointer(serializer, "$var", $var)
#end if
CALL fs_allocate(serializer, "$var", $var)
#end if
CALL fs_read_field(serializer, savepoint, "$var", $var)
CALL fs_read_field(serializer, savepoint, "$var", $var)
#else

#set $mandDims = $getNumberOfMandatoryDimensions($var)
Expand Down Expand Up @@ -183,11 +179,7 @@ END PROGRAM ftg_${subroutine.name}_test
#end for
$writeVarNameWithFilledIndicesToString($var, "ftg_c", $mandDims, "ftg_d1", "ftg_d2", "ftg_d3", "ftg_d4")
#set $filled = $fillIndices($var, $mandDims, "ftg_d1", "ftg_d2", "ftg_d3", "ftg_d4")
#if $isAllocatable($var)
CALL fs_allocate_allocatable(serializer, ftg_c, $filled)
#else if $isPointer($var)
CALL fs_allocate_pointer(serializer, ftg_c, $filled)
#end if
CALL fs_allocate(serializer, ftg_c, $filled)
CALL fs_read_field(serializer, savepoint, ftg_c, $filled)
#for $d in range(1, $getNumberOfMandatoryDimensions($var) + 1)
END DO
Expand Down
18 changes: 5 additions & 13 deletions templates/icon_testbed/replay.test.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ MODULE mo_ftg_${subroutine.name}_test

USE ${module.name}, ONLY: ${subroutine.name}, ftg_${subroutine.name}_capture_input_enabled, ftg_${subroutine.name}_capture_output_enabled, ftg_${subroutine.name}_capture_round, ftg_${subroutine.name}_output_dir

USE m_serialize, ONLY: t_serializer, t_savepoint, fs_create_serializer, fs_create_savepoint, fs_destroy_serializer, fs_destroy_savepoint, fs_get_field_bounds, fs_read_field, fs_write_field, fs_allocate_allocatable, fs_allocate_pointer, fs_field_exists, fs_print_debuginfo
USE m_serialize, ONLY: t_serializer, t_savepoint, fs_create_serializer, fs_create_savepoint, fs_destroy_serializer, fs_destroy_savepoint, fs_get_field_bounds, fs_read_field, fs_write_field, fs_allocate, fs_field_exists, fs_print_debuginfo

${globals.imports}

Expand Down Expand Up @@ -85,7 +85,7 @@ CONTAINS
! BASIC ARGUMENTS
#for $argument in $arguments.all.basic
#if $isArray($argument)
CALL fs_allocate_allocatable(serializer, "$argument", $argument)
CALL fs_allocate(serializer, "$argument", $argument)
#end if
CALL fs_read_field(serializer, savepoint, "$argument", $argument)
#end for
Expand All @@ -94,7 +94,7 @@ CONTAINS
#for $argument in $arguments.all.optional
IF (PRESENT($argument)) THEN
#if $isArray($argument)
CALL fs_allocate_allocatable(serializer, "$argument", $argument)
CALL fs_allocate(serializer, "$argument", $argument)
#end if
CALL fs_read_field(serializer, savepoint, "$argument", $argument)
END IF
Expand Down Expand Up @@ -131,11 +131,7 @@ END MODULE mo_ftg_${subroutine.name}_test
#end if
#end for
#if $needsAllocation($var)
#if $isAllocatable($var)
CALL fs_allocate_allocatable(serializer, "$var", $var)
#else
CALL fs_allocate_pointer(serializer, "$var", $var)
#end if
CALL fs_allocate(serializer, "$var", $var)
#end if
CALL fs_read_field(serializer, savepoint, "$var", $var)
#else
Expand Down Expand Up @@ -176,11 +172,7 @@ END MODULE mo_ftg_${subroutine.name}_test
#end for
$writeVarNameWithFilledIndicesToString($var, "ftg_c", $mandDims, "ftg_d1", "ftg_d2", "ftg_d3", "ftg_d4")
#set $filled = $fillIndices($var, $mandDims, "ftg_d1", "ftg_d2", "ftg_d3", "ftg_d4")
#if $isAllocatable($var)
CALL fs_allocate_allocatable(serializer, ftg_c, $filled)
#else if $isPointer($var)
CALL fs_allocate_pointer(serializer, ftg_c, $filled)
#end if
CALL fs_allocate(serializer, ftg_c, $filled)
CALL fs_read_field(serializer, savepoint, ftg_c, $filled)
#for $d in range(1, $getNumberOfMandatoryDimensions($var) + 1)
END DO
Expand Down
18 changes: 5 additions & 13 deletions templates/standalone/replay.test.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PROGRAM ftg_${subroutine.name}_test

USE ${module.name}, ONLY: ${subroutine.name}, ftg_${subroutine.name}_capture_input_enabled, ftg_${subroutine.name}_capture_output_enabled, ftg_${subroutine.name}_capture_round, ftg_${subroutine.name}_output_dir

USE m_serialize, ONLY: t_serializer, t_savepoint, fs_create_serializer, fs_create_savepoint, fs_destroy_serializer, fs_destroy_savepoint, fs_get_field_bounds, fs_read_field, fs_write_field, fs_allocate_allocatable, fs_allocate_pointer, fs_field_exists, fs_print_debuginfo
USE m_serialize, ONLY: t_serializer, t_savepoint, fs_create_serializer, fs_create_savepoint, fs_destroy_serializer, fs_destroy_savepoint, fs_get_field_bounds, fs_read_field, fs_write_field, fs_allocate, fs_field_exists, fs_print_debuginfo

${globals.imports}

Expand Down Expand Up @@ -90,7 +90,7 @@ CONTAINS
! BASIC ARGUMENTS
#for $argument in $arguments.all.basic
#if $isArray($argument)
CALL fs_allocate_allocatable(serializer, "$argument", $argument)
CALL fs_allocate(serializer, "$argument", $argument)
#end if
CALL fs_read_field(serializer, savepoint, "$argument", $argument)
#end for
Expand All @@ -99,7 +99,7 @@ CONTAINS
#for $argument in $arguments.all.optional
IF (PRESENT($argument)) THEN
#if $isArray($argument)
CALL fs_allocate_allocatable(serializer, "$argument", $argument)
CALL fs_allocate(serializer, "$argument", $argument)
#end if
CALL fs_read_field(serializer, savepoint, "$argument", $argument)
END IF
Expand Down Expand Up @@ -136,11 +136,7 @@ END PROGRAM ftg_${subroutine.name}_test
#end if
#end for
#if $needsAllocation($var)
#if $isAllocatable($var)
CALL fs_allocate_allocatable(serializer, "$var", $var)
#else
CALL fs_allocate_pointer(serializer, "$var", $var)
#end if
CALL fs_allocate_allocatable(serializer, "$var", $var)
#end if
CALL fs_read_field(serializer, savepoint, "$var", $var)
#else
Expand Down Expand Up @@ -181,11 +177,7 @@ END PROGRAM ftg_${subroutine.name}_test
#end for
$writeVarNameWithFilledIndicesToString($var, "ftg_c", $mandDims, "ftg_d1", "ftg_d2", "ftg_d3", "ftg_d4")
#set $filled = $fillIndices($var, $mandDims, "ftg_d1", "ftg_d2", "ftg_d3", "ftg_d4")
#if $isAllocatable($var)
CALL fs_allocate_allocatable(serializer, ftg_c, $filled)
#else if $isPointer($var)
CALL fs_allocate_pointer(serializer, ftg_c, $filled)
#end if
CALL fs_allocate(serializer, ftg_c, $filled)
CALL fs_read_field(serializer, savepoint, ftg_c, $filled)
#for $d in range(1, $getNumberOfMandatoryDimensions($var) + 1)
END DO
Expand Down
18 changes: 5 additions & 13 deletions templates/standalone_nompi/replay.test.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PROGRAM ftg_${subroutine.name}_test

USE ${module.name}, ONLY: ${subroutine.name}, ftg_${subroutine.name}_capture_input_enabled, ftg_${subroutine.name}_capture_output_enabled, ftg_${subroutine.name}_capture_round, ftg_${subroutine.name}_output_dir

USE m_serialize, ONLY: t_serializer, t_savepoint, fs_create_serializer, fs_create_savepoint, fs_destroy_serializer, fs_destroy_savepoint, fs_get_field_bounds, fs_read_field, fs_write_field, fs_allocate_allocatable, fs_allocate_pointer, fs_field_exists, fs_print_debuginfo
USE m_serialize, ONLY: t_serializer, t_savepoint, fs_create_serializer, fs_create_savepoint, fs_destroy_serializer, fs_destroy_savepoint, fs_get_field_bounds, fs_read_field, fs_write_field, fs_allocate, fs_field_exists, fs_print_debuginfo

${globals.imports}

Expand Down Expand Up @@ -78,7 +78,7 @@ CONTAINS
! BASIC ARGUMENTS
#for $argument in $arguments.all.basic
#if $isArray($argument)
CALL fs_allocate_allocatable(serializer, "$argument", $argument)
CALL fs_allocate(serializer, "$argument", $argument)
#end if
CALL fs_read_field(serializer, savepoint, "$argument", $argument)
#end for
Expand All @@ -87,7 +87,7 @@ CONTAINS
#for $argument in $arguments.all.optional
IF (PRESENT($argument)) THEN
#if $isArray($argument)
CALL fs_allocate_allocatable(serializer, "$argument", $argument)
CALL fs_allocate(serializer, "$argument", $argument)
#end if
CALL fs_read_field(serializer, savepoint, "$argument", $argument)
END IF
Expand Down Expand Up @@ -124,11 +124,7 @@ END PROGRAM ftg_${subroutine.name}_test
#end if
#end for
#if $needsAllocation($var)
#if $isAllocatable($var)
CALL fs_allocate_allocatable(serializer, "$var", $var)
#else
CALL fs_allocate_pointer(serializer, "$var", $var)
#end if
CALL fs_allocate(serializer, "$var", $var)
#end if
CALL fs_read_field(serializer, savepoint, "$var", $var)
#else
Expand Down Expand Up @@ -169,11 +165,7 @@ END PROGRAM ftg_${subroutine.name}_test
#end for
$writeVarNameWithFilledIndicesToString($var, "ftg_c", $mandDims, "ftg_d1", "ftg_d2", "ftg_d3", "ftg_d4")
#set $filled = $fillIndices($var, $mandDims, "ftg_d1", "ftg_d2", "ftg_d3", "ftg_d4")
#if $isAllocatable($var)
CALL fs_allocate_allocatable(serializer, ftg_c, $filled)
#else if $isPointer($var)
CALL fs_allocate_pointer(serializer, ftg_c, $filled)
#end if
CALL fs_allocate(serializer, ftg_c, $filled)
CALL fs_read_field(serializer, savepoint, ftg_c, $filled)
#for $d in range(1, $getNumberOfMandatoryDimensions($var) + 1)
END DO
Expand Down

0 comments on commit 3afb141

Please sign in to comment.