Education and Outreach Blog

« Back

HPC UNIVERSITY BI-WEEKLY CHALLENGE SOLUTION – GNU gprof for Ideal Gas

Solution for the week of February 16, 2015:

To disable the pictures of the flasks, the line to comment out or remove is line 38 in simulation.c.

The -pg flag can be added to the CFLAGS line in the Makefile to enable compiling for gprof.

Compiling uses the same commands as usual:
"make" to create the object files and executable file
"make clean" to remove the object files and executable file

The command to generate a gmon.out is:
./ideal-gas

To run gprof with the gmon.out file, use the following command:
gprof ideal-gas gmon.out

This reveals that the function taking the longest time is calculateAndPrintSimulationProperties(). This function would be a candidate for parallelism.

 

http://hpcuniversity.org/students/weeklyChallenge/92

Comments
Trackback URL: