1\newpage
2\chapter{Installation}
3\label{chapter:installation}
4\setcounter{footnote}{0}
5
6Choose one of the following three sections depending on whether you
7want to install a precompiled HMMER package for your system, compile
8from our source code
9distribution,\sidenote{\href{http://hmmer.org}{hmmer.org}} or compile
10source code from our github
11repository.\sidenote{\href{https://github.com/EddyRivasLab/hmmer}{github.com/EddyRivasLab/hmmer}}
12We recommend that you use one of the first two options.  You can
13skip the gory details section unless you're already proficient and you
14want to use optional configuration or installation parameters.
15
16
17\section{Quickest: install a precompiled binary package}
18
19The easiest way to install HMMER is to install a precompiled package
20for your operating system.\sidenote{Thanks to all the people who do
21  the packaging!}
22Some examples that I know of:
23
24\vspace{1ex}
25\begin{tabular}{ll}
26 \monob{\% brew install hmmer}  & \mono{\# OS/X, HomeBrew}    \\
27 \monob{\% port install hmmer}  & \mono{\# OS/X, MacPorts}    \\
28 \monob{\% apt install hmmer}   & \mono{\# Linux (Ubuntu, Debian...)} \\
29 \monob{\% dnf install hmmer}   & \mono{\# Linux (Fedora)} \\
30 \monob{\% yum install hmmer}   & \mono{\# Linux (older Fedora)} \\
31 \monob{\% conda install -c biocore hmmer} & \mono{\# Anaconda} \\
32\end{tabular}
33
34\section{Quick-ish: compile the source code}
35
36You can obtain the source code as a compressed \mono{.tar.gz} tarball
37from \href{http://hmmer.org}{hmmer.org} in your browser, or you can also
38\mono{wget} it on the command line from
39\href{http://eddylab.org/software/hmmer/hmmer-\HMMERversion{}.tar.gz}{eddylab.org/software/hmmer/hmmer-\HMMERversion{}.tar.gz}.
40Uncompress and untar it, and switch into the \mono{hmmer-\HMMERversion{}}
41directory.  For example:
42
43  \vspace{1ex}
44  \user{\% wget http://eddylab.org/software/hmmer/hmmer-\HMMERversion{}.tar.gz}\\
45  \user{\% tar xf hmmer-\HMMERversion{}.tar.gz}\\
46  \user{\% cd hmmer-\HMMERversion{}}
47  \vspace{1ex}
48
49To compile:
50
51  \vspace{1ex}
52  \user{\% ./configure}\\
53  \user{\% make}
54  \vspace{1ex}
55
56Optionally, to compile and run a test suite\sidenote{The test suite
57  uses scripts, and requires that you have \mono{python3} and
58  \mono{perl}. We haven't encountered any systems without perl.  If
59  you don't have \mono{python3}, \mono{make check} will fail and tell
60  you so. But HMMER is still fine, and you can install it -- running
61  the test suite is optional!}:
62
63  \vspace{1ex}
64  \user{\% make check}
65  \vspace{1ex}
66
67The newly compiled binaries are now in the \mono{src} directory.  You
68can run them from there, or manually copy them wherever.  You don't
69have to install HMMER programs to run them. Optionally, to install the
70programs and man pages in standard locations on your system, do:
71
72  \vspace{1ex}
73  \user{\% make install}
74  \vspace{1ex}
75
76By default, programs are installed in \mono{/usr/local/bin} and man
77pages in \mono{/usr/local/share/man/man1/}. You may need root
78privileges to do this, so you might need something like \mono{sudo
79  make install}.
80
81You can change the \mono{/usr/local} prefix to any directory you want
82when you do the \mono{./configure} step, using the \mono{./configure
83  {-}{-}prefix} option, as in \mono{./configure {-}{-}prefix
84  /the/directory/you/want}. For example, you might do
85\mono{./configure {-}{-}prefix=\$\{HOME\}}, for installation in
86\mono{bin/} and \mono{share/man/man1} subdirectories in your own home
87directory.
88
89Optionally, you can also install a set of additional small tools
90(``miniapps'') from our Easel library.  We don't do this by default,
91in case you already have a copy of Easel separately installed (from
92Infernal, for example). To install Easel miniapps and their man pages
93too:
94
95  \vspace{1ex}
96  \user{\% cd easel; make install}
97  \vspace{1ex}
98
99If you decide you did something wrong after the \mono{./configure},
100\mono{make distclean} will clean up everything that got built and
101restore the distribution to a pristine state, and you can start again.
102
103
104\section{Geeky: compile source from our github repository}
105
106Alternatively, you can clone our git repository master
107branch:\sidenote{As of 3.2, our git master branch is the stable
108  current release, as the git deities prefer. This wasn't true for us
109  in the past.}
110
111  \vspace{1ex}
112  \user{\% git clone https://github.com/EddyRivasLab/hmmer hmmer-\HMMERversion{}} \\
113  \user{\% cd hmmer-\HMMERversion{}} \\
114  \user{\% git clone https://github.com/EddyRivasLab/easel } \\
115  \user{\% autoconf }
116  \vspace{1ex}
117
118This is now essentially the same as if you unpacked a tarball, so from
119here, follow the \mono{./configure; make} instructions above.
120
121One difference is that our distribution tarballs include this user
122guide as a PDF, in addition to its \LaTeX\ source code. The github
123repo only has the source \LaTeX\ files. To compile the PDF, see
124``compiling the user guide'' in the gory details below.
125
126You need our Easel library, in addition to the HMMER repository. We
127don't guarantee that the two master branches are necessarily
128compatible at all times. It's possible that the Easel master branch
129has advanced in support of an Infernal release, for example. You might
130have to check out the Easel tag that corresponds to the more recent
131stable HMMER release. These Easel tags end in ``h'': for example,
132\mono{easel-0.45h}.
133
134If you want to suggest changes to us by submitting a pull request on
135GitHub, please base your changes against our \mono{develop} branches.
136Our master branches are for stable releases.
137
138
139
140\section{Gory details}
141
142\subsection{System requirements}
143
144\paragraph{Operating system:} HMMER is designed for
145POSIX-compatible platforms, including UNIX, Linux, and Mac OS/X. The
146POSIX standard essentially includes all operating systems except
147Microsoft Windows.\sidenote{Windows 10 includes a Linux subsystem that
148  allows you to install a Linux OS inside Windows, with a bash command
149  shell, and this should work fine. For older Windows, there are
150  add-on products available for making Windows more POSIX-compliant
151  and more compatible with GNU-ish configures and builds. One such
152  product is Cygwin, \href{http://www.cygwin.com}{www.cygwin.com},
153  which is freely available.}  We develop primarily on Apple OS/X and
154x86\_64/Linux (both Intel and AMD), and we test releases on a wider
155range of platforms.\sidenote{Thanks to the GCC Compile Farm Project,
156  especially its Toulouse and Oregon data centers, for providing
157  access to some of the platforms that we use for testing.}
158
159
160\paragraph{Processor:} HMMER depends on vector parallelization methods
161that are processor-specific. H3 requires either an x86-compatible
162(Intel/AMD) processor that supports the SSE2 vector instruction set,
163and on 32-bit ``powerpc'' or 64-bit ``ppc64'' PowerPC systems that
164support the Altivec/VMX instruction set in big-endian mode.
165
166SSE2 is supported on Intel processors from Pentium 4 on, and AMD
167processors from K8 (Athlon 64) on. This includes almost all Intel
168processors since 2000 and AMD processors since 2003.
169
170Altivec/VMX is supported on Motorola G4, IBM G5, and IBM PowerPC
171processors starting with the Power6, which includes almost all
172PowerPC-based desktop systems since 1999 and servers since
1732007.\sidenote{If your platform does not support either of these
174  vector instruction sets -- or if you're on a ppc64le system that
175  supports VMX but in little-endian byte order -- the configure script
176  will stop with an error message.}
177
178HMMER3 does not support little-endian PowerPC systems (ppc64le). Alas,
179the PowerPC world has been moving toward little-endian ppc64le, away
180from big-endian ppc64 and powerpc. H3's VMX implementation was
181originally developed on an AIX Power 7 system, and Power 7 systems
182were big-endian. More recent Power 8 and 9 machines are ``bi-endian'',
183bootable into either a big-endian or little-endian system. IBM has
184stated that it really, really wants them to all be in little-endian
185mode. Among common Linux/PowerPC distros, Debian, Fedora, Red Hat, and
186openSUSE still come in either ppc64 and ppc64le flavors; HMMER3 will
187run on the former but not the latter. Recent Ubuntu and SUSE for
188PowerPC distros are only coming in ppc64le flavor, incompatible with
189H3.
190
191\paragraph{Compiler:} The source code conforms to ANSI
192C99 and POSIX standards. It should compile with any ANSI C99 compliant
193compiler, including the freely available GNU C compiler \mono{gcc}.
194We test the code most frequently using the GNU \mono{gcc}, Apple
195\mono{llvm/clang}, and Intel \mono{icc} compilers.\sidenote{On OS/X,
196  if you're compiling the source, make sure you have XCode installed
197  so that you have a C compiler.}
198
199
200\paragraph{Libraries and other installation requirements:}
201HMMER3 does not have any dependencies other than a C compiler.  It
202does not require any additional libraries to be installed by you,
203other than standard ANSI C99 libraries that are already present on a
204system with a C99 compiler.
205
206The HMMER distribution is bundled with a software library from our lab
207called Easel.\sidenote{\href{http://bioeasel.org}{bioeasel.org}}
208Bundling Easel instead of making it a separate installation
209requirement simplifies installation. Easel is also included in other
210software from our lab. For example,
211Infernal\sidenote{\href{http://eddylab.org/infernal}{eddylab.org/infernal}}
212bundles both HMMER and Easel. If you install the Easel miniapps, you
213probably only want to do that once, from the most recent version of
214HMMER, Infernal, or Easel itself, to avoid clobbering a newer version
215with an older one.
216
217Our configuration and compilation process uses standard UNIX
218utilities. Although these utilities are \emph{supposed} to be
219available on all POSIX-compliant systems, there are always a few
220crufty old dinosaurs still running out there that do not support all
221the features that our \mono{./configure} script and Makefiles are
222expecting. We do aim to build cleanly on anything from supercomputers
223to Ebay'ed junk, but if you have an old system, you may want to hedge
224your bets and install up-to-date versions of GNU command line tools
225such as GNU make and GNU grep.
226
227Running the test suite (and some of our development tools, if you
228delve deep into our codebase) requires Perl and Python3 to be
229installed.  If you don't have them (which should be rare), \mono{make
230  check} won't work for you, but that's ok because \mono{make} and
231\mono{make install} will still work fine.
232
233Compiling the user guide itself (this document) does require
234additional tools to be installed, including \mono{rman} and some extra
235\LaTeX\ packages, described below.
236
237
238\subsection{Multicore parallelization is default}
239
240HMMER supports multicore parallelization using POSIX threads. By
241default, the configure script will identify whether your platform
242supports POSIX threads (almost all platforms do), and it will
243automatically compile in multithreading support.
244
245To disable multithreading at compile time, compile from source with
246the \mono{{-}{-}disable-threads} flag to \mono{./configure}.
247
248Multithreaded HMMER programs use master/worker parallelization, with
249\mono{<n>} worker threads and one master thread. When HMMER is run on
250a machine with multiple available cores, the default number of worker
251threads is two\footnote{Set by a compile-time configuration option,
252  \mono{P7\_NCPU}, in \mono{src/p7\_config.h.in}.}. You can control the
253number of cores each HMMER process will use for computation with the
254\mono{{-}{-}cpu <n>} command line option or the \mono{HMMER\_NCPU}
255environment variable.
256
257If you specify \mono{{-}{-}cpu 0}, a HMMER search program will run in
258serial-only mode, with no threading. We use this in debugging when we
259suspect something is awry with the parallel implementation, but it's
260not something you'd generally want to do in your work.  Even with a
261single worker thread (\mono{{-}{-}cpu 1}), HMMER will be faster than
262serial-only mode, because the master thread handles input and output.
263
264If you are running HMMER on a cluster that enforces policy on the
265number of cores a process can use, you may need to count both the
266workers and the master: you may need to tell your cluster management
267software that HMMER needs \mono{<n>}+1 cores.
268
269
270\subsection{MPI cluster parallelization is optional}
271
272MPI (Message Passing Interface) parallelization on clusters is
273supported in \mono{hmmbuild} and all search programs except \mono{nhmmer} and
274\mono{nhmmscan}. To compile for MPI, you need to have an MPI library
275installed, such as OpenMPI.\sidenote{\href{http://www.open-mpi.org}{open-mpi.org}}
276
277MPI support is not enabled by default.  To enable MPI support at
278compile time, add the \mono{{-}{-}enable-mpi} option to your
279\mono{./configure} command.
280
281To use MPI parallelization, each program that has an MPI-parallel mode
282has an \mono{{-}{-}mpi} command line option. This option activates a
283master/worker parallelization mode.\marginnote{Without the
284  \mono{{-}{-}mpi} option, if you run a program under \mono{mpirun} or
285  the equivalent on N nodes, you'll be running N duplicates, not a
286  single MPI-enabled parallel search. Don't do that.}
287
288The MPI implementation for \mono{hmmbuild} scales well up to hundreds
289of processors, and \mono{hmmsearch} scales all right. The other search
290programs (\mono{hmmscan}, \mono{phmmer}, and \mono{jackhmmer}) scale
291quite poorly, and probably shouldn't be used on more than tens of
292processors at most. Improving MPI scaling is something we're working on.
293
294
295\subsection{Using build directories}
296
297The configuration and compilation process from source supports the use
298of separate build trees, using the GNU-standard \mono{VPATH}
299mechanism. This allows you to do separate builds for different
300processors or with different configuration/compilation options. All
301you have to do is run the configure script from the directory you want
302to be the root of your build tree.  For example:
303
304  \vspace{1ex}
305  \user{\% mkdir my-hmmer-build}\\
306  \user{\% cd my-hmmer-build}\\
307  \user{\% ../configure}\\
308  \user{\% make}
309  \vspace{1ex}
310
311This assumes you have a \mono{make} that supports \mono{VPATH}. If your
312system's \mono{make} does not, you can install GNU make.
313
314
315\subsection{Makefile targets}
316
317\begin{sreitems}{\monob{distclean}}
318
319\item[\monob{all}]
320  Builds everything. Same as just saying \mono{make}.
321
322\item[\monob{check}]
323  Runs automated test suites in both HMMER and the Easel library.
324
325\item[\monob{pdf}]
326  Compiles this user guide.
327
328\item[\monob{install}]
329  Installs programs and man pages.
330
331\item[\monob{uninstall}]
332  Removes programs and man pages from where \mono{make install} put them.
333
334\item[\monob{clean}] Removes all files generated by compilation (by
335  \mono{make}). Configuration (files generated by \mono{./configure})
336  is preserved.
337
338\item[\monob{distclean}]
339  Removes all files generated by configuration (by \mono{./configure})
340  and by compilation (by \mono{make}).
341
342\end{sreitems}
343
344
345\subsection{Compiling the user guide}
346
347Compiling this User Guide from its source \LaTeX\ requires \LaTeX, of
348course, and also the \mono{rman} program from
349\mono{PolyGlotMan}.\sidenote{\href{https://sourceforge.net/projects/polyglotman/}{sourceforge.net/projects/polyglotman}}
350It use a customized version of the
351Tufte-LaTeX book class\sidenote{\href{https://tufte-latex.github.io/tufte-latex/}{tufte-latex.github.io/tufte-latex}}
352(which we include in our source code, so you don't have to
353install it), and the Tufte-LaTeX package depends on some optional \LaTeX\ packages
354listed at the
355Tufte-LaTeX site.
356These packages are typically included in bundles in
357standard \LaTeX\ distributions such as
358TeX Live.\sidenote{\href{https://www.tug.org/texlive/}{www.tug.org/texlive}}
359You can probably
360identify a short list of basic plus extra \LaTeX\ stuff you need to install on your machine. For
361example, on my Mac OS/X laptop, using the MacPorts
362package manager:\sidenote{\href{https://www.macports.org/}{www.macports.org}}
363
364  \vspace{1ex}
365  \user{\% sudo port install texlive}\\
366  \user{\% sudo port install texlive-latex-extra}\\
367  \user{\% sudo port install rman}
368  \vspace{1ex}
369
370Once you have these dependencies, doing:
371
372  \vspace{1ex}
373  \user{\% make pdf}
374  \vspace{1ex}
375
376in the top-level source directory builds \mono{Userguide.pdf}
377in the subdirectory \mono{documentation/userguide}.
378
379
380\subsection{What gets installed by \mono{make install}, and where?}
381
382HMMER only installs programs and man pages. There are 18 programs in
383HMMER and 22 in Easel (the Easel ``miniapps''), each with a man page.
384
385Each program is free-standing. Programs don't depend on any details of
386where other files are installed, and they will run fine no matter
387where you copy them.  Similarly the man pages can be read in any file
388location with \mono{man full/path/to/manpage.man}.  Nonetheless, it's
389most convenient if you put the programs in a directory that's in your
390\mono{PATH} and the man pages in a standard man page directory, using
391\mono{make install}.
392
393The top-level Makefile has variables that specify the two
394directories where \mono{make install} installs things:
395
396\vspace{1em}
397\begin{tabular}{ll}
398Variable             & What       \\ \hline
399\monobi{bindir}       & programs   \\
400\monobi{man1dir}      & man pages  \\
401\end{tabular}
402\vspace{1em}
403
404These variables are constructed from others in accordance with GNU
405Coding Standards, as follows:
406
407\vspace{1em}
408\begin{tabular}{lll}
409Variable              & Default                          & \mono{./configure} option \\ \hline
410\monobi{prefix}        & \mono{/usr/local}               & \mono{-{}-prefix}         \\
411\monobi{exec\_prefix}  & \monoi{prefix}                  & \mono{-{}-exec\_prefix}   \\
412\monobi{bindir}        & \monoi{exec\_prefix}\mono{/bin} & \mono{-{}-bindir}         \\
413\monobi{datarootdir}   & \monoi{prefix}\mono{/share}     & \mono{-{}-datarootdir}    \\
414\monobi{mandir}        & \monoi{datarootdir}\mono{/man}  & \mono{-{}-mandir}         \\
415\monobi{man1dir}       & \monoi{mandir}\mono{/man1}      & \mono{-{}-man1dir}        \\
416\end{tabular}
417\vspace{1em}
418
419You can change any of these defaults on the \mono{./configure} command
420line using the corresponding option. The most commonly used option is
421\mono{{-}{-}prefix}. For example, if you want to install HMMER in a
422directory hierarchy all of its own, you might want to do something
423like:
424
425  \vspace{1ex}
426  \user{\% ./configure {-}{-}prefix /usr/local/hmmer-\HMMERversion{}}
427  \vspace{1ex}
428
429That would keep HMMER out of your system-wide directories, which might
430be desirable. This is a simple way to install multiple versions of
431HMMER, for example, without having them clobber each other.  Then
432you'd add \mono{/usr/local/hmmer-\HMMERversion{}/bin} to your \mono{PATH} and
433\mono{/usr/local/hmmer-\HMMERversion{}/share/man} to your \mono{MANPATH}.
434
435Again, these variables only affect where \mono{make install} copies
436stuff. HMMER and Easel programs have no pathnames compiled into them.
437
438\subsection{Installing both HMMER2 and HMMER3}
439
440HMMER3 and HMMER2 are distinct codebases that are generally
441incompatible with each other. The last release of HMMER2 was 2.3.2 in
4422003. HMMER3 was first released in 2010.
443
444HMMER3 is superior to HMMER2 in almost all respects. One exception is
445that HMMER2 is capable of global and glocal alignment, whereas HMMER3
446programs generally only use local alignment.\marginnote{HMMER3's speed
447  depends on numerical properties that only hold for local alignment.
448  Its statistics depend on a statistical conjecture that only holds
449  well for local alignment. The internal HMMER3 API includes global
450  and glocal alignment modes like HMMER2, but the programs don't use
451  these modes.}  It turned out that some HMMER users need
452global/glocal alignment more than they want the speed and statistics,
453so HMMER2 still has users. I didn't anticipate this when I wrote
454H3. Unfortunately, the two packages have incompatible programs that
455have the same names, so installing them both can lead to problems.
456
457Specifically, HMMER2 installs 9 programs, 6 of which have identical
458names with incompatible HMMER3 programs: \mono{hmmalign},
459\mono{hmmbuild}, \mono{hmmconvert}, \mono{hmmemit}, \mono{hmmfetch},
460and \mono{hmmsearch}.
461
462One workaround is to install the two packages each in their own
463hierarchy, as above: \mono{./configure --prefix=somewhere/hmmer-\HMMERversion{}}
464for HMMER3, and \mono{./configure --prefix=somewhere/hmmer-2.3.2} for
465HMMER2. One set of programs could be in your \mono{PATH}, and you
466could call the others using full pathnames.
467
468Another workaround is simply to copy the HMMER2 programs to an
469installation directory while renaming them, bypassing \mono{make install}.
470For example, something like:
471
472  \vspace{1ex}
473  \user{\% cp hmmalign /usr/local/bin/h2-hmmalign} \\
474  \user{\% cp hmmconvert /usr/local/bin/h2-hmmconvert} \\
475  \user{...}
476  \vspace{1ex}
477
478and so on.
479
480\subsection{Seeing more output from \mono{make}}
481
482By default, our \mono{make} hides what's really going on with the
483compilation with a pretty wrapper that we stole from the source for
484\mono{git}. If you want to see what the command lines really look like
485in all their ugly glory, pass a \mono{V=1} option (V for ``verbose'')
486to \mono{make}, as in:
487
488  \vspace{1ex}
489  \user{\% make V=1}
490  \vspace{1ex}
491
492
493\subsection{Staged installations in a buildroot, for a packaging system}
494
495HMMER's \mono{make install} supports staged installations, accepting
496the traditional \mono{DESTDIR} variable that packagers use to specify
497a buildroot. For example, you can do:
498
499  \vspace{1ex}
500  \user{\% make DESTDIR=/rpm/tmp/buildroot install}
501  \vspace{1ex}
502
503
504
505
506\subsection{Workarounds for unusual configure/compilation problems}
507
508\paragraph{Failure when trying to use a
509  separate build directory.}  If you try to build in a build tree
510(other than the source tree) and you have any trouble in configuration
511or compilation, try just building in the source tree instead. Some
512\mono{make} versions don't support the VPATH mechanism needed to use
513separate build trees. Another workaround is to install GNU make.
514
515
516\paragraph{Configuration fails, complaining ``no acceptable grep could
517  be found''.} We've seen this happen on our Sun Sparc/Solaris
518machine. It's a known issue in GNU autoconf. You can either install
519GNU grep, or you can insist to \mono{./configure} that the Solaris
520grep (or whatever grep you have) is ok by explicitly setting
521\mono{GREP} to a path to one that works:
522
523  \vspace{1ex}
524  \user{\% ./configure GREP=/usr/xpg4/bin/grep}
525  \vspace{1ex}
526
527\paragraph{Many `make check' tests fail.} We have one report of a
528system that failed to link multithread-capable system C libraries
529correctly, and instead linked to one or more serial-only
530libraries.\footnote{If you're a pro: the telltale phenotype of this
531  failure is to configure with debugging flags on and recompile. Run
532  one of the failed unit test drivers (such as
533  \mono{easel/easel\_utest}) yourself and let it dump core. Use a
534  debugger to examine the stack trace in the core. If it failed in
535  \mono{\_\_errno\_location()}, then it's linked a non-thread-capable
536  system C library.} We were unable to reproduce the problem, and are
537not sure what could possibly cause it. We optimistically believe it
538was a one-off messed-up system, not our fault, but then we often say
539things like that and they turn out to be wrong. If it does happen, it
540screws all kinds of things up with the multithreaded implementation. A
541workaround is to shut threading off:
542
543  \vspace{1ex}
544  \user{\% ./configure {-}{-}disable-threads}
545  \vspace{1ex}
546
547This will compile code won't parallelize across multiple cores, of
548course, but it will still work fine on a single processor at a time
549(and MPI, if you build with MPI enabled).
550
551