smash-transport / smash

Simulating Many Accelerated Strongly-interacting Hadrons
https://smash-transport.github.io
Other
52 stars 30 forks source link

Crash on out of range integral tabulations #14

Closed jaelpark closed 4 years ago

jaelpark commented 4 years ago

I'm trying to use smash for hadronic rescattering as a part of JETSCAPE framework (integrated). However, it seems to always crash while performing some table look-ups and going out of range (see backtrace below). I'm using the default configuration for smash, and JETSCAPE should also be properly configured for the afterburner stage.

#6  0x00007fffde89a5bd in std::__throw_out_of_range (
    __s=__s@entry=0x7fffe1bf42ae "_Map_base::at")
    at /build/gcc/src/gcc/libstdc++-v3/src/c++11/functexcept.cc:82
#7  0x00007fffe1a1863c in std::__detail::_Map_base<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, smash::Tabulation>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, smash::Tabulation> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true>, true>::at (this=this@entry=0x7fffe1c480c0 <smash::RK_tabulations>, 
    __k="Δ̅")
    at /usr/include/c++/10.2.0/bits/hashtable_policy.h:433
#8  0x00007fffe1a14935 in std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, smash::Tabulation, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, smash::Tabulation> > >::at (__k=..., 
    this=0x7fffe1c480c0 <smash::RK_tabulations>)
    at /usr/include/c++/10.2.0/bits/unordered_map.h:1000
#9  smash::IsoParticleType::get_integral_RK (
    this=0x555556666ee8, sqrts=2.3692074873141471)
    at JETSCAPE/external_packages/smash/smash_code/src/isoparticletype.cc:324
#10 0x00007fffe195599a in smash::detailed_balance_factor_RK (
    sqrts=<optimized out>, pcm=pcm@entry=0.77111675422546411, 
    a=..., b=..., c=..., d=...)
    at JETSCAPE/external_packages/smash/smash_code/src/include/smash/particletype.h:185
#11 0x00007fffe195c265 in operator() (
    __closure=<optimized out>)
    at JETSCAPE/external_packages/smash/smash_code/src/crosssections.cc:1547
#12 smash::CrossSections::add_channel<smash::CrossSections::deltak_xx(smash::ReactionsBitSet) const::<lambda()> > (type_b=..., 
    type_a=..., sqrts=<optimized out>, get_xsection=..., 
    process_list=std::vector of length 0, capacity 0, 
    this=0x7fffffffdfc0)
    at JETSCAPE/external_packages/smash/smash_code/src/include/smash/crosssections.h:519
#13 smash::CrossSections::deltak_xx (this=0x7fffffffdfc0, 
    included_2to2=...)
    at JETSCAPE/external_packages/smash/smash_code/src/crosssections.cc:1545
#14 0x00007fffe1981244 in smash::CrossSections::two_to_two (
--Type <RET> for more, q to quit, c to continue without paging--
    this=0x7fffffffdfc0, included_2to2=std::bitset = {...})
    at JETSCAPE/external_packages/smash/smash_code/src/crosssections.cc:814
#15 0x00007fffe19876b9 in smash::CrossSections::generate_collision_list (this=this@entry=0x7fffffffdfc0, 
    elastic_parameter=elastic_parameter@entry=-1, 
    two_to_one_switch=two_to_one_switch@entry=true, 
    included_2to2=..., 
    included_2to2@entry=std::bitset = {...}, 
    low_snn_cut=low_snn_cut@entry=1.98, 
    strings_switch=strings_switch@entry=true, 
    use_AQM=use_AQM@entry=true, strings_with_probability=true, 
    nnbar_treatment=smash::NNbarTreatment::Strings, 
    string_process=0x5555566dfca0)
    at JETSCAPE/external_packages/smash/smash_code/src/crosssections.cc:168
#16 0x00007fffe1a69e74 in smash::ScatterAction::add_all_scatterings (this=this@entry=0x55555b8614f0, elastic_parameter=-1, 
    two_to_one=<optimized out>, 
    included_2to2=std::bitset = {...}, 
    low_snn_cut=<optimized out>, 
    strings_switch=<optimized out>, use_AQM=<optimized out>, 
    strings_with_probability=<optimized out>, 
    nnbar_treatment=smash::NNbarTreatment::Strings)
    at JETSCAPE/external_packages/smash/smash_code/src/scatteraction.cc:113
#17 0x00007fffe1a7496f in smash::ScatterActionsFinder::check_collision (this=0x5555565c2cc0, data_a=..., data_b=..., 
    dt=<optimized out>, beam_momentum=..., 
    cell_vol=42.040058809083938)
    at JETSCAPE/external_packages/smash/smash_code/src/scatteractionsfinder.cc:388
