Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
GOSI9esm
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Consortium Members
UKMO
GOSI
GOSI9esm
Commits
e20edf23
Commit
e20edf23
authored
1 year ago
by
Sebastien Masson
Committed by
Clement Rousset
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Resolve "use nf-config in build_arch-auto.sh"
parent
ecd77527
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
arch/build_arch-auto.sh
+77
-33
77 additions, 33 deletions
arch/build_arch-auto.sh
with
77 additions
and
33 deletions
arch/build_arch-auto.sh
+
77
−
33
View file @
e20edf23
...
@@ -23,11 +23,12 @@ Environment variables that can be defined
...
@@ -23,11 +23,12 @@ Environment variables that can be defined
NETCDF_C_prefix : prefix of the NetCDF-C library (
$NCDF_F_PREFIX
/lib) and include (
$NCDF_C_PREFIX
/include)
NETCDF_C_prefix : prefix of the NetCDF-C library (
$NCDF_F_PREFIX
/lib) and include (
$NCDF_C_PREFIX
/include)
- set it to "no" if you don't want to use NetCDF library
- set it to "no" if you don't want to use NetCDF library
- if not defined : we
look for the path of the command
"nc-config"
- if not defined : we
use
"nc-config
--prefix
"
Can also be specified with the optional argument --NETCDF_C_prefix
Can also be specified with the optional argument --NETCDF_C_prefix
NETCDF_F_prefix : prefix of the NetCDF-Fortran library (
$NCDF_F_PREFIX
/lib) and include (
$NCDF_F_PREFIX
/include)
NETCDF_F_prefix : prefix of the NetCDF-Fortran library (
$NCDF_F_PREFIX
/lib) and include (
$NCDF_F_PREFIX
/include)
- if not defined : we use "nc-config --flibs" to find it
- if not defined : we use "nf-config --prefix"
- if nf-config not found : we use "nc-config --flibs" to find it
- not used if NETCDF_C_prefix="no"
- not used if NETCDF_C_prefix="no"
Can also be specified with the optional argument --NETCDF_F_prefix
Can also be specified with the optional argument --NETCDF_F_prefix
...
@@ -134,8 +135,8 @@ find_fortran_wrapper () {
...
@@ -134,8 +135,8 @@ find_fortran_wrapper () {
}
}
# find the fortran compiler associated with the fortran wrapper $FCnemo
# find the fortran compiler associated with the fortran wrapper $FCnemo
find_fortran_compiler
()
{
find_fortran_compiler
()
{
if
[
$(
$FCnemo
--version
|
head
-n
1 |
grep
-ci
gcc
)
-eq
1
]
;
then
ftncomp
=
"gnu"
if
[
$(
$FCnemo
--version
|
head
-n
1 |
grep
-ci
"
\(
gcc
\|
gnu
\)
"
)
-eq
1
]
;
then
ftncomp
=
"gnu"
elif
[
$(
$FCnemo
--version
|
head
-n
1 |
grep
-ci
ifort
)
-eq
1
]
;
then
ftncomp
=
"intel"
elif
[
$(
$FCnemo
--version
|
head
-n
1 |
grep
-ci
"
ifort
"
)
-eq
1
]
;
then
ftncomp
=
"intel"
elif
[
$(
$FCnemo
--version
|
head
-n
1 |
grep
-ci
"Cray Fortran"
)
-eq
1
]
;
then
ftncomp
=
"cray"
elif
[
$(
$FCnemo
--version
|
head
-n
1 |
grep
-ci
"Cray Fortran"
)
-eq
1
]
;
then
ftncomp
=
"cray"
else
else
echo_red
"ERROR: the fortran wrapper
$FCnemo
does not correspond to the gnu, the intel or the cray compiler"
\
echo_red
"ERROR: the fortran wrapper
$FCnemo
does not correspond to the gnu, the intel or the cray compiler"
\
...
@@ -149,6 +150,7 @@ find_fortran_compiler () {
...
@@ -149,6 +150,7 @@ find_fortran_compiler () {
#-----------------------------------------------------
#-----------------------------------------------------
#
#
NETCDF_C_prefix
=
${
NETCDF_C_prefix
:-
notdef
}
NETCDF_C_prefix
=
${
NETCDF_C_prefix
:-
notdef
}
NETCDF_F_prefix
=
${
NETCDF_F_prefix
:-
notdef
}
if
[
"
$NETCDF_C_prefix
"
==
"no"
]
if
[
"
$NETCDF_C_prefix
"
==
"no"
]
then
then
echo_orange
"WARNING: You chose to compile without any NetCDF Library"
\
echo_orange
"WARNING: You chose to compile without any NetCDF Library"
\
...
@@ -168,26 +170,68 @@ then
...
@@ -168,26 +170,68 @@ then
OASIS_INC
=
""
OASIS_INC
=
""
OASIS_LIB
=
""
OASIS_LIB
=
""
else
else
if
[
"
$NETCDF_C_prefix
"
==
"notdef"
]
# find NETCDF_C_prefix and NC_CONFIG
if
[
"
$NETCDF_C_prefix
"
==
"notdef"
]
# use nc-config to define NETCDF_C_prefix
then
then
if
[
$(
err_which nc-config
)
-ne
0
]
# use
nc-config
to define NETCDF_C_prefix
if
[
$(
err_which nc-config
)
-ne
0
]
#
nc-config
not found in $PATH
then
then
echo_red
"ERROR: nc-config not found."
\
echo_red
"ERROR: nc-config not found."
\
" please define either your path to the N
ET
CDF
_C
with 'export NETCDF_C_prefix=...'"
\
" please define either your path to the N
et
CDF
-C library
with 'export NETCDF_C_prefix=...'"
\
" or specify you don't want to use NetCDF with 'export NETCDF_C_prefix=no'"
\
" or specify you don't want to use NetCDF with 'export NETCDF_C_prefix=no'"
\
exit
2
exit
2
fi
fi
NC_CONFIG
=
nc-config
NC_CONFIG
=
nc-config
NETCDF_C_prefix
=
$(
$NC_CONFIG
--prefix
)
NETCDF_C_prefix
=
$(
$NC_CONFIG
--prefix
)
else
else
# use NETCDF_C_prefix to define NC_CONFIG
NC_CONFIG
=
$NETCDF_C_prefix
/bin/nc-config
# assume that nc-config is in $NETCDF_C_prefix/bin
NC_CONFIG
=
$NETCDF_C_prefix
/bin/nc-config
# assume that nc-config is in $NETCDF_C_prefix/bin
nbok
=
$(
ls
$NC_CONFIG
2>/dev/null |
wc
-l
)
# check if we have nc-config
nbok
=
$(
ls
$NC_CONFIG
2>/dev/null |
wc
-l
)
# check if we have nc-config
if
[
$nbok
-eq
0
]
if
[
$nbok
-eq
0
]
then
then
echo_red
"ERROR: nc-config not found in
$NETCDF_C_prefix
/bin"
;
exit
2
echo_red
"ERROR: nc-config not found in
$NETCDF_C_prefix
/bin"
;
exit
2
fi
fi
fi
fi
# find NETCDF_F_prefix and NF_CONFIG
if
[
"
$NETCDF_F_prefix
"
==
"notdef"
]
# use nf-config to define NETCDF_F_prefix
then
if
[
$(
err_which nf-config
)
-ne
0
]
# nf-config not found in $PATH
then
NF_CONFIG
=
${
NC_CONFIG
/nc-config/nf-config
}
# try to find nf-config at the same place than nc-config
if
[
$(
err_which
$NF_CONFIG
)
-ne
0
]
# nf-config not located at the same place than nc-config
then
if
[
"
$(
$NC_CONFIG
--all
|
grep
-c
"has-fortran"
)
"
-gt
0
]
# we can use nc-config instead of nf-config?
then
# do we have NetCDF-Fortran?
if
[
"
$(
$NC_CONFIG
--has-fortran
)
"
!=
"yes"
]
then
echo_red
"ERROR: no netcdf-fortran "
;
exit
2
fi
NF_CONFIG
=
$NC_CONFIG
# use nc-config instead of nf-config
# define NETCDF_F_prefix with nc-config
NETCDF_F_prefix
=
$(
$NF_CONFIG
--flibs
|
sed
-e
"s/.*
\(
-L
\|
-rpath,
\)\(
[^ ]*
\)\/
lib *-lnetcdff.*/
\2
/"
)
[
-z
$NETCDF_F_prefix
]
&&
NETCDF_F_prefix
=
$NETCDF_C_prefix
# empty -> we try NETCDF_C_prefix
else
echo_red
"ERROR: nf-config not found."
\
" please define either your path to the NetCDF-Fortran library with 'export NETCDF_F_prefix=...'"
\
" or specify you don't want to use NetCDF with 'export NETCDF_C_prefix=no'"
\
exit
2
fi
else
NETCDF_F_prefix
=
$(
$NF_CONFIG
--prefix
)
# use nf-config to define NETCDF_F_prefix
fi
else
NF_CONFIG
=
nf-config
NETCDF_F_prefix
=
$(
$NF_CONFIG
--prefix
)
# use nf-config to define NETCDF_F_prefix
fi
else
NF_CONFIG
=
$NETCDF_F_prefix
/bin/nf-config
# assume that nf-config is in $NETCDF_F_prefix/bin
nbok
=
$(
ls
$NF_CONFIG
2>/dev/null |
wc
-l
)
# check if we have nf-config
if
[
$nbok
-eq
0
]
then
echo_red
"ERROR: nf-config not found in
$NETCDF_F_prefix
/bin"
;
exit
2
fi
fi
# do we have the proper path to the netcdf library?
# do we have the proper path to the netcdf library?
nbok
=
$(
ls
$NETCDF_C_prefix
/lib/libnetcdf
*
2>/dev/null |
wc
-l
)
nbok
=
$(
ls
$NETCDF_C_prefix
/lib/libnetcdf
*
2>/dev/null |
wc
-l
)
if
[
$nbok
-eq
0
]
if
[
$nbok
-eq
0
]
...
@@ -197,29 +241,14 @@ else
...
@@ -197,29 +241,14 @@ else
echo_green
"NETCDF_C_prefix=
$NETCDF_C_prefix
"
echo_green
"NETCDF_C_prefix=
$NETCDF_C_prefix
"
fi
fi
# do we have NetCDF-Fortran?
if
[
"
$(
$NC_CONFIG
--has-fortran
)
"
!=
"yes"
]
then
echo_red
"ERROR: no netcdf-fortran "
;
exit
2
fi
# do we have NetCDF-F90 interface?
# do we have NetCDF-F90 interface?
if
[
"
$(
$N
C
_CONFIG
--has-f03
)
"
!=
"yes"
]
if
[
"
$(
$N
F
_CONFIG
--has-f03
)
"
!=
"yes"
]
then
then
if
[
"
$(
$N
C
_CONFIG
--has-f90
)
"
!=
"yes"
]
if
[
"
$(
$N
F
_CONFIG
--has-f90
)
"
!=
"yes"
]
then
then
echo_red
"ERROR: no netcdf-fortran F90 interface"
;
exit
2
echo_red
"ERROR: no netcdf-fortran F90 interface"
;
exit
2
fi
fi
fi
fi
# NetCDF fortran prefix
NETCDF_F_prefix
=
${
NETCDF_F_prefix
:-
notdef
}
if
[
"
$NETCDF_F_prefix
"
==
"notdef"
]
then
# get the path of the netcdff library
NETCDF_F_prefix
=
$(
$NC_CONFIG
--flibs
|
sed
-e
"s/.*
\(
-L
\|
-rpath,
\)\(
[^ ]*
\)\/
lib *-lnetcdff.*/
\2
/"
)
[
-z
$NETCDF_F_prefix
]
&&
NETCDF_F_prefix
=
$NETCDF_C_prefix
# empty -> we try NETCDF_C_prefix
fi
# do we have the proper path to the netcdff library?
# do we have the proper path to the netcdff library?
nbok
=
$(
ls
$NETCDF_F_prefix
/lib/libnetcdff
*
2>/dev/null |
wc
-l
)
nbok
=
$(
ls
$NETCDF_F_prefix
/lib/libnetcdff
*
2>/dev/null |
wc
-l
)
...
@@ -309,7 +338,7 @@ else
...
@@ -309,7 +338,7 @@ else
CURLpath
=
""
CURLpath
=
""
fi
fi
fi
fi
CURLlib
=
"
$CURLpath
-lcurl"
CURLlib
=
"
$
{
CURLpath
:-
""
}
-lcurl"
else
else
CURLlib
=
""
CURLlib
=
""
fi
fi
...
@@ -322,6 +351,7 @@ else
...
@@ -322,6 +351,7 @@ else
# NCDF_INC and NCDF_LIB
# NCDF_INC and NCDF_LIB
NCDF_INC
=
"-I%NCDF_F_PREFIX/include -I%NCDF_C_PREFIX/include"
NCDF_INC
=
"-I%NCDF_F_PREFIX/include -I%NCDF_C_PREFIX/include"
#NCDF_LIB="-L%NCDF_F_PREFIX/lib -lnetcdff -L%NCDF_C_PREFIX/lib -lnetcdf -Wl,-rpath=%NCDF_F_PREFIX/lib -L%HDF5_PREFIX/lib -lhdf5_hl -lhdf5 $CURLlib $Zlib $libM -Wl,-rpath=%HDF5_PREFIX/lib"
NCDF_LIB
=
"-L%NCDF_F_PREFIX/lib -lnetcdff -L%NCDF_C_PREFIX/lib -lnetcdf -L%HDF5_PREFIX/lib -lhdf5_hl -lhdf5
$CURLlib
$Zlib
$libM
"
NCDF_LIB
=
"-L%NCDF_F_PREFIX/lib -lnetcdff -L%NCDF_C_PREFIX/lib -lnetcdf -L%HDF5_PREFIX/lib -lhdf5_hl -lhdf5
$CURLlib
$Zlib
$libM
"
fi
fi
...
@@ -346,7 +376,7 @@ then
...
@@ -346,7 +376,7 @@ then
ismpi
=
$(
basename
$FCnemo
|
cut
-c
1-3 |
grep
-Ec
'mpi|ftn'
)
ismpi
=
$(
basename
$FCnemo
|
cut
-c
1-3 |
grep
-Ec
'mpi|ftn'
)
if
[
$ismpi
-eq
0
]
if
[
$ismpi
-eq
0
]
then
then
echo_orange
"WARNING: the fortran compiler provided by
nc-config
\"
$FCnemo
\"
is not starting with
\"
mpi
\"
or
\"
ftn
\"
."
\
echo_orange
"WARNING: the fortran compiler provided by
$(
basename
$NF_CONFIG
)
,
\"
$FCnemo
\"
,
is not starting with
\"
mpi
\"
or
\"
ftn
\"
."
\
" we look for mpiifort, mpif90 or ftn..."
" we look for mpiifort, mpif90 or ftn..."
FCnemo_org
=
$FCnemo
FCnemo_org
=
$FCnemo
find_fortran_compiler
find_fortran_compiler
...
@@ -444,6 +474,19 @@ case "$ftncomp" in
...
@@ -444,6 +474,19 @@ case "$ftncomp" in
esac
esac
#
#
#-----------------------------------------------------
#-----------------------------------------------------
# CFLAGS
#-----------------------------------------------------
#
case
"
${
ftncomp
}
"
in
gnu
)
PROD_CFLAGS
=
"-O0 -fcommon"
;;
*
)
PROD_CFLAGS
=
"-O0"
;;
esac
#
#-----------------------------------------------------
# XIOS and OASIS
# XIOS and OASIS
#-----------------------------------------------------
#-----------------------------------------------------
#
#
...
@@ -461,7 +504,8 @@ then
...
@@ -461,7 +504,8 @@ then
XIOS_LIB
=
""
XIOS_LIB
=
""
else
else
XIOS_INC
=
"-I%XIOS_PREFIX/inc"
XIOS_INC
=
"-I%XIOS_PREFIX/inc"
XIOS_LIB
=
"-L%XIOS_PREFIX/lib -lxios -lstdc++ "
#XIOS_LIB="-L%XIOS_PREFIX/lib -lxios -lstdc++ -Wl,-rpath=%XIOS_PREFIX/lib"
XIOS_LIB
=
"-L%XIOS_PREFIX/lib -lxios -lstdc++"
fi
fi
# OASIS
# OASIS
...
@@ -562,7 +606,7 @@ cat > $archname << EOF
...
@@ -562,7 +606,7 @@ cat > $archname << EOF
#%FCFLAGS
$DEBUG_FCFLAGS
#%FCFLAGS
$DEBUG_FCFLAGS
%FFLAGS %FCFLAGS
%FFLAGS %FCFLAGS
%LD %FC
%LD %FC
%LDFLAGS
%LDFLAGS
-Wl,-rpath=%HDF5_PREFIX/lib -Wl,-rpath=%NCDF_F_PREFIX/lib -Wl,-rpath=%XIOS_PREFIX/lib
%FPPFLAGS -P -traditional
%FPPFLAGS -P -traditional
%AR
$ARnemo
%AR
$ARnemo
%ARFLAGS rs
%ARFLAGS rs
...
@@ -571,7 +615,7 @@ cat > $archname << EOF
...
@@ -571,7 +615,7 @@ cat > $archname << EOF
%USER_LIB %XIOS_LIB %OASIS_LIB %NCDF_LIB
%USER_LIB %XIOS_LIB %OASIS_LIB %NCDF_LIB
%CC
$CCnemo
%CC
$CCnemo
%CFLAGS
-O0
%CFLAGS
$PROD_CFLAGS
EOF
EOF
#
#
# Additional module search command for Cray Fortran to enable successful parallel builds
# Additional module search command for Cray Fortran to enable successful parallel builds
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment