This repository has been archived by the owner on Jun 24, 2022. It is now read-only.
forked from trotter-suzuki-mpi/trotter-suzuki-mpi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
150 lines (129 loc) · 3.77 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.61])
AC_INIT([trotter-suzuki], [1.6.2])
m4_include([m4/ax_mpi_options.m4])
m4_include([m4/ax_mpi_tests.m4])
AC_CONFIG_AUX_DIR([.])
AC_CONFIG_SRCDIR([src/trottersuzuki.h])
AC_CONFIG_HEADERS([config.h])
# Checks for programs.
CXXFLAGS="-fPIC"
AC_PROG_CXX
AC_PROG_INSTALL
AC_OPENMP
openmp_enabled=no
if test x"$OPENMP_CFLAGS" != x"" ; then
openmp_enabled=yes
fi
string=`$CXX --version`
# Change -fopenmp to -openmp if using ICC
if [[[ $string == *"ICC"* ]]]
then
if test x"$OPENMP_CFLAGS" = x"-fopenmp"
then
OPENMP_CFLAGS=-openmp
fi
fi
CXXFLAGS="${CXXFLAGS} ${OPENMP_CFLAGS}"
if [[[ $string == *"ICC"* ]]]
then
CXXFLAGS="${CXXFLAGS}"
else
AS_IF([test "x$GXX" = "xyes"],[CXXFLAGS="${CXXFLAGS} -Ofast -march=native"])
fi
#find out what version we are running
ARCH=`uname -m`
if [[ $ARCH == "x86_64" ]];
then
SUFFIX="64"
else
SUFFIX=""
fi
#Setup MPI Paths
# ------------------------------------------------------------------------------
AC_ARG_WITH([mpi],
[ --with-mpi=PATH prefix where MPI is installed])
mpi_enabled=no
if test x"$with_mpi" != x"no" ; then
AX_MPI_OPTIONS
if test x"$MPI_CXX" != x"none"; then
AX_MPI_TESTS
CXX=$MPI_CXX
mpi_enabled=yes
fi
fi
# Setup CUDA paths
# ------------------------------------------------------------------------------
if test -z "$CUDAHOME" ; then
CUDA_PATH=/usr/local/cuda
else
CUDA_PATH="$CUDAHOME"
fi
AC_ARG_WITH([cuda],
[ --with-cuda=PATH prefix where cuda is installed [default=/usr/local/cuda]])
if test x"$with_cuda" != x"no" ; then
if test -n "$with_cuda"
then
CUDA_PATH=$with_cuda
fi
AC_CHECK_PROG(NVCC_CHECK,nvcc,yes,no,$CUDA_PATH/bin)
if test x"$NVCC_CHECK" = x"yes" ; then
cuda_enabled=yes
AC_ARG_WITH([gpu-architecture],
[ --with-gpu-architecture=version specify GPU architecture [default=sm_35]])
if test x"$with_gpu_architecture" != x"" ; then
CUDA_ARCH=$with_gpu_architecture
else
CUDA_ARCH=sm_35
fi
CUDA_CFLAGS="-I$CUDA_PATH/include --gpu-architecture=${CUDA_ARCH} -use_fast_math -ccbin ${CXX} -Xptxas "-v" -Xcompiler \"${CXXFLAGS}\""
CXXFLAGS="${CXXFLAGS} -I$CUDA_PATH/include"
CUDA_LIBS="-lcudart -lcublas"
if test -e "$CUDA_PATH/lib$SUFFIX"; then
CUDA_LDFLAGS="-L$CUDA_PATH/lib$SUFFIX"
else
CUDA_LDFLAGS="-L$CUDA_PATH/lib"
fi
NVCC="$CUDA_PATH/bin/nvcc"
AC_SUBST(CUDA_CFLAGS)
AC_SUBST(CUDA_LIBS)
AC_SUBST(CUDA_LDFLAGS)
AC_SUBST(NVCC)
AC_DEFINE([CUDA], 1, [cuda enabled])
elif test -n "$with_cuda" ; then
echo "---------------------------------------"
echo "Unable to find CUDA in $with_cuda."
echo "Building a version without CUDA. "
echo "---------------------------------------"
cuda_enabled=no
else
cuda_enabled=no
fi
else
cuda_enabled=no
fi
AM_CONDITIONAL([HAVE_CUDA], [test x"$cuda_enabled" = x"yes"])
#Setup CppUnit
#-------------------------------------------------------------------------------
TEST_LIBS="-lcppunit -ldl"
AC_SUBST(TEST_LIBS)
AC_CONFIG_FILES([Makefile
src/Makefile
test/Makefile
examples/Makefile])
AC_OUTPUT
echo \
"-------------------------------------------------
${PACKAGE_NAME} Version ${PACKAGE_VERSION}
Prefix: ${prefix}.
Compiler: ${CXX} ${CXXFLAGS} ${MPI_INC} ${MPI_LIBDIR} ${MPI_LIBS}
Package features:
OpenMP enabled: ${openmp_enabled}
MPI enabled: ${mpi_enabled}
CUDA enabled: ${cuda_enabled}
Now type 'make @<:@<target>@:>@'
where the optional <target> is:
all - build all binaries
install - install everything
--------------------------------------------------"