Skip to content

Commit 5d78dcf

Browse files
committed
update installation instructions
1 parent 2e7a7d8 commit 5d78dcf

File tree

2 files changed

+53
-31
lines changed

2 files changed

+53
-31
lines changed

CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ message(STATUS "CIL_VERSION: ${CIL_VERSION}")
2626

2727
option (BUILD_MATLAB_WRAPPER "Build Matlab Wrappers" OFF)
2828
option (BUILD_PYTHON_WRAPPER "Build Python Wrappers" ON)
29-
option (CONDA_BUILD "Conda Build" OFF)
3029
option (BUILD_CUDA "Build the CUDA modules" ON)
3130

3231
set(MATLAB_DEST_DIR "" CACHE PATH "Directory of the Matlab wrappers")

Installation.md

+53-30
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
1-
## Installation:
1+
# CCPi Regularisation Toolkit
2+
3+
## Installation
24

35
In order to compile C/C++ sources and additional wrappers from source code for numpy 1.24 and python 3.10, the recommended way is:
4-
```
6+
7+
```sh
58
git clone https://github.com/vais-ral/CCPi-Regularisation-Toolkit
69
cd CCPi-Regularisation-Toolkit
710
export CCPI_BUILD_ARGS="--numpy 1.24 --python 3.10"
811
build/jenkins-build.sh
912
```
13+
1014
this will install `conda build` environment and compiles C/C++ and Python wrappers and performs basic tests for environment with python 3.10 and numpy 1.24.
1115

1216
### CMake
17+
1318
If you want to build directly using cmake, install CMake (v.>=3) to configure it. Additionally you will need a C compiler, `make` (on linux) and CUDA SDK where available. The toolkit may be used directly from C/C++ as it is compiled as a shared library (check-out the include files in `Core` for this)
19+
1420
1. Clone this repository to a directory, i.e. `CCPi-Regularisation-Toolkit`,
1521
2. create a build directory.
1622
3. Issue `cmake` to configure (or `cmake-gui`, or `ccmake`, or `cmake3`). Use additional flags to fine tune the configuration.
@@ -22,35 +28,35 @@ Flags used during configuration
2228
| `BUILD_PYTHON_WRAPPER` | bool | `ON\|OFF` whether to build the Python wrapper |
2329
| `BUILD_MATLAB_WRAPPER` | bool | `ON\|OFF` whether to build the Matlab wrapper |
2430
| `CMAKE_INSTALL_PREFIX` | path | your favourite install directory |
25-
| `PYTHON_DEST_DIR` | path | python modules install directory (default `${CMAKE_INSTALL_PREFIX}/python`) |
2631
| `MATLAB_DEST_DIR` | path | Matlab modules install directory (default `${CMAKE_INSTALL_PREFIX}/matlab`)|
2732
| `BUILD_CUDA` | bool | `ON\|OFF` whether to build the CUDA regularisers |
28-
| `CONDA_BUILD`| bool | `ON\|OFF` whether it is installed with `setup.py install`|
2933
| `Matlab_ROOT_DIR` | path | Matlab directory|
30-
|`PYTHON_EXECUTABLE` | path | /path/to/python/executable|
34+
| `PYTHON_EXECUTABLE` | path | /path/to/python/executable|
3135

3236
Here an example of build on Linux (see also `run.sh` for additional info):
3337

34-
```bash
35-
git clone https://github.com/vais-ral/CCPi-Regularisation-Toolkit.git
36-
cd build
37-
cmake .. -DCONDA_BUILD=OFF -DBUILD_MATLAB_WRAPPER=ON -DBUILD_PYTHON_WRAPPER=ON -DBUILD_CUDA=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./install
38-
make install
39-
cd install/python
40-
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:../lib
38+
```sh
39+
git clone https://github.com/vais-ral/CCPi-Regularisation-Toolkit
40+
cd CCPi-Regularisation-Toolkit
41+
cmake -S . -B ./build_proj -DBUILD_MATLAB_WRAPPER=ON -DBUILD_PYTHON_WRAPPER=ON -DBUILD_CUDA=ON -DCMAKE_INSTALL_PREFIX=./install
42+
cmake --build ./build_proj --target install
4143
```
4244

