forked from magnetotellurics/ModEM
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathINSTALL
More file actions
72 lines (53 loc) · 2.52 KB
/
INSTALL
File metadata and controls
72 lines (53 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
## Dependencies
ModEM depends on the [LAPACK][https://www.netlib.org/lapack/] and
[BLAS](https://www.netlib.org/blas/) libraries. Often, these are already
included on most systems, but if not you will need to install them yourself and
ensure they are properly linked in the `LIBS` and `LIBS_PATH` variables of the
Makefile.
## Creating Makefiles from Configuration files
The current build system for ModEM uses the `fmkmf.pl` Perl script and the
configuration scripts that are in `f90/CONFIG`. Although ModEM uses Make and
Makefiles, makefiles are meant to be created by these configuration scripts.
To create Makefiles, run the configuration scripts that match your system,
desired compiler and desired ModEM version. These configuration scripts
call the `fmkmf.pl` script:
``` bash
$ cd f90/
$ ./CONFIG/Configure.3D_MT.MAC.GFortran makefile.gnu.mpi MPI
```
All configuration scripts take the same arguments:
```bash
$ /CONFIG/Configfile <desired-makefile-name> <type>
```
Where `type` is either: `MPI, release, debug`:
* `MPI` - Generates a makefile that will compile an MPI version of ModEM
* `release` - Generates a makefile that will compile a serial version of ModEM
* `debug` - Generates a makefile that will compile a serial version of ModEM
with `-O0` (no optimizations) and debug symbols (`-g`, bounds checking ,etc)
Of course, any generated makefile can be altered as you see fit. For instance,
it is often helpful to add the `-g` to compile with debug symbols when working
with an MPI makefile.
## Compiling
Once you have generated your own makefile, or decided to use one of the
defaults, you can compile ModEM by renaming that makefile to `Makefile` and
then run `make`:
``` bash
$ cp Makefile.3D.MF.gnu Makefile
$ make clean # Not necessary from a fresh clone
$ make
```
### Compiling with MPI
If you have MPI installed, and already have a serial makefile generated you can
easily compile the MPI version of ModEM by altering the makefile. This is
sometimes easier then creating a new makefile from the configuration scripts.
To compile an MPI version, edit the compiler in your makefile to be an MPI
compiler (e.g. `mpifort`) and add `-DMPI` to the `MPIFLAGS` variable:
``` Makefile
F90 = mpifort
MPIFLAGS = -DMPI ... omitting other flags
```
However, you can also generate an MPI makefile by running the configuration
scripts and passing it `MPI` as the type.
> **IMPORTANT NOTE:** When running ModEM with MPI you must use at least 2 tasks
> and a max of `(2 x nTransmitters) + 1` tasks (except for the SP2 version
> compiled with `-DFG`).