More number of thread = slower #860
-
|
I have installed opengate through
I notice that if I set
What I notice is that it seems more thread lead to the simulation being repeated as if the source Code is quite simple just like this: sim = gate.Simulation()
# Basic simulation configuration
add_materials(sim)
sim.check_volumes_overlap = True
sim.world.size = [WORLD_RADIUS * 2, WORLD_RADIUS * 2, WORLD_DEPTH]
sim.world.material = "Air"
sim.world.color = [1, 0, 1, 1] # invisible
... # adding 8 detector discretion panels with the help of get_grid_repetition and then get_circular_repetition from opengate.geometry.utility
# Simulation parameters
sim.number_of_threads = num_thread
sim.random_seed = 123456
# Visualization (disable for production runs)
sim.visu = visu
# Run parameters (for actual simulation, not just visualization)
# Uncomment and adjust for production:
sim.run_timing_intervals = [(0, sim_time * sec)] # 1 second acquisition
# sim.number_of_events = 1e4 # Number of primary particles
print("\nStarting simulation...")
print("Close visualization window to end.")
sim.run()
print("Simulation complete!")I am using v10.0.2 as I can't build the core for 10.0.3 |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
|
yes you should divide the activity or the number of events by number_of_threads ;) |
Beta Was this translation helpful? Give feedback.
-
|
Hello @alabamagan To complete, if your computer has only 12 cores, when your run 48 threads, the processor need to wait the 12 firsts threads finished to run the following. It explains the growth of run-time in your question. Another question, you install opengate using pip but I do not understand why you "can't build the core for 10.0.3" |
Beta Was this translation helpful? Give feedback.
-
|
Thank you for the report. pip install opengate==10.0.3 does not work in your case because I can see you use Linux x64 with python 3.11 and gcc 9.4.0. Because we use Qt6, we need to have a quite recent version of gcc, gcc 14 in our case. |
Beta Was this translation helpful? Give feedback.
yes you should divide the activity or the number of events by number_of_threads ;)
Note that the speedup due to MT is not always linear, it depends on the actors. Moreover, it is not very efficient when multiple runs are used (which does not seems the case here).