From d4454c1ce5d8c834a8d268c3f5ee3ae70f5e4fe3 Mon Sep 17 00:00:00 2001 From: ahmed Date: Thu, 5 Sep 2024 20:55:00 -0400 Subject: [PATCH] timing mcf --- apps/MCF/mcf.cu | 6 ++- apps/MCF/mcf_cusolver_chol.cuh | 90 +++++++++++++++++++++++++++++++--- 2 files changed, 88 insertions(+), 8 deletions(-) diff --git a/apps/MCF/mcf.cu b/apps/MCF/mcf.cu index d0f2e978..bfd852ed 100644 --- a/apps/MCF/mcf.cu +++ b/apps/MCF/mcf.cu @@ -40,11 +40,13 @@ TEST(App, MCF) RXMeshStatic rx(Arg.obj_file_name); + ASSERT_TRUE(rx.is_edge_manifold()); + // RXMesh Impl - mcf_cg(rx); + //mcf_cg(rx); // RXMesh cusolver Impl - mcf_cusolver_chol(rx, PermuteMethod::NSTDIS); + mcf_cusolver_chol(rx, PermuteMethod::GPUND); } int main(int argc, char** argv) diff --git a/apps/MCF/mcf_cusolver_chol.cuh b/apps/MCF/mcf_cusolver_chol.cuh index 053f2b2d..a5e075ac 100644 --- a/apps/MCF/mcf_cusolver_chol.cuh +++ b/apps/MCF/mcf_cusolver_chol.cuh @@ -186,18 +186,93 @@ void mcf_cusolver_chol(rxmesh::RXMeshStatic& rx, // A_mat.move(DEVICE, HOST); // B_mat.move(DEVICE, HOST); // X_mat->move(DEVICE, HOST); - // A_mat.solve(B_mat, *X_mat, Solver::LU, PermuteMethod::NSTDIS); + // A_mat.solve(B_mat, *X_mat, Solver::LU, permute_method); // Solving using QR or CHOL - // A_mat.solve(B_mat, *X_mat, Solver::QR, PermuteMethod::NSTDIS); - // A_mat.solve(B_mat, *X_mat, Solver::CHOL, PermuteMethod::NSTDIS); - - // pre-solve - A_mat.pre_solve(rx, Solver::CHOL, permute_method); + // A_mat.solve(B_mat, *X_mat, Solver::QR, permute_method); + // A_mat.solve(B_mat, *X_mat, Solver::CHOL, permute_method); + // pre-solve + //A_mat.pre_solve(rx, Solver::CHOL, permute_method); // Solve + //A_mat.solve(B_mat, *X_mat); + + Report report("MCF_Chol"); + report.command_line(Arg.argc, Arg.argv); + report.device(); + report.system(); + report.model_data(Arg.obj_file_name, rx); + report.add_member("method", std::string("RXMesh")); + report.add_member("blockThreads", blockThreads); + + CPUTimer timer; + GPUTimer gtimer; + + timer.start(); + gtimer.start(); + A_mat.permute_alloc(permute_method); + timer.stop(); + gtimer.stop(); + RXMESH_INFO("permute_alloc took {} (ms), {} (ms)", + timer.elapsed_millis(), + gtimer.elapsed_millis()); + report.add_member("permute_alloc", timer.elapsed_millis()); + + timer.start(); + gtimer.start(); + A_mat.permute(rx, permute_method); + timer.stop(); + gtimer.stop(); + RXMESH_INFO("permute took {} (ms), {} (ms)", + timer.elapsed_millis(), + gtimer.elapsed_millis()); + report.add_member("permute", timer.elapsed_millis()); + + + timer.start(); + gtimer.start(); + A_mat.analyze_pattern(Solver::CHOL); + timer.stop(); + gtimer.stop(); + RXMESH_INFO("analyze_pattern took {} (ms), {} (ms)", + timer.elapsed_millis(), + gtimer.elapsed_millis()); + report.add_member("analyze_pattern", timer.elapsed_millis()); + + + timer.start(); + gtimer.start(); + A_mat.post_analyze_alloc(Solver::CHOL); + timer.stop(); + gtimer.stop(); + RXMESH_INFO("post_analyze_alloc took {} (ms), {} (ms)", + timer.elapsed_millis(), + gtimer.elapsed_millis()); + report.add_member("post_analyze_alloc", timer.elapsed_millis()); + + + timer.start(); + gtimer.start(); + A_mat.factorize(Solver::CHOL); + timer.stop(); + gtimer.stop(); + RXMESH_INFO("factorize took {} (ms), {} (ms)", + timer.elapsed_millis(), + gtimer.elapsed_millis()); + report.add_member("factorize", timer.elapsed_millis()); + + + timer.start(); + gtimer.start(); A_mat.solve(B_mat, *X_mat); + timer.stop(); + gtimer.stop(); + RXMESH_INFO("solve took {} (ms), {} (ms)", + timer.elapsed_millis(), + gtimer.elapsed_millis()); + report.add_member("solve", timer.elapsed_millis()); + // move the results to the host // if we use LU, the data will be on the host and we should not move the @@ -215,4 +290,7 @@ void mcf_cusolver_chol(rxmesh::RXMeshStatic& rx, B_mat.release(); X_mat->release(); A_mat.release(); + + report.write(Arg.output_folder + "/rxmesh", + "MCF_SpMat_" + extract_file_name(Arg.obj_file_name)); } \ No newline at end of file