Skip to content

Commit

Permalink
add check for MKL libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
xwuupb committed Apr 5, 2020
1 parent e1b753b commit 4b529fc
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 253 deletions.
24 changes: 17 additions & 7 deletions 09_matAdd/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ fi
# 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 -fopenmp -foffload=nvptx-none -I${CUDAINC} -I${MKLINC} $CFLAGS"
LDFLAGS="-L${CUDALIB} -L${MKLLIB} -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core $LDFLAGS"])
[CFLAGS="-Wall -fopenmp -foffload=nvptx-none $CFLAGS"])
AS_IF([test "${CC}" = clang],
[CFLAGS="-Wall -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda -I${CUDAINC} \
-I${MKLINC} -Xopenmp-target -march=sm_61 $CFLAGS"
LDFLAGS="-L${CUDALIB} -L${MKLLIB} -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core $LDFLAGS"])
[CFLAGS="-Wall -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda \
-Xopenmp-target -march=sm_61 $CFLAGS"])
##############################################################################80
#
# check archiver
Expand Down Expand Up @@ -69,10 +70,19 @@ 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([iomp5], [omp_set_num_threads], [],
[AC_MSG_ERROR([libiomp5 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
Expand Down
4 changes: 2 additions & 2 deletions 09_matAdd/src/matAdd.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ int main(int argc, char *argv[])
}
#pragma omp parallel for default(none) \
shared(a, b, ahost, aaccl, n) private(idx)
for (idx = 0; idx < n * n; idx++) {
for (idx = 0; idx < n * n; ++idx) {
a[idx] = rand() % 32 / 32.0f;
b[idx] = rand() % 32 / 32.0f;
ahost[idx] = 0.0f;
Expand Down Expand Up @@ -107,7 +107,7 @@ int main(int argc, char *argv[])
matAddAB_accl(aaccl, b, n, ial);
// check aaccl
maxabserr = -1.0f;
for (idx = 0; idx < n * n; idx++) {
for (idx = 0; idx < n * n; ++idx) {
maxabserr = fabsf(aaccl[idx] - ahost[idx]) > maxabserr?
fabsf(aaccl[idx] - ahost[idx]) : maxabserr;
}
Expand Down
237 changes: 0 additions & 237 deletions 09_matAdd/src/x.c

This file was deleted.

24 changes: 17 additions & 7 deletions 10_matMul/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ fi
# 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 -fopenmp -foffload=nvptx-none -I${CUDAINC} -I${MKLINC} $CFLAGS"
LDFLAGS="-L${CUDALIB} -L${MKLLIB} -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core $LDFLAGS"])
[CFLAGS="-Wall -fopenmp -foffload=nvptx-none $CFLAGS"])
AS_IF([test "${CC}" = clang],
[CFLAGS="-Wall -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda -I${CUDAINC} \
-I${MKLINC} -Xopenmp-target -march=sm_61 $CFLAGS"
LDFLAGS="-L${CUDALIB} -L${MKLLIB} -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core $LDFLAGS"])
[CFLAGS="-Wall -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda \
-Xopenmp-target -march=sm_61 $CFLAGS"])
##############################################################################80
#
# check archiver
Expand Down Expand Up @@ -69,10 +70,19 @@ AC_CHECK_LIB([cudart], [cudaSetDevice], [],
[AC_MSG_ERROR([libcudart required, but not found])], [])
AC_CHECK_LIB([cublas], [cublasSgemm], [],
[AC_MSG_ERROR([libcublas required, but not found])], [])
AC_CHECK_LIB([iomp5], [omp_set_num_threads], [],
[AC_MSG_ERROR([libiomp5 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_xsgemm], [],
[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_sgemm], [],
[AC_MSG_ERROR([libmkl_intel_thread required, but not found])],
[-lmkl_intel_lp64 -lmkl_core -liomp5 -lm])
AC_CHECK_LIB([mkl_intel_lp64], [sgemm], [],
[AC_MSG_ERROR([libmkl_intel_lp64 required, but not found])],
[-lmkl_intel_thread -lmkl_core -liomp5 -lm])
##############################################################################80
#
# check Doxygen
Expand Down

0 comments on commit 4b529fc

Please sign in to comment.