You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- documentation in the script folder (explain what we are doing)
7
-
- run using ulysses
8
-
- find a way to import functions in memory profiling
9
-
10
5
# Introduction
11
6
This repository contains the final project for the course in Development Tools in Scientific Computing.
12
7
@@ -36,7 +31,7 @@ In order to solve an eigenvalue problem, we considered multiple strategies.
36
31
1. The most trivial one was to implement the power method in order to be able to compute (at least) the biggest eigenvalue. We then used `numba` to try and optimize it, but in this case just-in-time compilation was not extremely beneficial.The implementation of the power method is contained in `eigenvalues.py`.
37
32
2. Lanczos + QR: this is an approach (tailored to the case of symmetric matrices) to compute *all* the eigenvalues and eigenvectors. Notice that, also in the case of the QR method,`numba` was not very beneficial in terms of speed-up, resulting in a pretty slow methodology. For this reason, we implemented the QR method in `C++` and used `pybind11` to expose it to `Python`. All the code written in `C++` can be found in `cxx_utils.cpp`.
38
33
3.`CuPy` implementation of all of the above: we implemented all the above methodologies using `CuPy` to see whether using GPU could speed up computations. Since this was not the case, we commented all the lines of code involving `CuPy`, so that installation of the package is no longer required and we can use our code also on machines that do not have GPU.
39
-
4. The core of the project is the implementation (as well as a generalization of the simplified case in which $\rho=1$ considered in our reference) of the _divide et implera_ method for the computation of eigenvalues of a symmetric matrix. Some helpers were originally written in `Python` and then translated to `C++` for efficiency reasons: their original implementation is in `zero_finder.py` and is still present in the project for testing purposes. The translated version can be found in `cxx_utils.cpp`. Instead, the implementation of the actual method to compute the eigenvalues starting from a tridiagonal matrix is contained in `parallel_tridiag_eigen.py` and makes use of `mpi4py`.
34
+
4. The core of the project is the implementation (as well as a generalization of the simplified case in which $\rho=1$ considered in our reference) of the _divide et implera_ method for the computation of eigenvalues of a symmetric matrix. Some helpers were originally written in `Python` and then translated to `C++` for efficiency reasons: their original implementation is in `zero_finder.py` and is still present in the project for testing purposes. The translated version can be found in `cxx_utils.cpp`. Instead, the implementation of the actual method to compute the eigenvalues starting from a tridiagonal matrix is contained in `parallel_tridiag_eigen.py` and makes use of `mpi4py`. Notice that the implementation of deflation in `cxx_utils.cpp` is done using the `Eigen` library.
40
35
41
36
# Results
42
37
The results of the profiling (runtime vs matrix size, memory consumption, scalability, and so on) are discussed in detail in `Documentation.ipynb`.
@@ -54,16 +49,34 @@ It is also possible to provide paths to other configuration files by passing the
54
49
Notice that the script is *not* called using `mpirun`, but internally it uses MPI.
55
50
This is done by spawning a communicator inside the script.
56
51
57
-
In addition, in the `shell` folder, we provide a `submit.sbatch` file to run using `SLURM`, as well as a `submit.sh` to run the same experiment locally.
58
-
These two files perform memory profiling.
52
+
In addition, in the `shell` folder, we provide a `submit.sbatch` file to run using `SLURM`, as well as a `submit.sh`.
53
+
They are used to perform memory profiling.
54
+
55
+
The `submit.sbatch` file is supposed to be used on Ulysses (or any other cluster using `SLURM`).
56
+
It is supposed to show how to send a job (in which our package is emplyed) using `SLURM`.
57
+
Notice, however, that due to Ulysse's problems with `MPI` the profiling for
58
+
As a result, we also provide `submit.sh`, which is supposed to be run on a workstation.
59
+
It executes `mpirun -np [n_procs] python scripts/profile_memory.py`, basically doing the same as the `submit.sbatch` script, but without using `SLURM`.
60
+
Notice that it assumes that `shell/load_modules.sh` has already been executed (see the next section).
61
+
62
+
We also remark that the script to perform memory profiling `scripts/profile_memory.py` does not spam an `MPI` communicator, but is supposed to be called using `mpirun`. The reason for that is to provide a more extensive list of examples of how our package can be used.
59
63
60
-
# To install using Ulysses:
64
+
Notice that it is possible that `scripts/mpi_running.py` will not run on systems using `SLURM` due to the fact that we are using a specific way to spawn an `MPI` communicator.
65
+
Nevertheless, the package still works: as done in `scripts/profile_memory.py`: it sufficies to run a file that can be used in combination with `mpirun` or `srun`.
66
+
67
+
# How to install:
68
+
If you are using Ulysses or a SISSA workstation, it is likely that you will need to load a couple of modules to be able to install the package.
69
+
The exact modules change according to the device you are currently using, but it is sufficient that you have `CMake`, `gcc` and `OpenMPI`.
70
+
71
+
To streamline the installation process, we provide the script `shell/load_modules.sh`.
72
+
This script loads the modules that are required on Ulysses/my workstation (according to the flag that is passed).
73
+
To use it, run:
61
74
```bash
62
-
source shell/load_modules.sh
75
+
source shell/load_modules.sh Ulysses # or source shell/load_modules.sh workstation
63
76
```
64
-
The previous line will load CMake and gcc. Both are needed to compile the project.
65
-
In addition, it will enable the istallation of `mpi4py`.
66
-
After that, you can just write
77
+
The previous line will allow the istallation of `mpi4py`and the automatic compilation of the `C++` source file used in the project.
78
+
79
+
Once the needed modules are loaded, you can regularly install via `pip` using the following command:
0 commit comments