SIParCS 2017-Supreeth Suresh
Vectorizing and Parallelizing NCL Routines for Improved Performance
NCAR Command Language (NCL) is an interpreted language designed for scientific data analysis and visualization. NCL includes numerical analysis functions that are portable, robust, and free. WRF-python is a collection of diagnostic calculations, interpolation routines, and utilities to help users plot WRF-ARW data. Based on user feedback, and to help them visualize their data more effectively, we selected two routines to optimize. The first routine calculates Convective Available Potential Energy (CAPE) and Convective Inhibition (CIN), which are both important for forecasting storms. The second routine is GCINOUT, which determines if a list of specified points are inside or outside spherical lat/lon polygon(s). We implemented numerous optimization techniques: set appropriate compiler flags, removed variable dependencies, changed the array access pattern for several arrays, converted a linear search to binary search, converted a scalar function to vector function, and removed duplicate numerical calculations. We then optimized the code for single-threaded performance, multi-threaded (OpenMP) performance, and ported the code to GPU (OpenACC). Compared to the original code, we achieved an approximately 2x performance improvement with single-threaded code and approximately 17x with multi-threaded code. In NCL, there are around 400 other numerical routines that can be rewritten in Fortran 90 and optimized for better performance.
Mentors: Bill Ladwig, Rick Brownrigg