-
Notifications
You must be signed in to change notification settings - Fork 97
More concise testing #237
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
base: main
Are you sure you want to change the base?
More concise testing #237
Conversation
@milancurcic your plan is a great way to start. Not coincidentally, what you've written is almost exactly where Julienne started! :) Subtracting blank lines, the genesis of Julienne was an 87-line utility first released in the Sourcery 3.1.0 library. I'll add a subsequent comment here to list the additional capabilities that you'll probably ultimately find useful, whether by adding them to your utility or by revisiting Julienne. |
Over time, the aforementioned 87-line utility expanded to become Julienne in order to support
Regarding item 5, there's a lot of logic hidden in |
Thanks, @rouson, point 2 especially I see as being important here. We can consider this PR as a step stone toward Julienne, given that mainly only scaffolding will need to change if I choose that move. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The source code changes LGTM.
With GCC 15.1.0 installed and in my PATH
, I tried fpm test --profile release
yielded the output below, which reports a runtime error after reporting many tests passing:
test_dense_layer: All tests passed.
test_optimizers: All tests passed.
test_multihead_attention_layer: All tests passed.
test_input1d_layer: All tests passed.
test_parametric_activation: All tests passed.
test_conv2d_layer: All tests passed.
test_maxpool2d_layer: All tests passed.
test_dropout_layer: All tests passed.
test_input3d_layer: All tests passed.
test_flatten_layer: All tests passed.
test_reshape_layer: All tests passed.
test_conv2d_network: All tests passed.
test_reshape2d_layer: All tests passed.
test_metrics: All tests passed.
test_loss: All tests passed.
incorrect updated weights.. failed
test_linear2d_layer: One or more tests failed.
STOP 1
test_conv1d_network: All tests passed.
test_layernorm_layer: All tests passed.
test_locally_connected2d_layer: All tests passed.
test_get_set_network_params: All tests passed.
test_embedding_layer: All tests passed.
test_conv1d_layer: All tests passed.
test_maxpool1d_layer: All tests passed.
test_dense_network: All tests passed.
test_insert_flatten: All tests passed.
test_input2d_layer: All tests passed.
<ERROR> Execution for object " test_linear2d_layer " returned exit code 1
<ERROR> *cmd_run*:stopping due to failed executions
STOP 1
@milancurcic I see now that the above output is the intended behavior for a failing test. Here are few more thoughts on what would likely save time for an. unfamiliar user or new developer in interpreting the test output: I think the compiler output Also, I suggest indenting the text |
The rationale for |
@milancurcic good question. The final three lines in Julienne output are equivalent to the final three lines in your test suite output. The biggest difference is that just above those lines is a global tally of test passes. Seeing the global tally is an indication that the test suite ran to completion, which took me quite a while to figure out with the neural-fortran test suite. Here's the trailing output when a Julienne test fails:
Less of a big deal is that Julienne uses error termination (which matters for multi-image runs) with a |
tuff (this PR) does the tally on failure as well, we only don't see them here because the 2 suites that I adapted are not failing. But yes, there was no tally on failure in the existing test programs. |
It also took me until just now to figure out why the output shows Part of my confusion is because I'm used to running parallel programs, wherein it can be common to have the same output from multiple images. So when I saw |
Alternative to #236.
Thank you for demoing Julienne, Damian, and for the inspiration. I've thought about the minimal added code needed for NF to make more concise tests without an additional dependency. This PR shows it on two test suites,
test_dense_layer
andtest_dense_network
.In summary:
tuff
module in tuff.f90 (72 LOC), which providestest
andtest_result
.test
can take a logical expression or a user-provided function that istest_result
-typed.test
can act as a suite driver for a mix of logical-expr tests and user-function tests.Obviously less powerful than Julienne but at the same time much simpler to use (for me).
If you notice any serious caveats, let me know. In my view, nothing more is needed for NF and I'd prefer a simpler approach than bringing in an external dependency.