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

Oscar/wet dep integration #303

Merged
merged 75 commits into from
Jun 3, 2024
Merged

Oscar/wet dep integration #303

merged 75 commits into from
Jun 3, 2024

Conversation

odiazib
Copy link
Contributor

@odiazib odiazib commented Mar 18, 2024

We are using this branch in PR # 2848

List of variables of the routine aero_model_wetdep

Inputs:

Variable Description Units Comments
cldt total cloud fraction fraction
cldn layer cloud fraction; it is used by modal_aero_wateruptake_dr cldn fraction
rprdsh rain production, shallow convection kg/kg/s pbuf_get_index('RPRDSH')
rprddp rain production, deep convection kg/kg/s
evapcdp Evaporation rate of deep convective precipitation kg/kg/s
evapcsh Evaporation rate of shallow convective precipitation kg/kg/s
dp_frac Deep convective cloud fraction fraction
sh_frac Shallow convective cloud fraction fraction
icwmrdp in cloud water mixing ratio, deep convection kg/kg
icwmrsh in cloud water mixing ratio, shallow convection kg/kg
evapr evaporation from stratiform rain kg/kg/s
dlf Detrainment of convective condensate or shallow+deep convective detrainment kg/kg/s
prain stratiform rain production rate kg/kg/s

In/Out:

Variable Description Units Comments
dgnum wet aerosol wet diameter m
dgncur_a aerosol particle diameter m
qaerwat aerosol water kg/kg
wetdens wet aerosol density kg/m3
ptend_lq
qqcw

Output:

Variable Description Units Comments
aerdepwetis aerosol wet deposition (interstitial) kg/m2/s
aerdepwetcw aerosol wet deposition (cloud water) kg/m2/s

@singhbalwinder,

In the tables above, could you please add comments indicating which process in EMAXX is responsible for computing the specific variables? This information can be added in the 'Comments' column.

Issue:

This code that produces this race condition is not needed by the eamxx-mam4xx interface. I commented out this code.

