Skip to content

Commit

Permalink
More 3.2.2 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
daniellivingston committed Jun 7, 2017
1 parent a25b418 commit 0c27b9c
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 59 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ Download the repo by running:

git clone https://github.com/lanl/LaGriT.git

Then `cd LaGriT/` and run:
Then `cd LaGriT/` and:

./install.sh --release

Or `--help` to see other build configurations. The build script will check if Exodus is installed; if not, download and building of Exodus from the [Seacas repo](https://github.com/gsjaardema/seacas) will automatically begin. If you do not need Exodus, pass the argument `--skipexodus`.

### Supporting Documentation ###
---
* [Manual Installation](documentation/INSTALL.md)
* [Installation](documentation/INSTALL.md)
* [LaGriT Description and Manual](http://lagrit.lanl.gov)
* [LaGriT commands](http://lagrit.lanl.gov/commands.shtml)
* [PyLaGriT documentation](https://lanl.github.io/LaGriT/)
Expand Down
105 changes: 52 additions & 53 deletions documentation/INSTALL.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,38 @@
# Building LaGriT
----------------------------------------------

If you are trying to build LaGriT on a Windows PC, follow the directions [here](build_win.md). If you are on Linux or macOS, you can build LaGriT manually by following the directions in this document or using the automatic installer script.

## Automatic Build (Linux, macOS)
To use the install script, download the repo by running:

$ git clone https://github.com/lanl/LaGriT.git

Then `cd LaGriT/` and:

$ ./install.sh --release

| Flag | Option |
| ------ | ------ |
| `-h`, `--help` | Displays usage and build options |
| `-r`, `--release` | Builds a standard release executable with shared libraries |
| `-s`, `--static` | Builds a static executable |
| `-d`, `--debug` | Builds a debug executable with shared libraries |
| `-se`, `--skipexodus` | Removes dependencies on Exodus and bypasses Exodus install |
| `-e=PATH`, `--exodus=PATH` | Pass `/path/to/exodus/lib` for existing Exodus build* |

**Script automatically parses `LD_LIBRARY_PATH` for Exodus libraries - pass PATH if `echo $LD_LIBRARY_PATH` doesn't find Exodus automatically*

## Manual Build (Linux, macOS)
### 1. Installing Dependencies
LaGriT requires the following packages installed:

| Library | Source |
| ------ | ------ |
| ExodusII 6.09 | (https://github.com/gsjaardema/seacas) |
| netCDF | (http://www.unidata.ucar.edu/software/netcdf/docs/getting_and_building_netcdf.html) |
| zlib | (https://github.com/madler/zlib) |
| HDF5 | (https://support.hdfgroup.org/HDF5/) |
| ExodusII 6.39 | https://github.com/gsjaardema/seacas |
| netCDF | https://www.unidata.ucar.edu/downloads/netcdf/index.jsp |
| zlib | https://github.com/madler/zlib |
| HDF5 | https://support.hdfgroup.org/HDF5/ |


For instructions on installing these dependencies, [visit here](DEPENDENCIES.md). LaGriT supports the ExodusII file format as output (which sits atop netCDF). If you have no need for this format, you may continue building LaGriT by skipping the ExodusII installation and following the directions in [Manging Exodus](#21-managing-exodus).
Expand All @@ -17,88 +42,62 @@ For instructions on installing these dependencies, [visit here](DEPENDENCIES.md)

### 2. Cloning and Building LaGriT
Clone the repository and begin the build process.
```sh
$ git clone https://github.com/lanl/LaGriT.git
$ cd LaGriT/src/
```

$ git clone https://github.com/lanl/LaGriT.git
$ cd LaGriT/src/

After cloning LaGriT to the directory you want it installed, navigate to the `src/` folder within that directory.

#### 2.1 Managing Exodus

LaGriT has the capability to export to the ExodusII file format. If you do not need this format, or would rather not install Exodus, run the following commands from within the `src/` directory:

```sh
$ cp dumpexodusII.f.withnoexo dumpexodusII.f
$ echo "" > exo_init_ext.c
$ echo "" > exo_put_sets.c
```
$ cp dumpexodusII.f.withnoexo dumpexodusII.f
$ echo "" > exo_init_ext.c
$ echo "" > exo_put_sets.c

These three files make calls to `exodusII.h`. The first line replaces `dumpexodusII.f` with a file that does not make this call, while the second two lines empty out ExodusII-centric C files.

**If instead you are using Exodus,** make sure it is built in such a way that `exodusII.h` can be read at buildtime. On a modularized Ubuntu configuration, this would require running
**If instead you are using Exodus,** export the path to the Exodus library to a variable that will be read by the linker:

```sh
$ module load exodusii/6.09/gcc-4.8.2-serial
$ module list
```

where `exodusii/6.09/gcc-4.8.2-serial` may need to be changed to match your particular configuration.
$ export $ACCESS=/path/to/exodus/lib/


#### 2.2 Building the LaGriT library

If this is your first time installing LaGriT, you will need to navigate to `LaGriT/lg_util/src` and build `lg_util`. To do this, you may either follow the directions in `README` for advanced operations, or simply run

```sh
$ make clean
$ make MOPT=64 lib
```

$ make clean
$ make MOPT=64 lib
$ export $LAGRIT_UTIL_SRC_DIR=`pwd`


Since this library is stable and generally not updated with most releases, it is usually not necessary to recompile with each pull.

#### 2.3 Building LaGriT

Navigate back to the `LaGriT/src` directory by running `$ cd ../src`.

Similar to the above step, run the commands

```sh
$ rm *.o
$ rm *.mod
$ make MOPT=64 lib
```
Clean the directory by running

When LaGriT launches, it displays a banner indicating date of compile and the type of system it was built on. Work is in progress to autopopulate this information, but in the meantime it is necessary to change this values yourself. If you want an updated banner, edit `lagrit_ulin64.h` to match your environment and then run

```sh
$ cp lagrit_ulin64.h lagrit.h
$ cp machine_m64.h machine.h
```
$ rm *.o
$ rm *.mod

Next, link the Fortran libraries and make:
```sh
$ gfortran -O -fcray-pointer -fdefault-integer-8 -m64 -Dlinx64 -c -o lagrit_main.o lagrit_main.f
$ gfortran -O -fcray-pointer -fdefault-integer-8 -m64 -Dlinx64 -c -o lagrit_fdate.o lagrit_fdate.f
make MOPT=64 lib
```

$ gfortran -O -fcray-pointer -fdefault-integer-8 -m64 -Dlinx64 -c -o lagrit_main.o lagrit_main.f
$ gfortran -O -fcray-pointer -fdefault-integer-8 -m64 -Dlinx64 -c -o lagrit_fdate.o lagrit_fdate.f
$ make MOPT=64 lib

One more command and we are done:

```sh
$ gfortran -O -Dlinx64 -fcray-pointer -fdefault-integer-8 -fno-sign-zero -o mylagrit lagrit_main.o lagrit_fdate.o lagrit_ulin64_o_gcc.a $LAGRIT_UTIL_SRC_DIR/util_ulin64_o_gcc.a -L/n/swdev/packages/Ubuntu-16.04-x86_64/exodusii/seacas-2.0/gcc-5.4.0-serial/lib -lexoIIv2for -lexodus -lnetcdf -lm -lstdc++
```

Before running this command, note a few things about it:
1. You will need to change `/n/swdev/packages/Ubuntu-14.04-x86_64/exodusii/6.09/gcc-4.8.2-serial/lib` to match your Exodus install.
2. Based on compilation, `../lg_util/src/util_ulin64_o_gcc.a` may have a different name...if an error is returned, navigate to this directory and change the command to match the `util_ulin64_*.a` file within.
$ gfortran -O -Dlinx64 -fcray-pointer -fdefault-integer-8 -fno-sign-zero -o lagrit lagrit_main.o lagrit_fdate.o lagrit_ulin64_o_gcc.a $LAGRIT_UTIL_SRC_DIR/util_ulin64_o_gcc.a -L$ACCESS -lexoIIv2for -lexodus -lnetcdf -lm -lstdc++

#### Congradulations - LaGriT is built! ####
#### Congratulations - LaGriT is built! ####
From inside `LaGriT/src/`, run

```sh
$ ./mylagrit
```
$ ./lagrit

and welcome to the wonderful world of mesh generation!

Expand Down
10 changes: 6 additions & 4 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
# This script will download packages for, configure, and build LaGriT cross-platform.
# For bug reporting or suggestions on improvement, email [email protected]
#-------------------------------------------------------------------------------------------
# TODO: (1) Fix --static build for macOS
# (1.1) Current version returns: dyld: Library not found: path/to/exodus/lib/libhdf5_hl.100.dylib
# (2) Fix build process for Windows (Cygwin / MinGW)
# (3) Test on other shells
# Verified on:
# - macOS Sierra
# - Ubuntu 14.04
# - Ubuntu 16.04
# - Windows 10 with Linux shell
#-------------------------------------------------------------------------------------------
# TODO: (1) Fix --static build for macOS
# (1.1) Current version returns: dyld: Library not found: path/to/exodus/lib/libhdf5_hl.100.dylib
# (2) Fix build process for Windows (Cygwin / MinGW)
# (3) Test on other shells

SCRIPT_VERSION="v0.5"

Expand Down

0 comments on commit 0c27b9c

Please sign in to comment.