This tweet made the rounds in late September, early October. Those new to OpenSeesPy, or unaware of how it works, might have been alarmed. I’m here to reassure you that OpenSeesPy is not a huge CO2 producer like native Python code.
OpenSeesPy is C++ code that calls the Python C/C++ API so that you can build and analyze OpenSees models in a Python script. The computational engine of the OpenSees framework is written in C++ and FORTRAN. So, all the finite element state determination, assembly, iterating, solving, and time stepping is fast–and light on the CO2.
Although the graph in the tweet is based on astronomy simulations, the trend carries over to finite element analysis. I’ve seen and run structural FEA code written in native Python, and it is brutally slow. But, the comparisons of Python with C++ or FORTRAN for number crunching are unfair because Python is interpreted while C++ and FORTRAN are compiled.
Of course, what you do in your Python scripts, e.g., with numpy
, pandas
, TensorFlow
, etc., after you import openseespy.opensees
can lead to larger amounts of CO2 production. But you have to weigh that against the CO2 footprint associated with prolonged development time when not using all those nice Python packages.
By the way, where’s Tcl on that graph? Although it has other strengths, for number crunching, native Tcl has to be way worse than native Python.
Thank you for the clarification. I was wondering why Opensees wasn’t developed in C++, but this is even better.
LikeLike
You’re welcome. To clarify, the core computations of OpenSees *are* written in C++.
LikeLike
I see. So analysis time of OpenSees model written in Tcl and Python script should be similar since both are computed in C++?
LikeLike