========= COMPUTE-SANITIZER
/home/odiazib/test_mam4/build/mam4xx/src/validation/aero_model/aero_model_driver: reading baseline_aero_model_wetdep_ts_379.yaml
aero_model_wetdep : 
========= Error: Race reported between Write access at 0x59a70 in void Kokkos::Impl::cuda_parallel_launch_constant_memory<Kokkos::Impl::ParallelFor<aero_model_wetdep(skywalker::Ensemble *)::[lambda(const skywalker::Input &, skywalker::Output &) (instance 1)]::operator ()(const skywalker::Input &, skywalker::Output &) const::[lambda(const Kokkos::Impl::CudaTeamMember &) (instance 1)], Kokkos::TeamPolicy<Kokkos::Cuda>, Kokkos::Cuda>>()
=========     and Read access at 0x58490 in void Kokkos::Impl::cuda_parallel_launch_constant_memory<Kokkos::Impl::ParallelFor<aero_model_wetdep(skywalker::Ensemble *)::[lambda(const skywalker::Input &, skywalker::Output &) (instance 1)]::operator ()(const skywalker::Input &, skywalker::Output &) const::[lambda(const Kokkos::Impl::CudaTeamMember &) (instance 1)], Kokkos::TeamPolicy<Kokkos::Cuda>, Kokkos::Cuda>>() [160 hazards]
=========     and Read access at 0x58500 in void Kokkos::Impl::cuda_parallel_launch_constant_memory<Kokkos::Impl::ParallelFor<aero_model_wetdep(skywalker::Ensemble *)::[lambda(const skywalker::Input &, skywalker::Output &) (instance 1)]::operator ()(const skywalker::Input &, skywalker::Output &) const::[lambda(const Kokkos::Impl::CudaTeamMember &) (instance 1)], Kokkos::TeamPolicy<Kokkos::Cuda>, Kokkos::Cuda>>() [336 hazards]
=========     and Read access at 0x58580 in void Kokkos::Impl::cuda_parallel_launch_constant_memory<Kokkos::Impl::ParallelFor<aero_model_wetdep(skywalker::Ensemble *)::[lambda(const skywalker::Input &, skywalker::Output &) (instance 1)]::operator ()(const skywalker::Input &, skywalker::Output &) const::[lambda(const Kokkos::Impl::CudaTeamMember &) (instance 1)], Kokkos::TeamPolicy<Kokkos::Cuda>, Kokkos::Cuda>>() [168 hazards]
=========     and Read access at 0x59330 in void Kokkos::Impl::cuda_parallel_launch_constant_memory<Kokkos::Impl::ParallelFor<aero_model_wetdep(skywalker::Ensemble *)::[lambda(const skywalker::Input &, skywalker::Output &) (instance 1)]::operator ()(const skywalker::Input &, skywalker::Output &) const::[lambda(const Kokkos::Impl::CudaTeamMember &) (instance 1)], Kokkos::TeamPolicy<Kokkos::Cuda>, Kokkos::Cuda>>() [152 hazards]
=========     and Read access at 0x593a0 in void Kokkos::Impl::cuda_parallel_launch_constant_memory<Kokkos::Impl::ParallelFor<aero_model_wetdep(skywalker::Ensemble *)::[lambda(const skywalker::Input &, skywalker::Output &) (instance 1)]::operator ()(const skywalker::Input &, skywalker::Output &) const::[lambda(const Kokkos::Impl::CudaTeamMember &) (instance 1)], Kokkos::TeamPolicy<Kokkos::Cuda>, Kokkos::Cuda>>() [304 hazards]
=========     and Read access at 0x59420 in void Kokkos::Impl::cuda_parallel_launch_constant_memory<Kokkos::Impl::ParallelFor<aero_model_wetdep(skywalker::Ensemble *)::[lambda(const skywalker::Input &, skywalker::Output &) (instance 1)]::operator ()(const skywalker::Input &, skywalker::Output &) const::[lambda(const Kokkos::Impl::CudaTeamMember &) (instance 1)], Kokkos::TeamPolicy<Kokkos::Cuda>, Kokkos::Cuda>>() [152 hazards]
========= 
========= Error: Race reported between Write access at 0x30fc0 in void Kokkos::Impl::cuda_parallel_launch_constant_memory<Kokkos::Impl::ParallelFor<aero_model_wetdep(skywalker::Ensemble *)::[lambda(const skywalker::Input &, skywalker::Output &) (instance 1)]::operator ()(const skywalker::Input &, skywalker::Output &) const::[lambda(const Kokkos::Impl::CudaTeamMember &) (instance 1)], Kokkos::TeamPolicy<Kokkos::Cuda>, Kokkos::Cuda>>()
=========     and Read access at 0x308d0 in void Kokkos::Impl::cuda_parallel_launch_constant_memory<Kokkos::Impl::ParallelFor<aero_model_wetdep(skywalker::Ensemble *)::[lambda(const skywalker::Input &, skywalker::Output &) (instance 1)]::operator ()(const skywalker::Input &, skywalker::Output &) const::[lambda(const Kokkos::Impl::CudaTeamMember &) (instance 1)], Kokkos::TeamPolicy<Kokkos::Cuda>, Kokkos::Cuda>>() [8 hazards]
=========     and Read access at 0x30940 in void Kokkos::Impl::cuda_parallel_launch_constant_memory<Kokkos::Impl::ParallelFor<aero_model_wetdep(skywalker::Ensemble *)::[lambda(const skywalker::Input &, skywalker::Output &) (instance 1)]::operator ()(const skywalker::Input &, skywalker::Output &) const::[lambda(const Kokkos::Impl::CudaTeamMember &) (instance 1)], Kokkos::TeamPolicy<Kokkos::Cuda>, Kokkos::Cuda>>() [16 hazards]
=========     and Read access at 0x309c0 in void Kokkos::Impl::cuda_parallel_launch_constant_memory<Kokkos::Impl::ParallelFor<aero_model_wetdep(skywalker::Ensemble *)::[lambda(const skywalker::Input &, skywalker::Output &) (instance 1)]::operator ()(const skywalker::Input &, skywalker::Output &) const::[lambda(const Kokkos::Impl::CudaTeamMember &) (instance 1)], Kokkos::TeamPolicy<Kokkos::Cuda>, Kokkos::Cuda>>() [8 hazards]
========= 
========= Error: Race reported between Write access at 0x31bd0 in void Kokkos::Impl::cuda_parallel_launch_constant_memory<Kokkos::Impl::ParallelFor<aero_model_wetdep(skywalker::Ensemble *)::[lambda(const skywalker::Input &, skywalker::Output &) (instance 1)]::operator ()(const skywalker::Input &, skywalker::Output &) const::[lambda(const Kokkos::Impl::CudaTeamMember &) (instance 1)], Kokkos::TeamPolicy<Kokkos::Cuda>, Kokkos::Cuda>>()
=========     and Read access at 0x314e0 in void Kokkos::Impl::cuda_parallel_launch_constant_memory<Kokkos::Impl::ParallelFor<aero_model_wetdep(skywalker::Ensemble *)::[lambda(const skywalker::Input &, skywalker::Output &) (instance 1)]::operator ()(const skywalker::Input &, skywalker::Output &) const::[lambda(const Kokkos::Impl::CudaTeamMember &) (instance 1)], Kokkos::TeamPolicy<Kokkos::Cuda>, Kokkos::Cuda>>() [8 hazards]
=========     and Read access at 0x31550 in void Kokkos::Impl::cuda_parallel_launch_constant_memory<Kokkos::Impl::ParallelFor<aero_model_wetdep(skywalker::Ensemble *)::[lambda(const skywalker::Input &, skywalker::Output &) (instance 1)]::operator ()(const skywalker::Input &, skywalker::Output &) const::[lambda(const Kokkos::Impl::CudaTeamMember &) (instance 1)], Kokkos::TeamPolicy<Kokkos::Cuda>, Kokkos::Cuda>>() [16 hazards]
=========     and Read access at 0x315d0 in void Kokkos::Impl::cuda_parallel_launch_constant_memory<Kokkos::Impl::ParallelFor<aero_model_wetdep(skywalker::Ensemble *)::[lambda(const skywalker::Input &, skywalker::Output &) (instance 1)]::operator ()(const skywalker::Input &, skywalker::Output &) const::[lambda(const Kokkos::Impl::CudaTeamMember &) (instance 1)], Kokkos::TeamPolicy<Kokkos::Cuda>, Kokkos::Cuda>>() [8 hazards]
========= 
========= Error: Race reported between Write access at 0x303a0 in void Kokkos::Impl::cuda_parallel_launch_constant_memory<Kokkos::Impl::ParallelFor<aero_model_wetdep(skywalker::Ensemble *)::[lambda(const skywalker::Input &, skywalker::Output &) (instance 1)]::operator ()(const skywalker::Input &, skywalker::Output &) const::[lambda(const Kokkos::Impl::CudaTeamMember &) (instance 1)], Kokkos::TeamPolicy<Kokkos::Cuda>, Kokkos::Cuda>>()
=========     and Read access at 0x2fd30 in void Kokkos::Impl::cuda_parallel_launch_constant_memory<Kokkos::Impl::ParallelFor<aero_model_wetdep(skywalker::Ensemble *)::[lambda(const skywalker::Input &, skywalker::Output &) (instance 1)]::operator ()(const skywalker::Input &, skywalker::Output &) const::[lambda(const Kokkos::Impl::CudaTeamMember &) (instance 1)], Kokkos::TeamPolicy<Kokkos::Cuda>, Kokkos::Cuda>>() [16 hazards]
=========     and Read access at 0x2fdb0 in void Kokkos::Impl::cuda_parallel_launch_constant_memory<Kokkos::Impl::ParallelFor<aero_model_wetdep(skywalker::Ensemble *)::[lambda(const skywalker::Input &, skywalker::Output &) (instance 1)]::operator ()(const skywalker::Input &, skywalker::Output &) const::[lambda(const Kokkos::Impl::CudaTeamMember &) (instance 1)], Kokkos::TeamPolicy<Kokkos::Cuda>, Kokkos::Cuda>>() [8 hazards]
========= 
/home/odiazib/test_mam4/build/mam4xx/src/validation/aero_model/aero_model_driver: writing mam4xx_baseline_aero_model_wetdep_ts_379.py
========= RACECHECK SUMMARY: 4 hazards displayed (4 errors, 0 warnings)

Copy link

codecov bot commented Mar 18, 2024

Codecov Report

Attention: Patch coverage is 99.15730% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 96.41%. Comparing base (7b0be56) to head (ce96755).

Files Patch % Lines
src/mam4xx/utils.hpp 93.54% 2 Missing ⚠️
src/mam4xx/wet_dep.hpp 99.68% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #303      +/-   ##
==========================================
+ Coverage   96.27%   96.41%   +0.14%     
==========================================
  Files          41       41              
  Lines        8365     8593     +228     
==========================================
+ Hits         8053     8285     +232     
+ Misses        312      308       -4     

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

@odiazib odiazib force-pushed the oscar/wet_dep_integration branch 2 times, most recently from 0424c78 to d4a3009 Compare March 26, 2024 19:25
@odiazib odiazib force-pushed the oscar/wet_dep_integration branch 2 times, most recently from 86c7a90 to 5d5119b Compare April 9, 2024 17:10
@odiazib odiazib force-pushed the oscar/wet_dep_integration branch from 8a8ae57 to eff10eb Compare May 20, 2024 13:35
src/mam4xx/aero_model.hpp Outdated Show resolved Hide resolved
@@ -26,7 +26,7 @@ constexpr int ntot_amode = mam4::AeroConfig::num_modes();
// FIXME: is top_lev equal to 1 in aerosol optics ?
constexpr int top_lev = 0;
//
constexpr int pcnst = aero_model::pcnst;
// constexpr int pcnst = mam4::pcnst;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can probably delete this commented out line of code.

src/validation/wetdep/wetdepa_v2.cpp Outdated Show resolved Hide resolved
acc_spec_in_ait,
// outputs
dgncur_i.data(), dgncur_c, ptend_q_k.data(),
dqqcwdt_k.data());
Copy link
Contributor

Choose a reason for hiding this comment

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

Sometimes data layout is not very obvious when we use .data() in the output variables. We don't need to change if it is working but just a note about revisiting these in the source code when time allows.

Copy link
Contributor

Choose a reason for hiding this comment

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

@singhbalwinder , I agree we should re-visit the use of data() sometime. Using data() allows the function being called to use a simple Real* parameter. But it means that the Kokkos::view has to have a stride of 1. This is true for 1D views but 1D sub-views of 2D views might not have stride 1 which can cause hard to diagnose errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree with both of you. I have created issue #322.

@odiazib odiazib merged commit b1c7d98 into main Jun 3, 2024
8 checks passed
@odiazib odiazib deleted the oscar/wet_dep_integration branch June 3, 2024 17:41
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.

3 participants