diff --git a/computeCalib/AOloopControl_computeCalib_processRM.c b/computeCalib/AOloopControl_computeCalib_processRM.c index 361d3bd8..b991924c 100644 --- a/computeCalib/AOloopControl_computeCalib_processRM.c +++ b/computeCalib/AOloopControl_computeCalib_processRM.c @@ -792,7 +792,7 @@ errno_t AOloopControl_computeCalib_mkCM_RUN() char cm_name[] = "sCMat"; -#ifdef HAVE_CUDA +#ifdef HAVE_MAGMA if(GPUmode) { LINALGEBRA_magma_compute_SVDpseudoInverse("respM", @@ -808,16 +808,16 @@ errno_t AOloopControl_computeCalib_mkCM_RUN() } else { -#endif +#endif // HAVE_MAGMA linopt_compute_SVDpseudoInverse("respM", cm_name, SVDlim, 10000, "VTmat", NULL); -#ifdef HAVE_CUDA +#ifdef HAVE_MAGMA } -#endif +#endif // HAVE_MAGMA { char ffname[STRINGMAXLEN_FULLFILENAME]; diff --git a/computeCalib/CMakeLists.txt b/computeCalib/CMakeLists.txt index e908d4b8..40804941 100644 --- a/computeCalib/CMakeLists.txt +++ b/computeCalib/CMakeLists.txt @@ -67,24 +67,23 @@ endif() if(USE_CUDA) -find_package(CUDA 9.0 REQUIRED) -message(STATUS "Found CUDA ${CUDA_VERSION_STRING} at ${CUDA_TOOLKIT_ROOT_DIR}") -message("---- CUDA_INCLUDE_DIRS = ${CUDA_INCLUDE_DIRS}") -message("---- CUDA_LIBRARIES = ${CUDA_LIBRARIES}" ) -target_compile_options(${LIBNAME} PUBLIC -DHAVE_CUDA) -target_link_libraries(${LIBNAME} PUBLIC ${CUDA_LIBRARIES} ${CUDA_CUBLAS_LIBRARIES}) - -if(USE_MAGMA) -find_package(PkgConfig REQUIRED) -pkg_check_modules(MAGMA REQUIRED magma) -message("---- MAGMA_LIBRARY_DIRS = ${MAGMA_LIBRARY_DIRS}") -message("---- MAGMA_LIBRARIES = ${MAGMA_LIBRARIES}" ) -message("---- MAGMA_CFLAGS_OTHER = ${MAGMA_CFLAGS_OTHER}" ) -target_include_directories(${LIBNAME} PUBLIC ${MAGMA_INCLUDE_DIRS}) -target_link_directories(${LIBNAME} PUBLIC ${MAGMA_LIBRARY_DIRS}) -target_link_libraries(${LIBNAME} PUBLIC ${MAGMA_LIBRARIES}) -target_compile_options(${LIBNAME} PUBLIC -DHAVE_MAGMA ${MAGMA_CFLAGS_OTHER}) -endif(USE_MAGMA) + find_package(CUDAToolkit) + message(STATUS "Found CUDA ${CUDAToolkit_VERSION} at ${CUDAToolkit_LIBRARY_DIR}") + message("---- CUDA_INCLUDE_DIRS = ${CUDAToolkit_INCLUDE_DIRS}") + target_compile_options(${LIBNAME} PUBLIC -DHAVE_CUDA) + target_link_libraries(${LIBNAME} PRIVATE CUDA::cublas) + + if(USE_MAGMA) + find_package(PkgConfig REQUIRED) + pkg_check_modules(MAGMA REQUIRED magma) + message("---- MAGMA_LIBRARY_DIRS = ${MAGMA_LIBRARY_DIRS}") + message("---- MAGMA_LIBRARIES = ${MAGMA_LIBRARIES}" ) + message("---- MAGMA_CFLAGS_OTHER = ${MAGMA_CFLAGS_OTHER}" ) + target_include_directories(${LIBNAME} PUBLIC ${MAGMA_INCLUDE_DIRS}) + target_link_directories(${LIBNAME} PUBLIC ${MAGMA_LIBRARY_DIRS}) + target_link_libraries(${LIBNAME} PUBLIC ${MAGMA_LIBRARIES}) + target_compile_options(${LIBNAME} PUBLIC -DHAVE_MAGMA ${MAGMA_CFLAGS_OTHER}) + endif(USE_MAGMA) endif(USE_CUDA)