| ... | @@ -7,25 +7,23 @@ As prerequisite, you must have verified that [git](Git), [a C++ compiler](C++ Co |
... | @@ -7,25 +7,23 @@ As prerequisite, you must have verified that [git](Git), [a C++ compiler](C++ Co |
|
|
```
|
|
```
|
|
|
git clone git@gitlab.uliege.be:rboman/math0471.git
|
|
git clone git@gitlab.uliege.be:rboman/math0471.git
|
|
|
```
|
|
```
|
|
|
* Open VS Code and load ("File / Open Folder...") the `math0471` folder.
|
|
* In the terminal of VS Code, open VS Code and load ("File / Open Folder...") the `math0471` folder.
|
|
|
* In the terminal of VS Code, go to the `lib` folder and install "gmsh-sdk" and "Eigen" using the scripts `get_gmsh.cmd` and `get_eigen.cmd` (this should be done only once per working copy of the repository):
|
|
* Add the MinGW compiler (and the future zlib path) to your environment by running this script. This script assumes that the compiler has been installed in the default location proposed by the MinGW installer. Running this script should be done each time you re-open VS Code or a new terminal:
|
|
|
|
```
|
|
|
|
envs\windows.cmd
|
|
|
|
```
|
|
|
|
* Then, go to the `lib` folder and install "zlib" using the scripts `get_zlib.cmd`. This should be done only once per working copy of the repository:
|
|
|
```
|
|
```
|
|
|
cd math0471
|
|
cd math0471
|
|
|
cd lib
|
|
cd lib
|
|
|
get_gmsh.cmd
|
|
get_zlib.cmd
|
|
|
get_eigen.cmd
|
|
|
|
|
cd ..
|
|
cd ..
|
|
|
```
|
|
```
|
|
|
|
|
* Next, in the same terminal, go to the `src` folder:
|
|
|
* Add MinGW, gmsh-sdk and Eigen to your environment by running this script (it should be done each time you re-open VS Code or a new terminal):
|
|
|
|
|
```
|
|
|
|
|
envs\windows.cmd
|
|
|
|
|
```
|
|
|
|
|
* Then, in the same terminal, go to the example folder:
|
|
|
|
|
```
|
|
```
|
|
|
cd examples\gmsh_api
|
|
cd src
|
|
|
```
|
|
```
|
|
|
* Create a `build` folder in `examples\gmsh_api`:
|
|
* Create a `build` folder in `src`:
|
|
|
```
|
|
```
|
|
|
mkdir build
|
|
mkdir build
|
|
|
```
|
|
```
|
| ... | @@ -33,21 +31,37 @@ mkdir build |
... | @@ -33,21 +31,37 @@ mkdir build |
|
|
```
|
|
```
|
|
|
cd build
|
|
cd build
|
|
|
```
|
|
```
|
|
|
* Run CMake (if an error occurs at this stage, it usually means that you forgot to run `envs\windows.cmd` or you installed the programs at locations on your hard drive other than those recommended in this wiki):
|
|
* Run CMake (if an error occurs at this stage, it usually means that you forgot to run `envs\windows.cmd` or you installed the programs at locations on your hard drive other than those recommended in this wiki):
|
|
|
```
|
|
```
|
|
|
cmake ..
|
|
cmake ..
|
|
|
```
|
|
```
|
|
|
* Start the compilation (with 4 parallel processes):
|
|
* Start the compilation (with 4 parallel processes):
|
|
|
```
|
|
```
|
|
|
make -j 4
|
|
make
|
|
|
```
|
|
```
|
|
|
* Run a program:
|
|
* Run the program:
|
|
|
```
|
|
```
|
|
|
code1_loadgeo.exe ..\rectangle.geo
|
|
solver.exe ..\simulation.json
|
|
|
```
|
|
```
|
|
|
|
* Open Paraview from the start menu and open the `.vtp` files that have been created by the solver.
|
|
|
|
|
|
|
|
|
You can also build the OpenMP and MPI examples from the `examples` folder using the same method:
|
|
|
|
```
|
|
|
|
cd examples\openmp
|
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
cmake .. && make
|
|
|
|
set OMP_NUM_THREADS=4
|
|
|
|
omp_hello.exe
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
cd examples\mpi
|
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
cmake .. && make
|
|
|
|
mpiexec -np 4 mpi_hello.exe
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
## CECI clusters / Linux / macOS
|
|
## CECI clusters / Linux / macOS
|
| ... | @@ -60,38 +74,35 @@ git clone git@gitlab.uliege.be:rboman/math0471.git |
... | @@ -60,38 +74,35 @@ git clone git@gitlab.uliege.be:rboman/math0471.git |
|
|
```
|
|
```
|
|
|
cd math0471
|
|
cd math0471
|
|
|
```
|
|
```
|
|
|
* Install gmsh-sdk and Eigen using the script `get_gmsh.sh` and `get_eigen.sh` in the `lib` folder:
|
|
* Build the source code:
|
|
|
```
|
|
|
|
|
cd lib
|
|
|
|
|
./get_gmsh.sh
|
|
|
|
|
./get_eigen.sh
|
|
|
|
|
cd ..
|
|
|
|
|
```
|
|
|
|
|
* Set the environment variables for cmake:
|
|
|
|
|
```
|
|
|
|
|
source ./envs/linux-macos.sh
|
|
|
|
|
```
|
|
|
|
|
* Go to the `examples/gmsh_api` folder:
|
|
|
|
|
```
|
|
|
|
|
cd examples/gmsh_api
|
|
|
|
|
```
|
|
|
|
|
* Create a `build` folder and go into it:
|
|
|
|
|
```
|
|
```
|
|
|
|
cd src
|
|
|
mkdir build
|
|
mkdir build
|
|
|
cd build
|
|
cd build
|
|
|
|
cmake .. && make -j 4
|
|
|
|
./solver ../simulation.json
|
|
|
```
|
|
```
|
|
|
* Run CMake (if an error occurs at this stage, it usually means that you forgot to "source" `envs/linux-macos.sh`):
|
|
* Display the results with Paraview
|
|
|
```
|
|
|
|
|
cmake ..
|
|
You can also build the OpenMP and MPI examples from the `examples` folder using the same method:
|
|
|
```
|
|
|
|
|
* Build the project (with 4 parallel processes):
|
|
|
|
|
```
|
|
```
|
|
|
make -j 4
|
|
cd examples/openmp
|
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
cmake .. && make
|
|
|
|
export OMP_NUM_THREADS=4
|
|
|
|
./omp_hello
|
|
|
```
|
|
```
|
|
|
* Run a program:
|
|
|
|
|
```
|
|
```
|
|
|
./code1_loadgeo ../rectangle.geo
|
|
cd examples/mpi
|
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
cmake .. && make
|
|
|
|
mpirun -np 4 ./mpi_hello
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
|
|
# "Debug" mode vs "Release" mode
|
|
# "Debug" mode vs "Release" mode
|
|
|
|
|
|
|
|
The code is built in "*debug mode*" by default. It means that the compiler makes no optimisations at all. It also enables many runtime checks and makes debugging possible by embedding all the debug symbols (the name of your variables and functions) into the executable.
|
|
The code is built in "*debug mode*" by default. It means that the compiler makes no optimisations at all. It also enables many runtime checks and makes debugging possible by embedding all the debug symbols (the name of your variables and functions) into the executable.
|
| ... | @@ -113,16 +124,16 @@ which is equivalent to |
... | @@ -113,16 +124,16 @@ which is equivalent to |
|
|
cmake -DCMAKE_BUILD_TYPE=Debug ..
|
|
cmake -DCMAKE_BUILD_TYPE=Debug ..
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
# Note about the environment scripts
|
|
# Note about environment scripts
|
|
|
|
|
|
|
|
The scripts in the `math0471/envs/` folder add several folders to 3 environment variables so that the system and CMake find the compiler and the libraries correctly:
|
|
The scripts in the `math0471/envs/` folder add several folders to 3 environment variables so that the system and CMake find the compiler and the libraries correctly:
|
|
|
* `PATH`: this variable should contain the location of the folder of your `g++` compiler, of `gmsh.exe` and its shared library (`gmsh.dll/.so/.dylib`),
|
|
* `PATH`: this variable should contain the location of the folder of your `g++` compiler, and the shared libraries you use in your program (`libzlib.dll/.so/.dylib`),
|
|
|
* `LIB`: points to the path of the folder containing `gmsh.lib` (windows) or `gmsh.so` (linux) or `gmsh.dylib` (macOS),
|
|
* `LIB`: points to the path of the folder containing `zlib.lib` (windows),
|
|
|
* `INCLUDE`: points to the path of the folder containing the `gmsh.h` header and the `Eigen` folder.
|
|
* `INCLUDE`: points to the path of the folder containing the `zlib.h` header.
|
|
|
|
|
|
|
|
Instead of using these scripts which should be loaded each time you start a new terminal, these 3 variables can be defined in your global user environment once and for all.
|
|
Instead of using these scripts which should be loaded each time you start a new terminal, these 3 variables can be defined in your global user environment once and for all.
|
|
|
|
|
|
|
|
This is done by going to "Settings" on Windows, and typing "env" in the search bar. Then choose the appropriate menu ("modify environment variables").
|
|
This is done by going to "Settings" on Windows, and typing "env" in the search bar. Then choose the appropriate menu ("modify environment variables").
|
|
|
|
|
|
|
|
On Linux/macOS, you can add/modify environment variables by editing `~/.bashrc` or `~/.profile` (just copy & paste the contents of `envs/linux-macos.sh` at the end of the file).
|
|
On Linux/macOS, you can add/modify environment variables by editing `~/.bashrc` or `~/.profile`.
|
|
|
|
|
|