Why Is My Python Script So Slow? (and a few solutions to speed it up)

March 27, 2024 | 1:00pm - 2:30pm CT

About the Webinar

Python is a popular programming language in natural hazards engineering research because it is free and open-source, and has a plethora of powerful packages for handling our community’s computing needs. However, Python is an interpreted language and is inherently slower and less efficient than compiled languages like Fortran, C, and C++. As a result, many scripts written in Python, particularly those involving loops, can run significantly faster with a few minor modifications.

This webinar will demonstrate how vectorized calculations using Numpy arrays are significantly faster than the same operations coded in Python. We will demonstrate how to use just in time (JIT) compilation and JAX (Numpy on steroids) to accelerate Python, particularly using GPU’s. Demonstrations will directly access DesignSafe published datasets.

Presenters

Krishna Kumar is an Assistant Professor at the Civil, Architecture, and Environmental Engineering at the University of Texas at Austin. Krishna completed his Ph.D. from the University of Cambridge in January 2015 on multi-scale multiphase modeling of granular flows. Krishnas work involves developing exascale micro and macro-scale numerical methods: Material Point Method, Lattice Boltzmann - Discrete Element coupling, Finite Element Method, and Lattice Element method. His work in high-performance computing in geomechanics provides insights into the mechanics of natural hazards such as landslides. Krishna uses Machine Learning (ML) to model multi-scale problems in geomechanics. Krishna is a Software Sustainability Institute Fellow, UK, and has developed many open-source research codes. Krishna also builds large-scale graph networks and agent-based models for simulating the resilience of city-scale infrastructure systems.

Scott J. Brandenberg is a Professor in the Department of Civil and Environmental Engineering at the University of California, Los Angeles. Scott completed his Ph.D. from the University of California, Davis in 2005 on the behavior of pile foundations exposed to liquefaction-induced lateral spreading and was supervised by Ross Boulanger and Bruce Kutter. Scott is a co-PI on the DesignSafe project and his work involves geotechnical earthquake engineering, including evaluation of liquefaction, earthquake ground motions, site response, and the reliability of spatially distributed infrastructure systems such as levees. He is also interested in developing relational databases and application programming interfaces to democratize data. He served as the Associate Dean for Diversity and Inclusion for the UCLA Samueli School of Engineering from 2017-2021.

Webinar Registration