Add config options for target backends for sycl instead of hard coding (#701)
Adds config options for specifying a target backend with sycl (both cmake and autoconf)
This commit is contained in:
parent
6cf11aaa08
commit
c551365fe7
@ -119,6 +119,8 @@ set(HYPRE_CUDA_SM "70" CACHE STRING "Target CUDA architecture.")
|
||||
option(HYPRE_ENABLE_ONEMKLSPARSE "Use oneMKL sparse" ON)
|
||||
option(HYPRE_ENABLE_ONEMKLBLAS "Use oneMKL blas" ON)
|
||||
option(HYPRE_ENABLE_ONEMKLRAND "Use oneMKL rand" ON)
|
||||
set(HYPRE_SYCL_TARGET "" CACHE STRING "Target SYCL architecture, e.g. 'spir64_gen'.")
|
||||
set(HYPRE_SYCL_TARGET_BACKEND "" CACHE STRING "Additional SYCL backend options, e.g. '-device 12.1.0,12.4.0'.")
|
||||
|
||||
option(TPL_DSUPERLU_LIBRARIES "List of absolute paths to SuperLU_Dist link libraries [].")
|
||||
option(TPL_DSUPERLU_INCLUDE_DIRS "List of absolute paths to SuperLU_Dist include directories [].")
|
||||
@ -309,6 +311,12 @@ if (HYPRE_WITH_SYCL)
|
||||
# Set CXX compiler to dpcpp
|
||||
set(CMAKE_CXX_COMPILER "dpcpp")
|
||||
|
||||
# Set linker to dpcpp
|
||||
set(CMAKE_LINKER "dpcpp")
|
||||
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_LINKER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
|
||||
set(CMAKE_CXX_LINKER_WRAPPER_FLAG " ")
|
||||
set(CMAKE_CXX_LINKER_WRAPPER_FLAG_SEP " ")
|
||||
|
||||
# Add any extra CXX compiler flags HYPRE_WITH_EXTRA_CXXFLAGS
|
||||
if (NOT HYPRE_WITH_EXTRA_CXXFLAGS STREQUAL "")
|
||||
string(REPLACE " " ";" HYPRE_WITH_EXTRA_CXXFLAGS "${HYPRE_WITH_EXTRA_CXXFLAGS}")
|
||||
@ -335,6 +343,13 @@ if (HYPRE_WITH_SYCL)
|
||||
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:-fsycl-unnamed-lambda>")
|
||||
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:-fsycl-device-code-split=per_kernel>")
|
||||
|
||||
if (HYPRE_SYCL_TARGET)
|
||||
add_link_options("SHELL:-fsycl-targets=${HYPRE_SYCL_TARGET}")
|
||||
endif ()
|
||||
if (HYPRE_SYCL_TARGET_BACKEND)
|
||||
add_link_options("SHELL:-Xsycl-target-backend '${HYPRE_SYCL_TARGET_BACKEND}'")
|
||||
endif ()
|
||||
|
||||
set(HYPRE_USING_HOST_MEMORY OFF CACHE BOOL "" FORCE)
|
||||
|
||||
if (HYPRE_ENABLE_CUDA_STREAMS)
|
||||
@ -437,6 +452,7 @@ if (HYPRE_USING_CUDA)
|
||||
endif ()
|
||||
|
||||
if (HYPRE_USING_SYCL)
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC $ENV{DPLROOT}/include)
|
||||
if (HYPRE_ENABLE_ONEMKLSPARSE)
|
||||
set(HYPRE_USING_ONEMKLSPARSE ON CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
|
||||
@ -1235,7 +1235,6 @@ AS_HELP_STRING([--with-cuda],
|
||||
[hypre_using_cuda=no]
|
||||
)
|
||||
|
||||
|
||||
dnl ***** HIP
|
||||
AC_ARG_WITH(hip,
|
||||
AS_HELP_STRING([--with-hip],
|
||||
@ -1260,6 +1259,7 @@ esac],
|
||||
[hypre_using_sycl=no]
|
||||
)
|
||||
|
||||
dnl ***** CUDA options
|
||||
|
||||
AC_ARG_WITH(cuda-home,
|
||||
AS_HELP_STRING([--with-cuda-home=DIR],
|
||||
@ -1285,6 +1285,39 @@ AS_HELP_STRING([--with-gpu-arch=ARG],
|
||||
]
|
||||
)
|
||||
|
||||
dnl ***** SYCL options
|
||||
|
||||
AC_ARG_WITH(sycl-target,
|
||||
AS_HELP_STRING([--with-sycl-target=ARG],
|
||||
[User specifies sycl targets for AOT compilation in ARG, where ARG is a comma-separated
|
||||
list (enclosed in quotes), e.g. "spir64_gen".]),
|
||||
[
|
||||
if test "x${withval}" != "x"
|
||||
then
|
||||
if test "x${HYPRE_SYCL_TARGET}" = "x"
|
||||
then
|
||||
HYPRE_SYCL_TARGET="${withval}"
|
||||
fi
|
||||
fi
|
||||
]
|
||||
)
|
||||
|
||||
AC_ARG_WITH(sycl-target-backend,
|
||||
AS_HELP_STRING([--with-sycl-target-backend=ARG],
|
||||
[User specifies additional options for the sycl target backend for AOT compilation in ARG,
|
||||
where ARG contains the desired options (enclosed in double+single quotes),
|
||||
e.g. --with-sycl-target-backend="'-device 12.1.0,12.4.0'".]),
|
||||
[
|
||||
if test "x${withval}" != "x"
|
||||
then
|
||||
if test "x${HYPRE_SYCL_TARGET_BACKEND}" = "x"
|
||||
then
|
||||
HYPRE_SYCL_TARGET_BACKEND="${withval}"
|
||||
fi
|
||||
fi
|
||||
]
|
||||
)
|
||||
|
||||
dnl ***** RAJA
|
||||
|
||||
AC_ARG_WITH(raja,
|
||||
@ -2425,7 +2458,15 @@ AS_IF([test x"$hypre_using_sycl" == x"yes"],
|
||||
SYCLFLAGS="-g -O3 ${SYCLFLAGS}"
|
||||
fi
|
||||
|
||||
LDFLAGS+="-fsycl-targets=spir64_gen -Xsycl-target-backend '-device 12.1.0,12.4.0'"
|
||||
dnl AOT compilation for specific devices
|
||||
if test "x${HYPRE_SYCL_TARGET}" != "x"
|
||||
then
|
||||
LDFLAGS+=" -fsycl-targets=${HYPRE_SYCL_TARGET}"
|
||||
fi
|
||||
if test "x${HYPRE_SYCL_TARGET_BACKEND}" != "x"
|
||||
then
|
||||
LDFLAGS+=" -Xsycl-target-backend ${HYPRE_SYCL_TARGET_BACKEND}"
|
||||
fi
|
||||
|
||||
dnl (Ab)Use CUFLAGS to capture SYCL compilation flags
|
||||
if test "$hypre_user_chose_cuflags" = "no"
|
||||
|
||||
55
src/configure
vendored
55
src/configure
vendored
@ -842,6 +842,8 @@ with_hip
|
||||
with_sycl
|
||||
with_cuda_home
|
||||
with_gpu_arch
|
||||
with_sycl_target
|
||||
with_sycl_target_backend
|
||||
with_raja
|
||||
with_raja_include
|
||||
with_raja_lib
|
||||
@ -1662,6 +1664,16 @@ Optional Packages:
|
||||
files will be compiled for in ARG, where ARG is a
|
||||
space-separated list (enclosed in quotes) of
|
||||
numbers.
|
||||
--with-sycl-target=ARG User specifies sycl targets for AOT compilation in
|
||||
ARG, where ARG is a comma-separated list (enclosed
|
||||
in quotes), e.g. "spir64_gen".
|
||||
--with-sycl-target-backend=ARG
|
||||
User specifies additional options for the sycl
|
||||
target backend for AOT compilation in ARG, where ARG
|
||||
contains the desired options (enclosed in
|
||||
double+single quotes), e.g.
|
||||
--with-sycl-target-backend="'-device
|
||||
12.1.0,12.4.0'".
|
||||
--with-raja Use RAJA. Require RAJA package to be compiled
|
||||
properly (default is NO).
|
||||
--with-raja-include=DIR User specifies that RAJA/*.h is in DIR. The options
|
||||
@ -4099,7 +4111,6 @@ fi
|
||||
|
||||
|
||||
|
||||
|
||||
# Check whether --with-hip was given.
|
||||
if test "${with_hip+set}" = set; then :
|
||||
withval=$with_hip; case "$withval" in
|
||||
@ -4157,6 +4168,39 @@ fi
|
||||
|
||||
|
||||
|
||||
# Check whether --with-sycl-target was given.
|
||||
if test "${with_sycl_target+set}" = set; then :
|
||||
withval=$with_sycl_target;
|
||||
if test "x${withval}" != "x"
|
||||
then
|
||||
if test "x${HYPRE_SYCL_TARGET}" = "x"
|
||||
then
|
||||
HYPRE_SYCL_TARGET="${withval}"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# Check whether --with-sycl-target-backend was given.
|
||||
if test "${with_sycl_target_backend+set}" = set; then :
|
||||
withval=$with_sycl_target_backend;
|
||||
if test "x${withval}" != "x"
|
||||
then
|
||||
if test "x${HYPRE_SYCL_TARGET_BACKEND}" = "x"
|
||||
then
|
||||
HYPRE_SYCL_TARGET_BACKEND="${withval}"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
# Check whether --with-raja was given.
|
||||
if test "${with_raja+set}" = set; then :
|
||||
withval=$with_raja; case "$withval" in
|
||||
@ -9347,7 +9391,14 @@ $as_echo "#define HYPRE_USING_SYCL 1" >>confdefs.h
|
||||
SYCLFLAGS="-g -O3 ${SYCLFLAGS}"
|
||||
fi
|
||||
|
||||
LDFLAGS+="-fsycl-targets=spir64_gen -Xsycl-target-backend '-device 12.1.0,12.4.0'"
|
||||
if test "x${HYPRE_SYCL_TARGET}" != "x"
|
||||
then
|
||||
LDFLAGS+=" -fsycl-targets=${HYPRE_SYCL_TARGET}"
|
||||
fi
|
||||
if test "x${HYPRE_SYCL_TARGET_BACKEND}" != "x"
|
||||
then
|
||||
LDFLAGS+=" -Xsycl-target-backend ${HYPRE_SYCL_TARGET_BACKEND}"
|
||||
fi
|
||||
|
||||
if test "$hypre_user_chose_cuflags" = "no"
|
||||
then
|
||||
|
||||
Loading…
Reference in New Issue
Block a user