#18 0x00007fffe1a74d13 in smash::ScatterActionsFinder::find_actions_in_cell (this=0x5555565c2cc0, 
    search_list=std::vector of length 5, capacity 8 = {...}, 
    dt=0.5, cell_vol=42.040058809083938, 
    beam_momentum=std::vector of length 0, capacity 0)
    at JETSCAPE/external_packages/smash/smash_code/src/scatteractionsfinder.cc:422
#19 0x00007fffe20b46ce in smash::Experiment<AfterburnerModus>::run_time_evolution()::{lambda(std::vector<smash::ParticleData, std::allocator<smash::ParticleData> > const&)#1}::operator()(std::vector<smash::ParticleData, std::allocator<smash::ParticleData> > const&) const (
    search_list=std::vector of length 5, capacity 8 = {...}, 
    this=<optimized out>)
    at /usr/include/c++/10.2.0/bits/unique_ptr.h:421
#20 std::__invoke_impl<void, smash::Experiment<AfterburnerModus>::run_time_evolution()::{lambda(std::vector<smash::ParticleData, std::allocator<smash::ParticleData> > const&)#1}&, std::vector<smash::ParticleData, std::allocator<smash::ParticleData> > const&>(std::__invoke_other, smash::Experiment<AfterburnerModus>::run_time_evolution()::{lambda(std::vector<smash::ParticleData, std::allocator<smash::ParticleData> > const&)#1}&, std::vector<smash::ParticleData, std::allocator<smash::ParticleData> > const&) (
    __f=...) at /usr/include/c++/10.2.0/bits/invoke.h:60
#21 std::__invoke_r<void, smash::Experiment<AfterburnerModus>::run_time_evolution()::{lambda(std::vector<smash::ParticleData, std::allocator<smash::ParticleData> > const&)#1}&, std::vector<smash::ParticleData, std::allocator<smash::ParticleData> > const&>(std::__is_invocable&&, (smash::Experiment<AfterburnerModus>::run_time_evolution()::{lambda(std::vector<smash::ParticleData, std::allocator<smash::ParticleData> > const&)#1}&)...) (__fn=...)
    at /usr/include/c++/10.2.0/bits/invoke.h:153
#22 std::_Function_handler<void (std::vector<smash::ParticleData, std::allocator<smash::ParticleData> > const&), smash::Experiment<AfterburnerModus>::run_time_evolution()::{lambda(std::vector<smash::ParticleData, std::allocator<smash::ParticleData> > const&)#1}>::_M_invoke(std::_Any_data const&, std::vector<smash::ParticleData, std::allocator<smash::ParticleData> > const&) (
    __functor=..., 
    __args#0=std::vector of length 5, capacity 8 = {...})
--Type <RET> for more, q to quit, c to continue without paging--
    at /usr/include/c++/10.2.0/bits/std_function.h:291
#23 0x00007fffe1a056f6 in std::function<void (std::vector<smash::ParticleData, std::allocator<smash::ParticleData> > const&)>::operator()(std::vector<smash::ParticleData, std::allocator<smash::ParticleData> > const&) const (
    __args#0=std::vector of length 5, capacity 8 = {...}, 
    this=0x7fffffffe4f0)
    at /usr/include/c++/10.2.0/bits/std_function.h:617
#24 smash::Grid<(smash::GridOptions)0>::iterate_cells(std::function<void (std::vector<smash::ParticleData, std::allocator<smash::ParticleData> > const&)> const&, std::function<void (std::vector<smash::ParticleData, std::allocator<smash::ParticleData> > const&, std::vector<smash::ParticleData, std::allocator<smash::ParticleData> > const&)> const&) const (
    this=this@entry=0x7fffffffe550, search_cell_callback=..., 
    neighbor_cell_callback=...)
    at JETSCAPE/external_packages/smash/smash_code/src/grid.cc:291
#25 0x00007fffe20bfd60 in smash::Experiment<AfterburnerModus>::run_time_evolution (this=0x5555566601e0)
    at /usr/include/c++/10.2.0/bits/std_function.h:87
#26 0x00007fffe20ad7ee in SmashWrapper::ExecuteTask (
    this=0x55555659c770)
    at /usr/include/c++/10.2.0/bits/shared_ptr_base.h:1324
#27 0x00007fffe20235a7 in Jetscape::Afterburner::Exec (
    this=0x55555659c770)
    at JETSCAPE/src/framework/Afterburner.cc:40
#28 0x00007fffe2058f43 in Jetscape::JetScapeTask::ExecuteTasks
    (this=this@entry=0x55555659c620)
    at JETSCAPE/src/framework/JetScapeTask.cc:60
#29 0x00007fffe2044c57 in Jetscape::JetScape::Exec (
    this=0x55555659c620)
    at JETSCAPE/src/framework/JetScape.cc:826
