Commit 92fde145 authored by Ron Rahaman's avatar Ron Rahaman

Appears to build and run nek using nek.mk

parent 04600ab4
......@@ -66,12 +66,12 @@ AC_ARG_ENABLE([neknek],
[neknek=${enableval}], [neknek=no])
AC_ARG_ENABLE([nek-lapack],
[AS_HELP_STRING([--disable-nek-lapack], [disable Nek-supplied LAPACK routines @<:@default: enabled@:>@])],
[nek_lapack=${enableval}], [nek_lapack=yes])
[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([--disable-nek-blas], [disable Nek-supplied BLAS routines @<:@default: enabled@:>@])],
[nek_blas=${enableval}], [nek_blas=yes])
[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@:>@])],
......@@ -128,6 +128,15 @@ if test "x$libmesh" = "xyes"; then
FFLAGS="$($libmesh_config --fflags) $FFLAGS"
fi
###############################################################################
# GET CASENAME
###############################################################################
if test "x$CASENAME" = "x"; then
CASENAME="$(basename $(pwd))"
fi
###############################################################################
# BUILT-IN CHECKS
###############################################################################
......@@ -215,9 +224,9 @@ fi
# See if MPI is enabled
if test "x$mpi" = "xyes"; then
AC_DEFINE([MPI], 1, [If MPI is enabled])
nek_mpi_obj="byte_mpi.o comm_mpi.o"
nek_mpi_obj="byte_mpi comm_mpi"
else
nek_mpi_obj="byte_mpi.o comm_mpi.o mpi_dummy.o"
nek_mpi_obj="byte_mpi comm_mpi mpi_dummy"
fi
AC_SUBST([nek_mpi], [$mpi])
AC_SUBST([nek_mpi_obj])
......@@ -228,9 +237,9 @@ 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"
jl_cgs_obj="amg fcrs"
else
jl_cgs_obj="sparse_cholesky.o xxt.o fcrs.o"
jl_cgs_obj="sparse_cholesky xxt fcrs"
fi
AC_SUBST([jl_cgs_obj])
......@@ -242,9 +251,9 @@ 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"
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.o"
nek_cmt_obj="cmt_dummy"
fi
AC_SUBST([nek_cmt_obj])
......@@ -266,9 +275,9 @@ 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"
nek_neknek_obj="multimesh"
else
nek_neknek_obj="singlmesh.o"
nek_neknek_obj="singlmesh"
fi
AC_SUBST([nek_neknek_obj])
......@@ -286,20 +295,20 @@ AC_SUBST([nek_neknek_obj])
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"
nek_mxm_obj="mxm_std mxm_bgq"
else
if test "x$xsmm" = "xyes"; then
AC_DEFINE([XSMM], 1, [if using libxsmm for mxm])
nek_blas_obj="blas.o"
nek_mxm_obj="mxm_std.o"
nek_blas_obj="blas"
nek_mxm_obj="mxm_std"
else
if test "x$nek_blas" = "xyes"; then
nek_blas_obj="blas.o"
nek_mxm_obj="mxm_std.o"
nek_blas_obj="blas"
nek_mxm_obj="mxm_std"
else
AC_DEFINE([BLAS_MXM], 1, [if not using Nek5000 BLAS mxm routines])
nek_blas_obj=""
nek_mxm_obj="mxm_std.o"
nek_mxm_obj="mxm_std"
fi
fi
fi
......@@ -310,7 +319,7 @@ AC_SUBST([nek_mxm_obj])
# TODO:
# * if automake, AM_CONDITIONAL([NO_LAPACK], [test "x$nek_lapack" = "xno"])
if test "x$nek_lapack" = "xyes"; then
nek_lapack_obj="dsygv.o ssygv.o"
nek_lapack_obj="dsygv ssygv"
else
AC_DEFINE([NO_LAPACK], 1, [if not using Nek5000 LAPACK routines])
nek_lapack_obj=""
......@@ -510,6 +519,6 @@ fi
# ALL DONE!
###############################################################################
AC_CONFIG_FILES([Makefile.nek:Makefile.nek.in])
AC_CONFIG_FILES([nek.mk:nek.mk.in])
AC_OUTPUT
......@@ -29,12 +29,7 @@ include $(MOOSE_DIR)/modules/modules.mk
###############################################################################
# nek
NEK_SOURCE_DIR := $(MOON_DIR)/Nek5000
NEK_CASE_DIR := $(CURDIR)
NEK_CASENAME := $(shell basename $(NEK_CASE_DIR))
NEK_OBJ := obj/$(NEK_CASENAME).o
NEK_LIB := $(NEK_CASE_DIR)/libnek5000.a
include $(NEK_SOURCE_DIR)/nek.mk
include nek.mk
# moon
APPLICATION_DIR := $(MOON_DIR)
......@@ -47,7 +42,6 @@ APPLICATION_DIR := $(CURDIR)
APPLICATION_NAME := $(shell basename $(APPLICATION_DIR))
MAIN_DIR := $(MOON_DIR)/src
BUILD_EXEC := yes
EXTERNAL_FLAGS := $(NEK_OBJ) $(NEK_LIB) -Wl,-no_compact_unwind
DEP_APPS := $(shell $(FRAMEWORK_DIR)/scripts/find_dep_apps.py $(APPLICATION_NAME))
include $(FRAMEWORK_DIR)/app.mk
......
# == Source and destination directories ============================================================
VPATH := ../../Nek5000/core:../../Nek5000/core/cmt:../../Nek5000/core/3rd_party:../../Nek5000/jl
srcdir := ../..
builddir := .
nek_includedir := ./include
# == Discovered by autoconf script
nek_CFLAGS := -O2 -funroll-loops -fstrict-aliasing -fopenmp -I/home/rahaman/install/mpich-3.2-gnu-5/include -I/home/rahaman/install/cvode-2.9.0-gnu-5/include
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 := -DNDEBUG -DPACKAGE_NAME=\"Nek5000\" -DPACKAGE_TARNAME=\"nek5000\" -DPACKAGE_VERSION=\"16.0.0\" -DPACKAGE_STRING=\"Nek5000\ 16.0.0\" -DPACKAGE_BUGREPORT=\"nek5000-users@lists.mcs.anl.gov\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSIZEOF_INT_P=8 -DSIZEOF_LONG_INT=8 -DF77_FUNC\(name,NAME\)=name\ \#\#\ _ -DF77_FUNC_\(name,NAME\)=name\ \#\#\ _ -DPTRSIZE8=1 -DUNDERSCORE=1 -DMPI=1 -DPREFIX=jl_ -DLONGINT8=1 -DGLOBAL_LONG_LONG=1 -DBLAS_MXM=1 -DNO_LAPACK=1 $(nek_INCLUDES)
nek_LDFLAGS := @LDFLAG@
nek_LIBS := -lz -Wl,-rpath,/opt/moose/tbb/lib -L/opt/moose/tbb/lib -ltbb -ltbbmalloc -L/opt/moose/petsc/mpich_petsc-3.6.4/gcc-opt-superlu/lib -lpetsc -Wl,-rpath,/opt/moose/petsc/mpich_petsc-3.6.4/gcc-opt-superlu/lib -lcmumps -ldmumps -lsmumps -lzmumps -lmumps_common -lpord -lscalapack -lsuperlu_dist_4.1 -lHYPRE -L/opt/moose/mpich/mpich-3.2/gcc-opt/lib -L/opt/moose/gcc-5.3.0/lib/gcc/x86_64-unknown-linux-gnu/5.3.0 -L/opt/moose/gcc-5.3.0/lib64 -L/lib/x86_64-linux-gnu -L/opt/moose/gcc-5.3.0/lib -lflapack -lfblas -lparmetis -lmetis -lX11 -lmpifort -lgfortran -lquadmath -lm -lmpicxx -lstdc++ -Wl,-rpath,/opt/moose/gcc-5.3.0/lib/gcc/x86_64-unknown-linux-gnu/5.3.0 -Wl,-rpath,/opt/moose/gcc-5.3.0/lib64 -Wl,-rpath,/lib/x86_64-linux-gnu -Wl,-rpath,/opt/moose/gcc-5.3.0/lib -Wl,-rpath,/opt/moose/mpich/mpich-3.2/gcc-opt/lib -lmpi -lgomp -lgcc_s -lpthread -ldl -L/usr/lib/x86_64-linux-gnu -Wl,-rpath,/usr/lib/x86_64-linux-gnu -Wl,-rpath,/home/rahaman/repos/moon_fresh/moose/scripts/../libmesh/installed/lib -L/home/rahaman/repos/moon_fresh/moose/scripts/../libmesh/installed/lib -lmesh_opt -lmpifort -lmpicxx -lmpi -lsundials_nvecserial -lsundials_nvecparallel -lsundials_fnvecserial -lsundials_fnvecparallel -lsundials_fcvode -lsundials_cvode
nek_FFLAGS := -g -O2 -fopenmp -cpp $(subst -D, -D, -DPACKAGE_NAME=\"Nek5000\" -DPACKAGE_TARNAME=\"nek5000\" -DPACKAGE_VERSION=\"16.0.0\" -DPACKAGE_STRING=\"Nek5000\ 16.0.0\" -DPACKAGE_BUGREPORT=\"nek5000-users@lists.mcs.anl.gov\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSIZEOF_INT_P=8 -DSIZEOF_LONG_INT=8 -DF77_FUNC\(name,NAME\)=name\ \#\#\ _ -DF77_FUNC_\(name,NAME\)=name\ \#\#\ _ -DPTRSIZE8=1 -DUNDERSCORE=1 -DMPI=1 -DPREFIX=jl_ -DLONGINT8=1 -DGLOBAL_LONG_LONG=1 -DBLAS_MXM=1 -DNO_LAPACK=1) $(nek_INCLUDES)
nek_FLIBS := -L/home/rahaman/install/pycharm-community-2016.1.4/lib -L/home/rahaman/install/mpich-3.2-gnu-5/lib -L/home/rahaman/install/cvode-2.9.0-gnu-5/lib -L/home/rahaman/install/clion-2016.2.3/lib -L/opt/moose/tbb/lib -L/opt/moose/petsc/mpich_petsc-3.6.4/gcc-opt-superlu/lib -L/opt/moose/mpich/mpich-3.2/gcc-opt/lib -L/opt/moose/gcc-5.3.0/lib/gcc/x86_64-unknown-linux-gnu/5.3.0 -L/opt/moose/gcc-5.3.0/lib64 -L/lib/x86_64-linux-gnu -L/opt/moose/gcc-5.3.0/lib -L/usr/lib/x86_64-linux-gnu -L/home/rahaman/repos/moon_fresh/moose/scripts/../libmesh/installed/lib -L/opt/moose/gcc-5.3.0/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib64 -L/lib/../lib64 -L. -L/opt/moose/gcc-5.3.0/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../.. -lz -ltbb -ltbbmalloc -lpetsc -lcmumps -ldmumps -lsmumps -lzmumps -lmumps_common -lpord -lscalapack -lsuperlu_dist_4.1 -lHYPRE -lflapack -lfblas -lparmetis -lmetis -lX11 -lmpifort -lgfortran -lm -lquadmath -lmpicxx -lstdc++ -lmpi -lgomp -lpthread -ldl -lmesh_opt -lsundials_nvecserial -lsundials_nvecparallel -lsundials_fnvecserial -lsundials_fnvecparallel -lsundials_fcvode -lsundials_cvode
nek_debug_flags := -g
nek_opt_flags := -O2
nek_real8_flags := -fdefault-real-8 -fdefault-double-8
jl_prefix := jl_
# == FORTRAN objects ===============================================================================
nek_core_f_obj := $(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 integration_example)
nek_math_obj := $(addsuffix .$(obj-suffix), math)
nek_blas_obj := $(addsuffix .$(obj-suffix), ) # blas.o | null
nek_cmt_obj := $(addsuffix .$(obj-suffix), cmt_dummy) # drive1_cmt.o ... | cmt_dummy.o
nek_lapack_obj := $(addsuffix .$(obj-suffix), ) # dsygv.o ssygv.o | null
nek_mpi_obj := $(addsuffix .$(obj-suffix), byte_mpi comm_mpi) # byte_mpi.o comm_mpi.o | byte_mpi.o comm_mpi.o mpi_dummy.o
nek_mxm_obj := $(addsuffix .$(obj-suffix), mxm_std) # mxm_std.o | mxm_std.o mxm_bgq.o
nek_neknek_obj := $(addsuffix .$(obj-suffix), singlmesh) # 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 := $(addsuffix .$(obj-suffix), \
byte chelpers nek_comm finiparser iniparser dictionary)
jl_core_obj := $(patsubst %, $(jl_prefix)%.$(obj-suffix), \
gs sort sarray_transfer sarray_sort gs_local crystal comm tensor fail fcrystal)
jl_interp_obj := $(patsubst %, $(jl_prefix)%.$(obj-suffix), \
findpts findpts_local obbox poly lob_bnd findpts_el_3 findpts_el_2)
jl_cgs_obj := $(patsubst %, $(jl_prefix)%.$(obj-suffix), sparse_cholesky xxt fcrs)
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 = -DNDEBUG # Used by pattern rules in moose/framework/build.mk
# Can't use Nek's DEFS here because the interfere with MOOSE
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 =========================================================================================
$(nek_core_f_obj) $(nek_cmt_obj) $(nek_math_obj) $(nek_mxm_obj): %.$(obj-suffix): %.f SIZE
@echo "Nek5000 Compiling Fortran (in "$(METHOD)" mode) "$<"..."
@$(libmesh_LIBTOOL) --tag=F77 $(LIBTOOLFLAGS) --mode=compile --quiet \
$(libmesh_F77) $(nek_FFLAGS) $(nek_real8_flags) -c $< -o $@
$(nek_mpi_obj) $(nek_neknek_obj): %.$(obj-suffix): %.f SIZE mpiheader
@echo "Nek5000 Compiling Fortran (in "$(METHOD)" mode) "$<"..."
@$(libmesh_LIBTOOL) --tag=F77 $(LIBTOOLFLAGS) --mode=compile --quiet \
$(libmesh_F77) $(nek_FFLAGS) $(nek_real8_flags) -c $< -o $@
$(nek_core_c_obj): %.$(obj-suffix): %.c
@echo "Nek5000 Compiling C (in "$(METHOD)" mode) "$<"..."
@$(libmesh_LIBTOOL) --tag=CC $(LIBTOOLFLAGS) --mode=compile --quiet \
$(libmesh_CC) $(nek_CPPFLAGS) $(nek_CFLAGS) -MMD -MP -MF $@.d -MT $@ -c $< -o $@
$(jl_core_obj) $(jl_interp_obj) $(jl_cgs_obj): $(jl_prefix)%.$(obj-suffix): %.c
@echo "Nek5000 Compiling C (in "$(METHOD)" mode) "$<"..."
@$(libmesh_LIBTOOL) --tag=CC $(LIBTOOLFLAGS) --mode=compile --quiet \
$(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
$(objdir) $(nek_includedir):
mkdir -p $@
......@@ -16,6 +16,7 @@ if [ -z "$INPUT_FILE" ]; then
fi
rm -f *.sch
echo "$(basename $(pwd))" > SESSION.NAME && pwd >> SESSION.NAME
CMD="./$(basename $(pwd))-opt -i $INPUT_FILE"
echo "Running \"$CMD\"..."
eval "$CMD"
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