Skip to content

Commit

Permalink
Merge pull request #744 from dgergel/feature/cesm_timing
Browse files Browse the repository at this point in the history
Feature/cesm timing
  • Loading branch information
bartnijssen authored Sep 5, 2017
2 parents bfdb4a6 + da9a62d commit b63a0d9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
4 changes: 4 additions & 0 deletions docs/Development/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ To check which release of VIC you are running:

Updates the cesm_put_data.c routine in the CESM driver to include the correct signs for the wind stresses and fixes a bug in calculating friction velocity (previously it was missing a square root).

[GH#744] (https://github.com/UW-Hydro/VIC/pull/744)

Updates the cesm_interface_c.c routine to include missing timers and the VIC RUN timer in the CESM driver.

3. Speed up NetCDF operations in the image/CESM drivers ([GH#684](https://github.com/UW-Hydro/VIC/pull/684))

These changes speed up image driver initialization, forcing reads, and history writes by only opening and closing each input netCDF file once.
Expand Down
24 changes: 18 additions & 6 deletions vic/drivers/cesm/src/cesm_interface_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ vic_cesm_init(vic_clock *vclock,
vic_populate_model_state(trimstr(cmeta->starttype), &dmy_current);

// initialize forcings
timer_start(&(global_timers[TIMER_VIC_FORCE]));
vic_force();
timer_stop(&(global_timers[TIMER_VIC_FORCE]));

// initialize output structures
vic_init_output(&dmy_current);
Expand All @@ -121,6 +123,8 @@ vic_cesm_init(vic_clock *vclock,
timer_stop(&(global_timers[TIMER_VIC_INIT]));
// stop vic all timer
timer_stop(&(global_timers[TIMER_VIC_ALL]));
// init vic run timer
timer_init(&(global_timers[TIMER_VIC_RUN]));

return EXIT_SUCCESS;
}
Expand All @@ -135,14 +139,16 @@ vic_cesm_run(vic_clock *vclock)

// continue vic all timer
timer_continue(&(global_timers[TIMER_VIC_ALL]));
// start vic run timer
timer_start(&(global_timers[TIMER_VIC_RUN]));
// continue vic run timer
timer_continue(&(global_timers[TIMER_VIC_RUN]));

// reset l2x fields
initialize_l2x_data();

// read forcing data
timer_continue(&(global_timers[TIMER_VIC_FORCE]));
vic_force();
timer_stop(&(global_timers[TIMER_VIC_FORCE]));

// run vic over the domain
vic_image_run(&dmy_current);
Expand All @@ -151,7 +157,9 @@ vic_cesm_run(vic_clock *vclock)
vic_cesm_put_data();

// Write history files
timer_continue(&(global_timers[TIMER_VIC_WRITE]));
vic_write_output(&dmy_current);
timer_stop(&(global_timers[TIMER_VIC_WRITE]));

// advance the clock
advance_vic_time();
Expand All @@ -160,8 +168,10 @@ vic_cesm_run(vic_clock *vclock)
// if save:
if (vclock->state_flag) {
// write state file
debug("writing state file for timestep %zu", current);
vic_store(&dmy_current, state_filename);
write_rpointer_file(state_filename);
debug("finished storing state file: %s", state_filename)
}

// reset x2l fields
Expand All @@ -183,8 +193,8 @@ vic_cesm_final()
{
// continue vic all timer
timer_continue(&(global_timers[TIMER_VIC_ALL]));
// start vic run timer
timer_start(&(global_timers[TIMER_VIC_RUN]));
// start vic final timer
timer_start(&(global_timers[TIMER_VIC_FINAL]));

// clean up
vic_cesm_finalize();
Expand All @@ -193,8 +203,10 @@ vic_cesm_final()
timer_stop(&(global_timers[TIMER_VIC_FINAL]));
// stop vic all timer
timer_stop(&(global_timers[TIMER_VIC_ALL]));
// write timing info
write_vic_timing_table(global_timers, VIC_DRIVER);

if (mpi_rank == VIC_MPI_ROOT) {
// write timing info
write_vic_timing_table(global_timers, VIC_DRIVER);
}
return EXIT_SUCCESS;
}
3 changes: 0 additions & 3 deletions vic/drivers/image/src/vic_image.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@ main(int argc,
// start vic run timer
timer_start(&(global_timers[TIMER_VIC_RUN]));

timer_init(&(global_timers[TIMER_VIC_FORCE]));
timer_init(&(global_timers[TIMER_VIC_WRITE]));

// loop over all timesteps
for (current = 0; current < global_param.nrecs; current++) {
// read forcing data
Expand Down

0 comments on commit b63a0d9

Please sign in to comment.