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

Check all basic operators results in all possible cases #1784

Merged
merged 3 commits into from
Mar 19, 2024

Conversation

GillesDuvert
Copy link
Contributor

@GillesDuvert GillesDuvert commented Mar 17, 2024

added test_indepth_basic_functions.pro and modified code to insure ~1200 tests on OPERATORS are similar to IDL.

Copy link

codecov bot commented Mar 17, 2024

Codecov Report

Attention: Patch coverage is 78.04054% with 65 lines in your changes are missing coverage. Please review.

Project coverage is 43.73%. Comparing base (2980154) to head (eb9e313).

Files Patch % Lines
src/basic_op_new.cpp 59.01% 25 Missing ⚠️
src/basic_op.cpp 70.21% 14 Missing ⚠️
src/snippets/basic_op_GtMarkNewCplx.incpp 60.00% 4 Missing ⚠️
src/snippets/basic_op_LtMarkNewCplx.incpp 60.00% 4 Missing ⚠️
src/snippets/basic_op_AndOpCplx.incpp 57.14% 3 Missing ⚠️
src/snippets/basic_op_AndOpInv.incpp 57.14% 3 Missing ⚠️
src/snippets/basic_op_LtMarkSNewCplx.incpp 83.33% 2 Missing ⚠️
src/snippets/basic_op_AndOpInvS.incpp 90.90% 1 Missing ⚠️
src/snippets/basic_op_DivInvSCplx.incpp 91.66% 1 Missing ⚠️
src/snippets/basic_op_DivInvSNew.incpp 92.30% 1 Missing ⚠️
... and 7 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1784      +/-   ##
==========================================
+ Coverage   42.70%   43.73%   +1.02%     
==========================================
  Files         361      376      +15     
  Lines       97331    97398      +67     
  Branches    19928    19919       -9     
==========================================
+ Hits        41570    42596    +1026     
+ Misses      55761    54802     -959     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@GillesDuvert
Copy link
Contributor Author

The test_indepth_basic_functions.pro brutally explores 95 different operators defined in files basic_op_xxx.pro, for a combination of the following cases:

  1. The 10 different numeric operand types (BYTE to DCOMPLEX)
  2. The size of each operand: scalar, array of 1 element, array of > 1 element
  3. The respective sizes of the two operands for operators using two operands (like in c= a + b ), the code is not the same when a is smaller of greater than b.
  4. The persistence of the operand, like in c = a + temporary(b)

Because each of these cases need a special code, for speed and memory optimization (this was written by Marc in the very first version of GDL, at least for 90% of the operators), the number of combinations explored is around 11000 cases.

The result of the procedure is a ~24000 lines text file that can be compared with an equivalent IDL output.
The present PR introduces a number of code patches or additions to insure even obscure operator+operand combination give the same result as IDL.
The GDL and IDL produced files are identical, with the exception of the signedness of a few NaN or Inf results in case or zero division of complex values.

As each operator is also optimized to use parallel processing on operands as soon as the number of elements is greater than !CPU.TPOOL_MIN_ELTS, the test_indepth_basic_functions.pro procedure can also be used to check that the parallelized results are identical to the single cpu ones (*). This has been checked too. Note that testing the equivalence of results between single and many cpu as performed in the test_indepth_basic_functions.pro procedure with IDL will... crash IDL on some complex values, so this part of procedure is deactivated with IDL.

(*) TPOOL (Thread Pool) using functions cannot in general be expected to provide exactly the same result in parallell or not parallell mode: TOTAL() is an example. But operators do.

@GillesDuvert GillesDuvert merged commit 41ca272 into gnudatalanguage:master Mar 19, 2024
7 of 8 checks passed
@GillesDuvert GillesDuvert deleted the close_1783 branch July 2, 2024 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant