-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure.ac
More file actions
125 lines (98 loc) · 2.81 KB
/
configure.ac
File metadata and controls
125 lines (98 loc) · 2.81 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
AC_PREREQ([2.69])
AC_INIT
AC_CONFIG_SRCDIR([DESCRIPTION])
AC_CONFIG_MACRO_DIR([tools/])
# Determine R_HOME.
: ${R_HOME=`R RHOME`}
if test -z "${R_HOME}"; then
echo "could not determine R_HOME"
exit 1
fi
R_SCMD="${R_HOME}/bin/Rscript -e"
# R flags
R_CPPFLAGS=`"${R_HOME}/bin/R" CMD config --cppflags`
FLOAT_LIBS=`${R_SCMD} "float:::ldflags()"`
FLOAT_INCL=`${R_SCMD} "float:::cppflags()"`
FML_INCL=`${R_SCMD} "fmlh:::cppflags()"`
# MPI flags
AC_ARG_ENABLE(mpi,
AS_HELP_STRING([--enable-mpi],[Enable MPI bindings.
]),
[USE_MPI="TRUE"],
[USE_MPI="FALSE"]
)
if test "X${USE_MPI}" = "XTRUE"; then
AC_MSG_NOTICE([using MPI])
HAS_PACKAGES=`${R_SCMD} "cat(all(c('pbdMPI', 'pbdSLAP') %in% installed.packages()))"`
if test "X${HAS_PACKAGES}" = "XFALSE"; then
AC_MSG_FAILURE([pbdMPI and pbdSLAP packages must both be installed when using MPI backend])
fi
SPMD_CPPFLAGS=`${R_SCMD} "source('./R/conf/get_conf.r');get.conf('PKG_CPPFLAGS','"${R_ARCH}"')"`
SPMD_LDFLAGS=`${R_SCMD} "source('./R/conf/get_conf.r');get.conf('PKG_LIBS','"${R_ARCH}"')"`
# ScaLAPACK flags
EXT_LDFLAGS=`${R_SCMD} "source('./R/conf/get_conf.r');get.conf('EXT_LDFLAGS','"${R_ARCH}"','pbdSLAP')"`
R_SLAP=`${R_SCMD} "source('./R/conf/get_lib.r');get.lib('R_SLAP','"${R_ARCH}"')"`
if test -f "$R_SLAP"; then
SLAP_LDFLAGS="$R_SLAP \$(LAPACK_LIBS) \$(BLAS_LIBS)"
else
SLAP_LDFLAGS="$EXT_LDFLAGS"
fi
else
AC_MSG_NOTICE([not using MPI])
fi
# GPU flags
AC_ARG_ENABLE(gpu,
AS_HELP_STRING([--enable-gpu],[Enable GPU bindings.
]),
[USE_GPU="TRUE"],
[USE_GPU="FALSE"]
)
if test "X${USE_GPU}" = "XTRUE"; then
AC_MSG_NOTICE([using GPU])
AX_CHECK_CUDA()
else
AC_MSG_NOTICE([not using GPU])
fi
# wrapup
echo " "
echo "******************* Results of fmlr package configure *******************"
echo " "
echo "* R Report:"
echo " >> R_CPPFLAGS=${R_CPPFLAGS}"
echo " >> FLOAT_LIBS=${FLOAT_LIBS}"
echo " >> FLOAT_INCL=${FLOAT_INCL}"
echo " >> FML_INCL=${FML_INCL}"
echo "* GPU Report:"
if test "X${USE_GPU}" = "XTRUE"; then
echo " >> NVCC=${NVCC}"
echo " >> CUDA_CFLAGS=${CUDA_CFLAGS}"
echo " >> CUDA_LDFLAGS=${CUDA_LDFLAGS}"
else
echo " >> not used"
fi
echo "* MPI report:"
if test "X${USE_MPI}" = "XTRUE"; then
echo " >> SPMD_CPPFLAGS = ${SPMD_CPPFLAGS}"
echo " >> SPMD_LDFLAGS = ${SPMD_LDFLAGS}"
echo " >> SLAP_LDFLAGS = ${SLAP_LDFLAGS}"
else
echo " >> not used"
fi
echo "*************************************************************************"
echo " "
AC_SUBST(R_CPPFLAGS)
AC_SUBST(FLOAT_LIBS)
AC_SUBST(FLOAT_INCL)
AC_SUBST(FML_INCL)
AC_SUBST(USE_MPI)
AC_SUBST(SPMD_CPPFLAGS)
AC_SUBST(SPMD_LDFLAGS)
AC_SUBST(SLAP_LDFLAGS)
AC_SUBST(USE_GPU)
AC_SUBST(NVCC)
AC_SUBST(CUDA_CFLAGS)
AC_SUBST(CUDA_LDFLAGS)
AC_CONFIG_FILES([src/Makevars])
AC_OUTPUT
AC_CONFIG_FILES([R/02-features.r])
AC_OUTPUT