Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose epsilon parameter to allow precision to to be specified #275

Merged
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
specify epsilon different for integer and floating types
  • Loading branch information
ChuckHastings committed Jun 15, 2021
commit b2961b44a49b2056abf83f8b7815ea5913c7d4ab
17 changes: 9 additions & 8 deletions cpp/test/lap/lap.cu
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ void generateProblem(weight_t *cost_matrix, int SP, int N, int costrange) {

template <typename vertex_t, typename weight_t>
void hungarian_test(int problemsize, int costrange, int problemcount,
int repetitions, int batchsize, bool verbose = false) {
int repetitions, int batchsize, weight_t epsilon,
bool verbose = false) {
raft::handle_t handle;

weight_t *h_cost = new weight_t[batchsize * problemsize * problemsize];
Expand All @@ -83,7 +84,7 @@ void hungarian_test(int problemsize, int costrange, int problemcount,

// Create an instance of LinearAssignmentProblem using problem size, number of subproblems
raft::lap::LinearAssignmentProblem<vertex_t, weight_t> lpx(
handle, problemsize, batchsize, weight_t{0});
handle, problemsize, batchsize, epsilon);

// Solve LAP(s) for given cost matrix
lpx.solve(elements_v.data(), row_assignment_v.data(),
Expand All @@ -110,32 +111,32 @@ void hungarian_test(int problemsize, int costrange, int problemcount,

TEST(Raft, HungarianIntFloat) {
hungarian_test<int, float>(PROBLEMSIZE, COSTRANGE, PROBLEMCOUNT, REPETITIONS,
BATCHSIZE);
BATCHSIZE, float{1e-6});
}

TEST(Raft, HungarianIntDouble) {
hungarian_test<int, double>(PROBLEMSIZE, COSTRANGE, PROBLEMCOUNT, REPETITIONS,
BATCHSIZE);
BATCHSIZE, double{1e-6});
}

TEST(Raft, HungarianIntLong) {
hungarian_test<int, long>(PROBLEMSIZE, COSTRANGE, PROBLEMCOUNT, REPETITIONS,
BATCHSIZE);
BATCHSIZE, long{0});
}

TEST(Raft, HungarianLongFloat) {
hungarian_test<long, float>(PROBLEMSIZE, COSTRANGE, PROBLEMCOUNT, REPETITIONS,
BATCHSIZE);
BATCHSIZE, float{1e-6});
}

TEST(Raft, HungarianLongDouble) {
hungarian_test<long, double>(PROBLEMSIZE, COSTRANGE, PROBLEMCOUNT,
REPETITIONS, BATCHSIZE);
REPETITIONS, BATCHSIZE, double{1e-6});
}

TEST(Raft, HungarianLongLong) {
hungarian_test<long, long>(PROBLEMSIZE, COSTRANGE, PROBLEMCOUNT, REPETITIONS,
BATCHSIZE);
BATCHSIZE, long{0});
}

} // namespace raft