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

Fix increasing write times with nc outputs #428

Merged
merged 3 commits into from
Aug 8, 2024

Conversation

N1ckP3rsl3y
Copy link
Contributor

  • In the latest version of SOILWAT2 (v8.0.0), when the user creates a large domain, there is a noticeable increase in the runtime of individual simulations

  • SOILWAT2 now makes use of

    • Custom nc chunking
    • A new user input - deflateLevel
    • An initial write to all output nc files while creating them
  • See nc-based SOILWAT2 runs slow down with increasing domain size #425 for more information

- Addresses issue #425
- Previously, when outputting to netCDFs, the bigger the domain, the longer it took to write output after every simulation run

- Created a new output within `Input_nc/desc.in` - "deflateLevel" that specifies the level of deflation that will be sent into `nc_def_var_deflate()`
	* If the value is 0 (default), variables will not have any kind of deflation
	* Otherwise, the values 1-9 specify the intensity of deflation that will occur
- New variable within SW_NETCDF to hold this new input - set to 0 in `SW_NC_init_ptrs()`

- Added custom chunking to every non-dimensional variable (e.g., variables that are not time, vert, lat/lon, x/y, etc.)
	* Previously, the deflation would provide chunk sizes that encompass the entire domain
		- E.g., chunk size = [10, 10, 366] for a variable with xy = 10 x 10 sites and time = one leap year
		- The preferred chunk size for the example above should be chunk size = [1, 1, 366]

- New function - `writeDummyVal` which is used to write a dummy value to a variable within the given netCDF and detects which type to write
	* Only use if `deflateLevel` is 0
@N1ckP3rsl3y N1ckP3rsl3y linked an issue Aug 7, 2024 that may be closed by this pull request
Copy link

codecov bot commented Aug 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.33%. Comparing base (0304be1) to head (2e109a8).

Additional details and impacted files
@@                  Coverage Diff                  @@
##           release/devel_v8.1.0     #428   +/-   ##
=====================================================
  Coverage                 73.33%   73.33%           
=====================================================
  Files                        20       20           
  Lines                      6233     6233           
=====================================================
  Hits                       4571     4571           
  Misses                     1662     1662           

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

Copy link
Member

@dschlaep dschlaep left a comment

Choose a reason for hiding this comment

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

Very nice! I've tested this for a domain of size 1,000,000 with and without deflation. It is now steadily making progress, excellent!

I made two minor comments about improving documentation and an error message. Please take a look at those and then we can finish this up. Thanks!

src/SW_netCDF.c Outdated Show resolved Hide resolved
src/SW_netCDF.c Outdated Show resolved Hide resolved
@N1ckP3rsl3y N1ckP3rsl3y merged commit 1605a74 into release/devel_v8.1.0 Aug 8, 2024
12 checks passed
@N1ckP3rsl3y N1ckP3rsl3y deleted the fix_longNCWriteTimes branch August 8, 2024 12:37
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.

nc-based SOILWAT2 runs slow down with increasing domain size
2 participants