memory: add cuda 13 support
In the latest cuda driver API (13.0), cuCtxCreate takes another
parameter CUctxCreateParams.
Fixes: #1988
Signed-off-by: Maxime Peim <maxime.peim@gmail.com>
diff --git a/configure b/configure
index 3209e22..43e20ca 100755
--- a/configure
+++ b/configure
@@ -180,6 +180,7 @@
devdax="no"
pmem="no"
cuda="no"
+cuda13="no"
libcufile="no"
disable_lex=""
disable_pmem="no"
@@ -2811,6 +2812,26 @@
print_config "libcufile" "$libcufile"
##########################################
+# cuda 13 probe
+if test "$cuda" != "no" || test "$libcufile" != "no"; then
+cat > $TMPC << EOF
+#include <cuda.h>
+
+int main(int argc, char **argv)
+{
+ cuCtxCreate(NULL, NULL, 0, NULL);
+ return 0;
+}
+EOF
+ if compile_prog "" "-lcuda" "cuda13"; then
+ cuda13="yes"
+ else
+ cuda13="no"
+ fi
+ print_config "cuda>=13" "$cuda13"
+fi
+
+##########################################
# check for cc -march=native
build_native="no"
cat > $TMPC << EOF
@@ -3305,6 +3326,9 @@
if test "$libcufile" = "yes" ; then
output_sym "CONFIG_LIBCUFILE"
fi
+if test "$cuda13" = "yes" ; then
+ output_sym "CONFIG_CUDA13"
+fi
if test "$dfs" = "yes" ; then
output_sym "CONFIG_DFS"
fi
diff --git a/memory.c b/memory.c
index 2fdca65..66b5362 100644
--- a/memory.c
+++ b/memory.c
@@ -215,6 +215,9 @@
#ifdef CONFIG_CUDA
CUresult ret;
char name[128];
+#ifdef CONFIG_CUDA13
+ CUctxCreateParams ctx_params = {};
+#endif
ret = cuInit(0);
if (ret != CUDA_SUCCESS) {
@@ -250,7 +253,11 @@
dprint(FD_MEM, "dev_id = [%d], device name = [%s]\n", \
td->gpu_dev_id, name);
- ret = cuCtxCreate(&td->cu_ctx, CU_CTX_MAP_HOST, td->cu_dev);
+#ifdef CONFIG_CUDA13
+ ret = cuCtxCreate(&td->cu_ctx, &ctx_params, CU_CTX_MAP_HOST, td->cu_dev);
+#else
+ ret = cuCtxCreate(&td->cu_ctx CU_CTX_MAP_HOST, td->cu_dev);
+#endif
if (ret != CUDA_SUCCESS) {
log_err("fio: failed to create cuda context: %d\n", ret);
return 1;