Skip to content

Commit

Permalink
Merge pull request #50 from cacao-org/vd/cmakecudaclean
Browse files Browse the repository at this point in the history
Build system: clean CUDA
  • Loading branch information
DasVinch authored Dec 11, 2024
2 parents f8871bd + 51efe5a commit ff521c4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 22 deletions.
8 changes: 4 additions & 4 deletions computeCalib/AOloopControl_computeCalib_processRM.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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];
Expand Down
35 changes: 17 additions & 18 deletions computeCalib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit ff521c4

Please sign in to comment.