MATPOWER EXERCISE
Introduction
• This exercise looks at analysing some simple fortran codes
Copyright By PowCoder代写 加微信 powcoder
• Download matpower_cirrus.tar from learn
• Extract with tar xvf matpower_cirrus.tar
• Load the compilers module load intel-compilers-19 • Build using make
• Aims are
• Simple program analysis
• Look at impact on input dependence • Look at impact of libraries
• Look at impact of algorithms
Profiling using gprof
• gprof is a fairly ubiquitous unix profiling tool • Compile and link with –pg
• Compiler adds instrumentation to count routine entry/exit • Only applies to routines compiled with –pg not libraries.
• Adds profiling thread
• Program interrupted at regular intervals and program counter is
• Used to generate fraction of time spent in each routine
• Only statistical sampling short running routines may not be sampled
• Results written to gmon.out when program exits
• Disable compiler optimisation with –O0
• gprof reports data by subroutine
• The same program is small enough for the compiler to fully in- line.
Generating gprof report
• Generate a gprof report by running
• gprof
• Generates text report with number of routine calls • Also % of time in each routine
Programs to analyse
• Makefile generates 3 programs • matpower
• blas_matpower
• Each program does the same job
• Generates an internal matrix (Nside x Nside)
• Raises it to a power (read from a file called input)
• matpower and naive use different algorithms
• The blas_matpower program uses the BLAS library for matrix multiply but the same algorithm as matpower
Input datasets
• Two standard data-sets • Input and Input2
• Use matpower to investigate these.
• Compare the profiles generated by each input-
• Are the same routines critical in each case
• Compare the performance of matpower and blas_matpower
• Note that some compilers are capable of recognising matrix-multiply in source code and substituting a library call but we have turned off optimisation here.
Algorithms
• The naïve program implements a simpler algorithm • Matrix is just multiplied by itself n times.
• Compare the performance of matpower and naïve.
• Use the “small” input datasets so naïve completes in reasonable time.
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com