-
Notifications
You must be signed in to change notification settings - Fork 3
/
gpu_impl.hpp
58 lines (40 loc) · 1.99 KB
/
gpu_impl.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef IMLP__GPU_IMPL_H
#define IMLP__GPU_IMPL_H
// #include <datastructures/problem.hpp>
#include <datastructures/tableau.hpp>
#include <impl/impl_common.hpp>
#include <util/primitive_structures.hpp>
#include <cuda_runtime.h>
namespace simplex {
namespace gpu {
template<typename FloatType>
struct ThetaValuesAndEnteringColumn {
util::PointerAndSize<FloatType> theta_values;
util::PointerAndSize<FloatType> entering_column;
ThetaValuesAndEnteringColumn(std::ptrdiff_t height)
: theta_values(NULL, height)
, entering_column(NULL, height)
{
cudaMalloc(&theta_values.data(), static_cast<std::size_t>(theta_values.data_size()));
cudaMalloc(&entering_column.data(), static_cast<std::size_t>(entering_column.data_size()));
}
// ThetaValuesAndEnteringColumn(const ThetaValuesAndEnteringColumn&) = default;
// ThetaValuesAndEnteringColumn(ThetaValuesAndEnteringColumn&&) = default;
};
// Tableau<double> create_tableau(const Problem& problem_stmt);
// find smallest also negative value in the first row
// boost::optional<VariableIndex> find_entering_variable(const Tableau<double>& tab);
struct ProblemContraints {
std::ptrdiff_t height_modulus;
std::ptrdiff_t width_modulus;
};
ptrdiff_t find_entering_variable(const util::PointerAndSize<double>& first_row);
ThetaValuesAndEnteringColumn<double> get_theta_values_and_entering_column(const Tableau<double>& tab, VariableIndex entering);
ptrdiff_t find_leaving_variable(const ThetaValuesAndEnteringColumn<double>& tvals_and_centering);
void update_leaving_row(Tableau<double>& tab, const util::PointerAndSize<double>& entering_column, VariablePair leaving_and_entering);
void update_rest_of_basis(Tableau<double>& tab, const util::PointerAndSize<double>& entering_column, VariableIndex leaving);
void update_entering_column(Tableau<double>& tab, const util::PointerAndSize<double>& entering_column, VariablePair leaving_and_entering);
ProblemContraints problem_constraints();
} // end namespace simplex
} // end namespace gpu
#endif /* IMLP__GPU_IMPL_H */