11# Building and installing HElib
22
3- The HElib build, install, and regression tests suite have been built and tested
4- on Ubuntu 18.04, Ubuntu 20.04, Fedora 32, Fedora 33, CentOS 7.8, CentOS 8.2,
5- macOS Mojave >=10.14.6, and macOS Catalina >=10.15.7 .
3+ The current HElib build, install, and regression tests suite have been built
4+ and tested on Ubuntu 20.04 and macOS Catalina >=10.15.7. Previous versions
5+ have also included Ubuntu 18.04, Fedora 33, CentOS 8.2, macOS Mojave >=10.14.6 .
66
77There are two different ways to build and install HElib. The first one will
88automatically download and build the GMP and NTL dependencies and pack the
99libraries in a relocatable folder. The second way, instead, requires the
1010dependencies to be installed by you and available in the system.
1111
12- ** Please read these instructions in full to better choose the type of build that
13- is better for you.**
12+ This release of HElib has experimental support for the Intel® [ HEXL] ( https://github.com/intel/hexl )
13+ acceleration library for homomorphic encryption that exploits Intel® Advanced Vector Extensions 512.
14+ Instructions to enable and link to HEXL are given
15+ [ below] ( #enabling-and-linking-to-intel-hexl ) .
16+
17+ ``` diff
18+ - Please read these instructions in full to better choose the type of build that is best for you.
19+ ```
1420
1521## General prerequisites
1622
17- - GNU make >= 3.82
1823- pthreads
19- - git >= 1.8.3 (required to build and run the HElib test suite)
24+ - git >= 2.27 (required to build and run the HElib test suite)
2025
21- ** Linux environment:**
26+ ** Default Linux environment:**
2227
23- - g++ >= 7.3.1
24- - cmake >= 3.10.2
28+ - GNU make >= 4.2
29+ - g++ >= 9.3.0 (recommended g++ 10.3.0)
30+ - cmake >= 3.16
2531
2632** macOS environment:**
2733
28- - Apple clang >= 11 .0.0 (available with the latest Xcode for the tested versions of macOS)
34+ - Apple clang >= 12 .0.0 (available with the latest Xcode for the tested versions of macOS)
2935- Xcode Command Line Tools (can be installed with the command `xcode-select
30- --install` in a teminal )
31- - cmake >= 3.17.3 (available from [ CMake] ( https://cmake.org/ ) or [ MacPorts
36+ --install` in a terminal )
37+ - cmake >= 3.20 (available from [ CMake] ( https://cmake.org/ ) or [ MacPorts
3238 Project] ( https://www.macports.org/ ) and [ Homebrew] ( https://brew.sh/ ) as
3339 packages)
40+ - GNU make >= 3.81
3441
35- ** For development:**
42+ ** For HElib development:**
3643
3744- clang-format >= 9.0.0 (available with your linux distribution and for macOS
3845 from [ MacPorts Project] ( https://www.macports.org/ ) and
@@ -108,7 +115,7 @@ some other system-wide path, step 5 may require `sudo` privileges.
108115This option involves building HElib on its own, linking against pre-existing
109116dependencies (NTL and GMP) on the system. In this way, the HElib library can be
110117moved around, but its dependencies (NTL and GMP) cannot, as they are absolute
111- paths. For this option, you must build GMP >=6.0.0 and NTL >=11.4.3 yourself.
118+ paths. For this option, you must build GMP >=6.2.1 and NTL >=11.5.1 yourself.
112119For details on how to do this, please see the section on building dependencies
113120later. It is assumed throughout this installation option that the environment
114121variables ` $GMPDIR ` and ` $NTLDIR ` are set to point to the installation
@@ -170,8 +177,8 @@ Many distributions come with GMP pre-installed. If not, you can install GMP as
170177follows.
171178
1721791 . Download GMP from [ http://www.gmplib.org ] ( http://www.gmplib.org ) -- make sure
173- that you get GMP >=6.0 .0 (current version is 6.2.0 ).
174- 2 . Decompress and cd into the gmp directory (e.g., ` gmp-6.2.0 ` ).
180+ that you get GMP >=6.2 .0 (current version is 6.2.1 ).
181+ 2 . Decompress and cd into the gmp directory (e.g., ` gmp-6.2.1 ` ).
1751823 . GMP is compiled in the standard unix way:
176183
177184``` bash
@@ -189,9 +196,9 @@ step 3.
189196
190197You can install NTL as follows:
191198
192- 1 . Download NTL >=11.4.3 (current version is 11.4.3) from
193- [ http ://www.shoup.net/ntl/ download.html] ( http ://www.shoup.net/ntl /download.html)
194- 2 . Decompress and cd into the directory, e.g., ` ntl-11.4.3 /src `
199+ 1 . Download NTL >=11.5.1 from
200+ [ https ://libntl.org/ download.html] ( https ://libntl.org /download.html)
201+ 2 . Decompress and cd into the directory, e.g., ` ntl-11.5.1 /src `
1952023 . NTL is configured, built and installed in the standard Unix way (but remember
196203 to specify the following flags to ` configure ` ):
197204
@@ -209,6 +216,42 @@ step 3.
209216** NOTE** : if linking against a non-system GMP, pass ` GMP_PREFIX=<path/to/gmp> `
210217to the ` ./configure ` step.
211218
219+ ## Enabling and linking to Intel® HEXL
220+ ** NOTE:** HElib with HEXL acceleration is only supported on the processors with AVX512DQ and
221+ AVX512-IFMA such as the 3rd generation Intel® Xeon® or the 11th generation Intel® Core®
222+
223+ ** NOTE:** It is currently only possible to use HEXL with HElib when using the
224+ library build and when building HElib as a static library. i.e.
225+ ` -DPACKAGE_BUILD=OFF ` and ` -DBUILD_SHARED=OFF ` .
226+
227+ First you must download and build HEXL from source. Currently, HElib only
228+ works with HEXL version >= 1.2.1 Using git this would be
229+
230+ ``` bash
231+ git clone https://github.com/intel/hexl --branch 1.2.1
232+ ```
233+ Follow the instructions for HEXL installation in the README.md for all
234+ available options. Note previous versions of HEXL requires the deprecated
235+ ` -DENABLE_EXPORT=ON ` otherwise the cmake metadata for linking a cmake project
236+ is not created. Modern versions do not have this flag and the metadata is
237+ created by default. For a quick start most people will want,
238+
239+ ``` bash
240+ cd hexl
241+ cmake -S . -B build/ [-DCMAKE_INSTALL_PREFIX=< install-location-for-HEXL> /lib/cmake/hexl-1.2.1]
242+ cmake --build build -j [< parallel-jobs> ]
243+ cmake --install build
244+ ```
245+ If you do not provide an optional install location for HEXL the default is
246+ ` /usr/local ` .
247+
248+ To enable and link HEXL in HElib, you must configure cmake for HElib with
249+ ` -DUSE_INTEL_HEXL=ON ` . If HEXL is not in the default system location or you
250+ wish to use another installation tell HElib where to find it using
251+ ` -DHEXL_DIR=<install-location-for-hexl> ` .
252+ There is no requirement to provide any HElib subprojects with the location of
253+ HEXL.
254+
212255## HElib build options
213256
214257### Generic options
@@ -248,6 +291,8 @@ to the `./configure` step.
248291
249292- ` GMP_DIR ` : Prefix of the GMP library.
250293- ` NTL_DIR ` : Prefix of the NTL library.
294+ - ` USE_INTEL_HEXL ` : Enable the Intel HEXL library.
295+ - ` HEXL_DIR ` : Prefix of the Intel HEXL library.
251296
252297# Using HElib in a project
253298
0 commit comments