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

template rate indices and corresponding changes for NSE_NET #1269

Merged
merged 49 commits into from
Jul 12, 2023

Conversation

zhichen3
Copy link
Collaborator

@zhichen3 zhichen3 commented Jul 8, 2023

Based on Pr#1231.

Added rate indices for aprox networks and iso7 to be compatible updated pynucastro c++ network template.
Delete unnecessary files that declare and initialize rate indices since now we do it directly via pynucastro, or hard coded it for aprox networks.

@zhichen3
Copy link
Collaborator Author

zhichen3 commented Jul 10, 2023

Flat profile:

Each sample counts as 0.01 seconds.
  %   cumulative   self              self     total           
 time   seconds   seconds    calls   s/call   s/call  name    
 19.99     27.81    27.81 1738717728     0.00     0.00  get_partition_function(int, tf_t const&, double&, double&)
 14.99     48.67    20.86 36104765     0.00     0.00  void fcn<burn_t>(amrex::Array1D<double, 1, 2>&, amrex::Array1D<double, 1, 2>&, burn_t const&, int&) [clone .constprop.0]
  9.01     61.21    12.54 654530895     0.00     0.00  std::_Function_handler<amrex::GpuTuple<amrex::ValLocPair<double, amrex::IntVect> > (), amrex::ReduceData<amrex::ValLocPair<double, amrex::IntVect> >::ReduceData<amrex::ReduceOpMin>(amrex::ReduceOps<amrex::ReduceOpMin>&)::{lambda()#1}>::_M_manager(std::_Any_data&, std::_Any_data const&, std::_Manager_operation)
  8.58     73.15    11.94      120     0.10     1.16  Castro::react_state(amrex::MultiFab&, amrex::MultiFab&, double, double, int)
  6.44     82.11     8.96 103117525     0.00     0.00  void apply_electrons<burn_t>(burn_t&)
  5.24     89.40     7.29 11060873     0.00     0.00  in_nse(burn_t&, bool)
  4.65     95.87     6.47 11283222     0.00     0.00  Castro::okToContinue()
  4.36    101.93     6.06 10973521     0.00     0.00  void nse_hybrid_solver<burn_t>(burn_t&, double)
  3.77    107.17     5.24 26202960     0.00     0.00  void actual_eos<eos_input_t, burn_t>(eos_input_t, burn_t&)
  2.99    111.33     4.16 10984671     0.00     0.00  void hybrj<2, burn_t>(hybrj_t<2>&, burn_t const&)
  2.54    114.87     3.54 15221646     0.00     0.00  void evaluate_rates<0, rate_t>(burn_t const&, rate_t&)
  2.44    118.27     3.40 81521661     0.00     0.00  is_fastest_rate(amrex::Array1D<int, 1, 2>&, double&, int, amrex::Array1D<double, 1, 22> const&, burn_t const&, amrex::Array1D<double, 1, 93> const&, amrex::Array1D<int, 1, 22> const&, double const&)
  2.44    121.66     3.39 15680708     0.00     0.00  sneut5(double, double, double, double, double&, double&, double&, double&, double&)
  1.93    124.34     2.69 15221646     0.00     0.00  void fill_reaclib_rates<0, rate_t>(tf_t const&, rate_t&)
  0.78    125.42     1.08 15680708     0.00     0.00  rhs_nuc(burn_t const&, amrex::Array1D<double, 1, 23>&, amrex::Array1D<double, 1, 22> const&, amrex::Array1D<double, 1, 93> const&)
  0.75    126.47     1.05 14230922     0.00     0.00  void chabrier1998<1>(plasma_state_t const&, scrn::screen_factors_t const&, double&, double&)
  0.64    127.36     0.89 15221646     0.00     0.00  void rate_ne20_to_he4_o16_derived<0>(tf_t const&, double&, double&)
  0.61    128.21     0.85 15221646     0.00     0.00  void rate_cr48_to_p_v47_derived_removed<0>(tf_t const&, double&, double&)
  0.59    129.02     0.82 15221646     0.00     0.00  void rate_mg24_to_he4_ne20_derived<0>(tf_t const&, double&, double&)
  0.52    129.75     0.73 15221646     0.00     0.00  void rate_he4_si28_to_p_p31_derived<0>(tf_t const&, double&, double&)
  0.51    130.46     0.71 15221646     0.00     0.00  void rate_s32_to_p_p31_derived<0>(tf_t const&, double&, double&)
  0.50    131.16     0.70 15221646     0.00     0.00  void rate_ca40_to_p_k39_derived_removed<0>(tf_t const&, double&, double&)
  0.49    131.84     0.69 15221646     0.00     0.00  void rate_he4_mg24_to_p_al27_derived<0>(tf_t const&, double&, double&)

It seems like a lot of time is taken when constructing fcn and getting the partition function.

I still want to optimize the is_fastest_rate function, since it looks inefficient.

@zingale
Copy link
Member

zingale commented Jul 10, 2023

can you resolve these conflicts?

{
// p_index is for photoionization proton
extern AMREX_GPU_MANAGED int p_index;
extern AMREX_GPU_MANAGED int h1_index;
Copy link
Member

Choose a reason for hiding this comment

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

couldn't these actually be constexpr int p_index = ...?
the values don't change, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Indeed. I fixed that, also did a corresponding change in pynucastro pr.

@yut23
Copy link
Collaborator

yut23 commented Jul 11, 2023

Should this update ignition_simple too?

@zhichen3
Copy link
Collaborator Author

Should this update ignition_simple too?

Yes, I missed that. Now it is updated.

@zingale zingale merged commit a801f2d into AMReX-Astro:development Jul 12, 2023
19 checks passed
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