Building with the Intel optimizing compiler (icc)

Add any particular hints or tricks you have found to help with your ZoneMinder experience.
Post Reply
nosyneighbor
Posts: 1
Joined: Mon Jun 22, 2009 12:18 am

Building with the Intel optimizing compiler (icc)

Post by nosyneighbor »

Here is my setup:

2x Panasonic IP cameras, 5fps, 640x480, JPEG
Intel Q6600 (quad core)
Ubuntu 8.04, 64-bit

I rebuilt libjpeg and zoneminder using the Intel compiler (icc/icpc). This reduced my total zma "top" CPU utilization from 30% to 17%. I am posting the procedure here in the hopes that it will be useful to other ZM users.


icc download here (NON COMMERCIAL USE ONLY):

https://registrationcenter.intel.com/Re ... NCOM&lang=
or: http://software.intel.com/en-us/article ... velopment/

For commercial use, you need to buy a license. (It is probably cheaper just to upgrade your PC. Not that Intel cares; they get your money either way.)

You can install as an ordinary user if you want. Beware: the installer tries to dump a couple gigs of stuff in /tmp . Very rude.

I installed to /opt/intel/Compiler/11.0/ . You cannot (easily) move it around after installation, because it writes some paths into the shell scripts.


Rebuild libjpeg62 with icc:

apt-get source libjpeg62
cd libjpeg6b-6b

Edit debian/rules:

was: CFLAGS += -O2
now: CFLAGS += -O2 -xHOST -ip -fno-builtin

Edit makefile.cfg:

was: LIBTOOL = @LIBTOOL@
now: LIBTOOL = @LIBTOOL@ --tag=foo

Next steps:

source /opt/intel/Compiler/11.0/bin/iccvars.sh intel64
CC=icc fakeroot debian/rules binary
cd ..


Rebuild zoneminder with icc:

apt-get source zoneminder
cd zoneminder-1.22.3

Edit src/zm_jpeg.c:jpeg_mem_src() for const correctness:

was: src->inbuffer = inbuffer;
now: src->inbuffer = (JOCTET *)inbuffer;

Add after unistd.h at the top: #include <stdlib>

Edit debian/rules:

was: CFLAGS += -O2
now: CFLAGS += -O2 -xHOST -ip

Next steps:

source /opt/intel/Compiler/11.0/bin/iccvars.sh intel64
CC=icc CXX=icpc fakeroot debian/rules binary
cd ..


Install the new deb's (dpkg -i *.deb) and you should be good to go.

Notes:

-xHOST uses the fastest ISA available for the system you are running on. i.e. my binaries probably will not run at all on an older CPU, and will not be optimal on a newer CPU. So you are best off building them from source on your system.

You will need to install a whole bunch of development packages to do the build. Off the top of my head:

ia32-libs (for icc)
debhelper
dh-make
libpcre3-dev
libavfomat-dev
libavcodec-dev
libavutil-dev
libmime-lite-perl
libgnutls-dev
libmysqlclient15-dev

Most of these are mandatory (configure will halt if they are missing). A few are optional (libav*) or have highly annoying side effects if they are missing (libpcre3).
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Thanks for this. This would be a good post to put in the Wiki if you have the time (and the inclination).
Phil
coke
Posts: 518
Joined: Wed Jan 30, 2008 5:53 pm
Location: St. Louis, MO, USA

Post by coke »

Has anyone tried this with a more recent version, say 1.24.2? Also, I found 1.24.2 wouldn't complile with libjpeg6, had to bump it up to 7.

Theoretically I installed the intel compiler, but compliation's not my strong point. Do I need to rerun configure? The instructions in the post seemed to indicate it was going to give me .deb's when it was done, but I can't seem to locate "debian/rules" to edit in intel's stuff or ZoneMinders.

I'm starting to push the boundaries of this machine, so any tweaks would be nice, and I have a feeling the core 2 quad could benefit from intel's compiler.
Post Reply