Skip to content

Commit

Permalink
Merge pull request #377 from oddkiva/maint-refactor-ba
Browse files Browse the repository at this point in the history
ENH: add basic bundle adjuster class.
  • Loading branch information
oddkiva authored May 23, 2024
2 parents 7422172 + 0157d2b commit 393d0aa
Show file tree
Hide file tree
Showing 9 changed files with 471 additions and 386 deletions.
15 changes: 9 additions & 6 deletions cpp/drafts/Compute/CLBlast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
#pragma once

#include <DO/Sara/Core/DebugUtilities.hpp>
#include <DO/Sara/Core/StringFormat.hpp>
#include <DO/Sara/Core/Tensor.hpp>
#include <DO/Sara/Core/Timer.hpp>

#include <fmt/format.h>

#if defined(__APPLE__) || defined(__MACOSX)
# include <OpenCL/cl.hpp>
#else
Expand Down Expand Up @@ -115,13 +116,14 @@ namespace DO::Sara {

if (status != clblast::StatusCode::kSuccess)
throw std::runtime_error{
format("Batched GEMM operation failed! Status code = %d", status)};
fmt::format("Batched GEMM operation failed! Status code = {}",
static_cast<int>(status))};

clWaitForEvents(1, &event);
clReleaseEvent(event);
}
const auto elapsed_time = timer.elapsed_ms();
SARA_DEBUG << format("Completed batched SGEMM in %.3lf ms", elapsed_time)
SARA_DEBUG << fmt::format("Completed batched SGEMM in {} ms", elapsed_time)
<< std::endl;

{
Expand All @@ -130,9 +132,10 @@ namespace DO::Sara {
/* offset */ 0, C.size() * sizeof(float), C.data());

if (status)
throw std::runtime_error{format("Error: Failed to read buffer from "
"device to host! Status code = %d",
status)};
throw std::runtime_error{
fmt::format("Error: Failed to read buffer from device to host! "
"Status code = {}",
status)};
}
}

Expand Down
7 changes: 3 additions & 4 deletions cpp/examples/Sara/MultiViewGeometry/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ target_link_libraries(

# Bundle adjustment.
sara_add_example(two_view_bundle_adjustment_example)
target_include_directories(two_view_bundle_adjustment_example
PRIVATE ${CERES_INCLUDE_DIRS})
target_link_libraries(two_view_bundle_adjustment_example
PRIVATE ${CERES_LIBRARIES})
target_link_libraries(
two_view_bundle_adjustment_example #
PRIVATE DO::Sara::SfM)
Loading

0 comments on commit 393d0aa

Please sign in to comment.