Skip to content

Commit 91a5171

Browse files
authored
.
1 parent b70828c commit 91a5171

File tree

1 file changed

+41
-299
lines changed

1 file changed

+41
-299
lines changed

docs/Utils/ConfigurationF/index.rst

Lines changed: 41 additions & 299 deletions
Original file line numberDiff line numberDiff line change
@@ -1,302 +1,44 @@
1-
Configuration file
2-
===================
3-
Reviewed for version 20.07
4-
5-
The main command ``./xmipp`` will try to make the properly configuration
6-
according to your system, generating a config file named ``xmipp.conf``.
7-
Afterwards, XMIPP will be built. You can run ``./xmipp config`` to only
8-
set the configuration.
9-
10-
- If your Xmipp is intended to run under **Scipion**, you should run
11-
``scipion3 run`` as a wrapper (i.e. ``scipion3 run ./xmipp`` or
12-
``scipion3 run ./xmipp config``). However, Scipion’s installation
13-
includes the Xmipp installation, by default.
14-
Check `this (for
15-
non-developers) <https://scipion-em.github.io/docs/docs/user/troubleshooting.html#general-error-while-installing-compiling-xmipp-non-development-installations>`__
16-
or `this (for
17-
developers) <https://scipion-em.github.io/docs/docs/user/troubleshooting.html#general-error-while-installing-compiling-xmipp-development-installations>`__
18-
to learn how to trigger a compilation through Scipion.
19-
20-
The Xmipp configuration sets mainly six compiling blocks:
21-
`C++ <#c-configuration>`__, `MPI <#mpi-configuration>`__,
22-
`Java <#java-configuration>`__, `Cuda <#cuda-configuration>`__ (optional
23-
but recommended), `Matlab <#matlab-configuration>`__ (optional),
24-
`OpenCV <#opencv-configuration>`__ (optional, not recommended).
25-
26-
The idea is always the same, Xmipp will try to find compilers in the
27-
PATH (similar to the ``which`` command) and will take the libraries and
28-
headers from them. If some compiler is not found in the PATH, Xmipp will
29-
look for the default paths on the majority of the Linux distros. You can
30-
bypass this automatic searching by means of manually setting the
31-
environment variables described in the sections below.
32-
33-
Xmipp asks users if agree on using automatically found paths in the
34-
system. Include the ``noAsk`` option to the config command in order to
35-
launch an unattended configuration.
36-
37-
- If your Xmipp is intended to run under **Scipion**, **the environment
38-
variables described in sections below can be added in the
39-
``scipion3/config/scipion.conf``** before launching
40-
``scipion3 installb xmippSrc`` (or your compilation command).
41-
42-
- Note that ``scipion3 installb xmippSrc`` (or other Xmipp compilation
43-
commands in Scipion) regenerates the ``xmipp.conf``. Therefore, **if
44-
you want to manually set some variables in the ``xmipp.conf``,
45-
``export XMIPP_NOCONFIG=True`` or include ``XMIPP_NOCONFIG=True`` in
46-
``scipion3/config/scipion.conf``** to skip that config regeneration.
47-
48-
C++ configuration
49-
-----------------
50-
51-
The default C compiler is ``gcc`` while ``g++`` compiler is for C++ code
52-
and C++ library links. Then Xmipp will ensure that they are visible
53-
prior to assign them to the configuration. You can set any other
54-
compilers by setting the ``CC``, ``CXX`` and ``LINKERFORPROGRAMS``
55-
variables.
56-
57-
Find below a list of tuneable variables regarding to C and C++
58-
compilation. Keep in mind that they are automatically set by Xmipp.
59-
However, you can bypass this automatic setting by exporting them
60-
(e.g. ``export CXX=icc``) prior to launch the command or, even, you can
61-
update the resulting ``xmipp.conf`` file, once created.
62-
63-
| · **CC**: C compiler. gcc`` by default.
64-
| · **CCFLAGS**: Flags to add during C compilations. ``-std=c99`` by
65-
default
66-
67-
| · CXX C++ compiler. ``g++`` by default.
68-
| · **CXXFLAGS**: Flags to add during C++ compilations.
69-
``-mtune=native -march=native -std=c++11 -O3`` by default.
70-
| · **INCDIRFLAGS**: Flags to add headers directories. See note
71-
below.
72-
| · **LIBDIRFLAGS**: Flags to add libraries directories. See note
73-
below.
74-
75-
| · **LINKERFORPROGRAMS**: C++ linker. ``g++`` by default.
76-
| · **LINKFLAGS**: Flags to add while linking. Empty by default.
77-
78-
| · **PYTHON_LIB**: Python library to make the python binding. Xmipp
79-
automatically discovers the current python (e.g. ``python3.5m).
80-
| · **PYTHONINCFLAGS**: Flags to add during the binding compilation.
81-
Usually to include the python header and the numpy header
82-
(e.g. ``-I/usr/include/python3.5m -I/home/david/scipion3/.scipion3env/lib/python3.5/site-packages/numpy/core/include``)
83-
84-
- Note regarding **INCDIRFLAGS** and **LIBDIRFLAGS**
85-
86-
Xmipp adds the ``include`` and ``lib`` from the current environ
87-
(using the python function ``sysconfig.get_path('data')``) in order
88-
to take system or environ headers and libs.
89-
90-
In addition, if ``hdf5`` is not found there, **Xmipp will look for it
91-
in ``/usr/lib`` and ``/usr/include/hdf5/serial``**. If found it, the
92-
paths are appended to the ``INCDIRFLAGS`` and ``LIBDIRFLAGS``. If not
93-
found and a specific conda environ is present, **Xmipp will try to
94-
install hdf5 through conda** under the current conda-environ.
95-
96-
Moreover, if ``fftw3`` or ``tiff`` libraries are not found and a
97-
specific conda environ is present, **Xmipp will try to install them
98-
through conda** under the current conda-environ.
99-
100-
- Note that **``CXXFLAGS``** is optimizing the compilation to the
101-
architecture found during in compilation time. This will make Xmipp
102-
incompatible to be run under another architecture.
103-
104-
To make more flexible this optimization in order to make Xmipp
105-
compatible on both, Intel and AMD cores, please consider to
106-
107-
::
108-
109-
export CXXFLAGS="-mfma -mavx2 -m3dnow -fomit-frame-pointer -std=c++11 -O3"
110-
111-
or edit the ``xmipp.conf`` file in such a way, before compiling
112-
Xmipp.
113-
114-
MPI configuration
115-
-----------------
116-
117-
The default MPI compiler for C is ``mpicc`` while ``mpicxx`` is for C++
118-
code and C++ library links. Then Xmipp will ensure that they are visible
119-
prior to assign them to the configuration. You can set any other
120-
compilers by setting the ``MPI_CC``, ``MPI_CXX`` and
121-
``MPI_LINKERFORPROGRAMS`` variables.
122-
123-
Additionally, ``mpirun`` is the default program to run mpi programs. If
124-
not found, ``mpiexec`` becomes an option. Then, Xmipp will ensure that
125-
they are visible prior to assign them to the configuration (any other
126-
mpi executor can be used by setting the ``MPI_RUN`` variable). You can
127-
set a given MPI toolkit by setting ``MPI_BINDIR``, ``MPI_LIBDIR`` and
128-
``MPI_INCLUDE`` (see `Scipion-config
129-
doc <https://scipion-em.github.io/docs/release-3.0.0/docs/scipion-modes/scipion-configuration.html#mpi-variables>`__).
130-
131-
If ``mpicc``, ``mpicxx`` or ``mpirun`` are not found following
132-
instructions above, Xmipp looks for them in the Linux default paths:
133-
``/usr/lib/openmpi/bin`` or ``/usr/lib64/openmpi/bin``.
134-
135-
Find below a list of tuneable variables regarding to MPI compilations.
136-
Keep in mind that they are automatically set by Xmipp. However, you can
137-
bypass this automatic setting by exporting them
138-
(e.g. ``export MPI_CXX=mpi2-intel``) prior to launch the command or,
139-
even, you can update the resulting ``xmipp.conf`` file, once created.
140-
141-
| · **MPI_RUN**: Executor to run MPI programs. ``mpirun`` by
142-
default.
143-
| · **MPI_CC**: MPI compiler for C code. ``mpicc`` by default.
144-
| · **MPI_CXX**: MPI compiler for C++ code. ``mpicxx`` by default.
145-
| · **MPI_CXXFLAGS**: Flags to add during the MPI compilation. Empty
146-
by default.
147-
| · **MPI_LINKERFORPROGRAMS**: MPI compiler to link C++ libraries.
148-
``mpicxx`` by default.
149-
| · **MPI_LINKFLAGS**: Flags to add during the MPI linking. Empty by
150-
default.
151-
152-
Java configuration
1+
Xmipp Configuration File
2+
========================
3+
4+
This document describes the variables present in the Xmipp configuration file and their purpose.
5+
Each section and variable is detailed below:
6+
7+
Toggle Section
8+
--------------
9+
These options allow activating or deactivating specific software functionalities.
10+
11+
- **SEND_INSTALLATION_STATISTICS**: Enables (`ON`) or disables (`OFF`) the sending of installation statistics.
12+
- **XMIPP_USE_CUDA**: Enables (`ON`) or disables (`OFF`) the use of CUDA to accelerate calculations via GPU.
13+
- **XMIPP_USE_MPI**: Enables (`ON`) or disables (`OFF`) the use of MPI for distributed parallelism.
14+
- **XMIPP_USE_MATLAB**: Enables (`ON`) or disables (`OFF`) the use of functionalities related to MATLAB.
15+
- **XMIPP_LINK_TO_SCIPION**: Enables (`ON`) or disables (`OFF`) linking Xmipp with the Scipion framework.
16+
- **BUILD_TESTING**: Enables (`ON`) or disables (`OFF`) the building of automated tests to verify software integrity.
17+
- **CMAKE_SKIP_RPATH**: Enables (`ON`) or disables (`OFF`) excluding `rpath` during the compilation process.
18+
19+
Package Home Section
20+
---------------------
21+
These variables define custom paths for the installation of required packages. If not specified, CMake will automatically search for these packages on the system.
22+
23+
- **CMAKE**: Path to the CMake executable.
24+
- **CMAKE_C_COMPILER**: C compiler to use.
25+
- **CMAKE_CXX_COMPILER**: C++ compiler to use.
26+
- **CMAKE_INSTALL_PREFIX**: Directory where the software will be installed. Default value: `dist`.
27+
- **CMAKE_PREFIX_PATH**: Additional paths for CMake to search for packages. Example: `/home/agarcia/anaconda3`.
28+
- **MPI_HOME**: Path to the main MPI directory.
29+
- **CMAKE_CUDA_COMPILER**: Path to the CUDA compiler (`nvcc`). Example: `/usr/local/cuda/bin/nvcc`.
30+
- **Python3_ROOT_DIR**: Main path to the Python 3 installation.
31+
- **FFTW_ROOT**: Main path to the FFTW library.
32+
- **TIFF_ROOT**: Main path to the TIFF library.
33+
- **HDF5_ROOT**: Main path to the HDF5 library.
34+
- **JPEG_ROOT**: Main path to the JPEG library.
35+
- **SQLite_ROOT**: Main path to the SQLite library.
36+
- **CMAKE_CUDA_HOST_COMPILER**: Host compiler for CUDA.
37+
38+
Compilation Flags
15339
------------------
40+
These variables configure specific options for the compilers. It is recommended not to modify these variables unless experienced with advanced compilation settings.
15441

