From b2f20807a4ac1b7eaa0bde89507602dcab5d3585 Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Tue, 9 Apr 2024 19:10:47 -0700 Subject: [PATCH 1/2] test(ifx):fewer training iterations prevents crash More training iterations in the trainable_engine_test_m function xor_gate_with_random_weights() yields a test that is less sensitive to the specific random number sequence used to initialize network weights. However, large number of iterations cause the test suite to crash when compiled with the Intel ifx compiler due to an apparent compiler bug. This commit therefore set the number of iterations for which the test suite currently passes with the gfortran, ifx, and NAG compilers. --- ...inable_engine_test_m.f90 => trainable_engine_test_m.F90} | 6 ++++++ 1 file changed, 6 insertions(+) rename test/{trainable_engine_test_m.f90 => trainable_engine_test_m.F90} (98%) diff --git a/test/trainable_engine_test_m.f90 b/test/trainable_engine_test_m.F90 similarity index 98% rename from test/trainable_engine_test_m.f90 rename to test/trainable_engine_test_m.F90 index f525aaa64..8b394ba22 100644 --- a/test/trainable_engine_test_m.f90 +++ b/test/trainable_engine_test_m.F90 @@ -281,9 +281,15 @@ function xor_gate_with_random_weights() result(test_passes) type(trainable_engine_t) trainable_engine real(rkind), parameter :: tolerance = 1.E-02_rkind real(rkind), allocatable :: harvest(:,:,:) +#ifndef __INTEL_COMPILER integer, parameter :: num_inputs=2, mini_batch_size = 1, num_iterations=500000 !! Depending on where in the random-number sequence the weights start, this test can pass for lower !! numbers of iterations, e.g., 400000. Using more iterations gives more robust convergence. +#else + integer, parameter :: num_inputs=2, mini_batch_size = 1, num_iterations=52219 + !! Reducing num_iterations yields a less robust test, but increasing num_iterations causes this + !! test to crash when compiled with the Intel ifx compiler. +#endif integer batch, iter allocate(harvest(num_inputs, mini_batch_size, num_iterations)) From 84defeca66ac90886a6652c2f19e1ab7bcb7cc5e Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Tue, 9 Apr 2024 19:29:24 -0700 Subject: [PATCH 2/2] test(tensor_range): increase tolerance The previous tolerance (1.E-08) in the tensor_range_test_m function map_to_from_training_range() was slightly too strict for default- real arithmetic. This commit increases the tolerance to 1.E-07. --- test/tensor_range_test_m.f90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/tensor_range_test_m.f90 b/test/tensor_range_test_m.f90 index 2d197608a..e6aee3b98 100644 --- a/test/tensor_range_test_m.f90 +++ b/test/tensor_range_test_m.f90 @@ -65,7 +65,7 @@ function write_then_read_tensor_range() result(test_passes) function map_to_from_training_range() result(test_passes) logical test_passes - real, parameter :: tolerance = 1.E-08 + real, parameter :: tolerance = 1.E-07 associate(tensor_range => tensor_range_t(layer="output", minima=[-4., 0., 1., -1.], maxima=[0., 2., 5., 1.])) associate(tensor => tensor_t([-2., 0., 5., 0.])) @@ -76,4 +76,4 @@ function map_to_from_training_range() result(test_passes) end associate end function -end module tensor_range_test_m \ No newline at end of file +end module tensor_range_test_m