-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.ac
72 lines (59 loc) · 1.69 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
AC_INIT(DESCRIPTION)
AC_CONFIG_MACRO_DIR([tools/])
: ${R_HOME=`R RHOME`}
if test -z "${R_HOME}"; then
echo "could not determine R_HOME"
exit 1
fi
CC=`"${R_HOME}/bin/R" CMD config CC`
R_CPPFLAGS=`"${R_HOME}/bin/R" CMD config --cppflags`
AC_PROG_CC_C99
AC_MSG_CHECKING([set backend])
AC_ARG_WITH(backend,
AC_HELP_STRING(
[--with-backend],
[CPU or GPU (default is GPU).]
),
[BACKEND=$withval],
[BACKEND="GPU"]
)
if test "X${BACKEND}" = "XGPU" -o "X${BACKEND}" = "Xgpu"; then
AX_CHECK_CUDA()
BACKEND="GPU"
elif test "X${BACKEND}" = "XCPU" -o "X${BACKEND}" = "Xcpu"; then
BACKEND="CPU"
else
AC_MSG_ERROR([backend must be GPU or CPU.])
fi
SPMD_CPPFLAGS=`"${R_HOME}/bin/Rscript" -e "source('./R/conf/get_conf.r');get.conf('PKG_CPPFLAGS','"${R_ARCH}"')"`
SPMD_LDFLAGS=`"${R_HOME}/bin/Rscript" -e "source('./R/conf/get_conf.r');get.conf('PKG_LIBS','"${R_ARCH}"')"`
# Report
echo " "
echo "***************** Results of glmrgame package configure *****************"
echo " "
echo "* R Report:"
echo " >> R_CPPFLAGS=${R_CPPFLAGS}"
echo "* Backend:"
echo " >> BACKEND=${BACKEND}"
echo "* CUDA Report:"
if test "X${BACKEND}" = "XGPU"; then
echo " >> NVCC=${NVCC}"
echo " >> CUDA_CFLAGS=${CUDA_CFLAGS}"
echo " >> CUDA_LDFLAGS=${CUDA_LDFLAGS}"
else
echo " >> not used"
fi
echo "* MPI report:"
echo " >> SPMD_CPPFLAGS = ${SPMD_CPPFLAGS}"
echo " >> SPMD_LDFLAGS = ${SPMD_LDFLAGS}"
echo "*************************************************************************"
echo " "
dnl Start to substitute templates
AC_SUBST(NVCC)
AC_SUBST(CUDA_CFLAGS)
AC_SUBST(CUDA_LDFLAGS)
AC_SUBST(R_CPPFLAGS)
AC_SUBST(BACKEND)
AC_SUBST(SPMD_CPPFLAGS)
AC_SUBST(SPMD_LDFLAGS)
AC_OUTPUT(src/Makevars)