|
| 1 | +#include "TChem.hpp" |
| 2 | +#include "TChem_Impl_MOSAIC.hpp" |
| 3 | +#include <verification.hpp> |
| 4 | +#include "skywalker.hpp" |
| 5 | + |
| 6 | +using device_type = typename Tines::UseThisDevice<TChem::exec_space>::type; |
| 7 | +using real_type_1d_view = TChem::real_type_1d_view; |
| 8 | +using oridinal_type_1d_view = TChem::ordinal_type_1d_view; |
| 9 | +using ordinal_type = TChem::ordinal_type; |
| 10 | +using namespace skywalker; |
| 11 | +using namespace TChem; |
| 12 | + |
| 13 | +void drh_mutual(Ensemble *ensemble) { |
| 14 | + ensemble->process([=](const Input &input, Output &output) { |
| 15 | + |
| 16 | + const auto j_index_arr = input.get_array("j_index"); |
| 17 | + const auto T_K_arr = input.get_array("T_K"); |
| 18 | + |
| 19 | + real_type_1d_view j_index("j_index", 1); |
| 20 | + verification::convert_1d_vector_to_1d_view_device(j_index_arr, j_index); |
| 21 | + |
| 22 | + real_type_1d_view T_K("T_K", 1); |
| 23 | + verification::convert_1d_vector_to_1d_view_device(T_K_arr, T_K); |
| 24 | + |
| 25 | + // Reals or int that are defined outside of the parallel_for region are passed as const. |
| 26 | + real_type_1d_view outputs_drh_mutual("outputs_drh_mutual", 1); |
| 27 | + |
| 28 | + const auto mmd = TChem::Impl::MosaicModelData<device_type>(); |
| 29 | + |
| 30 | + std::string profile_name ="Verification_test_drh_mutual"; |
| 31 | + using policy_type = |
| 32 | + typename TChem::UseThisTeamPolicy<TChem::exec_space>::type; |
| 33 | + const auto exec_space_instance = TChem::exec_space(); |
| 34 | + const auto host_exec_space = TChem::host_exec_space(); |
| 35 | + policy_type policy(exec_space_instance, 1, Kokkos::AUTO()); |
| 36 | + |
| 37 | + Kokkos::parallel_for( |
| 38 | + profile_name, |
| 39 | + policy, |
| 40 | + KOKKOS_LAMBDA(const typename policy_type::member_type& member) { |
| 41 | + |
| 42 | + Real& drh_mutual = outputs_drh_mutual(0); |
| 43 | + |
| 44 | + // Perform the adjustment calculation |
| 45 | + TChem::Impl::MOSAIC<real_type, device_type>::drh_mutual( |
| 46 | + mmd, |
| 47 | + j_index(0)-1, |
| 48 | + T_K(0), |
| 49 | + drh_mutual); |
| 50 | + }); |
| 51 | + |
| 52 | + const auto outputs_drh_mutual_h = Kokkos::create_mirror_view_and_copy(host_exec_space, outputs_drh_mutual); |
| 53 | + |
| 54 | + Real drh_mutual = outputs_drh_mutual_h(0); |
| 55 | + |
| 56 | + output.set("drh_mutual", drh_mutual); |
| 57 | + |
| 58 | + }); |
| 59 | +} |
0 commit comments