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

Optimise density_species_interp.py #115

Open
EvgeniiChaikin opened this issue Apr 9, 2021 · 4 comments
Open

Optimise density_species_interp.py #115

EvgeniiChaikin opened this issue Apr 9, 2021 · 4 comments

Comments

@EvgeniiChaikin
Copy link
Collaborator

Find a way to optimise the interpolation routine in density_species_interp.py

Currently, density_species_interp.py is the bottleneck

Script Run Time Statistics: 

Script name                               Run time (s)        Fraction of total CPU time
------------------------------------------------------------------------
density_temperature.py                    18.3012             0.009700  
density_temperature_sf_fraction.py        20.7434             0.010994  
density_temperature_metals.py             25.4663             0.013498  
density_temperature_dust.py               40.7885             0.021619  
density_temperature_dust_to_metals.py     35.5253             0.018829  
density_temperature_dust2metal.py         41.0889             0.021778  
density_internal_energy.py                16.4127             0.008699  
density_pressure.py                       17.0309             0.009027  
star_formation_history.py                 35.9841             0.019072  
stellar_mass_evolution.py                 7.0260              0.003724  
HI_mass_evolution.py                      5.7964              0.003072  
H2_mass_evolution.py                      5.6906              0.003016  
metallicity_distribution.py               11.6134             0.006155  
birth_density_distribution.py             6.6986              0.003550  
birth_density_metallicity.py              6.5353              0.003464  
birth_density_redshift.py                 6.3443              0.003363  
birth_metallicity_redshift.py             6.5139              0.003452  
last_SNII_density_distribution.py         9.6353              0.005107  
last_AGN_density_distribution.py          5.5164              0.002924  
gas_metallicity_evolution.py              6.6609              0.003530  
star_metallicity_evolution.py             6.4554              0.003421  
bh_metallicity_evolution.py               6.1238              0.003246  
bh_accretion_evolution.py                 6.6231              0.003510  
bh_mass_evolution.py                      5.5655              0.002950  
bh_masses.py                              6.5402              0.003466  
gas_masses.py                             7.3999              0.003922  
gas_smoothing_lengths.py                  9.0595              0.004802  
number_of_agn_thermal_injections.py       6.1583              0.003264  
max_temperatures.py                       8.6471              0.004583  
max_temperature_redshift.py               14.1719             0.007511  
particle_updates_step_cost.py             42.7715             0.022670  
wallclock_simulation_time.py              43.4664             0.023038  
wallclock_number_of_steps.py              42.9072             0.022742  
simulation_time_number_of_steps.py        41.7301             0.022118  
wallclock_timebin_hist.py                 42.7672             0.022667  
density_temperature_species.py            45.5940             0.024166  
density_species_interp.py                 1210.8607           0.641778  
last_SNII_kick_velocity_distribution.py   5.3379              0.002829  
max_SNII_kick_velocities.py               5.1766              0.002744  
Wallclock time                            1226.7246           0.650186  
Total CPU time                            1886.7285           1.000000 
@james-trayford
Copy link
Collaborator

james-trayford commented Apr 9, 2021

I think we can improve this lots, as @JBorrow indicated swiftsimio should be able to read the new fields made by the pre-processing, and the table dust masses are now computed with interpolation in my latest PR on the colibre code. However the pre processing needs to produce the hdf5 fields in a friendly format, I'm guessing with appropriate units etc, and this is not done yet afaik. Can't imagine It's too much work, but haven't looked at it yet because we were trying to get other things working. Without interpolation it should be as fast as any other script.

There's also a short-term fix that may improve things a bit - we don't need to interpolate elements that are not depleted and these are just big zero array slices in the table. so inserting

        for i in range(df.shape[-1]):
            if df[:, :, :, :, i].max() == 0.0:
                continue

to replace:
https://github.com/SWIFTSIM/pipeline-configs/blob/master/colibre/scripts/density_species_interp.py#L95

will help.

@james-trayford
Copy link
Collaborator

@EvgeniiChaikin are the autoplotter scripts also parallelised?

@EvgeniiChaikin
Copy link
Collaborator Author

Thanks James! I will later have a look.

No, autoplotter is not currently parallelised, but this is OK I guess. Although it makes about 150 plots it is generally very fast (\sim 2 mins).

@JBorrow
Copy link
Member

JBorrow commented Apr 14, 2021

Let me know if there's anything specific I can help with here. Just putting this script at the TOP of the pipeline will do a lot of good, as that makes sure it starts first and everything else gets scheduled around it.

robjmcgibbon pushed a commit that referenced this issue Mar 6, 2024
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

No branches or pull requests

3 participants