-
Notifications
You must be signed in to change notification settings - Fork 11
/
configure.ac
131 lines (126 loc) · 4.98 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
AC_PREREQ([2.63])
AC_INIT([saxpy], [1.0], [[email protected]])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_SRCDIR([src/saxpy.c])
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
##############################################################################80
#
# check CUDA
#
##############################################################################80
AC_ARG_VAR([CUDAINC], [The PATH wherein cuda_runtime.h can be found])
if test -z "${CUDAINC}"; then
AC_SUBST([CUDAINC], [${CUDA_ROOT}/include])
fi
AC_ARG_VAR([CUDALIB], [The PATH wherein libcudart.so can be found])
if test -z "${CUDALIB}"; then
AC_SUBST([CUDALIB], [${CUDA_ROOT}/lib64])
fi
##############################################################################80
#
# check MKL
#
##############################################################################80
AC_ARG_VAR([MKLINC], [The PATH wherein mkl.h can be found])
if test -z "${MKLINC}"; then
AC_SUBST([MKLINC], [${MKLROOT}/include])
fi
AC_ARG_VAR([MKLLIB], [The PATH wherein MKL library can be found])
if test -z "${MKLLIB}"; then
AC_SUBST([MKLLIB], [${MKLROOT}/lib/intel64])
fi
##############################################################################80
#
# check C compiler
#
##############################################################################80
CFLAGS+="-I${CUDAINC} -I${MKLINC}"
LDFLAGS+="-L${CUDALIB} -L${MKLLIB}"
#
AC_PROG_CC([clang gcc])
AS_IF([test "${CC}" = gcc],
[CFLAGS="-Wall -O2 -fopenmp -foffload=nvptx-none $CFLAGS"])
AS_IF([test "${CC}" = clang],
[CFLAGS="-Wall -O2 -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda \
-Xopenmp-target -march=sm_61 $CFLAGS"])
##############################################################################80
#
# check archiver
#
##############################################################################80
AC_PROG_RANLIB
AM_PROG_AR
##############################################################################80
#
# check headers
#
##############################################################################80
AC_CHECK_HEADER([cuda_runtime.h], [],
[AC_MSG_ERROR([cuda_runtime.h required, but not found])], [])
AC_CHECK_HEADER([cublas_v2.h], [],
[AC_MSG_ERROR([cublas_v2.h required, but not found])], [])
AC_CHECK_HEADER([mkl.h], [],
[AC_MSG_ERROR([mkl.h required, but not found])], [])
##############################################################################80
#
# check libraries
#
##############################################################################80
AC_CHECK_LIB([cudart], [cudaSetDevice], [],
[AC_MSG_ERROR([libcudart required, but not found])], [])
AC_CHECK_LIB([cublas], [cublasSaxpy], [],
[AC_MSG_ERROR([libcublas required, but not found])], [])
AC_CHECK_LIB([pthread], [pthread_create], [],
[AC_MSG_ERROR([libpthread required, but not found])], [])
AC_CHECK_LIB([iomp5], [omp_set_num_threads], [],
[AC_MSG_ERROR([libiomp5 required, but not found])], [])
AC_CHECK_LIB([mkl_core], [mkl_blas_xsaxpy], [],
[AC_MSG_ERROR([libmkl_core required, but not found])],
[-lmkl_intel_lp64 -lmkl_intel_thread -liomp5 -lm])
AC_CHECK_LIB([mkl_intel_thread], [mkl_blas_saxpy], [],
[AC_MSG_ERROR([libmkl_intel_thread required, but not found])],
[-lmkl_intel_lp64 -lmkl_core -liomp5 -lm])
AC_CHECK_LIB([mkl_intel_lp64], [saxpy], [],
[AC_MSG_ERROR([libmkl_intel_lp64 required, but not found])],
[-lmkl_intel_thread -lmkl_core -liomp5 -lm])
##############################################################################80
#
# check Doxygen
#
##############################################################################80
AC_ARG_VAR([DOXYGEN], [Doxygen: source documentation generation program])
AC_CHECK_PROG([DOXYGEN], [doxygen], [doxygen], [], [], [])
AS_IF([test -z "${DOXYGEN}"],
[AC_MSG_WARN([doxygen not found - continue without doxygen support])])
AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "${DOXYGEN}"])
AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([docs/Doxyfile])])
AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([docs/Makefile])])
##############################################################################80
#
# check ccsalloc (in OpenCCS)
#
##############################################################################80
AC_ARG_VAR([CCSALLOC], [OpenCCS: Open Computing Center Software])
AC_CHECK_PROG([CCSALLOC], [ccsalloc], [ccsalloc], [], [], [])
AS_IF([test -z "${CCSALLOC}"],
[AC_MSG_WARN([ccsalloc not found - continue without OpenCCS support])])
AM_CONDITIONAL([HAVE_CCSALLOC], [test -n "${CCSALLOC}"])
##############################################################################80
#
# create final files
#
##############################################################################80
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile
src/Makefile
tests/Makefile])
AC_OUTPUT
echo "
//============================================================================80
Configuration:
CC : ${CC}
CFLAGS : ${CFLAGS}
LDFLAGS : ${LDFLAGS}
LIBS : ${LIBS}
//============================================================================80
Now, type make to build ..."