initial upload
This commit is contained in:
204
documentation/build.md
Executable file
204
documentation/build.md
Executable file
@@ -0,0 +1,204 @@
|
||||
---
|
||||
Title: "Manual - Building an Executable"
|
||||
Tags: Manual Building an executable and running LaGriT
|
||||
---
|
||||
|
||||
|
||||
# Building an executable with LaGriT
|
||||
|
||||
------
|
||||
|
||||
The executable is built by linking a driver routine with the code and
|
||||
utility libraries. The driver routine must contain a call to initLaGriT
|
||||
and a call to control_command_lg and must contain a subroutine called
|
||||
user_sub.
|
||||
|
||||
The input arguments to initLaGriT are:
|
||||
|
||||
**mode** - set to 'noisy' for output to be echoed to the screen - set to
|
||||
'silent' for no echo
|
||||
|
||||
**log_file** - name of log file (if ' ' or '-def-' use default name which
|
||||
is logx3dgen) This file will contain a list of commands.
|
||||
|
||||
**batch_file** - name of batch file (if ' ' or '-def-' use default name
|
||||
which is outx3dgen). This file will contain a list of commands and the
|
||||
error, warning and informational messages generated by the command.
|
||||
User_sub is used to implement user commands, see [User Commands](writing.md).
|
||||
|
||||
A sample Fortran driver routine is listed below.
|
||||
|
||||
<pre>
|
||||
program adrivgen
|
||||
|
||||
C PURPOSE LaGriT driver
|
||||
|
||||
implicit none
|
||||
integer ierror_return
|
||||
|
||||
call initLaGriT('noisy',' ',' ')
|
||||
|
||||
call control_command_lg(ierror_return)
|
||||
|
||||
stop
|
||||
end
|
||||
|
||||
C Subroutine user_sub
|
||||
C
|
||||
C PURPOSE
|
||||
C Process user supplied commands
|
||||
C
|
||||
C INPUT ARGUMENTS
|
||||
C
|
||||
C imsgin - integer array of tokens returned by parser
|
||||
C xmsgin - real array of tokens returned by parser
|
||||
C cmsgin - character array of tokens returned by parser
|
||||
C msgtyp - int array of token types returned by parser
|
||||
C nwds - number of tokens returned by parser
|
||||
C
|
||||
C OUTPUT ARGUMENTS
|
||||
C
|
||||
C ierr1 - 0 for successful completion - -1 otherwise
|
||||
subroutine user_sub(imsgin,xmsgin,cmsgin,msgtyp,nwds,ierr1)
|
||||
|
||||
character*32 cmsgin(nwds)
|
||||
integer imsgin(nwds),msgtyp(nwds)
|
||||
integer nwds,ierr1,lenc
|
||||
real*8 xmsgin(nwds)
|
||||
|
||||
C set default error return to fail
|
||||
ierr1=-1
|
||||
|
||||
C Insert code here to handle user coded subroutines
|
||||
C For example
|
||||
|
||||
if(cmsgin(1).eq.'my_cmnd') then
|
||||
call my_rtn(imsgin,xmsgin,cmsgin,msgtyp,nwds,ierr1)
|
||||
else
|
||||
ierr1=-1
|
||||
endif
|
||||
|
||||
return
|
||||
end
|
||||
</pre>
|
||||
|
||||
### Sample build scripts
|
||||
|
||||
LaGriT can be compiled on most modern machines including Linux, and Mac. WINDOWS is still under development, but pre-cmake versions were successful under Cygwin. LaGriT now uses cmake to build with or without external libraries such as Seacas Exodus.
|
||||
|
||||
The most recent instructions can be found on the github pages.
|
||||
Simple install, build, and test: [LaGriT Github README](https://github.com/lanl/LaGriT/blob/master/README.md)
|
||||
|
||||
### Running LaGriT
|
||||
|
||||
To execute, use standard unix file redirection for standard input and
|
||||
output. LaGriT will produce two additional files, lagrit.out and
|
||||
lagrit.log. The user can change the names of these files by supplying new
|
||||
names as arguments in the call to initLaGriT before compiling. These files contain
|
||||
detailed output information and the list of commands respectively.
|
||||
LaGriT may also be run interactively in which case the user will be
|
||||
prompted to enter commands at the machine prompt.
|
||||
|
||||
lagrit < lagrit_command_file
|
||||
|
||||
|
||||
### The following are examples to build old releases (pre V3.2) but may be helpful on older machines.
|
||||
|
||||
**Sun OS and Sun Solaris forte version 7 compiler:**
|
||||
|
||||
f90 -O2 -lf77compat -o LaGriTgen adrivgen.f libLaGriT.a libutil.a
|
||||
|
||||
if the user wishes to link in user subroutines that contain CRAY type
|
||||
pointer statements, these routines must be compiled using the f77
|
||||
compiler and then the .o files linked in with f90:
|
||||
|
||||
|
||||
f77 -c -O2 user_routines.f
|
||||
f90 -O2 -lf77compat -o LaGriTgen adrivgen.f user_routines.o
|
||||
libLaGriT.a libutil.a
|
||||
|
||||
older sun compilers:
|
||||
|
||||
f90 -O2 -o LaGriTgen adrivgen.f libLaGriT.a libutil.a
|
||||
|
||||
**IBM RISC**
|
||||
|
||||
xlf -g -o LaGriTgen -qintlog -qcharlen=500 -brename:.fdate,.fdate_
|
||||
adrivgen.f
|
||||
libLaGriT.a libutil.a
|
||||
|
||||
**SGI**
|
||||
|
||||
f90 -O2 -n32 -r10000 -o LaGriTgen adrivgen.f libLaGriT.a libutil.a
|
||||
|
||||
Compile for 64 bit I8 SGI:
|
||||
|
||||
f90 -O2 -64 -i8 -o LaGriTgen adrivgen.f libLaGriT.a libutil.
|
||||
|
||||
**HP:**
|
||||
|
||||
f90 +U77 -R8 -lm -o LaGriTgen adrivgen.f libLaGriT.a libutil.a
|
||||
|
||||
**DEC COMPAQ compiler**
|
||||
|
||||
fort -i8 -O -fast -pipeline -transform_loops -o LaGriTgen
|
||||
adrivgen.f libLaGriT.a libutil.a
|
||||
|
||||
**ABSOFT compiler**:
|
||||
|
||||
f90 -YTEXT_NAMES=LCS -o LaGriTgen adrivgen.f fdate.f libLaGriT.a
|
||||
libutila. -lm -lu77
|
||||
|
||||
where fdate.f is
|
||||
<pre>
|
||||
subroutine fdate(string)
|
||||
character*(*) string
|
||||
call fdate_(string)
|
||||
return
|
||||
end
|
||||
</pre>
|
||||
|
||||
**LINUX**
|
||||
|
||||
if ($OSTYPE == 'Linux') then
|
||||
set OSTAG = _lin
|
||||
set F77FLAG = "-c -f -m32 -YEXT_NAMES=ASIS"
|
||||
set F90FLAG = "-m32 -YEXT_NAMES=ASIS"
|
||||
set LINKFLAG = "-lm -lU77"
|
||||
set F90DIR = /opt/absoft10.0/bin
|
||||
|
||||
else if ($OSTYPE == 'Darwin') then
|
||||
set OSTAG = _mac
|
||||
set F77FLAG = "-c -f -N113 -N90 -B19 -q"
|
||||
set F90FLAG = ""
|
||||
set LINKFLAG = " -lU77"
|
||||
set F90DIR = /Applications/Absoft/bin
|
||||
|
||||
else if ($OSTYPE == 'SunOS') then
|
||||
set OSTAG = _sun
|
||||
source /n/env/local.forte.7
|
||||
set F77FLAG = -c
|
||||
set F90FLAG = "-lf77compat "
|
||||
set LINKFLAG = " "
|
||||
set F90DIR = /n/local_SunOS/forte7/SUNWspro/bin
|
||||
|
||||
else
|
||||
echo 'OS $OSTYPE not recognized '
|
||||
exit 1
|
||||
endif
|
||||
|
||||
set FFILES = "lagrit_main.f lagrit_fdate.f"
|
||||
set OFILES = "lagrit_main.o lagrit_fdate.o"
|
||||
set binname = lagrit$OSTAG$COPT
|
||||
set binname_date = lagrit$OSTAG$COPT$DATETAG
|
||||
set liblagrit = lagrit$OSTAG$COPT.a
|
||||
set libutil = util$OSTAG$COPT.a
|
||||
'rm' -f *.o
|
||||
|
||||
$F90DIR/f77 $CFLAG $F77FLAG $FFILES
|
||||
$F90DIR/f90 $CFLAG $F90FLAG -o $binname $OFILES $LAGRIT_LIBS/$liblagrit $UTIL_LIBS/$libutil $LINKFLAG
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user