Photo by Wes Walker on Unsplash
Teaching Users How to Fish with Remora
Gone Fishing
Without a clear understanding of what your application is doing, improving performance becomes extremely challenging. Optimization can feel like a "ready, fire, aim" process driven mostly by experience or scattered advice. Fortunately, there are systematic ways to begin this journey. As the King said in Alice's Adventures in Wonderland , "Begin at the beginning."
Timers
One of the simplest and most effective ways to understand how your code behaves is through timers – functions that return either the current time or the elapsed time since it was last called. This approach works well for serial applications, including those accelerated with GPUs, because it allows you to measure execution time for specific regions of code and determine whether changes you make result in actual improvements.
Parallel applications introduce more complexity. Measuring total runtime doesn't reveal how individual functions behave internally. However, if your application is structured with a serial main routine that executes several ordered steps, each containing a parallel region, you can measure the time required for all parallel processes to complete each step, which yields more detailed insights into performance within the larger application workflow. The pseudocode in Listing 1 is not parallel, but it has parallel processes to complete tasks within a serial framework.
Listing 1
Structured Main Routine
Step 1: |-> Run in parallel Step 1 Parallel portion completes. Do some single thread computations. Step 2: |-> Run in parallel Step 2 Parallel portion complete. Do some single thread computations. ...
With this type of code, you can collect
...Buy this article as PDF
(incl. VAT)
Buy ADMIN Magazine
Subscribe to our ADMIN Newsletters
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Most Popular
Support Our Work
ADMIN content is made possible with support from readers like you. Please consider contributing when you've found an article to be beneficial.

