Commit a4bed7fc authored by Ron Rahaman's avatar Ron Rahaman
Browse files

First attempt at Makefile.nek. Just rules to compile

TODO:
  * Rules to link executables
  * Point to correct directories
  * Make clean
parent 55b41733
CASENAME = @CASENAME@
# == Compilers and flags ======================================================
CC = @CC@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@ @DEFS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
F77 = @F77@
FFLAGS = @FFLAGS@ @FCFLAGS_f@ $(subst -D, @FC_DEFINE@, @DEFS@)
FLIBS = @FLIBS@
nek_debug_flags = @nek_debug_flags@
nek_opt_flags = @nek_opt_flags@
nek_real8_flags = @nek_real8_flags@
# == Nek objects =========================================================
nek_core_f_obj = drive.o drive1.o drive2.o \
plan4.o bdry.o coef.o conduct.o connect1.o connect2.o \
dssum.o edgec.o eigsolv.o gauss.o genxyz.o navier1.o makeq.o \
navier0.o navier2.o navier3.o navier4.o prepost.o speclib.o \
map2.o turb.o mvmesh.o ic.o ssolv.o planx.o mxm_wrapper.o \
hmholtz.o gfdm_par.o gfdm_op.o gfdm_solve.o subs1.o subs2.o \
genbox.o gmres.o hsmg.o convect.o induct.o perturb.o \
navier5.o navier6.o navier7.o navier8.o fast3d.o fasts.o calcz.o \
byte_mpi.o postpro.o \
cvode_driver.o \
vprops.o qthermal.o cvode_aux.o makeq_aux.o \
papi.o nek_in_situ.o \
readat_new.o
nek_math_f_obj = math.o
nek_core_c_obj = byte.o chelpers.o nek_comm.o finiparser.o iniparser.o dictionary.o
nek_blas_obj = @nek_blas_obj@ # blas.o | null
nek_cmt_obj = @nek_cmt_obj@ # drive1_cmt.o drive2_cmt.o ... | cmt_dummy.o
nek_lapack_obj = @nek_lapack_obj@ # dsygv.o ssygv.o | null
nek_mpi_obj = @nek_mpi_obj@ # comm_mpi.o | comm_mpi.o mpi_dummy.o
nek_mxm_obj = @nek_mxm_obj@ # mxm_std.o | mxm_std.o mxm_bgq.o
nek_neknek_obj = @nek_neknek_obj@ # singlmesh.o | multimesh.o
# == JL objects ===============================================================
jl_prefix = @jl_prefix@
jl_core_obj = $(patsubst %, $(jl_prefix)%, gs.o sort.o sarray_transfer.o sarray_sort.o gs_local.o crystal.o comm.o tensor.o fail.o fcrystal.o)
jl_interp_obj = $(patsubst %, $(jl_prefix)%, findpts.o findpts_local.o obbox.o poly.o lob_bnd.o findpts_el_3.o findpts_el_2.o)
jl_cgs_obj = $(patsubst %, $(jl_prefix)%, @jl_cgs_obj@)
# == Rules ====================================================================
# A set of rules each for:
# * nek_core_f_obj + nek_cmt_obj + nek_mpi_obj + nek_neknek_obj
# * nek_math_f_obj + nek_mxm_obj
# * nek_parfile_f_obj: same as nek_core_f_obj but also requires PARDICT
# * nek_in_situ.o: same as nek_core_f_obj but also requires VISIT_IFLAGS
# * nek_core_c_obj + jl_core_obj + jl_interp_obj + jl_cgs_obj
# * nek_blas_obj + nek_lapack_obj
# TODO:
# * Write dependencies for common block files (esp. SIZE!)
$(nek_core_f_obj) $(nek_cmt_obj) $(nek_mpi_obj) $(nek_neknek_obj): %.o: %.f
$(F77) -c $(FFLAGS) $(nek_opt_flags) $(nek_debug_flags) $(nek_real8_flags) $< -o $@
$(nek_math_f_obj) $(nek_mxm_obj): %.o : %.f
$(F77) -c $(FFLAGS) -O3 $(nek_debug_flags) $(nek_real8_flags) $< -o $@
$(nek_blas_obj) $(nek_lapack_obj): %.o: %.f
$(F77) -c $(FFLAGS) -O0 $(nek_debug_flags) $< -o $@
$(nek_core_c_obj) $(jl_core_obj) $(jl_interp_obj) $(jl_cgs_obj): %.o: %.c
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(nek_opt_flags) $(nek_debug_flags) $< -o $@
......@@ -25,6 +25,14 @@ 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])
......@@ -95,18 +103,18 @@ 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
old_fc="$F77"; FC="$F77"
AC_FC_PP_SRCEXT([f]) # Discover what flags are needed to preprocess .f files
AC_FC_PP_DEFINE # Discover the flag (eg, -D, -Df) is used to define PP symbols
FC="$old_fc"
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])
old_fflags="$FFLAGS"
real8_fflags=""
fflags_old="$FFLAGS"
nek_real8_flags=""
for flag in dnl
"-r8 -fpconstant" dnl Intel
"-r8" dnl PGI, some others
......@@ -118,40 +126,36 @@ do
AC_MSG_CHECKING([if Fortran 77 compiler accepts $flag])
AC_COMPILE_IFELSE(
AC_LANG_PROGRAM(, [[ real foo]],),
AC_MSG_RESULT([yes]) && real8_fflags="$flag" && break,
AC_MSG_RESULT([yes]) && nek_real8_flags="$flag" && break,
AC_MSG_RESULT([no])
)
done
AC_LANG_POP([Fortran 77])
FFLAGS="$old_fflags"
FFLAGS="$fflags_old"
if test "x$real8_fflags" = "x"; then
if test "x$nek_real8_flags" = "x"; then
AC_MSG_FAILURE([could not determine Fortran flag for 8-byte floats])
else
FFLAGS="$FFLAGS $real8_fflags"
fi
AC_SUBST([nek_real8_flags])
###############################################################################
# SET NEK's PREPROCESSOR MACROS
###############################################################################
# Enable debug flags
if test "x$debug" = "xyes"; then
CFLAGS="-g $CFLAGS"
FFLAGS="-g $FFLAGS"
FCFLAGS="-g $FCFLAGS"
nek_debug_flags="-g"
fi
AC_SUBST([nek_debug_flags])
# Enable optimization flags
if test "x$opt" = "xyes" || test "x$bgq" = "xyes"; then
CFLAGS="-O3 $CFLAGS"
FFLAGS="-O3 $FFLAGS"
FCFLAGS="-O3 $FCFLAGS"
nek_opt_flags="-O3"
else
CFLAGS="-O2 $CFLAGS"
FFLAGS="-O2 $FFLAGS"
FCFLAGS="-O2 $FCFLAGS"
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
......@@ -166,12 +170,37 @@ fi
# See if MPI is enabled
if test "x$mpi" = "xyes"; then
AC_DEFINE([MPI], 1, [If MPI is enabled])
nek_mpi_obj="comm_mpi.o"
else
nek_mpi_obj="comm_mpi.o mpi_dummy.o"
fi
AC_SUBST([nek_mpi_obj])
# Always define jl_prefix
AC_SUBST([jl_prefix], [jl_])
AC_DEFINE([PREFIX], [jl_], [prefix for JL subroutines])
# See if AMG is enabled
if test "x$amg" = "xyes"; then
jl_cgs_obj="amg.o fcrs.o"
else
jl_cgs_obj="sparse_cholesky.o xxt.o fcrs.o"
fi
AC_SUBST([jl_cgs_obj])
# See if AMG_DUMP is enabled
if test "x$amg_dump" = "xyes"; then
AC_DEFINE([AMG_DUMP], 1, [if AMG dump is enabled])
fi
# See if CMT is enabled
if test "x$cmt" = "xyes"; then
AC_DEFINE([CMT], 1, [If CMT is enabled])
nek_cmt_obj="drive1_cmt.o drive2_cmt.o driver3_cmt.o face.o ausm.o MixtPerf.o intpdiff.o diffusive_cmt.o eqnsolver_cmt.o surface_fluxes.o bc.o inflow_bc.o outflow_bc.o wall_bc.o step.o filters_cmt.o diagnostics.o"
else
nek_cmt_obj="cmt_dummy.o"
fi
AC_SUBST([nek_cmt_obj])
# Check if sizeof long int == 8
if test "$ac_cv_sizeof_long_int" -eq 8; then
......@@ -191,7 +220,11 @@ AC_DEFINE([GLOBAL_LONG_LONG], 1, [Use global long long])
# See if neknek is enabled
if test "x$neknek" = "xyes"; then
AC_DEFINE([NEKNEK], 1, [if neknek is enabled])
nek_neknek_obj="multimesh.o"
else
nek_neknek_obj="singlmesh.o"
fi
AC_SUBST([nek_neknek_obj])
# TODO: Set defs for CVODE
......@@ -199,33 +232,40 @@ fi
# TODO: Set defs for BLAS_MXM
# == MXM handling =============================================================
# == 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.
nek_mxm_obj="mxm_std.o blas.o"
if test "x$bgq" = "xyes"; then
AC_DEFINE([BGQ], 1, [if using IBM BG/Q optimizations])
nek_blas_obj=""
nek_mxm_obj="mxm_std.o mxm_bgq.o"
else
if test "x$xsmm" = "xyes"; then
AC_DEFINE([XSMM], 1, [if using libxsmm for mxm])
nek_mxm_obj="mxm_std.o blas.o"
nek_blas_obj="blas.o"
nek_mxm_obj="mxm_std.o"
else
if test "x$nek_blas" = "xno"; then
if test "x$nek_blas" = "xyes"; then
nek_blas_obj="blas.o"
nek_mxm_obj="mxm_std.o"
else
AC_DEFINE([BLAS_MXM], 1, [if not using Nek5000 BLAS mxm routines])
nek_blas_obj=""
nek_mxm_obj="mxm_std.o"
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"])
nek_lapack_obj="dsygv.o ssygv.o"
if test "x$nek_lapack" = "xno"; then
if test "x$nek_lapack" = "xyes"; then
nek_lapack_obj="dsygv.o ssygv.o"
else
AC_DEFINE([NO_LAPACK], 1, [if not using Nek5000 LAPACK routines])
nek_lapack_obj=""
fi
......@@ -424,5 +464,7 @@ fi
# ALL DONE!
###############################################################################
AC_CONFIG_FILES([Makefile.arch:Makefile.arch.in])
AC_CONFIG_FILES([Makefile.arch:Makefile.arch.in Makefile.nek:Makefile.nek.in])
AC_OUTPUT
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment