-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into poisson_disk
- Loading branch information
Showing
18 changed files
with
659 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,65 @@ | ||
# CMake Build System | ||
# LaGriT and ExodusII with cmake | ||
|
||
The CMake build system is a way of enabling LaGriT to | ||
be cross-platform, cross-architecture, and cross-compiler. | ||
The CMake build system is a way of enabling LaGriT to be cross-platform, cross-architecture, and cross-compiler. This page is a verbose description of building LaGriT and includes instructions for building the optional library for ExodusII. | ||
|
||
The CMake build is controlled by CMakeLists.txt and files in directory /cmake | ||
|
||
The ExodusII libraries can be built using install-exodus.sh | ||
For additional help on ExodusII, see instructions at https://github.com/sandialabs/seacas | ||
**Note for Exodus with LaGriT, FORTRAN must be set to YES** | ||
|
||
See Build and Install Instructions: https://github.com/lanl/LaGriT#readme | ||
|
||
There's a really good tutorial-overview on CMake here, it covers how to handle multiple build configurations: https://cliutils.gitlab.io/modern-cmake/ | ||
|
||
|
||
## Code Development | ||
## Download LaGriT | ||
|
||
You can build as Debug (-g) or as Release with the CMake flag "-D CMAKE_BUILD_TYPE=[Debug|Release]". | ||
There's two stages in CMake; the 'configure' stage (where you run 'cmake ..') and the build stage (where you run 'make' using the Makefile created by cmake) | ||
|
||
The build type can only be set in the configure stage. One way to handle building both Debug and release is to make two build directories. Here's a short guide: https://riptutorial.com/cmake/example/7357/switching-between-build-types--e-g--debug-and-release | ||
Download the repo as shown under the Code button on git. | ||
For developers, be sure to use SSH version to clone. | ||
|
||
You can set cmake and make to show verbose screen reporting. These are run from your buld directory with the following options: | ||
``` | ||
cmake -D CMAKE_FIND_DEBUG_MODE=ON .. | ||
make VERBOSE=1 | ||
$ git clone [email protected]:lanl/LaGriT.git | ||
$ cd LaGriT/ | ||
``` | ||
|
||
If SSH Key needed, generate a key for your machine. | ||
[See GitHub Docs for SSH Key](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) | ||
``` | ||
Generate a SSH key (NOT RSA) in your .ssh directory. | ||
ssh-keygen -t ed25519 -C "email.lanl.gov" | ||
Copy contents of id_ed25519.pub into your SSH Keys on github (under settings). | ||
``` | ||
|
||
For LANL developers, you may need to generate a token to use as password. See instructions at https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token | ||
## Build ExodusII (optional) | ||
|
||
See instructions in install-exodus.sh | ||
|
||
LaGriT will use libs and files located in TPLs/seacas | ||
|
||
Expected libs and include files: | ||
|
||
``` | ||
lib/libexodus.a lib/libexoIIv2for32.a lib/libhdf5_hl.a lib/libnetcdf.a | ||
lib/libexodus_for.a lib/libhdf5.a lib/libhdf5_tools.a lib/libz.a | ||
include/exodus_config.h include/exodusII.h include/exodusII.inc include/exodusII_par.h | ||
include/netcdf.h include/hdf5.h | ||
``` | ||
|
||
Once the ExodusII is successful, build LaGriT as usual but with the EXODUS flag: | ||
|
||
``` | ||
mkdir build/ && cd build/ | ||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DLAGRIT_BUILD_EXODUS=ON | ||
make | ||
``` | ||
|
||
## Create your build directory: | ||
|
||
You can build as Debug (-g) or as Release with the CMake flag "-D CMAKE_BUILD_TYPE=[Debug|Release]". | ||
There's two stages in CMake; the 'configure' stage (where you run 'cmake ..') and the build stage (where you run 'make' using the Makefile created by cmake) | ||
|
||
The build type can only be set in the configure stage (with cmake) and will apply to all files in your build directory. If you make a change to cmake, you will need to run in a new directory, or remove all the files and directories created with your previous cmake configuration. | ||
|
||
Setup a work directory for dev and debug work (example using name "debug"). | ||
Use cmake to create Makefiles and build files. You will do this only once. | ||
Compile the lagrit executable using 'make' or 'make VERBOSE=1' | ||
|
@@ -36,8 +70,14 @@ make | |
``` | ||
|
||
Run ./lagrit and type command **test** which creates hex mesh and reports expected values. | ||
|
||
For debugging the build process, set cmake and make to show verbose screen reporting. These are run from your build directory with the following options: | ||
``` | ||
cmake -D CMAKE_FIND_DEBUG_MODE=ON .. | ||
make VERBOSE=1 | ||
``` | ||
## Modify code | ||
## Modify code and update **lagrit** executable | ||
|
||
Modify code by working with lagrit source files in LaGriT/src | ||
Do not add any non-code develpment files in the /src directory, they may be detected and attempted to use during compile time. | ||
|
@@ -55,7 +95,7 @@ make | |
|
||
|
||
### Example Directory structure for development: | ||
### Example Directory structure for developers: | ||
``` | ||
LaGriT/ | ||
|
@@ -132,8 +172,11 @@ make[2]: Leaving directory '/project/eesdev/tam/LaGriT/build' | |
[100%] Built target lagrit | ||
``` | ||
|
||
## Automatic Configurations | ||
|
||
This is work performed by cmake and is usually not modified. Cmake is used to do some automatic file edits that depend on the machine or platform you are using. | ||
|
||
## Header File configuration | ||
### Header File configuration | ||
|
||
CMake automatically configures two header files: | ||
|
||
|
@@ -164,3 +207,32 @@ configure_file( | |
|
||
The variable above - `@PROJECT_VERSION_MAJOR@` is an instrinsic CMake variable. You can define your own. For example, CMake code within `SetBitSize.cmake` configures the `lg_util/src/mm2000.h.in` file. | ||
|
||
### C-Fortran Compatibility | ||
|
||
LaGriT codes include both Fortran and C/C++ code files. The driver routines are Fortran, the C/C++ files use wrapper functions and definitions set by cmake before code is compiled. These are set during the configuration and should not need to be modified unless new routines are added. | ||
|
||
cmake writes fc_mangle.h for c-fortran routines. This file handles the symbol mangling for routines declared in src/lg_f_interface.h include file. For more information on this method visit https://www.netlib.org/lapack/lawnspdf/lawn270.pdf | ||
|
||
The C++ wrapper routines need to be listed in CMakeLists.txt: | ||
|
||
``` | ||
FortranCInterface_HEADER( | ||
${SRC_CORE}/fc_mangle.h | ||
SYMBOLS | ||
INITLAGRIT # syntax: <subroutine> | ||
DOTASK | ||
CMO_GET_NAME | ||
CMO_GET_INFO | ||
CMO_GET_INTINFO | ||
FC_CMO_GET_INT | ||
FC_CMO_GET_VINT | ||
FC_CMO_GET_DOUBLE | ||
FC_CMO_GET_VDOUBLE | ||
FPASS_TYPES | ||
INSIDE_TET | ||
LINESEG_TRI) | ||
``` | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
LaGriT Code Development Team | ||
---------------------------- | ||
|
||
[Carl W. Gable](http://www.lanl.gov/expertise/profiles/view/carl-gable), Geological Applications | ||
[Carl W. Gable](http://www.lanl.gov/search-capabilities/profiles/carl-gable.shtml) Author (Retired from LANL) | ||
|
||
[Terry Miller](http://www.lanl.gov/search-capabilities/profiles/terry-miller.shtml) Support | ||
|
||
[Jeffrey De'Haven Hyman](http://www.lanl.gov/search-capabilities/profiles/jeffrey-hyman.shtml) Applications | ||
|
||
[Tinka Gammel](http://public.lanl.gov/jtg/) | ||
|
||
Denise George (Retired) | ||
|
||
[Andrew Kuprat](http://www.pnnl.gov/science/staff/staff_info.asp?staff_num=7019) | ||
|
||
[Terry Miller](http://www.lanl.gov/expertise/profiles/view/terry-miller) | ||
|
||
Frank A. Ortega | ||
|
||
[Harold Trease](http://www.sysbio.org/resources/staff/trease.stm) | ||
[Harold Trease](http://www.sysbio.org/resources/staff/trease.stm) Retired from LANL | ||
|
||
[Lynn Trease](http://www.sysbio.org/resources/staff/l-trease.stm) | ||
[Lynn Trease](http://www.sysbio.org/resources/staff/l-trease.stm) Retired from LANL | ||
|
||
Robert B. Walker | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.