Commit 8f6f379d authored by Ron Rahaman's avatar Ron Rahaman
Browse files

Merge branch 'moosenek-makefile' into 'develop'

Integrates Nek/MOOSE build system

This integrates the Nek5000 build system with the MOOSE build system and obviates the need for makenek.

The functionality of makenek is replicated in an autotools-derived configure script.  When run, the configure script takes command-line options for Nek; runs compiler checks; tweaks the SIZE and .usr files; and outputs a nek.mk file, which contains pattern rules for build targets, compiler flags, etc.  The flags and targets are set to variables understood by the MOOSE build system, such as $ADDITIONAL_CPPFLAGS and $ADDITIONAL_APP_OBJECTS.

See merge request !13
parents 7dc20293 d130bf6a
......@@ -146,3 +146,10 @@ out.xyz
*.sch
SESSION.NAME
nek5000
# Autconf artifacts
aclocal.m4
autom4te.cache/**
config.log
config.status
install-sh
......@@ -15,6 +15,7 @@ IFNEKNEK=
IFMOAB=
MOAB_DIR=
F77=
F77LINK=
CC=
P=
PC=
......@@ -28,6 +29,16 @@ IFVISIT=
VISIT_IFLAGS=
VISIT_LFLAGS=
libmesh_LIBTOOL=
libmesh_F77=
libmesh_CC=
libmesh_INCLUDE=
libmesh_CPPFLAGS=
libmesh_FFLAGS=
libmesh_CFLAGS=
libmesh_LIBS=
libmesh_LDFLAGS=
################################################################################
lFLAGS = $(USR_LFLAGS)
......
......@@ -426,6 +426,7 @@ rm -rf makefile.nek 2>/dev/null
sed -e "s:^F77[ ]*=.*:F77\:=$F77:" \
-e "s:^CC[ ]*=.*:CC\:=$CC:" \
-e "s:^F77LINK[ ]*=.*:F77LINK\:=$F77LINK:" \
-e "s:^G[ ]*=.*:G\:=$G:" \
-e "s:^OPT_FLAGS[ ]*=.*:OPT_FLAGS\:=$OPT_FLAGS:" \
-e "s/^P[ ]*=.*/P:=$P/" \
......
# Assume that NEK_DIR and NEK_CASENAME are defined by parent Makefile
$(NEK_OBJ): run_makenek
#all:: $(NEK_OBJ) $(NEK_LIB) SESSION.NAME
run_makenek:
$(NEK_SOURCE_DIR)/core/makenek $(NEK_CASENAME) $(NEK_SOURCE_DIR)
SESSION.NAME:
echo $(NEK_CASENAME) > SESSION.NAME && echo $(NEK_CASE_DIR) >> SESSION.NAME
.PHONY: run_makenek
$(NEK_LIB): run_makenek
make lib
# == Source and destination directories ============================================================
VPATH := @srcdir@/Nek5000/core:@srcdir@/Nek5000/core/cmt:@srcdir@/Nek5000/core/3rd_party:@srcdir@/Nek5000/jl
srcdir := @srcdir@
builddir := @builddir@
nek_objdir := @builddir@/nek_obj
nek_includedir := @builddir@/include
# == Discovered by autoconf script
nek_CFLAGS := @CFLAGS@
nek_INCLUDES := -I$(builddir) -I$(nek_includedir) -I$(srcdir)/Nek5000/core -I$(srcdir)/Nek5000/core/cmt -I$(srcdir)/Nek5000/core/3rd_party -I$(srcdir)/Nek5000/jl
nek_CPPFLAGS := @CPPFLAGS@ @DEFS@ @nek_DEFS@ $(nek_INCLUDES)
nek_LDFLAGS := @LDFLAGS@
nek_LIBS := @LIBS@
nek_FFLAGS := @FFLAGS@ @FCFLAGS_f@ $(subst -D, @FC_DEFINE@, @DEFS@ @nek_DEFS@) $(nek_INCLUDES)
nek_FLIBS := @FLIBS@
nek_debug_flags := @nek_debug_flags@
nek_opt_flags := @nek_opt_flags@
nek_real8_flags := @nek_real8_flags@
jl_prefix := @jl_prefix@
# == FORTRAN objects ===============================================================================
nek_drive_obj := $(addprefix $(nek_objdir)/, $(addsuffix .$(obj-suffix), drive))
nek_core_f_obj := $(addprefix $(nek_objdir)/, $(addsuffix .$(obj-suffix), \
drive1 drive2 plan4 bdry coef conduct connect1 connect2 \
dssum edgec eigsolv gauss genxyz navier1 makeq navier0 \
navier2 navier3 navier4 prepost speclib map2 turb mvmesh ic \
ssolv planx mxm_wrapper hmholtz gfdm_par gfdm_op gfdm_solve \
subs1 subs2 genbox gmres hsmg convect induct perturb navier5 \
navier6 navier7 navier8 fast3d fasts calcz postpro \
cvode_driver vprops qthermal cvode_aux makeq_aux papi nek_in_situ \
readat_new @CASENAME@))
nek_math_obj := $(addprefix $(nek_objdir)/, $(addsuffix .$(obj-suffix), math))
nek_blas_obj := $(addprefix $(nek_objdir)/, $(addsuffix .$(obj-suffix), @nek_blas_obj@)) # blas.o | null
nek_cmt_obj := $(addprefix $(nek_objdir)/, $(addsuffix .$(obj-suffix), @nek_cmt_obj@)) # drive1_cmt.o ... | cmt_dummy.o
nek_lapack_obj := $(addprefix $(nek_objdir)/, $(addsuffix .$(obj-suffix), @nek_lapack_obj@)) # dsygv.o ssygv.o | null
nek_mpi_obj := $(addprefix $(nek_objdir)/, $(addsuffix .$(obj-suffix), @nek_mpi_obj@)) # byte_mpi.o comm_mpi.o | byte_mpi.o comm_mpi.o mpi_dummy.o
nek_mxm_obj := $(addprefix $(nek_objdir)/, $(addsuffix .$(obj-suffix), @nek_mxm_obj@)) # mxm_std.o | mxm_std.o mxm_bgq.o
nek_neknek_obj := $(addprefix $(nek_objdir)/, $(addsuffix .$(obj-suffix), @nek_neknek_obj@)) # singlmesh.o | multimesh.o
nek_flib_obj := $(nek_core_f_obj) $(nek_math_obj) $(nek_blas_obj) $(nek_cmt_obj) \
$(nek_lapack_obj) $(nek_mpi_obj) $(nek_mxm_obj) $(nek_neknek_obj)
# == C objects =====================================================================================
nek_core_c_obj := $(addprefix $(nek_objdir)/, $(addsuffix .$(obj-suffix), \
byte chelpers nek_comm finiparser iniparser dictionary))
jl_core_obj := $(addprefix $(nek_objdir)/, $(patsubst %, $(jl_prefix)%.$(obj-suffix), \
gs sort sarray_transfer sarray_sort gs_local crystal comm tensor fail fcrystal))
jl_interp_obj := $(addprefix $(nek_objdir)/, $(patsubst %, $(jl_prefix)%.$(obj-suffix), \
findpts findpts_local obbox poly lob_bnd findpts_el_3 findpts_el_2))
jl_cgs_obj := $(addprefix $(nek_objdir)/, $(patsubst %, $(jl_prefix)%.$(obj-suffix), @jl_cgs_obj@))
nek_clib_obj := $(nek_core_c_obj) $(jl_core_obj) $(jl_interp_obj) $(jl_cgs_obj)
# == MOOSE app flags and objects ==================================================================
# Recursive definition (= rather than :=) is probably the right usage, since they're probably
# defined here after they're referenced by MOOSE makefile
ADDITIONAL_CPPFLAGS = @CPPFLAGS@ @DEFS@ # Used by pattern rules in moose/framework/build.mk
ADDITIONAL_INCLUDES = $(nek_INCLUDES) # Used by pattern rules in moose/framework/build.mk (through app_INCLUDES)
ADDITIONAL_LIBS = $(nek_LIBS) $(nek_FLIBS) # Used during linking in moose/framework/app.mk
ADDITIONAL_APP_OBJECTS = $(nek_flib_obj) $(nek_clib_obj) # Added to dependencies in moose/framework/app.mk
# == Rules =========================================================================================
nek5000: $(nek_drive_obj) $(nek_flib_obj) $(nek_clib_obj)
@echo "Linking Executable "$@"..."
@$(libmesh_LIBTOOL) --tag=F77 $(LIBTOOLFLAGS) --mode=link \
$(libmesh_F77) $(libmesh_FFLAGS) -o $@ $^ $(libmesh_LIBS) $(libmesh_LDFLAGS) $(nek_LIBS) $(nek_LDFLAGS) $(nek_FLIBS)
$(nek_drive_obj) $(nek_core_f_obj) $(nek_cmt_obj) $(nek_math_obj) $(nek_mxm_obj): $(nek_objdir)/%.$(obj-suffix): %.f SIZE | $(nek_objdir)
@echo "Nek5000 Compiling Fortran (in "$(METHOD)" mode) "$<"..."
@$(libmesh_LIBTOOL) --tag=F77 $(LIBTOOLFLAGS) --mode=compile \
$(libmesh_F77) $(nek_FFLAGS) $(nek_real8_flags) -c $< -o $@
$(nek_mpi_obj) $(nek_neknek_obj): $(nek_objdir)/%.$(obj-suffix): %.f SIZE mpiheader | $(nek_objdir)
@echo "Nek5000 Compiling Fortran (in "$(METHOD)" mode) "$<"..."
@$(libmesh_LIBTOOL) --tag=F77 $(LIBTOOLFLAGS) --mode=compile \
$(libmesh_F77) $(nek_FFLAGS) $(nek_real8_flags) -c $< -o $@
$(nek_core_c_obj): $(nek_objdir)/%.$(obj-suffix): %.c | $(nek_objdir)
@echo "Nek5000 Compiling C (in "$(METHOD)" mode) "$<"..."
@$(libmesh_LIBTOOL) --tag=CC $(LIBTOOLFLAGS) --mode=compile \
$(libmesh_CC) $(nek_CPPFLAGS) $(nek_CFLAGS) -MMD -MP -MF $@.d -MT $@ -c $< -o $@
$(jl_core_obj) $(jl_interp_obj) $(jl_cgs_obj): $(nek_objdir)/$(jl_prefix)%.$(obj-suffix): %.c | $(nek_objdir)
@echo "Nek5000 Compiling C (in "$(METHOD)" mode) "$<"..."
@$(libmesh_LIBTOOL) --tag=CC $(LIBTOOLFLAGS) --mode=compile \
$(libmesh_CC) $(nek_CPPFLAGS) $(nek_CFLAGS) -MMD -MP -MF $@.d -MT $@ -c $< -o $@
mpiheader: | $(nek_includedir)
ifneq ($(findstring mpi_dummy.o, $(nek_mpi_obj)),)
cp $(srcdir)/Nek5000/core/mpi_dummy.h $(nek_includedir)/mpif.h
else
rm -rf $(srcdir)/Nek5000/core/mpif.h $(nek_includedir)/mpif.h
endif
$(nek_objdir) $(nek_includedir):
mkdir -p $@
PHONY: mpiheader
......@@ -13,6 +13,49 @@ git clone --recursive https://xgitlab.cels.anl.gov/nek5000/moon.git
This will download and populate the src/moose and src/moose/libmesh.
Building PETSc
--------------
MOON requires PETSc, as described in the [MOOSE installation instructions](http://mooseframework.com/getting-started/). PETSc is not distributed with MOON. PETSc must either be compiled from source or installed as part of the MOOSE Environment package. After installing PETSc, you must define the `$PETSC_DIR` variable in your environment.
Building libmesh
----------------
MOON also requires libmesh, as described in the [MOOSE installation instructions](http://mooseframework.com/getting-started/). The libmesh source code is distributed with MOOSE. It should be compiled using the following scripts:
```
$ cd moose/
$ scripts/update\_and\_rebuild\_libmesh.sh.
```
After installing libmesh, you must define the `$LIBMESH_DIR` in your environment.
The Example Problems
--------------------
Currently, the only working example problem is "integration_example" in `moon/examples/integration_example`.
### Building Example Problems
To configure and build each example problem, first generate the `configure` script in the top-level MOON directory:
```
$ cd moon
$ ./bootstrap
```
Then cd into the example subdirectory and simply run `configure` && `make`. This will build the MOOSE and Nek5000 libraries, then link them to the executable driver.
```
$ cd moon/examples/integration_example`
$ ../../configure
$ make
```
The `configure` script may be run with additional options (for example, to point to a custom libmesh or MOOSE installation). Run `./configure --help` to see a list of the available options.
### Running Example Problems
To run an example problem, it is recommended to use the convenience script `moon/examples/build_coupled_nek`. This script will automatically setup some input files needed by Nek5000 (such as SESSION.NAME). The script takes one command-line argument for the MOOSE configuration file, `-i <config_file>.i`.
```
$ cd moon/examples/integration_example
$ ../../scripts/build_coupled_nek.sh -i coefficient_integration.i
```
Developing Nek5000 in MOON
--------------------------
Developers may freely modify src/Nek5000 as if it were a normal part of the MOON repo. This is because Nek5000 is included as a Git subtree (rather than a submodule). For routine commits, pushes, and pulls to the MOON repository, no extra Git commands are necessary.
......
#!/bin/sh
autoreconf --install
automake --add-missing --copy >/dev/null 2>&1
AC_PREREQ([2.61])
AC_INIT([Nek5000], [16.0.0], [nek5000-users@lists.mcs.anl.gov])
AC_PROG_INSTALL
#AM_INIT_AUTOMAKE
#LT_PREREQ([2.2])
#LT_INIT([dlopen])
#AC_CONFIG_SRCDIR([Nek5000/core/drive1.f])
#AC_CONFIG_HEADERS([config.h])
###############################################################################
# COMMAND-LINE OPTS
###############################################################################
AC_ARG_VAR([CASENAME], [the Nek5000 case name (i.e., the name of the .usr and .rea files)])
AC_ARG_ENABLE([debug],
[AC_HELP_STRING([--disable-debug], [compile without debug flags (-g) @<:@default: enabled@:>@])],
[debug="$enableval"], [debug="yes"])
AC_ARG_ENABLE([opt],
[AC_HELP_STRING([--enable-opt], [compile with optimization flags (-O3) @<:@default: disabled@:>@])],
[opt="$enableval"], [opt="no"])
AC_ARG_ENABLE([mpi],
[AS_HELP_STRING([--disable-mpi], [compile without mpi @<:@default: enabled@:>@])],
[mpi=${enableval}], [mpi=yes])
AC_ARG_ENABLE([amg],
[AS_HELP_STRING([--enable-amg], [compile without AMG coarse-grid solver @<:@default: disabled@:>@])],
[amg=${enableval}], [amg=no])
AC_ARG_ENABLE([amg-dump],
[AS_HELP_STRING([--enable-amg-dump], [if using AMG, dump setup @<:@default: disabled@:>@])],
[amg_dump=${enableval}], [amg_dump=no])
AC_ARG_ENABLE([cmt],
[AS_HELP_STRING([--enable-cmt], [compile with compressible multiphase turbulence support @<:@default: disabled@:>@])],
[cmt=${enableval}], [cmt=no])
AC_ARG_ENABLE([timer],
[AS_HELP_STRING([--disable-timer], [disable runtime statistics @<:@default: enabled@:>@])],
[timer=${enableval}], [timer=yes])
AC_ARG_ENABLE([mpi-timer],
[AS_HELP_STRING([--enable-mpi-timer], [enable MPI runtime statistics @<:@default: disabled@:>@])],
[mpi_timer=${enableval}], [mpi_timer=no])
AC_ARG_ENABLE([mpi-io],
[AS_HELP_STRING([--enable-mpi-io], [use MPI-IO I/O kernel @<:@default: disabled@:>@])],
[mpi_io=${enableval}], [mpi_io=no])
AC_ARG_ENABLE([bgq],
[AS_HELP_STRING([--enable-bgq], [enable Blue Gene optimizations (BG/Q) @<:@default: disabled@:>@])],
[bgq=${enableval}], [bgq=no])
AC_ARG_ENABLE([cvode],
[AS_HELP_STRING([--enable-cvode], [use ODE solver from Sundials to solve for IFIELD>1 @<:@default: disabled@:>@])],
[cvode=${enableval}], [cvode=no])
AC_ARG_ENABLE([moab],
[AS_HELP_STRING([--enable-moab], [enable MOAB/CUBIT support @<:@default: disabled@:>@])],
[moab=${enableval}], [moab=no])
AC_ARG_ENABLE([neknek],
[AS_HELP_STRING([--enable-neknek], [enable multidomain support @<:@default: disabled@:>@])],
[neknek=${enableval}], [neknek=no])
AC_ARG_ENABLE([nek-lapack],
[AS_HELP_STRING([--enable-nek-lapack], [enable Nek-supplied LAPACK routines @<:@default: disabled@:>@])],
[nek_lapack=${enableval}], [nek_lapack=no])
AC_ARG_ENABLE([nek-blas],
[AS_HELP_STRING([--enable-nek-blas], [enable Nek-supplied BLAS routines @<:@default: disabled@:>@])],
[nek_blas=${enableval}], [nek_blas=no])
AC_ARG_ENABLE([xsmm],
[AS_HELP_STRING([--enable-xsmm], [use libxsmm for mxm @<:@default: disabled@:>@])],
[xsmm=${enableval}], [xsmm=no])
AC_ARG_ENABLE([extbar],
[AS_HELP_STRING([--enable-extbar], [adds underscore to exit call(for BGQ) @<:@default: disabled@:>@])],
[extbar=${enableval}], [extbar=no])
AC_ARG_ENABLE([libmesh],
[AS_HELP_STRING([--enable-libmesh], [configure with compilers and flags from an existing libmesh installation @<:@default: enabled@:>@])],
[libmesh=${enableval}], [libmesh=yes])
AC_ARG_VAR([MOOSE_DIR], [directory of moose installation @<:@default: moon/moose/@:>@])
AC_ARG_VAR([LIBMESH_DIR], [directory of libmesh installation @<:@default: \$MOOSE_DIR/libmesh/installed/@:>@])
###############################################################################
# GET COMPILERS AND FLAGS FROM LIBMESH
###############################################################################
# Default values for $MOOSE_DIR and $LIBMESH_DIR
: "${MOOSE_DIR=$srcdir/moose}"
: "${LIBMESH_DIR=$MOOSE_DIR/libmesh/installed}"
# If libmesh is enabled, get compilers and flags from libmesh-config
# Adapted from moose/framework/build.mk
if test "x$libmesh" = "xyes"; then
# First, see if installed libmesh-config exists
libmesh_config="$LIBMESH_DIR/bin/libmesh-config"
AC_MSG_CHECKING([if $libmesh_config exists])
if test -x $libmesh_config; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
# If not, see if uninstalled libmesh-config exists
libmesh_config="$LIBMESH_DIR/contrib/bin/libmesh-config"
AC_MSG_CHECKING([if $libmesh_config exists])
if test -x $libmesh_config; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([could not find libmesh-config script. Ensure that LIBMESH_DIR and/or MOOSE_DIR are correctly set.])
fi
fi
AC_MSG_NOTICE([getting compilers and flags from $libmesh_config])
CC="$($libmesh_config --cc)"
CFLAGS="$($libmesh_config --cflags) $CFLAGS"
CPPFLAGS="$($libmesh_config --cppflags) $CPPFLAGS"
LDFLAGS="$($libmesh_config --ldflags) $LDFLAGS"
LIBS="$($libmesh_config --libs) $LIBS"
F77="$($libmesh_config --fc)"
FFLAGS="$($libmesh_config --fflags) $FFLAGS"
fi
###############################################################################
# GET CASENAME
###############################################################################
if test "x$CASENAME" = "x"; then
CASENAME="$(basename $(pwd))"
fi
###############################################################################
# BUILT-IN CHECKS
###############################################################################
# C compiler checks
: ${CFLAGS=""} # Do not use autconf's default "-g -O2"
AC_PROG_CC # Validate C Compiler
AC_PROG_CC_C_O # Necessary for automake
AC_CHECK_SIZEOF([int *]) # Get sizeof int*, set SIZEOF_INT_P. If SIZEOF_INT_P == 8, then Nek needs -DPTRSIZE8
AC_CHECK_SIZEOF([long int]) # Get sizeof long int, set SIZEOF_LONG_INT
# Fortran compiler checks
: ${FFLAGS="$FFLAGS"} # Do not use autconf's default "-g -O2"
: ${FCFLAGS="$FCFLAGS"} # Do not use autconf's default "-g -O2"
AC_PROG_F77 # Validate F77 compiler
AC_PROG_F77_C_O # Necessary for automake
AC_F77_LIBRARY_LDFLAGS # Determine -l and -L flags, append to $FLIBS
AC_F77_WRAPPERS # Discover how to call F77 funcs from C, set F77_FUNC macro. If underscore, then Nek needs -DUNDERSCORE
# Discover flags for Fortran preprocessing
fc_old="$F77"; FC="$F77"
AC_FC_PP_SRCEXT([f]) # Discover what flags are needed to preprocess .f files, define FCFLAGS_f
AC_FC_PP_DEFINE # Discover the flag (eg, -D, -Df) is used to define PP symbols, define FC_DEFINE
FC="$fc_old"
###############################################################################
# FIND F77 FLAG FOR DEFAULT 8-BYTE FLOATS
###############################################################################
AC_LANG_PUSH([Fortran 77])
fflags_old="$FFLAGS"
nek_real8_flags=""
for flag in dnl
"-r8 -fpconstant" dnl Intel
"-r8" dnl PGI, some others
"-fdefault-real-8 -fdefault-double-8" dnl GNU
"-qrealsize=8 -qdpc=e" dnl IBM
"-s default64"; dnl Cray
do
FFLAGS="$flag"
AC_MSG_CHECKING([if Fortran 77 compiler accepts $flag])
AC_COMPILE_IFELSE(
AC_LANG_PROGRAM(, [[ real foo]],),
AC_MSG_RESULT([yes]) && nek_real8_flags="$flag" && break,
AC_MSG_RESULT([no])
)
done
AC_LANG_POP([Fortran 77])
FFLAGS="$fflags_old"
if test "x$nek_real8_flags" = "x"; then
AC_MSG_FAILURE([could not determine Fortran flag for 8-byte floats])
fi
AC_SUBST([nek_real8_flags])
###############################################################################
# SET NEK's PREPROCESSOR MACROS
###############################################################################
nek_DEFS=""
# Enable debug flags
if test "x$debug" = "xyes"; then
nek_debug_flags="-g"
fi
AC_SUBST([nek_debug_flags])
# Enable optimization flags
if test "x$opt" = "xyes" || test "x$bgq" = "xyes"; then
nek_opt_flags="-O3"
else
nek_opt_flags="-O2"
fi
AC_SUBST([nek_opt_flags])
# Check if pointer size == 8
if test "$ac_cv_sizeof_int_p" -eq 8; then
nek_DEFS="-DPTRSIZE8 $nek_DEFS"
fi
# See if 'underscore' is in mangling scheme.
if echo "$ac_cv_f77_mangling"| tr -d @<:@:blank:@:>@ | grep '\<underscore\>' > /dev/null ; then
nek_DEFS="-DUNDERSCORE $nek_DEFS"
fi
# See if MPI is enabled
if test "x$mpi" = "xyes"; then
nek_DEFS="-DMPI $nek_DEFS"
nek_mpi_obj="byte_mpi comm_mpi"
else
nek_mpi_obj="byte_mpi comm_mpi mpi_dummy"
fi
AC_SUBST([nek_mpi], [$mpi])
AC_SUBST([nek_mpi_obj])
# Always define jl_prefix
AC_SUBST([jl_prefix], [jl_])
nek_DEFS="-DPREFIX=jl_ $nek_DEFS"
# See if AMG is enabled
if test "x$amg" = "xyes"; then
jl_cgs_obj="amg fcrs"
else
jl_cgs_obj="sparse_cholesky xxt fcrs"
fi
AC_SUBST([jl_cgs_obj])
# See if AMG_DUMP is enabled
if test "x$amg_dump" = "xyes"; then
nek_DEFS="-DAMG_DUMP $nek_DEFS"
fi
# See if CMT is enabled
if test "x$cmt" = "xyes"; then
nek_DEFS="-DCMT $nek_DEFS"
nek_cmt_obj="drive1_cmt drive2_cmt driver3_cmt face ausm MixtPerf intpdiff diffusive_cmt eqnsolver_cmt surface_fluxes bc inflow_bc outflow_bc wall_bc step filters_cmt diagnostics"
else
nek_cmt_obj="cmt_dummy"
fi
AC_SUBST([nek_cmt_obj])
# Check if sizeof long int == 8
if test "$ac_cv_sizeof_long_int" -eq 8; then
nek_DEFS="-DLONGINT8 $nek_DEFS"
fi
# See if timer is enabled
if test "x$timer" = "xno"; then
nek_DEFS="-DNOTIMER $nek_DEFS"
fi
# Always set GLOBAL_LONG_LONG
nek_DEFS="-DGLOBAL_LONG_LONG $nek_DEFS"
# TODO: Set defs for MOAB
# See if neknek is enabled
if test "x$neknek" = "xyes"; then
nek_DEFS="-DNEKNEK $nek_DEFS"
nek_neknek_obj="multimesh"
else
nek_neknek_obj="singlmesh"
fi
AC_SUBST([nek_neknek_obj])
# TODO: Set defs for CVODE
# TODO: Set defs for AMG_DUMP
# TODO: Set defs for BLAS_MXM
# == BLAS and MXM handling =====================================================
# TODO:
# * Set -O3 flag if $bgq = yes
# * Consistency check between options
# * If automake, AM_CONDITIONAL([BGQ], [test "x$bgq" = "xyes"]), etc.
if test "x$bgq" = "xyes"; then
nek_DEFS="-DBGQ $nek_DEFS"
nek_blas_obj=""
nek_mxm_obj="mxm_std mxm_bgq"
else
if test "x$xsmm" = "xyes"; then
nek_DEFS="-DXSMM $nek_DEFS"
nek_blas_obj="blas"
nek_mxm_obj="mxm_std"
else
if test "x$nek_blas" = "xyes"; then
nek_blas_obj="blas"
nek_mxm_obj="mxm_std"
else
nek_DEFS="-DBLAS_MXM $nek_DEFS"
nek_blas_obj=""
nek_mxm_obj="mxm_std"
fi
fi
fi
AC_SUBST([nek_blas_obj])
AC_SUBST([nek_mxm_obj])
# == LAPACK handling ==========================================================
# TODO:
# * if automake, AM_CONDITIONAL([NO_LAPACK], [test "x$nek_lapack" = "xno"])
if test "x$nek_lapack" = "xyes"; then
nek_lapack_obj="dsygv ssygv"
else
nek_DEFS="-DNO_LAPACK $nek_DEFS"
nek_lapack_obj=""
fi
AC_SUBST([nek_lapack_obj])
AC_SUBST([nek_DEFS])
###############################################################################
# SIZE FILE HANDLING
###############################################################################
AC_CHECK_FILE([SIZE], , AC_MSG_ERROR([could not find SIZE file in current directory]))
AC_MSG_NOTICE([tweaking SIZE file])
# == General subroutines ======================================================
cat SIZE | grep -i 'lxo' >/dev/null
if test $? -ne 0; then
echo >>SIZE
echo 'c automatically added by makenek' >>SIZE
echo ' parameter(lxo = lx1) ! max output grid size (lxo>=lx1)' >>SIZE
fi
cat SIZE | grep -i 'lpart' >/dev/null
if test $? -ne 0; then
echo >>SIZE
echo 'c automatically added by makenek' >>SIZE
echo ' parameter(lpart = 1 ) ! max number of particles/proc' >>SIZE
fi
cat SIZE | grep -i 'ax1' >/dev/null
if test $? -ne 0; then
echo >>SIZE
echo 'c automatically added by makenek' >>SIZE
echo ' integer ax1,ay1,az1,ax2,ay2,az2' >> SIZE
echo ' parameter (ax1=lx1,ay1=ly1,az1=lz1,ax2=lx2,ay2=ly2,az2=lz2) ! running averages' >> SIZE
fi
cat SIZE | grep -i 'lys=lxs' >/dev/null
if test $? -ne 0; then
cat SIZE | grep -iv lxs > SIZE.x; mv SIZE.x SIZE # Clean existing SIZE file of old version
echo >>SIZE
echo 'c automatically added by makenek' >>SIZE
echo ' parameter (lxs=1,lys=lxs,lzs=(lxs-1)*(ldim-2)+1) !New Pressure Preconditioner' >> SIZE
fi
cat SIZE | grep -i 'lfdm' >/dev/null
if test $? -ne 0; then
echo >>SIZE
echo 'c automatically added by makenek' >>SIZE
echo ' parameter (lfdm=0) ! == 1 for fast diagonalization method' >> SIZE
fi
cat SIZE | grep -i 'nio' >/dev/null
if test $? -ne 0; then
echo >>SIZE
echo 'c automatically added by makenek' >>SIZE
echo ' common/IOFLAG/nio ! for logfile verbosity control' >> SIZE
fi
# == CVODE subroutines ========================================================
if test "x$cvode" = "xyes"; then
cat SIZE | grep -i 'cv_maxl' >/dev/null
if test $? -ne 0; then
echo >>SIZE
echo 'c automatically added by makenek' >>SIZE
echo ' integer cv_maxl' >> SIZE
echo ' parameter(cv_maxl = 20 ) ! Size of Krylov Space' >>SIZE
fi
cat SIZE | grep -i 'cv_delt' >/dev/null
if test $? -ne 0; then
echo >>SIZE
echo 'c automatically added by makenek' >>SIZE
echo ' real cv_delt' >> SIZE
echo ' parameter(cv_delt = 0.1 ) ! linear convergence factor ' >>SIZE
fi
cat SIZE | grep -i 'cv_sigs' >/dev/null
if test $? -ne 0; then
echo >>SIZE
echo 'c automatically added by makenek' >>SIZE
echo ' real cv_sigs' >> SIZE
echo ' parameter(cv_sigs = 0.01) ! Jacobian DQ perturbation scaling factor' >>SIZE
fi
fi
# == CMT subroutines ==========================================================
cat SIZE | grep -i 'toteq' >/dev/null
if test $? -ne 0; then
if test "x$cmt" = "xyes"; then
echo >>SIZE
echo 'c automatically added by makenek' >>SIZE
echo ' integer toteq' >> SIZE
echo ' parameter(toteq = 5 ) ! Number of conserved variables ' >>SIZE
echo 'c IFCMT=TRUE then toteq=5' >>SIZE
else
echo >>SIZE
echo 'c automatically added by makenek' >>SIZE
echo ' integer toteq' >> SIZE
echo ' parameter(toteq = 1 ) ! Number of conserved variables ' >>SIZE
echo 'c IFCMT=FALSE then toteq=1' >>SIZE
fi
fi
cat SIZE | grep -i 'lelcmt' >/dev/null
if test $? -ne 0; then
if test "x$cmt" = "xyes"; then
echo >>SIZE
echo 'c automatically added by makenek' >>SIZE
echo ' integer lelcmt' >> SIZE
echo ' parameter(lelcmt = lelt ) ! # of cmt elements ' >>SIZE
echo 'c IFCMT=TRUE then lelcmt=lelt' >>SIZE