forked from PanPalitta/phase_estimation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure.ac
More file actions
137 lines (127 loc) · 3.63 KB
/
configure.ac
File metadata and controls
137 lines (127 loc) · 3.63 KB
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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.61])
AC_INIT([phase_estimation], [1.0])
m4_include([m4/ax_mpi_options.m4])
m4_include([m4/ax_mpi_tests.m4])
AC_CONFIG_SRCDIR([src/main.cpp])
AC_CONFIG_HEADERS([config.h])
# Checks for programs.
AC_PROG_CXX
AC_PROG_INSTALL
AC_ARG_ENABLE([whatever],
[AS_HELP_STRING([--enable-openmp], [Use OpenMP (default: disabled)])])
if test "$enable_openmp" == yes; then
AC_OPENMP
else
enable_openmp=no
fi
CXXFLAGS="${OPENMP_CFLAGS}"
#find out what version we are running
ARCH=`uname -m`
if [[ $ARCH == "x86_64" ]];
then
SUFFIX="64"
else
SUFFIX=""
fi
string=`$CXX --version`
if [[[ $string == *"ICC"* ]]]
then
CXXFLAGS="${CXXFLAGS} -fast"
else
AS_IF([test "x$GXX" = "xyes"],[CXXFLAGS="${CXXFLAGS} -Ofast -march=native -Wall"])
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
else
AC_MSG_ERROR(MPI is necessary to compile)
fi
else
AC_MSG_ERROR(MPI is necessary to compile)
fi
# Setup CUDA paths
# ------------------------------------------------------------------------------
CUDA_PATH=/usr/local/cuda
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
CUDA_INC="-I$CUDA_PATH/include"
CUDA_CFLAGS="-use_fast_math -Xcompiler \"${CXXFLAGS}\""
CUDA_LIBS="-lcudart -lcurand"
CUDA_LDFLAGS="-L$CUDA_PATH/lib$SUFFIX"
NVCC="$CUDA_PATH/bin/nvcc"
AC_SUBST(CUDA_INC)
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"])
# Set up VSL
# ------------------------------------------------------------------------------
AC_ARG_WITH([vsl],
[ --with-vsl=PATH prefix where Intel MKL/VSL is installed])
if test x"$with_vsl" != x"no" ; then
if test -n "$with_vsl"
then
VSL_PATH=$with_vsl
vsl_enabled=yes
VSL_LIBDIR="-L$VSL_PATH/lib/intel$SUFFIX"
VSL_INC="-I$VSL_PATH/include"
VSL_LIBS="-lmkl_intel_ilp64 -lmkl_sequential -lmkl_core"
AC_SUBST(VSL_INC)
AC_SUBST(VSL_LIBS)
AC_SUBST(VSL_LIBDIR)
AC_DEFINE([VSL], 1, [vsl enabled])
else
vsl_enabled=no
fi
fi
AM_CONDITIONAL([HAVE_VSL], [test x"$vsl_enabled" = x"yes"])
AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile])
AC_OUTPUT
echo \
"-------------------------------------------------
${PACKAGE_NAME} Version ${PACKAGE_VERSION}
Prefix: ${prefix}.
Compiler: ${CXX} ${CXXFLAGS} ${MPI_INC} ${MPI_LIBDIR} ${MPI_LIBS} ${CUDA_INC} ${VSL_INC} ${VSL_LIBDIR} ${VSL_LIBS}
Package features:
OpenMP enabled: ${enable_openmp}
MPI enabled: ${mpi_enabled}
CUDA enabled: ${cuda_enabled}
VSL enabled: ${vsl_enabled}
Now type 'make @<:@<target>@:>@'
where the optional <target> is:
all - build all binaries
install - install everything
test - build tests
--------------------------------------------------"