#30 0x00005555555565bb in main (argc=-6128, 
    argv=0x7fffffffe968)
    at JETSCAPE/examples/runJetscape.cc:80

Here's a minimal JETSCAPE config to reproduce. The problem seems to disappear when I remove <TransInputs> section from the Trento configuration. Is this a smash bug or some misconfiguration issue from JETSCAPE side?

<?xml version="1.0"?>
<jetscape>
    <!-- General settings -->
    <nEvents>1</nEvents>
    <setReuseHydro>false</setReuseHydro>
    <outputFilename>out</outputFilename>

    <!-- fix the random seed -->
    <Random>
        <seed>23</seed>
    </Random>

    <!-- Inital State Module  -->
    <IS>
        <!-- Initial condition -->
        <Trento>
            <PhysicsInputs projectile='Pb'
                target='Pb'
                sqrts='5020.'
                cross-section='7.0'
                normalization='18.5'>
            </PhysicsInputs>
            <TransInputs
                reduced-thickness='0.006'
                fluctuation='1.6'
                nucleon-width='0.96'
                nucleon-min-dist='1.28'>
            </TransInputs>
            <CutInputs centrality-low='0'
                centrality-high='60'>
            </CutInputs>
        </Trento>
    </IS>

    <Preequilibrium>
        <NullPreDynamics> </NullPreDynamics>
    </Preequilibrium>

    <!-- Hydro Module -->
    <Hydro>
        <MUSIC>
            <T_dependent_Shear_to_S_ratio>3</T_dependent_Shear_to_S_ratio>
            <eta_over_s_T_kink_in_GeV>0.16</eta_over_s_T_kink_in_GeV>
            <eta_over_s_low_T_slope_in_GeV>0.1</eta_over_s_low_T_slope_in_GeV>
            <eta_over_s_high_T_slope_in_GeV>0.68</eta_over_s_high_T_slope_in_GeV>
            <eta_over_s_at_kink>0.08</eta_over_s_at_kink>
            <temperature_dependent_bulk_viscosity>3</temperature_dependent_bulk_viscosity>
            <zeta_over_s_max>0.1</zeta_over_s_max>
            <zeta_over_s_T_peak_in_GeV>0.16</zeta_over_s_T_peak_in_GeV>
            <zeta_over_s_width_in_GeV>0.01</zeta_over_s_width_in_GeV>
            <zeta_over_s_lambda_asymm>0.0</zeta_over_s_lambda_asymm>
            <Include_second_order_terms>1</Include_second_order_terms>
            <freezeout_temperature>0.152</freezeout_temperature>
        </MUSIC>
    </Hydro>

    <SoftParticlization>
        <iSS>
        <!-- hadron species list  0: PDG 2005; 1: UrQMD; 2: SMASH -->
        <afterburner_type>2</afterburner_type>
        <Perform_resonance_decays>0</Perform_resonance_decays>
        </iSS>
    </SoftParticlization>

    <Afterburner>
        <SMASH>
            <end_time>500.0</end_time>
        </SMASH>
    </Afterburner>
</jetscape>
stdnmr commented 4 years ago

Thanks for the feedback. I mention @doliinychenko here, since he is the one most familiar with using SMASH as part of JETSCAPE and I will also ask around if we have experienced a similar issue before.

doliinychenko commented 4 years ago

Can you please go to SMASH code, JETSCAPE/external_packages/smash/smash_code/src/isoparticletype.cc:324 and print out which resonance is causing the problem?

  if (XS_RK_tabulation_ == nullptr) {
    const auto res = states_[0]->iso_multiplet();
+    std::cout << res->name() << " is causing a problem" << std::endl;
    XS_RK_tabulation_ = &RK_tabulations.at(res->name());
  }

My first impression is that this is about some resonance table mismatch between sampler and SMASH.

doliinychenko commented 4 years ago

Ok, I got "Δ̅ is causing a problem". It is unlikely to be a particle table mismatch. I'm looking into it.

doliinychenko commented 4 years ago

It's not a SMASH problem, it's a problem of the SMASH wrapper in the JETSCAPE. The tabulations are simply not initialized there -- I'm working on it. The wrapper was written for an older SMASH version, where these tabulations were initialized inside SMASH in a different way. Let me fix that. Please open a JETSCAPE issue. This one can be closed.

jaelpark commented 4 years ago

Ok, thanks! I will open an issue there and refer to this one.

doliinychenko commented 4 years ago

I have fixed it in the wrapper. Before it's merged to master you can use the oliiny/fix_smash_wrapper_bug in my fork https://github.com/doliinychenko/JETSCAPE.

Again, the issue can be closed here, as the problem is not SMASH-related.

jaelpark commented 4 years ago

Thanks Dmytro, the problem seems to be solved.

stdnmr commented 4 years ago

Thanks @doliinychenko for taking care of it.