diff --git a/Make.inc.in b/Make.inc.in index 858ad336..38c8ef86 100755 --- a/Make.inc.in +++ b/Make.inc.in @@ -67,6 +67,12 @@ UTILMODNAME=@UTILMODNAME@ CBINDLIBNAME=libpsb_cbind.a +OACCD=@OACCD@ +OACCLD=@OACCLD@ +FCOPENACC=@FCOPENACC@ +CCOPENACC=@CCOPENACC@ +CXXOPENACC=@CXXOPENACC@ + CUDAD=@CUDAD@ CUDALD=@CUDALD@ LCUDA=@LCUDA@ @@ -82,6 +88,7 @@ CUDA_SHORT_VERSION=@CUDA_SHORT_VERSION@ NVCC=@CUDA_NVCC@ CUDEFINES=@CUDEFINES@ + .SUFFIXES: .cu .cu.o: $(NVCC) $(CINCLUDES) $(CDEFINES) $(CUDEFINES) -c $< diff --git a/Makefile b/Makefile index 95f4cb17..972fd3c6 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ include Make.inc -all: dirs based precd kryld utild cbindd extd $(CUDAD) libd +all: dirs based precd kryld utild cbindd extd $(CUDAD) $(OACCD) libd @echo "=====================================" @echo "PSBLAS libraries Compilation Successful." @@ -14,9 +14,10 @@ utild: based kryld: precd extd: based cudad: extd +oaccd: extd cbindd: based precd kryld utild -libd: based precd kryld utild cbindd extd $(CUDALD) +libd: based precd kryld utild cbindd extd $(CUDALD) $(OACCLD) $(MAKE) -C base lib $(MAKE) -C prec lib $(MAKE) -C krylov lib @@ -25,6 +26,8 @@ libd: based precd kryld utild cbindd extd $(CUDALD) $(MAKE) -C ext lib cudald: cudad $(MAKE) -C cuda lib +oaccld: oaccd + $(MAKE) -C openacc lib based: @@ -41,6 +44,8 @@ extd: based $(MAKE) -C ext objs cudad: based extd $(MAKE) -C cuda objs +oaccd: based extd + $(MAKE) -C openacc objs install: all @@ -67,6 +72,7 @@ clean: $(MAKE) -C cbind clean $(MAKE) -C ext clean $(MAKE) -C cuda clean + $(MAKE) -C openacc clean check: all make check -C test/serial @@ -84,6 +90,7 @@ veryclean: cleanlib cd cbind && $(MAKE) veryclean cd ext && $(MAKE) veryclean cd cuda && $(MAKE) veryclean + cd openacc && $(MAKE) veryclean cd test/fileread && $(MAKE) clean cd test/pargen && $(MAKE) clean cd test/util && $(MAKE) clean diff --git a/config/pac.m4 b/config/pac.m4 index 0d22392f..d74a6f24 100644 --- a/config/pac.m4 +++ b/config/pac.m4 @@ -2267,3 +2267,47 @@ CPPFLAGS="$SAVE_CPPFLAGS" ])dnl + +dnl @synopsis PAC_ARG_OPENACC +dnl +dnl Test for --enable-openacc +dnl +dnl +dnl +dnl Example use: +dnl +dnl +dnl @author Salvatore Filippone +dnl +AC_DEFUN([PAC_ARG_OPENACC], +[AC_MSG_CHECKING([whether we want openacc ]) +AC_ARG_ENABLE(openacc, +AS_HELP_STRING([--enable-openacc], +[Specify whether to enable openacc. ]), +[ +pac_cv_openacc="yes"; +] +dnl , +dnl [pac_cv_openacc="no";] + ) +if test x"$pac_cv_openacc" == x"yes" ; then + AC_MSG_RESULT([yes.]) +# AC_LANG_PUSH([Fortran]) +# AC_OPENACC() +# pac_cv_openacc_fcopt="$OPENACC_FCFLAGS"; +# AC_LANG_POP() +# AC_LANG_PUSH([C]) +# AC_OPENACC() +# pac_cv_openacc_ccopt="$OPENACC_CFLAGS"; +# AC_LANG_POP() +# AC_LANG_PUSH([C++]) +# AC_OPENACC() +# pac_cv_openacc_cxxopt="$OPENACC_CXXFLAGS"; +# AC_LANG_POP() +else + pac_cv_openacc="no"; + AC_MSG_RESULT([no.]) +fi +] +) + diff --git a/configure b/configure index b7e5f329..15e3670d 100755 --- a/configure +++ b/configure @@ -667,6 +667,11 @@ CUDA_DIR EXTRALDLIBS SPGPU_LIBS SPGPU_FLAGS +CXXOPENACC +CCOPENACC +FCOPENACC +OACCLD +OACCD METISINCFILE UTILLIBNAME METHDLIBNAME @@ -840,6 +845,10 @@ with_amdincdir with_amdlibdir with_cuda with_cudacc +enable_openacc +with_ccopenacc +with_cxxopenacc +with_fcopenacc ' ac_precious_vars='build_alias host_alias @@ -1490,6 +1499,7 @@ Optional Features: --disable-silent-rules verbose build output (undo: "make V=0") --enable-openmp Specify whether to enable openmp. --disable-openmp do not use OpenMP + --enable-openacc Specify whether to enable openacc. Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1535,6 +1545,12 @@ Optional Packages: --with-cuda=DIR Specify the CUDA install directory. --with-cudacc A comma-separated list of CCs to compile to, for example, --with-cudacc=50,60,70,75 + --with-ccopenacc additional [CCOPENACC] flags to be added: will + prepend to [CCOPENACC] + --with-cxxopenacc additional [CXXOPENACC] flags to be added: will + prepend to [CXXOPENACC] + --with-fcopenacc additional [FCOPENACC] flags to be added: will + prepend to [FCOPENACC] Some influential environment variables: FC Fortran compiler command @@ -10867,6 +10883,106 @@ printf "%s\n" "$as_me: For CUDA I need psb_ipk_ to be 4 bytes but it is $pac_cv_ CUDA_LIBS=""; fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we want openacc " >&5 +printf %s "checking whether we want openacc ... " >&6; } +# Check whether --enable-openacc was given. +if test ${enable_openacc+y} +then : + enableval=$enable_openacc; +pac_cv_openacc="yes"; + + +fi + +if test x"$pac_cv_openacc" == x"yes" ; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes." >&5 +printf "%s\n" "yes." >&6; } +# AC_LANG_PUSH([Fortran]) +# AC_OPENACC() +# pac_cv_openacc_fcopt="$OPENACC_FCFLAGS"; +# AC_LANG_POP() +# AC_LANG_PUSH([C]) +# AC_OPENACC() +# pac_cv_openacc_ccopt="$OPENACC_CFLAGS"; +# AC_LANG_POP() +# AC_LANG_PUSH([C++]) +# AC_OPENACC() +# pac_cv_openacc_cxxopt="$OPENACC_CXXFLAGS"; +# AC_LANG_POP() +else + pac_cv_openacc="no"; + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no." >&5 +printf "%s\n" "no." >&6; } +fi + + +if test x"$pac_cv_openacc" == x"yes" ; then + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether additional CCOPENACC flags should be added (should be invoked only once)" >&5 +printf %s "checking whether additional CCOPENACC flags should be added (should be invoked only once)... " >&6; } + +# Check whether --with-ccopenacc was given. +if test ${with_ccopenacc+y} +then : + withval=$with_ccopenacc; +CCOPENACC="${withval} ${CCOPENACC}" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: CCOPENACC = ${CCOPENACC}" >&5 +printf "%s\n" "CCOPENACC = ${CCOPENACC}" >&6; } + +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +fi + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether additional CXXOPENACC flags should be added (should be invoked only once)" >&5 +printf %s "checking whether additional CXXOPENACC flags should be added (should be invoked only once)... " >&6; } + +# Check whether --with-cxxopenacc was given. +if test ${with_cxxopenacc+y} +then : + withval=$with_cxxopenacc; +CXXOPENACC="${withval} ${CXXOPENACC}" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: CXXOPENACC = ${CXXOPENACC}" >&5 +printf "%s\n" "CXXOPENACC = ${CXXOPENACC}" >&6; } + +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +fi + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether additional FCOPENACC flags should be added (should be invoked only once)" >&5 +printf %s "checking whether additional FCOPENACC flags should be added (should be invoked only once)... " >&6; } + +# Check whether --with-fcopenacc was given. +if test ${with_fcopenacc+y} +then : + withval=$with_fcopenacc; +FCOPENACC="${withval} ${FCOPENACC}" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: FCOPENACC = ${FCOPENACC}" >&5 +printf "%s\n" "FCOPENACC = ${FCOPENACC}" >&6; } + +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +fi + + + + OACCD=oaccd; + OACCLD=oaccld; + + #FCOPT="$FCOPT $FCOPENACC"; + #CCOPT="$CCOPT $CCOPENACC" + #CXXOPT="$CXXOPT $CXXOPENACC" + #FLINK="$FLINK $FCOPENACC"; +fi @@ -10957,6 +11073,13 @@ FDEFINES=$(PSBFDEFINES) $(CUDA_DEFINES) + + + + + + + diff --git a/configure.ac b/configure.ac index 10f9e2f4..ed4f4acc 100755 --- a/configure.ac +++ b/configure.ac @@ -843,6 +843,20 @@ if test "x$pac_cv_ipk_size" != "x4"; then CUDA_LIBS=""; fi +PAC_ARG_OPENACC() +if test x"$pac_cv_openacc" == x"yes" ; then + PAC_ARG_WITH_FLAGS(ccopenacc,CCOPENACC) + PAC_ARG_WITH_FLAGS(cxxopenacc,CXXOPENACC) + PAC_ARG_WITH_FLAGS(fcopenacc,FCOPENACC) + + OACCD=oaccd; + OACCLD=oaccld; + + #FCOPT="$FCOPT $FCOPENACC"; + #CCOPT="$CCOPT $CCOPENACC" + #CXXOPT="$CXXOPT $CXXOPENACC" + #FLINK="$FLINK $FCOPENACC"; +fi @@ -927,6 +941,12 @@ AC_SUBST(PRECLIBNAME) AC_SUBST(METHDLIBNAME) AC_SUBST(UTILLIBNAME) AC_SUBST(METISINCFILE) +AC_SUBST(OACCD) +AC_SUBST(OACCLD) +AC_SUBST(FCOPENACC) +AC_SUBST(CCOPENACC) +AC_SUBST(CXXOPENACC) + AC_SUBST(SPGPU_FLAGS) AC_SUBST(SPGPU_LIBS) dnl AC_SUBST(SPGPU_DIR) @@ -944,6 +964,7 @@ AC_SUBST(CUDEFINES) AC_SUBST(CUDAD) AC_SUBST(CUDALD) AC_SUBST(LCUDA) + ############################################################################### # the following files will be created by Automake