4345
### Python
46+
4447
#### Python binaries
48+
4549
Python binaries are distributed via the [ccpi](https://anaconda.org/ccpi/ccpi-regulariser) conda channel.
4650

47-
```
51+
```sh
4852
conda install ccpi-regulariser -c ccpi -c conda-forge
4953
```
5054

5155
#### Python (conda-build)
52-
```
53-
export CIL_VERSION=$(date +%Y.%m) (Unix) / set CIL_VERSION=19.10 (Windows)
56+
57+
```sh
58+
export CIL_VERSION=$(date +%Y.%m.%d) # UNIX
59+
# set CIL_VERSION=24.3.0 # Windows
5460
conda build recipe/ --numpy 1.23 --python 3.10
5561
conda install ccpi-regulariser=${CIL_VERSION} --use-local --force-reinstall # doesn't work?
5662
conda install -c file://${CONDA_PREFIX}/conda-bld/ ccpi-regulariser=${CIL_VERSION} --force-reinstall # try this one
@@ -60,25 +66,38 @@ python demo_gpu_regularisers.py # to run GPU demo
6066
```
6167

6268
### Python (GPU-CuPy)
63-
One can also use some of the GPU modules directly (i.e. without the need of building the package) by using [CuPy](https://docs.cupy.dev/en/stable/index.html) implementations.
69+
70+
One can also use some of the GPU modules directly (i.e. without the need of building the package) by using [CuPy](https://docs.cupy.dev) implementations.
71+
72+
```sh
73+
pip install git+https://github.com/vais-ral/CCPi-Regularisation-Toolkit
6474
```
65-
git clone git@github.com:vais-ral/CCPi-Regularisation-Toolkit.git
66-
cd CCPi-Regularisation-Toolkit
67-
pip install .
68-
```
75+
76+
> [!WARNING]
77+
> The above currently doesn't work; see **Python build** below instead:
6978
7079
#### Python build
71-
If passed `CONDA_BUILD=ON` the software will be installed by issuing `python setup.py install` which will install in the system python (or whichever other python it's been picked up by CMake at configuration time.)
72-
If passed `CONDA_BUILD=OFF` the software will be installed in the directory pointed by `${PYTHON_DEST_DIR}` which defaults to `${CMAKE_INSTALL_PREFIX}/python`. Therefore this directory should be added to the `PYTHONPATH`.
7380

74-
If Python is not picked by CMake you can provide the additional flag to CMake `-DPYTHON_EXECUTABLE=/path/to/python/executable`.
81+
If passed `BUILD_PYTHON_WRAPPER=ON`, CMake will install libraries in-place under `./src/Python`, followed by running `python -m pip install ./src/Python`.
82+
(Note that libraries are also installed under the user-specified `${CMAKE_INSTALL_PREFIX}`, which could be set to a throwaway directory, e.g. `-DCMAKE_INSTALL_PREFIX=./install`).
83+
84+
If Python is not picked by CMake you can provide the additional flag to CMake `-DPYTHON_EXECUTABLE=/path/to/executable/python`.
85+
86+
Tests can also be run in-place after the build:
87+
88+
```sh
89+
PYTHONPATH=./src/Python python -m unittest discover ./test
90+
```
7591

7692
### MultiGPU capability (to use in Python with mpi4py)
93+
7794
The toolkit can be used by running in parallel across multiple GPU devices on a PC or a compute node of a cluster. In order to initiate a parallel run on your GPUs you will need an MPI library, such as, [mpi4py](https://mpi4py.readthedocs.io/en/stable/). See multi_gpu demo script in demos folder, it can be run as
78-
```
95+
96+
```sh
7997
mpirun -np 2 python multi_gpu.py -g -s -gpus 2
8098
```
81-
where `-np` parameter defines the total number of processes and `-gpus` defines the number of available GPUs.
99+
100+
where `-np` parameter defines the total number of processes and `-gpus` defines the number of available GPUs.
82101

83102
### Matlab
84103

@@ -87,23 +106,27 @@ Matlab wrapper will install in the `${MATLAB_DEST_DIR}` directory, which default
87106
If Matlab is not picked by CMake, you could add `-DMatlab_ROOT_DIR=<Matlab directory>`.
88107

89108
#### Linux
109+
90110
Because you've installed the modules in `<your favourite install directory>` you need to instruct Matlab to look in those directories:
91111

92112
```bash
93-
94113
PATH="/path/to/mex/:$PATH" LD_LIBRARY_PATH="/path/to/library:$LD_LIBRARY_PATH" matlab
95114
```
115+
96116
By default `/path/to/mex` is `${CMAKE_INSTALL_PREFIX}/bin` and `/path/to/library/` is `${CMAKE_INSTALL_PREFIX}/lib`
97117

98118
#### Windows
119+
99120
On Windows the `dll` and the mex modules must reside in the same directory. It is sufficient to add the directory at the beginning of the m-file.
121+
100122
```matlab
101123
addpath(/path/to/library);
102124
```
103125

104126
#### Legacy Matlab installation (partly supported, please use Cmake)
127+
128+
```sh
129+
cd src/Matlab/mex_compile
130+
compileCPU_mex.m % to compile CPU modules
131+
compileGPU_mex.m % to compile GPU modules (see instructions in the file)
105132
```
106-
cd src/Matlab/mex_compile
107-
compileCPU_mex.m % to compile CPU modules
108-
compileGPU_mex.m % to compile GPU modules (see instructions in the file)
109-
```

0 commit comments

Comments
 (0)