Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ if(${MATLAB})
endif()

set_property(GLOBAL APPEND PROPERTY QOCO_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/qoco_api.c"
${CMAKE_CURRENT_SOURCE_DIR}/src/qoco_batch.c
${CMAKE_CURRENT_SOURCE_DIR}/src/input_validation.c
${CMAKE_CURRENT_SOURCE_DIR}/src/common_linalg.c
${CMAKE_CURRENT_SOURCE_DIR}/src/kkt.c
Expand All @@ -118,6 +119,7 @@ set_property(GLOBAL APPEND PROPERTY QOCO_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/sr

set_property(GLOBAL APPEND PROPERTY QOCO_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/include/qoco.h"
${CMAKE_CURRENT_SOURCE_DIR}/include/qoco_api.h
${CMAKE_CURRENT_SOURCE_DIR}/include/qoco_batch.h
${CMAKE_CURRENT_SOURCE_DIR}/include/input_validation.h
${CMAKE_CURRENT_SOURCE_DIR}/include/qoco_linalg.h
${CMAKE_CURRENT_SOURCE_DIR}/include/kkt.h
Expand Down Expand Up @@ -190,6 +192,11 @@ if(IS_LINUX OR IS_MACOS)
endif()

target_include_directories(qoco PUBLIC ${qoco_include})
if(${QOCO_ALGEBRA_BACKEND} STREQUAL "cuda")
target_compile_definitions(qoco PUBLIC QOCO_ALGEBRA_BACKEND_CUDA)
else()
target_compile_definitions(qoco PUBLIC QOCO_ALGEBRA_BACKEND_BUILTIN)
endif()
target_sources(qoco PRIVATE ${qoco_sources})

# Build qoco static library.
Expand All @@ -205,6 +212,11 @@ if(IS_LINUX OR IS_MACOS)
endif()

target_include_directories(qocostatic PUBLIC ${qoco_include})
if(${QOCO_ALGEBRA_BACKEND} STREQUAL "cuda")
target_compile_definitions(qocostatic PUBLIC QOCO_ALGEBRA_BACKEND_CUDA)
else()
target_compile_definitions(qocostatic PUBLIC QOCO_ALGEBRA_BACKEND_BUILTIN)
endif()
target_sources(qocostatic PRIVATE ${qoco_sources})

# Build qoco demo.
Expand Down Expand Up @@ -251,4 +263,4 @@ install(
)
install(FILES ${qoco_headers}
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/qoco"
)
)
22 changes: 13 additions & 9 deletions algebra/cuda/cuda_linalg.cu
Original file line number Diff line number Diff line change
Expand Up @@ -352,15 +352,19 @@ void sync_vector_to_device(QOCOVectorf* v)
void sync_matrix_to_device(QOCOMatrix* M)
{
if (M->csc && M->d_csc) {
CUDA_CHECK(cudaMemcpy(M->d_csc_host->x, M->csc->x,
M->csc->nnz * sizeof(QOCOFloat),
cudaMemcpyHostToDevice));
CUDA_CHECK(cudaMemcpy(M->d_csc_host->i, M->csc->i,
M->csc->nnz * sizeof(QOCOInt),
cudaMemcpyHostToDevice));
CUDA_CHECK(cudaMemcpy(M->d_csc_host->p, M->csc->p,
(M->csc->n + 1) * sizeof(QOCOInt),
cudaMemcpyHostToDevice));
if (M->csc->nnz > 0) {
CUDA_CHECK(cudaMemcpy(M->d_csc_host->x, M->csc->x,
M->csc->nnz * sizeof(QOCOFloat),
cudaMemcpyHostToDevice));
CUDA_CHECK(cudaMemcpy(M->d_csc_host->i, M->csc->i,
M->csc->nnz * sizeof(QOCOInt),
cudaMemcpyHostToDevice));
}
if (M->csc->p && M->d_csc_host->p) {
CUDA_CHECK(cudaMemcpy(M->d_csc_host->p, M->csc->p,
(M->csc->n + 1) * sizeof(QOCOInt),
cudaMemcpyHostToDevice));
}
}
}

Expand Down
Loading
Loading