Skip to content

Commit

Permalink
Port in-house Simplex to GPU
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquev6 committed Oct 9, 2024
1 parent 621c138 commit 099ddca
Show file tree
Hide file tree
Showing 7 changed files with 744 additions and 4 deletions.
2 changes: 1 addition & 1 deletion development/cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def run_cpp_tests(*, python_version, skip_long, skip_wpb, skip_wpb_glop, skip_wp
env = dict(os.environ)
env["LD_LIBRARY_PATH"] = "."
command = [
# "gdb", "--eval-command=run", "--eval-command=quit",
# "gdb", "--eval-command=run " + ' '.join(doctest_options), "--eval-command=quit",
"/tmp/lincs-tests",
]
if skip_wpb:
Expand Down
2 changes: 2 additions & 0 deletions lincs/liblincs/learning.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "learning/ucncs-by-sat-by-separation.hpp"
#include "linear-programming/alglib.hpp"
#include "linear-programming/custom-on-cpu.hpp"
#include "linear-programming/custom-on-gpu.hpp"
#include "linear-programming/glop.hpp"
#include "sat/eval-max-sat.hpp"
#include "sat/minisat.hpp"
Expand All @@ -31,6 +32,7 @@ namespace lincs {
typedef MaxSatSeparationUcncsLearning<EvalmaxsatMaxSatProblem> LearnUcncsByMaxSatBySeparationUsingEvalmaxsat;
typedef OptimizeWeightsUsingLinearProgram<AlglibLinearProgram> OptimizeWeightsUsingAlglib;
typedef OptimizeWeightsUsingLinearProgram<CustomOnCpuLinearProgram> OptimizeWeightsUsingCustomOnCpu;
typedef OptimizeWeightsUsingLinearProgram<CustomOnGpuLinearProgram> OptimizeWeightsUsingCustomOnGpu;
typedef OptimizeWeightsUsingLinearProgram<GlopLinearProgram> OptimizeWeightsUsingGlop;
typedef SatCoalitionsUcncsLearning<MinisatSatProblem> LearnUcncsBySatByCoalitionsUsingMinisat;
typedef SatSeparationUcncsLearning<MinisatSatProblem> LearnUcncsBySatBySeparationUsingMinisat;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "../../../chrones.hpp"
#include "../../../linear-programming/alglib.hpp"
#include "../../../linear-programming/custom-on-cpu.hpp"
#include "../../../linear-programming/custom-on-gpu.hpp"
#include "../../../linear-programming/glop.hpp"


Expand Down Expand Up @@ -97,6 +98,7 @@ void OptimizeWeightsUsingLinearProgram<LinearProgram>::optimize_model_weights(un

template class OptimizeWeightsUsingLinearProgram<GlopLinearProgram>;
template class OptimizeWeightsUsingLinearProgram<CustomOnCpuLinearProgram>;
template class OptimizeWeightsUsingLinearProgram<CustomOnGpuLinearProgram>;
template class OptimizeWeightsUsingLinearProgram<AlglibLinearProgram>;

} // namespace lincs
8 changes: 6 additions & 2 deletions lincs/liblincs/linear-programming/custom-on-cpu.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright 2024 Vincent Jacques

#include "custom-on-cpu.hpp"

#include <cassert>
#include <cmath>
#include <ctime>
#include <filesystem>
#include <fstream>
Expand All @@ -13,7 +16,6 @@

#include <boost/format.hpp>

#include "custom-on-cpu.hpp"
#include "../vendored/lov-e.hpp"

#include "../vendored/doctest.h" // Keep last because it defines really common names like CHECK that we don't want injected into other headers
Expand Down Expand Up @@ -137,6 +139,7 @@ CustomOnCpuVerbose::~CustomOnCpuVerbose() {
verbosity = 0;
}

namespace {

struct Tableau {
const unsigned client_variables_count;
Expand All @@ -161,7 +164,6 @@ struct Tableau {
}
};


class Simplex {
public:
Simplex(Tableau& tableau) :
Expand Down Expand Up @@ -809,6 +811,8 @@ class CustomOnCpuLinearProgramSolver {
const CustomOnCpuLinearProgram& program;
};

} // namespace

std::optional<CustomOnCpuLinearProgram::solution_type> CustomOnCpuLinearProgram::solve() {
const auto solution = CustomOnCpuLinearProgramSolver(*this).solve();
#ifndef NDEBUG
Expand Down
Loading

0 comments on commit 099ddca

Please sign in to comment.