GSoC:Fix vpacket energy histogram race condition in prange loop#3424
GSoC:Fix vpacket energy histogram race condition in prange loop#3424remo-lab wants to merge 1 commit intotardis-sn:masterfrom
Conversation
tardis-bot
left a comment
There was a problem hiding this comment.
👋 Welcome @remo-lab! Thank you for your first contribution to this repository!
Before asking for reviews, please fill out the PR description template and ensure that all checks are passing.
If you are applying to GSoC, please read our AI Usage Policy and make sure to add GSoC to the PR title like so:
GSoC: <title of your pull request>
Please mark the pull request as draft if you are not ready for review yet or if there are things you will be adding.
|
*beep* *bop* Hi, human. I'm the @tardis-bot and couldn't find your records in my database. I think we don't know each other, or you changed your credentials recently. Please add your name and email to In case you need to map an existing alias, follow this example. |
|
*beep* *bop* Hi, human. I'm the @tardis-bot and I noticed that your email is not associated with an ORCID ID in our database. Please add your email and ORCID ID to the If you don't have an ORCID ID yet, you can create one for free at orcid.org. ORCID IDs help ensure you get proper credit for your scientific contributions. The format should be: |
|
*beep* *bop* Details805 [ ] syntax-error
8 G004 [ ] logging-f-string
6 I001 [*] unsorted-imports
5 F401 [*] unused-import
4 E902 [ ] io-error
3 W291 [ ] trailing-whitespace
3 F821 [ ] undefined-name
3 RET505 [*] superfluous-else-return
2 UP006 [*] non-pep585-annotation
2 UP035 [ ] deprecated-import
1 E701 [ ] multiple-statements-on-one-line-colon
1 W293 [*] blank-line-with-whitespace
1 B017 [ ] assert-raises-exception
1 F811 [ ] redefined-while-unused
1 INP001 [ ] implicit-namespace-package
1 PIE804 [*] unnecessary-dict-kwargs
1 RET506 [*] superfluous-else-raise
1 RUF021 [*] parenthesize-chained-operators
1 UP032 [*] f-string
Found 850 errors.
[*] 23 fixable with the `--fix` option.
Complete output(might be large): Detailstardis/energy_input/tests/test_gamma_ray_packet_source_minimal.py:3:1: I001 [*] Import block is un-sorted or un-formatted
tardis/energy_input/tests/test_gamma_ray_packet_source_minimal.py:5:17: F401 [*] `numpy` imported but unused
tardis/io/configuration/config_reader.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/io/configuration/config_reader.py:54:29: G004 Logging statement uses f-string
tardis/io/configuration/config_reader.py:118:9: RET505 [*] Unnecessary `else` after `return` statement
tardis/io/configuration/config_reader.py:142:13: RET505 [*] Unnecessary `else` after `return` statement
tardis/io/configuration/config_reader.py:219:29: G004 Logging statement uses f-string
tardis/io/model/csvy/__init__.py:1:1: E902 No such file or directory (os error 2)
tardis/io/model/csvy/data.py:1:1: E902 No such file or directory (os error 2)
tardis/io/model/csvy/readers.py:1:1: E902 No such file or directory (os error 2)
tardis/io/model/parse_density_configuration.py:2:1: UP035 `typing.Tuple` is deprecated, use `tuple` instead
tardis/io/model/parse_density_configuration.py:20:6: UP006 [*] Use `tuple` instead of `Tuple` for type annotation
tardis/io/model/parse_mass_fraction_configuration.py:4:25: F401 [*] `astropy.units` imported but unused
tardis/io/model/parse_radiation_field_configuration.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/io/model/readers/generic_readers.py:1:1: UP035 `typing.Tuple` is deprecated, use `tuple` instead
tardis/io/model/readers/generic_readers.py:20:6: UP006 [*] Use `tuple` instead of `Tuple` for type annotation
tardis/io/model/readers/generic_readers.py:51:72: W291 [*] Trailing whitespace
tardis/io/model/readers/tests/test_csvy_reader.py:1:1: INP001 File `tardis/io/model/readers/tests/test_csvy_reader.py` is part of an implicit namespace package. Add an `__init__.py`.
tardis/io/model/readers/tests/test_csvy_reader.py:47:10: B017 Do not assert blind exception: `Exception`
tardis/model/base.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/model/base.py:368:21: G004 Logging statement uses f-string
tardis/transport/montecarlo/montecarlo_main_loop.py:9:55: F401 [*] `tardis.transport.montecarlo.configuration.montecarlo_globals` imported but unused
tardis/transport/montecarlo/montecarlo_main_loop.py:20:5: F401 [*] `tardis.transport.montecarlo.packets.packet_collections.initialize_last_interaction_tracker` imported but unused
tardis/transport/montecarlo/montecarlo_main_loop.py:170:1: W293 [*] Blank line contains whitespace
tardis/visualization/widgets/custom_abundance.py:3:1: I001 [*] Import block is un-sorted or un-formatted
tardis/visualization/widgets/custom_abundance.py:741:16: RUF021 [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
tardis/visualization/widgets/custom_abundance.py:1131:9: RET505 [*] Unnecessary `else` after `return` statement
tardis/visualization/widgets/custom_abundance.py:1422:9: RET506 [*] Unnecessary `else` after `raise` statement
tardis/visualization/widgets/custom_abundance.py:1725:9: F811 Redefinition of unused `input_d_time_0_eventhandler` from line 1714
tardis/visualization/widgets/custom_abundance.py:1755:13: F821 Undefined name `display`
tardis/visualization/widgets/custom_abundance.py:1757:13: F821 Undefined name `display`
tardis/visualization/widgets/custom_abundance.py:1759:13: F821 Undefined name `display`
tardis/workflows/simple_tardis_workflow.py:269:17: G004 Logging statement uses f-string
tardis/workflows/simple_tardis_workflow.py:525:17: G004 Logging statement uses f-string
tardis/workflows/type_iip_workflow.py:155:13: PIE804 [*] Unnecessary `dict` kwargs
tardis/workflows/type_iip_workflow.py:357:13: G004 Logging statement uses f-string
tardis/workflows/type_iip_workflow.py:411:17: G004 Logging statement uses f-string
tardis/workflows/type_iip_workflow.py:518:15: UP032 [*] Use f-string instead of `format` call
tardis/workflows/type_iip_workflow.py:883:17: G004 Logging statement uses f-string
Found 39 errors.
[*] 20 fixable with the `--fix` option.
|
|
Hi @atharva-2001 @wkerzendorf , I think I found a race condition in the montecarlo loop where virtual packet energies weren't being accumulated correctly in multi-threaded runs. I moved the histogram binning outside the prange loop . would appreciate a review whenever you have time! |
|
Hi, please read the instructions mentioned here- https://tardis-sn.github.io/summer_of_code/pr_checklist/ |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3424 +/- ##
==========================================
- Coverage 70.73% 70.53% -0.21%
==========================================
Files 213 213
Lines 17259 17261 +2
==========================================
- Hits 12209 12175 -34
- Misses 5050 5086 +36 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
dd02768 to
ba351bd
Compare
|
*beep* *bop* Hi, human. I'm the @tardis-bot and couldn't find your records in my database. I think we don't know each other, or you changed your credentials recently. Please add your name and email to In case you need to map an existing alias, follow this example. |
Signed-off-by: remo-lab <remopanda7@gmail.com>
ba351bd to
3c550f9
Compare
📝 Description
Type: 🪲
bugfixSummary: Fixed race condition in virtual packet energy histogram accumulation inside
prangeparallel loop. The+=operation on shared arrayv_packets_energy_histcaused non-deterministic energy loss scaling with thread count. Moved histogram binning to sequential post-processing loop.Impact: Multi-threaded virtual packet spectra were systematically low in luminosity. Now matches single-threaded results.
🚦 Testing
☑️ Checklist
build_docslabel