155-
Xmipp ensures that ``javac`` command is visible and takes its location
156-
in order to get the ``jar`` and ``java`` programs. If ``javac`` is not
157-
present in the PATH, Xmipp look for it at ``/usr/lib/jvm/java-*/bin``.
158-
If still not found and a specific conda environ is present, **Xmipp will
159-
try to install ``openjdk`` through conda** under that conda-environ.
160-
161-
Find below a list of tuneable variables regarding to Java compilations.
162-
Keep in mind that they are automatically set by Xmipp. However, you can
163-
bypass this automatic setting by exporting them
164-
(e.g. ``export JAVA_HOME=/my/own/java``) prior to launch the command or,
165-
even, you can update the resulting ``xmipp.conf`` file, once created.
166-
167-
| · **JAVA_HOME**: Path where java is loacated.
168-
``dirname $(dirname $(realpath $(which javac)))`` by default
169-
(``jre/bin`` is pull out if present).
170-
| · **JAVA_BINDIR**: Path where ``jar`` and ``javac`` are located.
171-
``%(JAVA_HOME)s/bin`` by default.
172-
| · **JAVAC**: JavaC compiler. ``%(JAVA_BIN)s/javac`` by default.
173-
| · **JAR**: Jar compiler. ``%(JAVA_BIN)s/jar`` by default.
174-
| · **JNI_CPPPATH**: Include paths during the Java compilation.
175-
``%(JAVA_HOME)s/include:%(JAVA_HOME)s/include/linux`` by default.
176-
177-
Cuda configuration
178-
------------------
179-
180-
Cuda compilation is optional in Xmipp, but strongly recommended. Xmipp
181-
will find the ``nvcc`` compiler in the PATH and will take its
182-
corresponding cuda toolkit. If no ``nvcc`` is found in the PATH, Xmipp
183-
looks for it in the default Linux locations: ``/usr/local/cuda*/bin``.
184-
In addition, following the Scipion syntax, you can manually set a
185-
certain path where to find the ``nvcc`` by
186-
``export CUDA_BIN=/my/own/cuda/bin`` or even
187-
``export XMIPP_CUDA_BIN=/my/own/cuda/bin`` (or include it in the
188-
``scipion3/config/scipion.conf`` if you are under Scipion structure).
189-
190-
Check below the preference list while looking for a ``nvcc`` compiler:
191-
192-
1. in ``XMIPP_CUDA_BIN``.
193-
2. in ``CUDA_BIN``
194-
3. in ``PATH``
195-
4. in ``/usr/local/cuda/bin``
196-
5. in ``/usr/local/cuda*/bin`` (in this case, the glob-expanding order
197-
will be defined by the OS)
198-
199-
At the end, Xmipp will take as ``CUDA_HOME`` the directory (resolving
200-
any eventual linking) of the ``nvcc`` found. If it is found using
201-
assumption 4. or 5., Xmipp asks users if they agree (use ``noAsk``
202-
option in the command launching for an unattended behavior).
203-
204-
Find below a list of tuneable variables regarding to CUDA compilations.
205-
Keep in mind that they are automatically set by Xmipp according to that
206-
described above. However, you can bypass this automatic setting by
207-
exporting them (e.g. ``export NVCC=/my/own/cuda/bin/nvcc``) prior to
208-
launch the command or, even, you can update the resulting ``xmipp.conf``
209-
file, once created.
210-
211-
| · **CUDA**: Main flag to enable/disable CUDA compilation, set to
212-
``True``/``False`` accordingly. By default, it is set to ``True`` if a
213-
``nvcc`` is found.
214-
| · **NVCC**: Path to the Cuda compiler (it can be just the command
215-
if it is in the PATH). ``nvcc`` (or the real path to it) by default.
216-
| · **CXX_CUDA**: C++ compiler to compile Cuda code. Notice that
217-
Cuda-8.0 is incompatible with ``g++>5``, then this can be set to
218-
``g++-5``, whereas the main C++ compiler still ``g++-8``. By default,
219-
it is ``g++`` (if compatible).
220-
| · **NVCC_CXXFLAGS**: Cuda compilation flags.
221-
``--x cu -D_FORCE_INLINES -Xcompiler -fPIC -ccbin %(CXX_CUDA)s -std=c++11 --expt-extended-lambda -gencode=arch=compute_30,code=compute_30 -gencode=arch=compute_35,code=compute_35 -gencode=arch=compute_50,code=compute_50 -gencode=arch=compute_60,code=compute_60 -gencode=arch=compute_61,code=compute_61``,
222-
by default.
223-
| · **NVCC_LINKFLAGS**: Cuda linking flags.
224-
``-L/usr/local/cuda-X.Y/targets/x86_64-linux/lib -L/usr/local/cuda-X.Y/targets/x86_64-linux/lib/stubs``
225-
by default.
226-
227-
Notice that ``NVCC_LINKFLAGS`` contain the libraries according to the
228-
``nvcc`` found (in the default example there is ``cuda-X.Y`` indicating
229-
a certain cuda version). That libraries are set by looking for the
230-
``libcudart.so`` lib following the preference list below:
231-
232-
1. in ``$CUDA_HOME/lib``
233-
2. in ``$CUDA_HOME/lib64``
234-
3. in ``$CUDA_HOME/targets/x86_64-linux/lib``
235-
4. in ``$CUDA_HOME/lib/x86_64-linux-gnu``
236-
5. in ``/usr/lib``
237-
6. in ``/usr/lib64``
238-
7. in ``/usr/targets/x86_64-linux/lib``
239-
8. in ``/usr/lib/x86_64-linux-gnu``
240-
241-
If it is found using assumptions from 5. to 8., Xmipp asks users if they
242-
agree (use ``noAsk`` option in the command launching for an unattended
243-
behavior).
244-
245-
Matlab configuration
246-
--------------------
247-
248-
Some programs in Xmipp are coded in Matlab and they needs to be compiled
249-
with. (*TODO: list those programs*)
250-
251-
Find below a list of tuneable variables regarding to Matlab
252-
compilations. Keep in mind that they are automatically set by Xmipp.
253-
However, you can bypass this automatic setting by exporting them
254-
(e.g. ``export MATLAB_DIR=/my/own/matlab``) prior to launch the command
255-
or, even, you can update the resulting ``xmipp.conf`` file, once
256-
created.
257-
258-
| · **MATLAB**: Main flag to enable/disable Matlab compilation, set
259-
to ``True``/``False`` accordingly. By default is set to ``True`` if a
260-
``matlab`` is found in the PATH.
261-
| · **MATLAB_DIR**: Matlab home directory where ``bin/mex`` is
262-
expected to compile Matlab code.
263-
``dirname $(dirname $(which matlab))`` by default.
264-
265-
OpenCV configuration
266-
--------------------
267-
268-
A few programs in Xmipp are coded using the OpenCV library and they
269-
needs to be compiled against it. (*TODO: list those programs*)
270-
271-
Find below a list of tuneable variables regarding to OpenCV
272-
compilations. Keep in mind that they are automatically set by Xmipp.
273-
However, you can bypass this automatic setting by exporting them
274-
(e.g. ``export OPENCV=False``) prior to launch the command or, even, you
275-
can update the resulting ``xmipp.conf`` file, once created.
276-
277-
| · **OPENCV**: Main flag to enable/disable OpenCV compilation, set
278-
to ``True``/``False`` accordingly. By default, it is set to ``True``
279-
if a basic code including the ``opencv2/core/core.hpp`` header
280-
compiles.
281-
| · **OPENCV3**: Flag to indicate if openCV-v3 is present, set to
282-
``True``/``False`` accordingly. By default, it is set to ``True`` if
283-
the ``CV_MAJOR_VERSION >= 3`` in the ``opencv2/core/version.hpp``.
284-
| · **OPENCVSUPPORTSCUDA**: Flag to enable/disable OpenCV
285-
compilation against CUDA, set to ``True``/``False`` accordingly. By
286-
default, it is set to ``True`` if a basic code including the
287-
``cudaoptflow.hpp`` header compiles (if OpenCV-v3 is used, the
288-
``cuda.hpp`` is used to check it).
289-
290-
Others
291-
------
42+
- **CMAKE_C_FLAGS**: Compilation options for the C compiler. Default value: `-mtune=native`.
43+
- **CMAKE_CXX_FLAGS**: Compilation options for the C++ compiler. Default value: `-mtune=native`.
29244

293-
| · **VERIFIED**: Firstly, it is set to ``False`` and, then
294-
``./xmipp check_config`` swaps it to ``True`` (if checks passes). This
295-
prevents to check the configuration twice.
296-
| · **CONFIG_VERSION**: Config generator’s (``xmipp`` script) hash
297-
version. An error is raised if trying to compile Xmipp with a
298-
different hash than the current in the github repository.
299-
| · **USE_DL**: Flag to download deep learning models during the
300-
compilation process. ``False`` by default.
301-
| · **DEBUG**: Flag to compile the code under the debug mode.
302-
``False`` by default.

0 commit comments

Comments
 (0)