Open main menu

CDOT Wiki β

Changes

Savy Cat

730 bytes added, 19:18, 27 March 2018
Rotate90
==== Profiling Using gprof ====
In order to get performance information using gprof, copy the CImg folder containing all source files to matrix. Update Rotate.h to use a relative path: #include "CImg-2.2.1/CImg.h". CImg is a built to be cross-platform library and should work as is.
To get the libjpeg library file (libjpeg.a), download the Unix formatted package jpegsrc.v9c.tar.gz [http://www.ijg.org/ from their homepage] and copy this to matrix. To extract the contents, issue the command:
This compiles files within the source folder.
Finally, run the following, which will put the files our project needs libjpeg.a into the jpeg-build folder we created:jpeg-build/lib/
make install
 
Now, build the Rotate source for profiling, linking libjpeg.a and X11 resources required for CImg Display functionality in a Unix environment. This prevents any errors during compilation, however, if we call the CImg display function, matrix will throw a run-time error of "Failed to open X11 display". I created the following makefile:
 
<nowiki>
# Makefile for CImg-Rotate
#
GCC_VERSION = 7.2.0
PREFIX = /usr/local/gcc/${GCC_VERSION}/bin/
CC = ${PREFIX}gcc
CPP = ${PREFIX}g++
 
Rotate: Rotate.o
$(CPP) -pg -oRotate90 Rotate.o -L/usr/X11R6/lib -lm -lpthread -lX11 -l:libjpeg.a
 
Rotate.o: Rotate.cpp
$(CPP) -c -O2 -g -pg -std=c++17 Rotate.cpp
 
clean:
rm *.o</nowiki>
=== Assignment 2 ===
=== Assignment 3 ===
93
edits