/py_aff3ct

Python wrapper for AFF3CT.

Primary LanguageC++MIT LicenseMIT

Python to AFF3CT

This repository contains a code example for integrating a Python module inside an AFF3CT sequence.

Using AFF3CT as a library for your codes

The first step is to compile AFF3CT into a library.

Prerequisite:

$ sudo apt install python3 python3-pip doxygen

Get the AFF3CT library:

$ git submodule update --init --recursive

Compile the library on Linux/MacOS/MinGW:

$ cd lib/aff3ct
$ mkdir build
$ cd build
$ cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-funroll-loops -march=native -fvisibility=hidden -fvisibility-inlines-hidden -faligned-new" -DAFF3CT_COMPILE_EXE="OFF" -DAFF3CT_COMPILE_STATIC_LIB="ON" -DAFF3CT_COMPILE_SHARED_LIB="ON"
$ make -j4

Now the AFF3CT library has been built in the lib/aff3ct/build folder.

Compile the documentation with Doxygen:

$ cd ../doc
$ mkdir build
$ cd source
$ doxygen Doxyfile

Go back to the project root:

$ cd ../../../../

Compile your code

Copy the CMake configuration files from the AFF3CT build

$ mkdir cmake && mkdir cmake/Modules
$ cp lib/aff3ct/build/lib/cmake/aff3ct-*/* cmake/Modules

Compile the code on Linux/MacOS/MinGW:

$ mkdir build && cd build
$ ../configure.py --verbose
$ cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-Wall -funroll-loops -march=native -fvisibility=hidden -fvisibility-inlines-hidden -faligned-new"
$ make -j4

The compiled library is in build/lib/py_aff3ct*.so.

Check if it works:

$ cd ../examples/full_python/
$ python3 test.py