@@ -80,24 +80,6 @@ void sethet(Ensemble *ensemble) {
8080 ColumnView xgas2, xgas3, delz, xh2o2, xso2, xliq, rain, precip, xhen_h2o2,
8181 xhen_hno3, xhen_so2, t_factor, xk0_hno3, xk0_so2, so2_diss;
8282
83- // initialize internal veriables
84- std::vector<Real> vector0 (pver, 0 );
85- auto xgas2_host = View1DHost (vector0.data (), pver);
86- auto xgas3_host = View1DHost (vector0.data (), pver);
87- auto delz_host = View1DHost (vector0.data (), pver);
88- auto xh2o2_host = View1DHost (vector0.data (), pver);
89- auto xso2_host = View1DHost (vector0.data (), pver);
90- auto xliq_host = View1DHost (vector0.data (), pver);
91- auto rain_host = View1DHost (vector0.data (), pver);
92- auto precip_host = View1DHost (vector0.data (), pver);
93- auto xhen_h2o2_host = View1DHost (vector0.data (), pver);
94- auto xhen_hno3_host = View1DHost (vector0.data (), pver);
95- auto xhen_so2_host = View1DHost (vector0.data (), pver);
96- auto t_factor_host = View1DHost (vector0.data (), pver);
97- auto xk0_hno3_host = View1DHost (vector0.data (), pver);
98- auto xk0_so2_host = View1DHost (vector0.data (), pver);
99- auto so2_diss_host = View1DHost (vector0.data (), pver);
100-
10183 xgas2 = haero::testing::create_column_view (pver);
10284 xgas3 = haero::testing::create_column_view (pver);
10385 delz = haero::testing::create_column_view (pver);
@@ -114,27 +96,26 @@ void sethet(Ensemble *ensemble) {
11496 xk0_so2 = haero::testing::create_column_view (pver);
11597 so2_diss = haero::testing::create_column_view (pver);
11698
117- Kokkos::deep_copy (xgas2, xgas2_host );
118- Kokkos::deep_copy (xgas3, xgas3_host );
119- Kokkos::deep_copy (delz, delz_host );
120- Kokkos::deep_copy (xh2o2, xh2o2_host );
121- Kokkos::deep_copy (xso2, xso2_host );
122- Kokkos::deep_copy (xliq, xliq_host );
123- Kokkos::deep_copy (rain, rain_host );
124- Kokkos::deep_copy (precip, precip_host );
125- Kokkos::deep_copy (xhen_h2o2, xhen_h2o2_host );
126- Kokkos::deep_copy (xhen_hno3, xhen_hno3_host );
127- Kokkos::deep_copy (xhen_so2, xhen_so2_host );
128- Kokkos::deep_copy (t_factor, t_factor_host );
129- Kokkos::deep_copy (xk0_hno3, xk0_hno3_host );
130- Kokkos::deep_copy (xk0_so2, xk0_so2_host );
131- Kokkos::deep_copy (so2_diss, so2_diss_host );
99+ Kokkos::deep_copy (xgas2, 0.0 );
100+ Kokkos::deep_copy (xgas3, 0.0 );
101+ Kokkos::deep_copy (delz, 0.0 );
102+ Kokkos::deep_copy (xh2o2, 0.0 );
103+ Kokkos::deep_copy (xso2, 0.0 );
104+ Kokkos::deep_copy (xliq, 0.0 );
105+ Kokkos::deep_copy (rain, 0.0 );
106+ Kokkos::deep_copy (precip, 0.0 );
107+ Kokkos::deep_copy (xhen_h2o2, 0.0 );
108+ Kokkos::deep_copy (xhen_hno3, 0.0 );
109+ Kokkos::deep_copy (xhen_so2, 0.0 );
110+ Kokkos::deep_copy (t_factor, 0.0 );
111+ Kokkos::deep_copy (xk0_hno3, 0.0 );
112+ Kokkos::deep_copy (xk0_so2, 0.0 );
113+ Kokkos::deep_copy (so2_diss, 0.0 );
132114
133115 ColumnView het_rates[gas_pcnst];
134116 ColumnView tmp_hetrates[gas_pcnst];
135117 ColumnView qin[gas_pcnst];
136118 View1DHost het_rates_host[gas_pcnst];
137- View1DHost tmp_hetrates_host[gas_pcnst];
138119 View1DHost qin_host[gas_pcnst];
139120
140121 for (int mm = 0 ; mm < gas_pcnst; ++mm) {
@@ -143,45 +124,38 @@ void sethet(Ensemble *ensemble) {
143124 qin[mm] = haero::testing::create_column_view (pver);
144125
145126 het_rates_host[mm] = View1DHost (" het_rates_host" , pver);
146- tmp_hetrates_host[mm] = View1DHost (" tmp_hetrates_host" , pver);
147127 qin_host[mm] = View1DHost (" qin_host" , pver);
148128 }
149129
150130 int count = 0 ;
151131 for (int mm = 0 ; mm < gas_pcnst; ++mm) {
152132 for (int kk = 0 ; kk < pver; ++kk) {
153- het_rates_host[mm](kk) = 0.0 ;
154- tmp_hetrates_host[mm](kk) = 0.0 ;
155133 qin_host[mm](kk) = qin_in[count];
156134 count++;
157135 }
158136 }
159137
160138 // transfer data to GPU.
161139 for (int mm = 0 ; mm < gas_pcnst; ++mm) {
162- Kokkos::deep_copy (het_rates[mm], het_rates_host[mm] );
163- Kokkos::deep_copy (tmp_hetrates[mm], tmp_hetrates_host[mm] );
140+ Kokkos::deep_copy (het_rates[mm], 0.0 );
141+ Kokkos::deep_copy (tmp_hetrates[mm], 0.0 );
164142 Kokkos::deep_copy (qin[mm], qin_host[mm]);
165143 }
166144
167145 // initialize internal veriables
168- ColumnView xeqca, xca, allca;
169- auto xeqca_host = View1DHost (vector0.data (), pver);
170- auto xca_host = View1DHost (vector0.data (), pver);
171- auto allca_host = View1DHost (" allca_host" , 1 );
146+ ColumnView xeqca, xca;
147+ View1D allca (" allca" , 1 );
172148 xeqca = haero::testing::create_column_view (pver);
173149 xca = haero::testing::create_column_view (pver);
174- allca = haero::testing::create_column_view (1 );
175- Kokkos::deep_copy (xeqca, xeqca_host);
176- Kokkos::deep_copy (xca, xca_host);
177- Kokkos::deep_copy (allca, allca_host);
150+ Kokkos::deep_copy (xeqca, 0.0 );
151+ Kokkos::deep_copy (xca, 0.0 );
178152
179153 auto team_policy = ThreadTeamPolicy (1u , Kokkos::AUTO);
180154 Kokkos::parallel_for (
181155 team_policy, KOKKOS_LAMBDA (const ThreadTeam &team) {
182156 mo_sethet::sethet (
183157 team, het_rates, rlat, press, zmid, phis, tfld, cmfdqr, nrain,
184- nevapr, delt, xhnm, qin, xeqca, xca, allca, t_factor, xk0_hno3,
158+ nevapr, delt, xhnm, qin, xeqca, xca, allca, t_factor, xk0_hno3,
185159 xk0_so2, so2_diss,
186160 xgas2, xgas3, delz, xh2o2, xso2, xliq, rain, precip, xhen_h2o2,
187161 xhen_hno3, xhen_so2, tmp_hetrates, spc_h2o2_ndx, spc_so2_ndx,
@@ -203,4 +177,4 @@ void sethet(Ensemble *ensemble) {
203177
204178 output.set (" het_rates" , het_rates_out);
205179 });
206- }
180+ }
0 commit comments