diff --git a/config/opal_check_hipcc.m4 b/config/opal_check_hipcc.m4 new file mode 100644 index 00000000000..568a7854ad2 --- /dev/null +++ b/config/opal_check_hipcc.m4 @@ -0,0 +1,51 @@ +dnl -*- autoconf -*- +dnl +dnl Copyright (c) 2024 Stony Brook University. All rights reserved. +dnl +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl + +dnl +dnl Check for HIPCC and bail out if HIPCC was requested +dnl Options provided: +dnl --with-hipcc[=path/to/hipcc]: provide a path to HIPCC +dnl --enable-hipcc: require HIPCC, bail out if not found +dnl + +AC_DEFUN([OPAL_CHECK_HIPCC],[ + + # This option is probably only helpful to developers: have + # configure fail if Sphinx is not found (i.e., if you don't have + # the ability to use Sphinx to build the HTML docs and man pages). + AC_ARG_ENABLE([hipcc], + [AS_HELP_STRING([--enable-hipcc], + [Force configure to fail if CUDA hipcc is not found (CUDA hipcc is used to build CUDA operator support).])]) + + AC_ARG_WITH([hipcc], + [AS_HELP_STRING([--with-hipcc=DIR], + [Path to the CUDA compiler])]) + + AS_IF([test -n "$with_hipcc"], + [OPAL_HIPCC=$with_hipcc], + # no path specified, try to find hipcc + [AC_PATH_PROG([OPAL_HIPCC], [hipcc], [])]) + + # If the user requested to disable sphinx, then pretend we didn't + # find it. + AS_IF([test "$enable_hipcc" = "no"], + [OPAL_HIPCC=]) + + # If --enable-sphinx was specified and we did not find Sphinx, + # abort. This is likely only useful to prevent "oops!" moments + # from developers. + AS_IF([test -z "$OPAL_HIPCC" && test "$enable_hipcc" = "yes"], + [AC_MSG_WARN([A suitable CUDA compiler was not found, but --enable-hipcc was specified]) + AC_MSG_ERROR([Cannot continue])]) + + OPAL_SUMMARY_ADD([Accelerators], [HIPCC compiler], [], [$OPAL_HIPCC]) + +]) diff --git a/config/opal_check_nvcc.m4 b/config/opal_check_nvcc.m4 index 6443cdd01a2..fa29151bebc 100644 --- a/config/opal_check_nvcc.m4 +++ b/config/opal_check_nvcc.m4 @@ -1,7 +1,6 @@ dnl -*- autoconf -*- dnl -dnl Copyright (c) 2020-2022 Cisco Systems, Inc. All rights reserved. -dnl Copyright (c) 2024 Jeffrey M. Squyres. All rights reserved. +dnl Copyright (c) 2024 Stony Brook University. All rights reserved. dnl dnl $COPYRIGHT$ dnl @@ -10,26 +9,16 @@ dnl dnl $HEADER$ dnl -dnl Setup Sphinx for building HTML docs and man pages dnl -dnl 1 -> sanity file to check if pre-built docs are already available -dnl You probably want to pass something like -dnl "$srcdir/docs/_build/man/foo.1" +dnl Check for NVCC and bail out if NVCC was requested +dnl Options provided: +dnl --with-nvcc[=path/to/nvcc]: provide a path to NVCC +dnl --enable-nvcc: require NVCC, bail out if not found +dnl --nvcc-compute-arch: request a specific compute +dnl architecture for the operator +dnl kernels dnl -dnl 2 -> (OPTIONAL) URL to display in AC_MSG_WARN when docs will not be installed -dnl If $2 is empty, nothing will be displayed. -dnl Note: if $2 contains a #, be sure to double quote it -dnl (e.g., [[https://example.com/foo.html#some-anchor]]) -dnl -dnl 3 -> (OPTIONAL) Filename of requirements.txt-like file containing -dnl the required Pip modules (to be displayed if rendering a -dnl simple RST project fails). -dnl -dnl This macro requires that OAC_PUSH_PREFIX was previously called. -dnl The pushed prefix may be used if this macro chooses to set {OAC -dnl prefix}_MAKEDIST_DISABLE. If set, it is a message indicating why -dnl "make dist" should be disabled, suitable for emitting via -dnl AC_MSG_WARN. + AC_DEFUN([OPAL_CHECK_NVCC],[ # This option is probably only helpful to developers: have diff --git a/ompi/mca/op/rocm/Makefile.am b/ompi/mca/op/rocm/Makefile.am index 93a110c7e23..c6177374178 100644 --- a/ompi/mca/op/rocm/Makefile.am +++ b/ompi/mca/op/rocm/Makefile.am @@ -26,7 +26,7 @@ rocm_sources = op_rocm_impl.hip HIPCC = hipcc -.cpp.l$(OBJEXT): +.hip.l$(OBJEXT): $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(HIPCC) -O2 -std=c++17 -fvectorize -prefer-non-pic -Wc,-fPIC,-g -c $< diff --git a/ompi/mca/op/rocm/configure.m4 b/ompi/mca/op/rocm/configure.m4 index ffd88698be0..6fa10b5824e 100644 --- a/ompi/mca/op/rocm/configure.m4 +++ b/ompi/mca/op/rocm/configure.m4 @@ -24,6 +24,7 @@ AC_DEFUN([MCA_ompi_op_rocm_CONFIG],[ AC_CONFIG_FILES([ompi/mca/op/rocm/Makefile]) OPAL_CHECK_ROCM([op_rocm]) + OPAL_CHECK_HIPCC([op_hipcc]) AS_IF([test "x$ROCM_SUPPORT" = "x1"], [$1], @@ -33,4 +34,6 @@ AC_DEFUN([MCA_ompi_op_rocm_CONFIG],[ AC_SUBST([op_rocm_LDFLAGS]) AC_SUBST([op_rocm_LIBS]) + AC_SUBST([OPAL_HIPCC]) + ])dnl