Skip to content
Snippets Groups Projects
Commit 7e8e4485 authored by Kurt A. O'Hearn's avatar Kurt A. O'Hearn
Browse files

PuReMD: backport build system updates from branch full-far-nbrs-list-charge-matrix.

parent 569ada79
No related branches found
No related tags found
No related merge requests found
ACLOCAL_AMFLAGS = -I ../m4
AM_CFLAGS = -Wall -O3 -funroll-loops -fstrict-aliasing #-finline-functions -finline-limit=15 -qhot
bin_PROGRAMS = bin/puremd
bin_puremd_SOURCES = src/allocate.c src/basic_comm.c src/ffield.c src/grid.c src/list.c src/lookup.c \
src/io_tools.c src/reset_tools.c src/restart.c src/random.c src/tool_box.c src/traj.c \
src/vector.c src/analyze.c src/box.c src/system_props.c src/control.c src/comm_tools.c \
src/geo_tools.c src/linear_solvers.c src/neighbors.c src/qEq.c src/bond_orders.c src/multi_body.c \
src/bonds.c src/valence_angles.c src/hydrogen_bonds.c src/torsion_angles.c src/nonbonded.c src/forces.c \
src/integrate.c src/init_md.c src/parallelreax.c
include_HEADERS = src/reax_defs.h src/reax_types.h \
src/integrate.c src/init_md.c src/parallelreax.c \
src/reax_defs.h src/reax_types.h \
src/allocate.h src/basic_comm.h src/ffield.h src/grid.h src/list.h src/lookup.h \
src/io_tools.h src/reset_tools.h src/restart.h src/random.h src/tool_box.h src/traj.h \
src/vector.h src/analyze.h src/box.h src/system_props.h src/control.h src/comm_tools.h \
......@@ -18,5 +15,5 @@ include_HEADERS = src/reax_defs.h src/reax_types.h \
src/bonds.h src/valence_angles.h src/hydrogen_bonds.h src/torsion_angles.h src/nonbonded.h src/forces.h \
src/integrate.h src/init_md.h
bin_puremd_CFLAGS = $(AM_CFLAGS) $(MPI_CFLAGS)
bin_puremd_LDFLAGS = $(AM_LDFLAGS) $(MPI_LDFLAGS)
bin_puremd_CFLAGS = $(MPI_CFLAGS)
bin_puremd_LDADD = $(MPI_LIBS)
......@@ -4,6 +4,8 @@
AC_PREREQ([2.69])
AC_INIT([PuReMD], [1.0], [ohearnku@msu.edu hma@msu.edu])
# Do not allow AC_PROG_CC to set CFLAGS (this line must be after AC_INIT but before AC_PROG_CC)
save_CFLAGS="${CFLAGS}"
: ${CFLAGS=""}
AM_INIT_AUTOMAKE([1.15 subdir-objects -Wall -Werror foreign])
# Enable silent build rules by default.
......@@ -13,20 +15,21 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], [AC_SUBST([AM_DEFAULT_VERB
AC_CONFIG_MACRO_DIR([../m4])
AC_LANG([C])
AC_CONFIG_SRCDIR([src/torsion_angles.h])
AC_CONFIG_HEADERS([src/config.h])
# Headline formatter
AC_DEFUN([CONFIGURE_HEADLINE],
[
echo; echo "+++ $1 +++"
])
AC_LANG([C])
# Checks for programs.
AC_PROG_CC([cc icc gcc])
AC_PROG_CPP
CFLAGS="${save_CFLAGS}"
AC_CONFIG_SRCDIR([src/torsion_angles.h])
AC_CONFIG_HEADERS([src/config.h])
# Checks for libraries.
AC_SEARCH_LIBS([exp], [m])
......@@ -47,69 +50,122 @@ AC_FUNC_REALLOC
AC_FUNC_STRTOD
AC_CHECK_FUNCS([gettimeofday memset pow sqrt])
# Check for MPI support.
# Check for compiler vendor. If the compiler is recognized,
# the variable ax_cv_c_compiler_vendor is set accordingly.
AX_COMPILER_VENDOR
if test "x${ax_cv_c_compiler_vendor}" = "xgnu"; then
if test "x${BUILD_DEBUG}" = "x"; then
CFLAGS="-Wall -O2 -funroll-loops"
else
CFLAGS="-Wall -O0 -g2 -D_GLIBCXX_DEBUG"
fi
elif test "x${ax_cv_c_compiler_vendor}" = "xintel"; then
if test "x${BUILD_DEBUG}" = "x"; then
CFLAGS="-Wall -O2 -funroll-loops"
else
CFLAGS="-Wall -O0"
fi
fi
# Check for MPI support. If found, sets the following variables:
# Compiler-related: MPICC, MPICXX, MPIF77
# Library linking: MPILIBS
# Compilation support (via preprocessor def): HAVE_MPI
CONFIGURE_HEADLINE([ MPI compiler ])
ACX_MPI([], [AC_MSG_ERROR([could not find mpi library])])
AC_CHECK_PROG(MPIRUN, mpirun, mpirun)
AC_SUBST(MPIRUN)
# try to find if we are using OpenMPI / MPICH by looking inside mpi.h
sav_CC="$CC"
sav_CFLAGS="$CFLAGS"
CC="$MPICC"
CFLAGS="$CFLAGS"
save_CC="${CC}"
save_CFLAGS="${CFLAGS}"
CC="${MPICC}"
CFLAGS=""
AC_CHECK_DECL([OPEN_MPI], [mpi_vendor="OpenMPI"],
[], [#include "mpi.h"])
# MPICH v2
AC_CHECK_DECL([MPICH2], [mpi_vendor="MPICH2"],
[], [#include "mpi.h"])
# MPICH v3
AC_CHECK_DECL([MPICH_VERSION], [mpi_vendor="MPICH3"],
[], [#include "mpi.h"])
CC="$sav_CC"
CFLAGS="$sav_CFLAGS"
CC="${save_CC}"
CFLAGS="${save_CFLAGS}"
#
# try to set MPI_CFLAGS and MPI_LDFLAGS
#
# try to set MPI_CFLAGS and MPI_LIBS
MPI_CFLAGS=
MPI_LDFLAGS=
if test "x$mpi_vendor" = "xOpenMPI"
MPI_LIBS=
if test "x${mpi_vendor}" = "xOpenMPI"
then
MPI_CFLAGS=`$MPICC --showme:compile`
MPI_LDFLAGS=`$MPICC --showme:link`
MPI_CFLAGS=`${MPICC} --showme:compile`
MPI_LIBS=`${MPICC} --showme:link`
AC_MSG_NOTICE([OpenMPI found])
AC_MSG_NOTICE([MPI_CFLAGS=$MPI_CFLAGS])
AC_MSG_NOTICE([MPI_LDFLAGS=$MPI_LDFLAGS])
elif test "x$mpi_vendor" = "xMPICH2" || test "x$mpi_vendor" = "xMPICH3"
AC_MSG_NOTICE([MPI_CFLAGS=${MPI_CFLAGS}])
AC_MSG_NOTICE([MPI_LIBS=${MPI_LIBS}])
elif test "x${mpi_vendor}" = "xMPICH2" || test "x${mpi_vendor}" = "xMPICH3"
then
# build MPI_CFLAGS
tmp=`$MPICC -compile-info | awk '{$1=""; print $0 }'`
tmp=`${MPICC} -compile-info | awk '{$1=""; print $0 }'`
MPI_CFLAGS=
for i in $tmp
do
case $i in
case ${i} in
-[[DIUbi]]*)
MPI_CFLAGS="$MPI_CFLAGS $i"
MPI_CFLAGS="${MPI_CFLAGS} ${i}"
;;
esac
done
# build MPI_LDFLAGS
tmp=`$MPICC -link-info | awk '{$1=""; print $0 }'`
# build MPI_LIBS
tmp=`${MPICC} -link-info | awk '{$1=""; print $0 }'`
for i in $tmp
do
case $i in
case ${i} in
[[\\/]]*.a | ?:[[\\/]]*.a | -[[lLRu]]* | -Wl* )
MPI_LDFLAGS="$MPI_LDFLAGS $i"
MPI_LIBS="${MPI_LIBS} ${i}"
;;
esac
done
AC_MSG_NOTICE([MPICH found])
AC_MSG_NOTICE([MPI_CFLAGS=$MPI_CFLAGS])
AC_MSG_NOTICE([MPI_LDFLAGS=$MPI_LDFLAGS])
AC_MSG_NOTICE([MPI_CFLAGS=${MPI_CFLAGS}])
AC_MSG_NOTICE([MPI_LIBS=${MPI_LIBS}])
else
AC_MSG_WARN([Neither OpenMPI and MPICH have been recognized...])
fi
AC_SUBST(MPI_CFLAGS)
AC_SUBST(MPI_LDFLAGS)
AC_SUBST(MPI_LIBS)
# Check for LAPACKE
AC_CHECK_HEADERS([mkl.h], [MKL_FOUND_HEADERS="yes"])
if test "x${MKL_FOUND_HEADERS}" = "xyes"
then
AC_SEARCH_LIBS([LAPACKE_dgels], [mkl_intel_ilp64],
[MKL_FOUND_LIBS="yes"], [MKL_FOUND_LIBS="no"],
[-lmkl_sequential -lmkl_core -lpthread -lm -ldl])
AS_IF([test "x${MKL_FOUND_LIBS}" != "xyes"],
[AC_MSG_ERROR([Unable to find MKL LAPACKE library.])])
# dynamic linking
#LIBS="${LIBS} -lmkl_intel_ilp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl"
# static linking
LIBS="${LIBS} -Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_intel_ilp64.a ${MKLROOT}/lib/intel64/libmkl_sequential.a ${MKLROOT}/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl"
AC_DEFINE([HAVE_LAPACKE_MKL], [1], [Define to 1 if you have MKL LAPACKE support enabled.])
else
AC_CHECK_HEADERS([lapacke.h], [LAPACKE_FOUND_HEADERS="yes"])
if test "x${LAPACKE_FOUND_HEADERS}" = "xyes"
then
AC_SEARCH_LIBS([LAPACKE_dgels], [lapacke],
[LAPACKE_FOUND_LIBS="yes"], [LAPACKE_FOUND_LIBS="no"],
[-llapack])
AS_IF([test "x${LAPACKE_FOUND_LIBS}" != "xyes"],
[AC_MSG_ERROR([Unable to find LAPACKE library.])])
LIBS="${LIBS} -llapack"
AC_DEFINE([HAVE_LAPACKE], [1], [Define to 1 if you have LAPACKE support enabled.])
else
AC_MSG_WARN([
-----------------------------------------------
Unable to find LAPACKE on this system.
Disabling support for dependent methods.
-----------------------------------------------])
fi
fi
AC_CONFIG_FILES([Makefile])
......
......@@ -84,9 +84,7 @@ if test "x${DEBUG}" = "xyes"
then
# #TODO: fix exporting to subdirs
# # See: http://stackoverflow.com/questions/34124337/changing-flags-in-configure-ac-vs-caching-with-subprojects
# CFLAGS="-g3 -O0 -D_GLIBCXX_DEBUG ${CFLAGS}"
export BUILD_DEBUG="true"
export DEBUG_FLAGS="-g2 -O0 -D_GLIBCXX_DEBUG"
export BUILD_DEBUG="yes"
fi
# gprof flags.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment