Skip to content

Commit

Permalink
drop format usage. drop c++ standard to c++17 for gcc compatibility o…
Browse files Browse the repository at this point in the history
…n frontier
  • Loading branch information
superwhiskers committed Jul 25, 2024
1 parent 34403ac commit 1cb7134
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 46 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cmake_minimum_required(VERSION 3.22)
# Adds version settings and set variable CMAKE_PROJECT_VERSION
project(ReSolve VERSION "0.99.1")

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD 17)

set(PACKAGE_NAME "ReSolve")
set(PACKAGE_TARNAME "resolve")
Expand Down
42 changes: 20 additions & 22 deletions examples/r_KLU_KLU.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include <chrono>
#include <cmath>
#include <filesystem>
#include <format>
#include <fstream>
#include <iomanip>
#include <iostream>
Expand Down Expand Up @@ -162,27 +161,26 @@ int main(int argc, char* argv[])
matrix_handler->matrixInfNorm(A, &norm_A, ReSolve::memory::HOST);
norm_x = vector_handler->infNorm(vec_x, ReSolve::memory::HOST);

output << std::format("{},{},{},{},{},{},{},{},{},{},{:.16e},{:.16e},{:.16e},{:.16e},{:.16e},{},{},{},{}",
matrixFileNameFull,
rhsFileNameFull,
i + 1,
numSystems,
A->getNumRows(),
A->getNumColumns(),
A_coo->getNnz(),
A->getNnz(),
std::chrono::nanoseconds(factorization_time).count(),
std::chrono::nanoseconds(solving_time).count(),
sqrt(vector_handler->dot(vec_r, vec_r, ReSolve::memory::HOST)),
norm_A,
norm_r,
norm_x,
norm_r / (norm_A * norm_x),
L->getNnz(),
L->getNumRows() * L->getNumColumns(),
U->getNnz(),
U->getNumRows() * U->getNumColumns())
<< std::endl;
output << std::setprecision(16) << std::scientific
<< matrixFileNameFull << ","
<< rhsFileNameFull << ","
<< i + 1 << ","
<< numSystems << ","
<< A->getNumRows() << ","
<< A->getNumColumns() << ","
<< A_coo->getNnz() << ","
<< A->getNnz() << ","
<< std::chrono::nanoseconds(factorization_time).count() << ","
<< std::chrono::nanoseconds(solving_time).count() << ","
<< sqrt(vector_handler->dot(vec_r, vec_r, ReSolve::memory::HOST)) << ","
<< norm_A << ","
<< norm_r << ","
<< norm_x << ","
<< (norm_r / (norm_A * norm_x)) << ","
<< L->getNnz() << ","
<< (L->getNumRows() * L->getNumColumns()) << ","
<< U->getNnz() << ","
<< (U->getNumRows() * U->getNumColumns()) << std::endl;
}

output.close();
Expand Down
43 changes: 20 additions & 23 deletions examples/r_LUSOL_LUSOL.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include <chrono>
#include <cmath>
#include <filesystem>
#include <format>
#include <fstream>
#include <iomanip>
#include <iostream>
Expand Down Expand Up @@ -95,7 +94,6 @@ int main(int argc, char* argv[])
output << "matrix_file_path,rhs_file_path,system,total_systems,n_rows,n_columns,initial_nnz,cleaned_nnz,ns_factorization,ns_solving,residual_2_norm,matrix_inf_norm,residual_inf_norm,solution_inf_norm,residual_scaled_norm,l_nnz,l_elements,u_nnz,u_elements\n";
}

[[omp::directive(parallel for)]]
for (int system = 0; system < n_systems; system++) {
std::unique_ptr<ReSolve::LinAlgWorkspaceCpu> workspace(new ReSolve::LinAlgWorkspaceCpu());
std::unique_ptr<ReSolve::MatrixHandler> matrix_handler(new ReSolve::MatrixHandler(workspace.get()));
Expand Down Expand Up @@ -197,27 +195,26 @@ int main(int argc, char* argv[])
matrix_handler->matrixInfNorm(A.get(), &norm_A, ReSolve::memory::HOST);
norm_x = vector_handler->infNorm(vec_x.get(), ReSolve::memory::HOST);

[[omp::directive(critical)]] output << std::format("{},{},{},{},{},{},{},{},{},{},{:.16e},{:.16e},{:.16e},{:.16e},{:.16e},{},{},{},{}",
matrix_file_path,
rhs_file_path,
system + 1,
n_systems,
A->getNumRows(),
A->getNumColumns(),
A_unexpanded->getNnz(),
A->getNnz(),
std::chrono::nanoseconds(factorization_time).count(),
std::chrono::nanoseconds(solving_time).count(),
sqrt(vector_handler->dot(vec_r.get(), vec_r.get(), ReSolve::memory::HOST)),
norm_A,
norm_r,
norm_x,
norm_r / (norm_A * norm_x),
L->getNnz(),
L->getNumRows() * L->getNumColumns(),
U->getNnz(),
U->getNumRows() * U->getNumColumns())
<< std::endl;
output << std::setprecision(16) << std::scientific
<< matrix_file_path << ","
<< rhs_file_path << ","
<< system + 1 << ","
<< n_systems << ","
<< A->getNumRows() << ","
<< A->getNumColumns() << ","
<< A_unexpanded->getNnz() << ","
<< A->getNnz() << ","
<< std::chrono::nanoseconds(factorization_time).count() << ","
<< std::chrono::nanoseconds(solving_time).count() << ","
<< sqrt(vector_handler->dot(vec_r.get(), vec_r.get(), ReSolve::memory::HOST)) << ","
<< norm_A << ","
<< norm_r << ","
<< norm_x << ","
<< (norm_r / (norm_A * norm_x)) << ","
<< L->getNnz() << ","
<< (L->getNumRows() * L->getNumColumns()) << ","
<< U->getNnz() << ","
<< (U->getNumRows() * U->getNumColumns()) << std::endl;

delete[] rhs;
}
Expand Down

0 comments on commit 1cb7134

Please sign in to comment.