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

Refactor build system to conditionally enable CUDA support in PG-PuReMD.

parent a4a5aeff
No related branches found
No related tags found
No related merge requests found
ACLOCAL_AMFLAGS = -I m4
SUBDIRS =
if BUILD_S_OMP
S_OMP=sPuReMD
SUBDIRS += sPuReMD
endif
if BUILD_MPI
MPI=PuReMD
SUBDIRS += PuReMD
endif
if BUILD_SINGLE_GPU
SINGLE_GPU=PuReMD-GPU
if BUILD_GPU
SUBDIRS += PuReMD-GPU
endif
if BUILD_MULTI_GPU
MULTI_GPU=PG-PuReMD
if BUILD_MPI_GPU
SUBDIRS += PG-PuReMD
endif
SUBDIRS = $(S_OMP) $(MPI) $(SINGLE_GPU) $(MULTI_GPU)
EXTRA_DIST = doc/README.txt doc/manual.pdf
dist-hook: rm -rf `find $(distdir) -name .git`
SUBDIRS = src
if BUILD_CUDA
SUFFIXES = .cu
include cuda.am
endif
AM_CFLAGS = -Wall -O3 -funroll-loops -fstrict-aliasing
AM_CPPFLAGS = -I$(srcdir)
AM_LDFLAGS =
if BUILD_CUDA
AM_CFLAGS += $(CUDA_CFLAGS)
AM_CPPFLAGS += $(CUDA_CFLAGS)
# default CUDA nvcc flags
# Note: cc 13 for Tesla
# Note: cc 20 for Fermi
# Note: cc 30 for Kepler K10
# Note: cc 35 for Kepler K20
NVCCFLAGS += -D__USE_GPU__ -use_fast_math
NVCCFLAGS += -gencode arch=compute_35,code=sm_35 --compiler-options "-O3 -funroll-loops -fstrict-aliasing" -O3
NVCCFLAGS += --ptxas-options -v
NVCCFLAGS += --compiler-options -I$(srcdir)
NVCCFLAGS += --compiler-options -fno-strict-aliasing
NVCCFLAGS += --compiler-options -Wno-unused-function
NVCCFLAGS += --compiler-options -Wno-unused-parameter
NVCCFLAGS += --compiler-options "$(MPI_CFLAGS)"
#NVCC_LIBS = -lcudart -m64
endif
bin_PROGRAMS = pg-puremd
pg_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
if BUILD_CUDA
pg_puremd_SOURCES += src/cuda_utils.cu src/dev_alloc.cu src/cuda_environment.cu \
src/dev_system_props.cu src/reduction.cu src/center_mass.cu \
src/cuda_copy.cu src/cuda_reset_tools.cu src/dev_list.cu \
src/cuda_neighbors.cu src/cuda_bond_orders.cu src/cuda_bonds.cu \
src/cuda_multi_body.cu src/cuda_valence_angles.cu \
src/cuda_torsion_angles.cu src/cuda_hydrogen_bonds.cu src/cuda_forces.cu \
src/cuda_qEq.cu src/cuda_linear_solvers.cu src/matvec.cu src/dual_matvec.cu \
src/cuda_nonbonded.cu src/cuda_integrate.cu src/cuda_post_evolve.cu \
src/cuda_init_md.cu src/validation.cu src/cuda_lookup.cu
# dummy source to cause C linking
nodist_EXTRA_pg_puremd_SOURCES = src/dummy.c
endif
pg_puremd_CFLAGS = $(AM_CFLAGS) $(MPI_CFLAGS)
pg_puremd_LDFLAGS = $(AM_LDFLAGS) $(MPI_LDFLAGS)
if BUILD_CUDA
pg_puremd_LDFLAGS += $(CUDA_LIBS)
endif
......@@ -4,7 +4,7 @@
AC_PREREQ([2.69])
AC_INIT([PG-PuReMD], [1.0], [ohearnku@msu.edu hma@msu.edu])
AM_INIT_AUTOMAKE([1.15 -Wall -Werror foreign])
AM_INIT_AUTOMAKE([1.15 subdir-objects -Wall -Werror foreign])
#LT_PREREQ([2.2])
#LT_INIT([dlopen])
......@@ -47,18 +47,27 @@ AC_FUNC_STRTOD
AC_CHECK_FUNCS([gettimeofday memset])
# Check for CUDA support.
CONFIGURE_HEADLINE([ CUDA support ])
AX_CUDA
if test "BUILD_DEBUG" = "true"
then
NVCCFLAGS+=" -g -G"
else
NVCCFLAGS+=" -O3"
if test "x$BUILD_GPU" = "xyes"; then
CONFIGURE_HEADLINE([ CUDA support ])
AX_CUDA
if test "BUILD_DEBUG" = "true"
then
NVCCFLAGS+=" -g -G"
else
NVCCFLAGS+=" -O3"
fi
AC_DEFINE([HAVE_CUDA], [1], [Define to 1 if you have CUDA support enabled.])
fi
AM_CONDITIONAL([BUILD_CUDA], [test "x${BUILD_GPU}" = "xyes"])
if test "BUILD_PROF" = "true"
then
NVCCFLAGS+=" --compiler-options ${gprof_flags}"
if test "x$BUILD_GPU" = "xyes"; then
NVCCFLAGS+=" --compiler-options ${gprof_flags}"
else
CFLAGS+=" --compiler-options ${gprof_flags}"
fi
fi
# Check for MPI support.
......@@ -123,6 +132,6 @@ fi
AC_SUBST(MPI_CFLAGS)
AC_SUBST(MPI_LDFLAGS)
AC_CONFIG_FILES([Makefile src/Makefile])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
SUFFIXES = .cu
include cuda.am
AM_CFLAGS = -Wall -O3 -funroll-loops -fstrict-aliasing $(CUDA_CFLAGS)
AM_CPPFLAGS = -I$(srcdir) $(CUDA_CFLAGS)
AM_LDFLAGS =
# default CUDA nvcc flags
# Note: cc 13 for Tesla
# Note: cc 20 for Fermi
# Note: cc 30 for Kepler K10
# Note: cc 35 for Kepler K20
NVCCFLAGS = -D__USE_GPU__ -use_fast_math
NVCCFLAGS += -gencode arch=compute_35,code=sm_35 --compiler-options "-O3 -funroll-loops -fstrict-aliasing" -O3
NVCCFLAGS += --ptxas-options -v
NVCCFLAGS += --compiler-options -I$(srcdir)
NVCCFLAGS += --compiler-options -fno-strict-aliasing
NVCCFLAGS += --compiler-options -Wno-unused-function
NVCCFLAGS += --compiler-options -Wno-unused-parameter
NVCCFLAGS += --compiler-options "$(MPI_CFLAGS)"
#NVCC_LIBS = -lcudart -m64
bin_PROGRAMS = pg-puremd
pg_puremd_SOURCES = allocate.c basic_comm.c ffield.c grid.c list.c lookup.c \
io_tools.c reset_tools.c restart.c random.c tool_box.c traj.c \
vector.c analyze.c box.c system_props.c control.c comm_tools.c \
geo_tools.c linear_solvers.c neighbors.c qEq.c bond_orders.c multi_body.c \
bonds.c valence_angles.c hydrogen_bonds.c torsion_angles.c nonbonded.c forces.c \
integrate.c init_md.c parallelreax.c cuda_utils.cu dev_alloc.cu cuda_environment.cu \
dev_system_props.cu reduction.cu center_mass.cu cuda_copy.cu cuda_reset_tools.cu \
dev_list.cu cuda_neighbors.cu cuda_bond_orders.cu cuda_bonds.cu cuda_multi_body.cu \
cuda_valence_angles.cu cuda_torsion_angles.cu cuda_hydrogen_bonds.cu cuda_forces.cu \
cuda_qEq.cu cuda_linear_solvers.cu matvec.cu dual_matvec.cu cuda_nonbonded.cu \
cuda_integrate.cu cuda_post_evolve.cu cuda_init_md.cu validation.cu cuda_lookup.cu
# dummy source to cause C linking
nodist_EXTRA_pg_puremd_SOURCES = dummy.c
pg_puremd_CFLAGS = $(AM_CFLAGS) $(MPI_CFLAGS)
pg_puremd_LDFLAGS = $(AM_LDFLAGS) $(MPI_LDFLAGS) $(CUDA_LIBS)
/* src/config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have CUDA support enabled. */
#undef HAVE_CUDA
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
......
......@@ -25,14 +25,18 @@ AC_ARG_ENABLE([mpi],
[AS_HELP_STRING([--enable-mpi],
[enable MPI support @<:@default: no@:>@])],
[package_mpi_enabled=${enableval}], [package_mpi_enabled=no])
AC_ARG_ENABLE([mpi-single-gpu],
[AS_HELP_STRING([--enable-mpi-single-gpu],
[enable MPI+CUDA (single GPU) support @<:@default: no@:>@])],
[package_mpi_single_gpu_enabled=${enableval}], [package_mpi_single_gpu_enabled=no])
AC_ARG_ENABLE([mpi-multi-gpu],
[AS_HELP_STRING([--enable-mpi-multi-gpu],
AC_ARG_ENABLE([gpu],
[AS_HELP_STRING([--enable-gpu],
[enable CUDA (single GPU) support @<:@default: no@:>@])],
[package_gpu_enabled=${enableval}], [package_gpu_enabled=no])
AC_ARG_ENABLE([mpi-not-gpu],
[AS_HELP_STRING([--enable-mpi-not-gpu],
[enable MPI but not CUDA support @<:@default: no@:>@])],
[package_mpi_not_gpu_enabled=${enableval}], [package_mpi_not_gpu_enabled=no])
AC_ARG_ENABLE([mpi-gpu],
[AS_HELP_STRING([--enable-mpi-gpu],
[enable MPI+CUDA (multi GPU) support @<:@default: no@:>@])],
[package_mpi_multi_gpu_enabled=${enableval}], [package_mpi_multi_gpu_enabled=no])
[package_mpi_gpu_enabled=${enableval}], [package_mpi_gpu_enabled=no])
if test "x${package_serial_enabled}" = "xyes" || test "x${package_openmp_enabled}" = "xyes"; then
AC_CONFIG_SUBDIRS([sPuReMD])
......@@ -47,14 +51,19 @@ if test "x${package_mpi_enabled}" = "xyes"; then
AC_CONFIG_SUBDIRS([PuReMD])
fi
AM_CONDITIONAL([BUILD_MPI], [test "x${package_mpi_enabled}" = "xyes"])
if test "x${package_mpi_single_gpu_enabled}" = "xyes"; then
if test "x${package_gpu_enabled}" = "xyes"; then
AC_CONFIG_SUBDIRS([PuReMD-GPU])
fi
AM_CONDITIONAL([BUILD_SINGLE_GPU], [test "x${package_mpi_single_gpu_enabled}" = "xyes"])
if test "x${package_mpi_multi_gpu_enabled}" = "xyes"; then
AM_CONDITIONAL([BUILD_GPU], [test "x${package_gpu_enabled}" = "xyes"])
if test "x${package_mpi_not_gpu_enabled}" = "xyes" || test "x${package_mpi_gpu_enabled}" = "xyes"; then
AC_CONFIG_SUBDIRS([PG-PuReMD])
if test "x${package_mpi_not_gpu_enabled}" = "xyes" || test "x${package_mpi_gpu_enabled}" != "xyes"; then
export BUILD_MPI_NOT_GPU="yes"
else
export BUILD_MPI_NOT_GPU="no"
fi
fi
AM_CONDITIONAL([BUILD_MULTI_GPU], [test "x${package_mpi_multi_gpu_enabled}" = "xyes"])
AM_CONDITIONAL([BUILD_MPI_GPU], [test "x${package_mpi_not_gpu_enabled}" = "xyes" || test "x${package_mpi_gpu_enabled}" = "xyes"])
# Provides debug compilation mode.
AC_ARG_ENABLE([debug],
......
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