diff --git a/russell_sparse/data/results/solve-matrix-market-umfpack-bfwb62.json b/russell_sparse/data/results/solve-matrix-market-umfpack-bfwb62.json index 79335a66..3991be25 100644 --- a/russell_sparse/data/results/solve-matrix-market-umfpack-bfwb62.json +++ b/russell_sparse/data/results/solve-matrix-market-umfpack-bfwb62.json @@ -1,42 +1,27 @@ { - "platform": "russell", - "blasLib": "OpenBLAS", - "matrixName": "bfwb62", - "read": { - "timeReadNs": 37275, - "timeReadStr": "37.275µs" - }, - "triplet": { - "neq": 62, - "nnz_current": 342, - "nnz_maximum": 404, - - }, - "symmetry": "Some(General)" - "solver": { - "name": "UMF", - "ordering": "Auto", - "scaling": "Auto", - "pctIncWorkspace": 100, - "maxWorkMemory": 0, - "openmpNumThreads": 1 - "usedOrdering": "Amd", - "usedScaling": "Sum", - "doneFactorize": true, - "nrow": 62, - "timeFactNs": 176349, - "timeSolveNs": 7712, - "timeTotalNs": 184061, - "timeFactStr": "176.349µs", - "timeSolveStr": "7.712µs", - "timeTotalStr": "184.061µs" - }, - "verify": { - "maxAbsA": 0.0001, - "maxAbsAx": 1.0000000000000004, - "maxAbsDiff": 4.440892098500626e-16, - "relativeError": 4.4404480536952566e-16, - "timeCheckNs": 1322, - "timeCheckStr": "1.322µs" - } + "platform": "Russell", + "blas_lib": "OpenBLAS", + "matrix_name": "bfwb62", + "symmetry": "General", + "layout": "Full", + "nrow": 62, + "ncol": 62, + "nnz": 342, + "time_read_matrix_market_nanosecond": 40524, + "time_read_matrix_market_human": "40.524µs", + "time_factorize_nanosecond": 183818, + "time_factorize_human": "183.818µs", + "time_solve_nanosecond": 6198, + "time_solve_human": "6.198µs", + "requested_ordering": "Auto", + "requested_scaling": "Auto", + "requested_openmp_num_threads": 1, + "effective_ordering": "Amd", + "effective_scaling": "Sum", + "effective_openmp_num_threads": 32, + "verify_max_abs_a": 0.0001, + "verify_max_abs_a_times_x": 1.0000000000000004, + "verify_relative_error": 4.4404480536952566e-16, + "verify_time_nanosecond": 1144, + "verify_time_human": "1.144µs" } diff --git a/russell_sparse/src/bin/solve_matrix_market_build.rs b/russell_sparse/src/bin/solve_matrix_market_build.rs index 556d4a1c..9953260e 100644 --- a/russell_sparse/src/bin/solve_matrix_market_build.rs +++ b/russell_sparse/src/bin/solve_matrix_market_build.rs @@ -1,6 +1,7 @@ use russell_lab::{format_nanoseconds, Stopwatch, StrError, Vector}; -use russell_openblas::set_num_threads; +use russell_openblas::{get_num_threads, set_num_threads}; use russell_sparse::prelude::*; +use serde_json; use std::path::Path; use structopt::StructOpt; @@ -97,39 +98,45 @@ fn main() -> Result<(), StrError> { // matrix name let path = Path::new(&opt.matrix_market_file); - let matrix_name = path.file_stem().unwrap().to_str().unwrap(); + let matrix_name = match path.file_stem() { + Some(v) => match v.to_str() { + Some(w) => w.to_string(), + None => "Unknown".to_string(), + }, + None => "Unknown".to_string(), + }; // output - println!( - "{{\n\ - \x20\x20\"platform\": \"russell\",\n\ - \x20\x20\"blasLib\": \"OpenBLAS\",\n\ - \x20\x20\"matrixName\": \"{}\",\n\ - \x20\x20\"read\": {{\n\ - \x20\x20\x20\x20\"timeReadNs\": {},\n\ - \x20\x20\x20\x20\"timeReadStr\": \"{}\"\n\ - \x20\x20}},\n\ - \x20\x20\"triplet\": {{\n\ - {}\n\ - \x20\x20}},\n\ - \x20\x20\"symmetry\": \"{:?}\"\n\ - \x20\x20\"solver\": {{\n\ - {}\n\ - {}\n\ - \x20\x20}},\n\ - \x20\x20\"verify\": {{\n\ - {}\n\ - \x20\x20}}\n\ - }}", + let (time_fact, time_solve) = solver.get_elapsed_times(); + let info = SolutionInfo { + platform: "Russell".to_string(), + blas_lib: "OpenBLAS".to_string(), matrix_name, - time_read, - format_nanoseconds(time_read), - coo, - symmetry, - config, - solver, - verify - ); + symmetry: if sym { "General".to_string() } else { "None".to_string() }, + layout: format!("{:?}", coo.layout), + nrow: coo.nrow, + ncol: coo.ncol, + nnz: coo.pos, + time_read_matrix_market_nanosecond: time_read, + time_read_matrix_market_human: format_nanoseconds(time_read), + time_factorize_nanosecond: time_fact, + time_factorize_human: format_nanoseconds(time_fact), + time_solve_nanosecond: time_solve, + time_solve_human: format_nanoseconds(time_solve), + requested_ordering: config.str_ordering(), + requested_scaling: config.str_scaling(), + requested_openmp_num_threads: opt.omp_nt as usize, + effective_ordering: solver.get_effective_ordering(), + effective_scaling: solver.get_effective_scaling(), + effective_openmp_num_threads: get_num_threads() as usize, + verify_max_abs_a: verify.max_abs_a, + verify_max_abs_a_times_x: verify.max_abs_ax, + verify_relative_error: verify.relative_error, + verify_time_nanosecond: verify.time_check, + verify_time_human: format_nanoseconds(verify.time_check), + }; + let info_json = serde_json::to_string_pretty(&info).unwrap(); + println!("{}", info_json); // check if path.ends_with("bfwb62.mtx") { diff --git a/russell_sparse/src/solver.rs b/russell_sparse/src/solver.rs index 6640dd96..52af16a2 100644 --- a/russell_sparse/src/solver.rs +++ b/russell_sparse/src/solver.rs @@ -380,6 +380,16 @@ impl Solver { (self.time_fact, self.time_solve) } + /// Returns the ordering effectively used by the solver + pub fn get_effective_ordering(&self) -> String { + self.used_ordering.to_string() + } + + /// Returns the scaling effectively used by the solver + pub fn get_effective_scaling(&self) -> String { + self.used_scaling.to_string() + } + /// Handles error code fn handle_mmp_error_code(err: i32) -> StrError { match err {