Build instructions
==================

ReSCAL package includes a number of programs located in src directory.

It has a standard build procedure. From the ReSCAL directory, type 
the following commands:

./configure
make

Note: If your installed version of automake does not match, run the 
autoreconf command and try again, or jump to the alternative 
procedure described in §5.

To disable AVX optimizations, use the following syntax:
./configure --disable-avx

Note: The execution of rescal will crash after compiling with AVX code whereas
your CPU does not support AVX (Intel Core i3/i5/i7/i9 and Xeon processors
support AVX since 2011, but Celeron since 2020 only).

Complete syntax is available when typing:
./configure --help

Needed development libraries are glib-2.0, libgtk2.0-dev, gdk-pixbuf, libpng and
pthread.


1. Compiling on Linux
----------------------
Please make sure that the packages gcc, pkg-config and libgtk2.0-dev are 
installed.

Tested on Ubuntu 14.04 to 22.04


2. Compiling on MacOS X
-----------------------
Needed packages are automake and gtk+.  It can be installed with 
Homebrew. It may also help to initialize CFLAGS variable while 
running the configure script, as below:
CFLAGS='-I/usr/local/include -L/usr/local/lib' ./configure

Then type:
make

Note: With non-Intel CPU (e.g., Apple M1 or M2 processor), it is advised to use 
Clang compiler to get better performances. Moreover, one has to disable AVX 
code:
./configure --disable-avx

2.1 with Clang
--------------
It is likely that your version of Clang does not support OpenMP,
in which case you'll have to install OpenMP libraries:
brew install clang-omp

Then (on Mac OS X 10.11):
export CFLAGS='-I/usr/local/include/libiomp -liomp5' 
./configure
make

Alternatively, one may discard OpenMP code: 
./configure --disable-openmp

2.2 with GCC
------------
The default gcc command is merely a link to CLang. One has to
install it explicitly with Homebrew or MacPorts. Then make sure
to call gcc and not cc (i.e. CLang), before starting the standard
build procedure. The recommended solution is to edit the CC 
environment variable.

CC='/usr/local/bin/gcc-6' ./configure
make


3. Compiling with ICC (Intel C compiler)
----------------------------------------
To take advantage of Intel's compiler specifities, just type:
cd src
make -f makefile.icc

Note: ReSCAL seems to run faster with ICC than with GCC, at least on
Intel Xeon processors.

Tested with ICC 13.0 and 15.0 (64bits).


4. Compiling on Windows
-----------------------
Several options exist based on virtualization or emulation:
- Windows Subsystem for Linux (WSL), available since Windows 10;
- VirtualBox;
- Cygwin/X.

Then the procedure is similar to that on Linux.

Note: There may be some limitations related to OpenMP and AVX 
optimization. The first option (WSL) is preferable to get seamless 
access to almost all hardware features (multicore execution, AVX 
instruction set).


5. Alternative procedure
------------------------
There is a the customizable makefile located in src directory, that 
may work out of the box on most Unix-like systems.
cd src
make -f makefile.default

If errors still occur, please check the variables in makefile.default
and/or install missing libraries.


6. Compiling without GTK-2.0
----------------------------
For people working remotely with no need of a GUI, the library gtk-2.0
is not useful. To compile without the latter, it suffices to add the 
option --without-gtk when running configure. Alternatively, one may 
apply the following procedure:
cd src
make -f makefile.nogtk


7. Contacts
-----------
Olivier Rozier - rozier@ipgpfr

