I need to modify linux rdma-core driver and add some cuda-related functions; firstly, cuMemAlloc
.
I have changed the CMake file in the driver to include the cuda.h
header file. But when I compile the driver, I get undefined reference to
error
In the CMakeLists.txt file, I have included
project(rdma-core LANGUAGES CUDA C CXX)
FIND_PACKAGE(CUDA 12.2 REQUIRED)
and -I/usr/local/cuda-12.2/include -lcuda
to
RDMA_AddOptCFlag(CMAKE_C_FLAGS HAVE_C_WARNINGS
"-Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -I/usr/local/cuda-12.2/include -lcuda")
Although cuda.h is successfully found, I get the following compilation error:
/usr/bin/ld: CMakeFiles/mlx5.dir/verbs.c.o: in function `mlx5_alloc_dyn_uar':
/home/nurlan/rdma-core/providers/mlx5/verbs.c:235: undefined reference to `cuMemAlloc_v2'
/usr/bin/ld: /home/nurlan/rdma-core/providers/mlx5/verbs.c:235: undefined reference to `cuMemAlloc_v2'
/usr/bin/ld: CMakeFiles/mlx5.dir/verbs.c.o: in function `mlx5_alloc_pd':
/home/nurlan/rdma-core/providers/mlx5/verbs.c:153: undefined reference to `cuMemAlloc_v2'
collect2: error: ld returned 1 exit status
make[2]: *** [providers/mlx5/CMakeFiles/mlx5.dir/build.make:501: lib/libmlx5.so.1.24.48.0] Error 1
make[1]: *** [CMakeFiles/Makefile2:1560: providers/mlx5/CMakeFiles/mlx5.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
Anyone encountering similar problem before or knowing the solution to this problem?