Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
feature-scripts
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Community
feature-scripts
Commits
e9c4f977
Commit
e9c4f977
authored
Jun 30, 2017
by
Mark Olesen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ENH: update legacyCompile to use separate config files
parent
c0aae671
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
478 additions
and
307 deletions
+478
-307
legacyCompile/README.md
legacyCompile/README.md
+23
-26
legacyCompile/legacyCompile
legacyCompile/legacyCompile
+349
-281
legacyCompile/v1612.cfg
legacyCompile/v1612.cfg
+53
-0
legacyCompile/v1706.cfg
legacyCompile/v1706.cfg
+53
-0
No files found.
legacyCompile/README.md
View file @
e9c4f977
...
...
@@ -52,18 +52,17 @@ and package versions, it may not work for all users and environments.
---
##
Script
Configuration
## Configuration
Users need to define the desired packages and versions to use for the
OpenFOAM compilation. The packages and versions need to be input under the
paragraph
`USER INPUT (2)
`
, stating whether the default version is to be
section
`[software]
`
, stating whether the default version is to be
used, or the user needs to use a different version. If both entries have
information, the user-preference will prevail. In any case, a suitable
tar/zip file with packageName-versionNumber needs to be placed under subdir
`packages/`
. The value
`ompiType`
refers to the openmpi type (system|third).
# USER INPUT (2)
# ~~~~~~~~~~~~~~
[software]
# Preferred software versions etc. Use 'third' for ThirdParty.
#---------------------+-------------------+-------------------+
# package | default | user-preference |
...
...
@@ -95,23 +94,21 @@ tar/zip file with packageName-versionNumber needs to be placed under subdir
## Usage
./legacyCompile [OPTION] OPERATION [...OPERATION]
./legacyCompile [OPTIONS] OPERATION [...OPERATION] configFile
options
:
-purge Purge old directories before unpacking (CAUTION)
-int32 | -int64 Label width
-SP | -DP Precision
-sigfpe | -no-sigfpe Activate/deactivate FOAM_SIGFPE handling
-help
operations
:
-unpack Unpack sources, configure
-third Compile ThirdParty
-foam Compile OpenFOAM
-list List configured versions only
-all Alias for -unpack -third -foam
-rebuild Alias for -third -foam
options
:
-purge Purge old directories before unpacking (CAUTION)
-help
Config options
:
-int32 | -int64 Label width (default
:
32)
-SP | -DP Precision (default
:
DP)
-sigfpe |-no-sigfpe Activate/deactivate FOAM_SIGFPE handling
-all Alias for -unpack -third -foam
-rebuild Alias for -third -foam
The script contains the three essential operations
:
...
...
@@ -127,43 +124,43 @@ unpack stage).
*
To compile first time (from scratch) with default label size and precision
:
./legacyCompile -all
./legacyCompile -all
configFile
*
To repeat the same, **overwriting** any existing installation
:
./legacyCompile -all -purge
./legacyCompile -all -purge
configFile
*
To unpack all packages and configure some OpenFOAM settings without
compiling
:
./legacyCompile -unpack
./legacyCompile -unpack -purge
# c
aution: removes existing installation
./legacyCompile -unpack
configFile
./legacyCompile -unpack -purge
configFile
# C
aution: removes existing installation
To compile with 64 bit label size in single precission
:
./legacyCompile -all -int64 -SP
./legacyCompile -all -int64 -SP
configFile
If you change your third-party package selections or the preferred
configuration (SP, DP etc), you will need the `-unpack` operation,
which also includes some configuration operations.
./legacyCompile -unpack
./legacyCompile -unpack
configFile
To (re)compile ThirdParty and OpenFOAM individually
:
./legacyCompile -unpack -third -purge
./legacyCompile -unpack -third -purge
configFile
(to compile ThirdParty from scratch)
./legacyCompile -foam
./legacyCompile -foam
configFile
(to compile OpenFOAM from existing ThirdParty)
To compile with 32 bit label size in single precission
:
./legacyCompile -all -int64 -SP
./legacyCompile -all -int64 -SP
configFile
---
...
...
@@ -183,4 +180,4 @@ building Clang), you should remove the corrsponding logfile(s) before
recompiling with the '-unpack -third
`
options.
---
201
6-12-21
201
7-06-29
legacyCompile/legacyCompile
View file @
e9c4f977
...
...
@@ -7,220 +7,50 @@
#
Simple
convenience
script
to
install
OpenFOAM
on
older
systems
.
#
Use
ThirdParty
compiler
,
but
retain
most
default
software
versions
.
#
#
Adjust
the
relevant
USER
INPUT
sections
below
prior
to
running
.
#
-
INPUT
(
1
)
has
the
top
-
level
packaging
#
-
INPUT
(
2
)
has
version
preference
s
#
[
package
]
-
Top
-
level
package
information
#
[
arch
]
-
Architecture
#
[
software
]
-
Preferred
software
version
s
#
#
Input
Directory
:
#
-
./
packages
#
Contains
the
tar
files
#
-
./
packages
-
Contains
the
tar
files
#
#
Output
Directories
#
-
./
install
#
The
compiled
installation
#
-
./
log
#
Log
files
from
the
build
scripts
#
-
./
install
-
The
compiled
installation
#
-
./
log
-
Log
files
from
the
build
scripts
#
#
License
#
GPL
v3
or
later
#
Copyright
(
C
)
2016
Roger
Almenar
,
ESI
GmbH
.
#
Copyright
(
C
)
2016
-
2017
Roger
Almenar
,
ESI
GmbH
.
#------------------------------------------------------------------------------
#
~~~~~~~~~~~~~~
#
USER
INPUT
(
1
)
#
~~~~~~~~~~~~~~
FoamVersion
=
v1612
+
OFdirName
=
OpenFOAM
-$
FoamVersion
TPdirName
=
ThirdParty
-$
FoamVersion
#
Source
package
names
may
differ
from
the
directory
names
above
#
uncomment
and
change
if
needed
)
#
OFsource
=
OpenFOAM
-
plus
#
TPsource
=
ThirdParty
-
plus
#
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
User
input
continues
below
at
USER
INPUT
(
2
)
#
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#------------------------------------------------------------------------------
_preferences
()
{
#
'package default version'
lines
=>
packageDefault
,
packageVersion
variable
local
line
pkg
def
val
while
read
-
r
line
do
set
--
$
line
;
pkg
=
"$1"
;
def
=
"$2"
;
val
=
"$3"
if
[
"$pkg"
=
"${pkg#[a-z]}"
]
then
continue
#
Packages
must
start
with
lowercase
elif
[
$#
-
eq
2
-
o
$#
-
eq
3
]
then
val
=
"${3:-$def}"
#
Use
default
if
not
specified
eval
"${pkg}Default=
\"
\$def
\"
"
;
eval
"${pkg}Version=
\"
\$val
\"
"
else
echo
"Bad input while setting versions"
;
echo
" $line"
exit
1
fi
done
}
_preferences
<<-
USER_INPUT
#
~~~~~~~~~~~~~~
#
USER
INPUT
(
2
)
#
~~~~~~~~~~~~~~
#
Preferred
software
versions
etc
.
Use
'third'
for
ThirdParty
.
#---------------------+-------------------+-------------------+
#
package
|
default
|
user
-
preference
|
#---------------------+-------------------+-------------------+
boost
boost_1_62_0
cgal
CGAL
-
4.9
fftw
fftw
-
3.3.5
openmpi
openmpi
-
1.10.4
scotch
scotch_6
.0.3
paraview
ParaView
-
5.0.1
cmake
cmake
-
system
cmake
-
3.5.2
vtk
none
VTK
-
7.1.0
mesa
none
mesa
-
13.0.1
qt
qt
-
system
qt
-
4.8.7
llvm
llvm
-
3.7.0
gcc
system
gcc
-
4.8.5
gmp
system
gmp
-
6.1.1
mpfr
system
mpfr
-
3.1.5
mpc
system
mpc
-
1.0.3
label
32
precision
DP
ompiType
system
third
compilerType
system
third
compiler
Gcc
Clang
#
-----------------------------------------------------------------------------
USER_INPUT
#
#
NO
NORMAL
EDITING
BELOW
THIS
LINE
#------------------------------------------------------------------------------
#
Local
directories
INSTALL_DIR
=$
PWD
/
install
PACKAGE_DIR
=$
PWD
/
packages
LOGFILE_DIR
=$
PWD
/
log
#
Special
treatment
for
gcc
sub
-
components
(
needs
rethinking
)
case
"$compilerVersion"
in
Gcc
|
Gcc48
)
gccVersion
=
gcc
-
4.8.5
#
match
value
in
config
.
sh
/
compiler
;;
Gcc49
)
gccVersion
=
gcc
-
4.9.3
#
match
value
in
config
.
sh
/
compiler
;;
Gcc62
)
gccVersion
=
gcc
-
6.2.0
#
match
value
in
config
.
sh
/
compiler
;;
Gcc
*)
echo
"Error: unconfigured gcc version '$compilerVersion'"
exit
1
#
Really
exit
,
since
this
must
be
an
input
error
;;
esac
#
-----------------------------------------------------------------------------
#
NO
FURTHER
EDITING
BELOW
THIS
LINE
#------------------------------------------------------------------------------
#
Name
of
qt
source
directory
is
a
fixed
value
qtSource
=
"qt-everywhere-opensource-src-${qtVersion##*-}"
#
Change
'system'
into
'gmp-system'
etc
for
check
in
gcc
gmp
mpfr
mpc
do
if
eval
test
"\$${check}Version = system"
then
eval
"${check}Version=${check}-system"
eval
"${check}Default=${check}-system"
fi
done
#
No
gcc
/
gmp
/
mpfr
/
mpc
for
system
compilers
or
non
-
Gcc
compilers
case
"$compilerTypeVersion:$compilerVersion"
in
third
:
Gcc
*)
;;
third
:
Clang
*
|
system
:
Clang
*
|
system
:
Gcc
|
system
:
Icc
|
system
:*)
#
System
,
or
known
non
-
gcc
for
check
in
gcc
gmp
mpfr
mpc
do
eval
"unset ${check}Version ${check}Default"
done
;;
*)
echo
"Error: unknown $compilerTypeVersion-compiler '$compilerVersion'"
exit
1
;;
esac
#
Separator
lines
_line
()
{
echo
" ==================== ==================== ===================="
}
#
Various
formatting
for
-
list
output
#
formatted
print
_fmt2
()
{
local
arg1
=
"${1:-????}"
local
arg2
=
"${2:-undefined}"
printf
" %-20s %-20s
\n
"
"$arg1"
"$arg2"
}
#
formatted
print
#
name
version
default
[-
nocheck
]
_fmt3
()
{
local
what
=
"${1:-????}"
local
arg1
=
"${2:-undefined}"
local
arg2
=
"${3:-undefined}"
if
[
"$#"
-
eq
2
]
then
_fmt2
"$what"
"$arg1"
elif
[
"$#"
-
eq
3
-
a
"$arg1"
=
"$arg2"
]
then
_fmt2
"$what"
"$arg1"
else
printf
" %-20s %-20s %-20s
\n
"
"$what"
"$arg1"
"$arg2"
fi
}
#
input
:
'package'
#
output
:
'package'
packageDefault
packageVersion
_fmtDefVer
()
{
local
pkg
=
"$1"
eval
local
"def=\$${pkg}Default"
eval
local
"val=\$${pkg}Version"
_fmt3
"$pkg"
"$def"
"$val"
}
#------------------------------------------------------------------------------
usage
()
{
exec
1
>&
2
while
[
"$#"
-
ge
1
];
do
echo
"$1"
;
shift
;
done
cat
<<
USAGE
usage
:
${
0
##*/}
[
OPTION
]
OPERATION
[...
OPERATION
]
usage
:
${
0
##*/}
[
OPTIONS
]
OPERATION
[...
OPERATION
]
configFile
options
:
-
purge
Purge
old
directories
before
unpacking
(
CAUTION
)
-
int32
|
-
int64
Label
width
-
SP
|
-
DP
Precision
-
sigfpe
|
-
no
-
sigfpe
Activate
/
deactivate
FOAM_SIGFPE
handling
-
help
operations
:
-
unpack
Unpack
sources
,
configure
-
third
Compile
ThirdParty
-
foam
Compile
OpenFOAM
-
list
List
configured
versions
only
-
all
Alias
for
-
unpack
-
third
-
foam
-
rebuild
Alias
for
-
third
-
foam
options
:
-
purge
Purge
old
directories
before
unpacking
(
CAUTION
)
-
help
Config
options
:
-
int32
|
-
int64
Label
width
(
default
:
${
labelDefault
:-?})
-
SP
|
-
DP
Precision
(
default
:
${
precisionDefault
:-?})
-
sigfpe
|-
no
-
sigfpe
Activate
/
deactivate
FOAM_SIGFPE
handling
-
all
Alias
for
-
unpack
-
third
-
foam
-
rebuild
Alias
for
-
third
-
foam
=========================
Make
and
install
$
OFdirName
/
$
TPdirName
Make
and
install
OpenFOAM
/
ThirdParty
package
=
$
PWD
/
packages
logdir
=
$
PWD
/
log
install
=
$
PWD
/
install
...
...
@@ -228,7 +58,7 @@ Make and install $OFdirName / $TPdirName
USAGE
exit
1
}
#------------------------------------------------------------------------------
#
Report
error
and
exit
die
()
{
...
...
@@ -240,17 +70,11 @@ die()
exit
1
}
#------------------------------------------------------------------------------
#
Location
of
the
OpenFOAM
bashrc
BASHRC_FILE
=$
INSTALL_DIR
/$
OFdirName
/
etc
/
bashrc
#
Various
building
operations
#
OpenFOAM
options
,
various
build
options
unset
optLabel
optPrec
optVerbose
optFpe
configFile
unset
runLIST
runUNPACK
runTHIRD
runFOAM
purgeOLDFILES
#
Pre
-
load
options
unset
optLabel
optPrec
optFpe
case
"$labelVersion"
in
(
32
|
64
)
optLabel
=
"-int$labelVersion"
;;
esac
case
"$precisionVersion"
in
(
DP
|
SP
)
optPrec
=
"-$precisionVersion"
;;
esac
#
Parse
options
while
[
"$#"
-
gt
0
]
do
...
...
@@ -283,6 +107,9 @@ do
-
list
)
optList
=
true
;;
-
verbose
)
optVerbose
=
true
;;
-
int32
|
-
int64
)
optLabel
=
"$1"
...
...
@@ -294,22 +121,263 @@ do
optFpe
=
"$1"
;;
--)
shift
break
;;
-*)
die
"unknown option: '$1'"
;;
*)
die
"unknown option/argument: '$1'"
break
;;
esac
shift
done
configFile
=
"$1"
[
"$#"
-
eq
1
]
||
die
"expecting a config filename"
[
-
f
"$configFile"
]
||
die
"No such file: $configFile"
[
-
n
"$runUNPACK$runTHIRD$runFOAM$optList"
]
||
die
"No operations specified"
#------------------------------------------------------------------------------
#
Set
some
of
the
architecture
configuration
#
[
package
]
#
Get
[
config
]
section
with
these
types
of
entries
(
as
shell
variables
)
#
FoamVersion
=
value
#
OFdirName
=
value
#
TPdirName
=
value
#
---------------
#
Extract
name
=
value
-
ignore
blank
and
comment
lines
eval
$(
sed
-
n
\
-
e
'/^ *[;#]/d'
\
-
e
'/^\[package\]/,/^\s*\[/{ /^[^ =][^ =]*\=[^ =][^ =]/p }'
\
$
configFile
)
#
These
must
be
defined
for
envar
in
FoamVersion
OFdirName
TPdirName
do
if
[
"$optVerbose"
]
then
eval
echo
"$envar=\$$envar"
fi
eval
test
"\$$envar"
||
die
"variable \$$envar not set"
done
#
Alternative
tar
file
names
:
${
OFsource
:=$
OFdirName
}
:
${
TPsource
:=$
TPdirName
}
#------------------------------------------------------------------------------
#
[
arch
]
#
Get
[
arch
]
section
with
these
types
of
entries
#
label
=
32
#
precision
=
DP
#
sigfpe
=
false
#
---------------
#
Extract
name
=
value
-
ignore
blank
and
comment
lines
values
=$(
sed
-
n
\
-
e
'/^ *[;#]/d'
\
-
e
'/^\[arch\]/,/^\s*\[/{ /^[^ =][^ =]*\=[^ =][^ =]/p }'
\
$
configFile
)
for
line
in
$
values
do
case
"$line"
in
(
label
=
32
|
label
=
64
)
optLabel
=
"-int${line#*=}"
;;
(
scalar
=
32
|
precision
=
SP
|
precision
=
sp
)
optPrec
=
"-SP"
;;
(
scalar
=
64
|
precision
=
DP
|
precision
=
dp
)
optPrec
=
"-DP"
;;
(
sigfpe
=
true
)
optFpe
=
"-sigfpe"
;;
(
sigfpe
=
false
)
optFpe
=
"-no-sigfpe"
;;
esac
done
#
Set
part
of
the
architecture
configuration
configArch
=
"$optLabel $optPrec $optFpe"
if
[
"$ompiTypeVersion"
!= "$ompiTypeDefault" ]
echo
"arch: $configArch"
#------------------------------------------------------------------------------
#
[
software
]
#
Get
[
software
]
section
with
these
types
of
entries
#
boost
boost_1_62_0
#
cmake
cmake
-
system
cmake
-
3.5.2
#
---------------
#
Ensure
that
these
are
always
defined
for
pkg
in
cmake
qt
gcc
gmp
mpfr
mpc
do
eval
"${pkg}DEFAULT='${pkg}-system';${pkg}VERSION='${pkg}-system'"
done
#
#
parse
'package default version'
lines
#
and
transform
to
=>
packageDEFAULT
,
packageVERSION
variables
#
_software
()
{
local
line
pkg
def
val
while
read
-
r
line
do
#
Packages
must
start
with
lowercase
.
Also
removes
rubbish
set
--
$(
echo
$
line
|
sed
-
e
's/=/ /g'
)
pkg
=
"$1"
;
def
=
"$2"
;
val
=
"$3"
##
echo
"Using $# package=$pkg default='$def' version='$val'"
1
>&
2
if
[
"$pkg"
=
"${pkg#[a-z]}"
]
then
continue
#
Packages
must
start
with
lowercase
elif
[
$#
-
eq
2
]
then
echo
"${pkg}DEFAULT='${def}';${pkg}VERSION='${def}'"
elif
[
$#
-
eq
3
]
then
echo
"${pkg}DEFAULT='${def}';${pkg}VERSION='${val}'"
else
echo
"Bad input while setting versions"
1
>&
2
echo
" $line"
1
>&
2
exit
1
fi
done
}
eval
$(
sed
-
n
\
-
e
'/^ *[;#]/d'
\
-
e
'/^\[software\]/,/^\s*\[/{ s/^ *//g; s/ *$//g; s/ */=/g; p }'
\
$
configFile
|
\
_software
)
#------------------------------------------------------------------------------
#
Special
treatment
for
gcc
sub
-
components
(
needs
rethinking
)
case
"$compilerVERSION"
in
Gcc
|
Gcc48
)
gccVERSION
=
gcc
-
4.8.5
#
match
value
in
config
.
sh
/
compiler
;;
Gcc49
)
gccVERSION
=
gcc
-
4.9.3
#
match
value
in
config
.
sh
/
compiler
;;
Gcc62
)
gccVERSION
=
gcc
-
6.2.0
#
match
value
in
config
.
sh
/
compiler
;;
Gcc63
)
gccVERSION
=
gcc
-
6.3.0
#
match
value
in
config
.
sh
/
compiler
;;
Gcc71
)
gccVERSION
=
gcc
-
7.1.0
#
match
value
in
config
.
sh
/
compiler
;;
Gcc
*)
echo
"Error: unconfigured gcc version '$compilerVERSION'"
exit
1
#
Really
exit
,
since
this
must
be
an
input
error
;;
esac
#
-----------------------------------------------------------------------------
#
NO
FURTHER
EDITING
BELOW
THIS
LINE
#------------------------------------------------------------------------------
#
Name
of
qt
source
directory
is
a
fixed
value
qtSource
=
"qt-everywhere-opensource-src-${qtVERSION##*-}"
#
Change
'system'
into
'gmp-system'
etc
for
pkg
in
gcc
gmp
mpfr
mpc
do
if
eval
test
"\$${pkg}VERSION = system"
then
eval
"${pkg}VERSION='${pkg}-system'"
eval
"${pkg}DEFAULT='${pkg}-system'"
fi
done
#
No
gcc
/
gmp
/
mpfr
/
mpc
for
system
compilers
or
non
-
Gcc
compilers
case
"$compilerTypeVERSION:$compilerVERSION"
in
third
:
Gcc
*)
;;
third
:
Clang
*
|
system
:
Clang
*
|
system
:
Gcc
|
system
:
Icc
|
system
:*)
#
System
,
or
known
non
-
gcc
for
check
in
gcc
gmp
mpfr
mpc
do
eval
"unset ${check}VERSION ${check}DEFAULT"
done
;;
*)
echo
"Error: unknown ${compilerTypeVERSION}-compiler '$compilerVERSION'"
exit
1
;;
esac
#
Separator
lines
_line
()
{
echo
" ==================== ==================== ===================="
}
#
Various
formatting
for
-
list
output
#
formatted
print
_fmt2
()
{
local
arg1
=
"${1:-????}"
local
arg2
=
"${2:-undefined}"
printf
" %-20s %-20s
\n
"
"$arg1"
"$arg2"
}
#
formatted
print
#
name
version
default
[-
nocheck
]
_fmt3
()
{
local
what
=
"${1:-????}"
local
arg1
=
"${2:-undefined}"
local
arg2
=
"${3:-undefined}"
if
[
"$#"
-
eq
2
]
then
_fmt2
"$what"
"$arg1"
elif
[
"$#"
-
eq
3
-
a
"$arg1"
=
"$arg2"
]
then
_fmt2
"$what"
"$arg1"
else
printf
" %-20s %-20s %-20s
\n
"
"$what"
"$arg1"
"$arg2"
fi
}
#
input
:
'package'
#
output
:
'package'
packageDEFAULT
packageVERSION
_fmtDefVer
()
{
local
pkg
=
"$1"
eval
local
"def=\$${pkg}DEFAULT"
eval
local
"val=\$${pkg}VERSION"
_fmt3
"$pkg"
"$def"
"$val"
}
#
Location
of
the
OpenFOAM
bashrc
BASHRC_FILE
=$
INSTALL_DIR
/$
OFdirName
/
etc
/
bashrc