Skip to content

Conversation

@hurricane642
Copy link
Contributor

@hurricane642 hurricane642 commented Jul 20, 2021

This PR contains a base for the tests and their implementation for cscs-checks with updated syntax and unified style. I'll be happy with your review and suggestions!

@pep8speaks
Copy link

pep8speaks commented Jul 20, 2021

Hello @hurricane642, Thank you for updating!

Line 15:13: E231 missing whitespace after ':'
Line 65:1: E302 expected 2 blank lines, found 1
Line 86:80: E501 line too long (81 > 79 characters)

Do see the ReFrame Coding Style Guide

Comment last updated at 2021-09-01 12:12:53 UTC

@jenkins-cscs
Copy link
Collaborator

Can I test this patch?

@jjotero
Copy link
Contributor

jjotero commented Jul 20, 2021

ok to test

@codecov-commenter
Copy link

codecov-commenter commented Jul 20, 2021

Codecov Report

Merging #2084 (0ea8823) into master (78e7ce2) will decrease coverage by 0.02%.
The diff coverage is n/a.

❗ Current head 0ea8823 differs from pull request most recent head 817802b. Consider uploading reports for the commit 817802b to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2084      +/-   ##
==========================================
- Coverage   86.29%   86.26%   -0.03%     
==========================================
  Files          53       53              
  Lines        9571     9313     -258     
==========================================
- Hits         8259     8034     -225     
+ Misses       1312     1279      -33     
Impacted Files Coverage Δ
reframe/frontend/autodetect.py 57.48% <0.00%> (-4.40%) ⬇️
reframe/frontend/loader.py 92.12% <0.00%> (-1.84%) ⬇️
reframe/utility/typecheck.py 95.45% <0.00%> (-1.69%) ⬇️
reframe/core/namespaces.py 95.08% <0.00%> (-1.64%) ⬇️
reframe/frontend/cli.py 75.95% <0.00%> (-0.37%) ⬇️
reframe/core/pipeline.py 91.90% <0.00%> (-0.35%) ⬇️
reframe/core/meta.py 98.92% <0.00%> (-0.23%) ⬇️
reframe/core/deferrable.py 98.04% <0.00%> (-0.17%) ⬇️
reframe/utility/sanity.py 97.79% <0.00%> (-0.03%) ⬇️
reframe/utility/osext.py 84.71% <0.00%> (ø)
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 78e7ce2...817802b. Read the comment docs.

@jjotero
Copy link
Contributor

jjotero commented Jul 20, 2021

Hi @hurricane642! One comment regarding the file structure. The base tests are meant to go into hpctestlib/apps and there you can have you Amber tests in hpctestlib/apps/amber/__init__.py. Then, there is no need to prepend the derived file with the _der.py and you can just leave the names as amber there (and the same for all the other apps).

So when you import your base, the python import should look as from hpctestlib.apps.amber import AmberBase.

Copy link
Contributor

@jjotero jjotero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few more comments on the structure before delving into the test-specifics:

  • Rename the cscs-checks/apps/lammps/lammps to cscs-checks/apps/lammps/lammps_check.py and then use git mv if you want to. Otherwise, we'd be losing all the git history.
  • Delete the __init__ files that just have a version ID in there.
  • For each test, just replace the __init__ with the *_base.py files. That intermediate step is not needed. Have a look into the other tests in the library to see how it's done there.

Copy link
Contributor

@jjotero jjotero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better if each app is under its own directory instead of having all the python files in the same place. The reason behind this is that each test might have their own additional files that one might need for the tests, and then you don't want to have all those files mixed up in the same directory (please, have a look into hpctestlib/microbenchmarks/gpu and see how it's done in there). So in short, I would rename hpctestlib/apps/amber.py to hpctestlib/apps/amber/__init__.py (and the same for all the other apps).

Copy link
Contributor

@jjotero jjotero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have just briefly gone through the base classes for now.

I think there are a few conceptual changes to be made to the base classes. Things like the self.benchmark parameter (which referenced, but not declared in the base classes) should not be enforced from the base class. If someone wants to parameterise all these tests, they're free to do so in the base class. But if someone doesn't they should not need to define anything such as self.benchmark, because there is only one of them. Also, (and this is for the derived classes) perhaps the name variant makes more sense than benchmark.

Comment on lines 80 to 84
for key in list(self.REFERENCE_DICT):
if self.current_partition.fullname in key:
d = {self.current_partition.fullname:
self.REFERENCE_DICT[key]}
self.reference = d
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say that we make this set_perf_reference a different hook for both the GPU and CPU cases, simply because their references above are compacted in a different format. So move this hook into the GPU-specific class, and then create a similar one in the GPU class where you also deal with the small & large scopes of the dictionary.

This also avoids having to store another reference to this REFERENCE_DICT in the class, which is a bit confusing.

Suggested change
for key in list(self.REFERENCE_DICT):
if self.current_partition.fullname in key:
d = {self.current_partition.fullname:
self.REFERENCE_DICT[key]}
self.reference = d
for key, val in REFERENCE_GPU_PERFORMANCE.items():
if self.current_partition.fullname in key:
self.reference = {'*': val}
break
else:
raise ValueError(
f'could not find a reference for the current '
f'partition {self.current_partition.fullname!r}'
)

},
}

REFERENCE_CPU_PERFORMANCE_LARGE = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The keys for this dictionary also must be made tuples.

Comment on lines 145 to 147
@run_after('setup')
def set_reference_dict(self):
self.REFERENCE_DICT = REFERENCE_CPU_PERFORMANCE[self.scale]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@run_after('setup')
def set_reference_dict(self):
self.REFERENCE_DICT = REFERENCE_CPU_PERFORMANCE[self.scale]
@run_before('performance')
def set_perf_reference(self):
for key, val in REFERENCE_CPU_PERFORMANCE[self.scale].items():
if self.current_partition.fullname in key:
self.reference = {'*': val}
break
else:
raise ValueError(
f'could not find a reference for the current '
f'partition {self.current_partition.fullname!r}'
)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the keys of REFERENCE_CPU_PERFORMANCE_LARGE also must be made tuples in order for this to work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? Thank to string if self.current_partition.fullname in key: we check either substring in the string (as in case REFERENCE_CPU_PERFORMANCE_LARGE) or element in a tuple

@vkarak
Copy link
Contributor

vkarak commented Oct 29, 2021

Replaced by individual PRs.

@vkarak vkarak closed this Oct 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants