-
Notifications
You must be signed in to change notification settings - Fork 64
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
Testing refactor #612
base: develop
Are you sure you want to change the base?
Testing refactor #612
Conversation
… with same binary name.
Greetings all, apologies for throwing this out there without an issue but I've been trying to keep up with the changes in the framework and the equivalent tests and was getting lost in the details and noticed a few things that I thought would make things a little bit easier overall. My main goal was making it more explicit what was being tested and reducing the amount of duplication we have but that necessitated quite a few changes at various levels of the infrastructure. I started going down a rabbit hole of how the framework is built and tested but before going much further, I figured I would share some of the things I've updated and check in to see if these make sense and are useful for the rest of the team. There are a few technical details that need to be evaluated as well but I wanted to check if, overall, this is moving things in a reasonable direction or if this is making things more complicated? |
Hi @mwaxmonsky, thanks for tackling this. So far, most of this looks like much needed cleanup! There is one change I do not understand. The old (clumsy, wordy) |
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.
There is a lot of great stuff in this PR, thanks @mwaxmonsky.
My main concern with this PR is that it touches code/build files that aren't just used by the unit tests, but also by production code (e.g. the top-level CMakeLists.txt
file). For instance, this PR enfores -O0
and certain compiler flags for the CCPP framework. We definitely do not want -O0
for production environments. There must be different options to set compilers for unit testing and for host models like the UFS, CAM/SIMA, NEPTUNE, and there must be a way for the host model to define compiler flags that overwrite any defaults (if we want to set defaults for cases other than running the tests).
There are two comments below that need fixing.
We also need to consider targeting the main
branch for this PR due to the impact on the host modeling systems. This PR may have to come straight after the current develop
was merged into main
. And it must be written in a way that it allows ccpp-prebuild to continue to work, otherwise this PR (or the develop branch, if this PR gets merged into develop) will be blocked until all host models have moved to capgen. We don't want this, it was a heavy lift last time to get feature/capgen
being merged into main
after a long time of parallel development.
ADD_COMPILE_OPTIONS(-ggdb) | ||
ADD_COMPILE_OPTIONS(-ffree-line-length-none) | ||
ADD_COMPILE_OPTIONS(-cpp) | ||
elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "IntelLLVM") |
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.
ifort
will be staying around for quite a while longer, we need this as an option, too.
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.
Ah, okay, I'll add those back in and differentiate between ifort
and ifx
.
option(BUILD_SHARED_LIBS "Build a static library" OFF) | ||
set(CCPP_VERBOSITY "0" CACHE STRING "Verbosity level of output (default: 0)") | ||
|
||
if(CCPP_FRAMEWORK_ENABLE_TESTS) |
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.
If CCPP_FRAMEWORK_ENABLE_TESTS
is ON, then there needs to be a find_package
call for pFUnit
with the REQUIRED
keyword. pfunit must come from the user-provided software stack. No implicit installs during cmake calls/build steps.
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.
Understood, happy to make that change. I'm actually looking to make a container with all the dependencies/packages already installed so the environment better mimics our development environments to make the cmake call clean as well (we can pass in the pfunit path at configure time but it's clunky without modules).
@@ -12,48 +12,22 @@ | |||
""" |
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.
Is every test directory in test/
going to have a copy of this gigantic file?
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.
I will be templating it so each test/test_reports.py
file only sets the field variables and inherits the tests from a shared parent file. That's a detail that's on my list but wanted to get feedback on the present state before refactoring the other directories.
@gold2718 Yup! I made sure to be as faithful to the current coverage and made each of the shell tests their own unit tests at the bottom of the python file using the |
@climbfuji Happy to remove the In terms of options from different compilers/flags, I'll look into different APIs for cmake and see what makes the most sense. As for targeting main, I'm happy to pivot there but the tests for prebuild run successfully the same as on main. Is the issue that users would have to update their model code and their build integration with the framework? Just trying to understand the issue of targeting develop instead of main. |
Yes, if you change the top-level CMakeLists.txt, you will impact the host models that use the ccpp-framework. UFS, SCM and NEPTUNE all use the ccpp-framework CMakeLists.txt. |
Also, this might be better saved for a discussion thread but I was wondering about the references to MPI and OpenMP. I don't see any openmp pragmas or types and currently the only reference to MPI is the mpi_comm in I see a note in # Maximum number of concurrent CCPP instances per MPI task
CCPP_NUM_INSTANCES = 200 and this value is used in the write function in mkstatic but it doesn't look like this is directly tied to the framework being build with MPI support. If we don't need MPI or openmp at build time for the framework, would it make sense removing these references in the CMake and ccpp_types or are these actively being used and I'm just missing a key detail? |
Currently, capgen generates |
ccpp-prebuild doesn't use any OpenMP calls in the auto-generated caps (everything comes from the host model via |
Refactoring of testing infrastructure
Changes include:
unittest
framework.to just fortran and python file.
and var_compatability tests.
and tests.
equivalents.
User interface changes?: No
Fixes: None
Testing:
test removed: None
unit tests:
system tests:
manual testing: