diff --git a/examples/benchmark_amg.cpp b/examples/benchmark_amg.cpp index c79b9e64..885c387c 100644 --- a/examples/benchmark_amg.cpp +++ b/examples/benchmark_amg.cpp @@ -10,6 +10,8 @@ #include "raptor/raptor.hpp" +using namespace raptor; + int main(int argc, char* argv[]) { MPI_Init(&argc, &argv); diff --git a/examples/benchmark_matmult.cpp b/examples/benchmark_matmult.cpp index 489c7782..618b9458 100644 --- a/examples/benchmark_matmult.cpp +++ b/examples/benchmark_matmult.cpp @@ -20,7 +20,7 @@ #include "external/mfem_wrapper.hpp" #endif -// using namespace raptor; +using namespace raptor; int main(int argc, char *argv[]) { MPI_Init(&argc, &argv); diff --git a/examples/benchmark_matops.cpp b/examples/benchmark_matops.cpp index 9063e898..8573db8c 100644 --- a/examples/benchmark_matops.cpp +++ b/examples/benchmark_matops.cpp @@ -22,6 +22,8 @@ #include "external/mfem_wrapper.hpp" #endif +using namespace raptor; + #define eager_cutoff 1000 #define short_cutoff 62 diff --git a/examples/benchmark_nek5000.cpp b/examples/benchmark_nek5000.cpp index d3659c17..669d51bd 100644 --- a/examples/benchmark_nek5000.cpp +++ b/examples/benchmark_nek5000.cpp @@ -8,9 +8,11 @@ #include "clear_cache.hpp" -#include "core/types.hpp" -#include "multilevel/par_multilevel.hpp" -#include "external/hypre_wrapper.hpp" +#include "raptor/core/types.hpp" +#include "raptor/multilevel/par_multilevel.hpp" +#include "raptor/external/hypre_wrapper.hpp" + +using namespace raptor; int main(int argc, char *argv[]) { diff --git a/examples/benchmark_par_spmv.cpp b/examples/benchmark_par_spmv.cpp index a8f7e8c3..73ab0bce 100644 --- a/examples/benchmark_par_spmv.cpp +++ b/examples/benchmark_par_spmv.cpp @@ -11,10 +11,10 @@ #include "raptor/raptor.hpp" #ifdef USING_MFEM -#include "external/mfem_wrapper.hpp" +#include "raptor/external/mfem_wrapper.hpp" #endif -//using namespace raptor; +using namespace raptor; int main(int argc, char *argv[]) { MPI_Init(&argc, &argv); diff --git a/examples/benchmark_pcg.cpp b/examples/benchmark_pcg.cpp index 5d82377f..b3feafc9 100644 --- a/examples/benchmark_pcg.cpp +++ b/examples/benchmark_pcg.cpp @@ -10,6 +10,7 @@ #include "raptor/raptor.hpp" +using namespace raptor; int main(int argc, char* argv[]) { MPI_Init(&argc, &argv); diff --git a/examples/benchmark_reader.cpp b/examples/benchmark_reader.cpp index b37d998a..7db31c9f 100644 --- a/examples/benchmark_reader.cpp +++ b/examples/benchmark_reader.cpp @@ -9,6 +9,7 @@ #include "raptor/raptor.hpp" +using namespace raptor; int main(int argc, char* argv[]) { MPI_Init(&argc, &argv); diff --git a/examples/benchmark_rss.cpp b/examples/benchmark_rss.cpp index e0cc7e3d..3727055a 100644 --- a/examples/benchmark_rss.cpp +++ b/examples/benchmark_rss.cpp @@ -8,23 +8,23 @@ #include "clear_cache.hpp" -#include "core/par_matrix.hpp" -#include "core/par_vector.hpp" -#include "core/types.hpp" -#include "gallery/par_stencil.hpp" -#include "gallery/laplacian27pt.hpp" -#include "gallery/diffusion.hpp" -#include "gallery/par_matrix_IO.hpp" -#include "ruge_stuben/par_ruge_stuben_solver.hpp" -#include "external/hypre_wrapper.hpp" -#include "krylov/par_cg.hpp" +#include "raptor/core/par_matrix.hpp" +#include "raptor/core/par_vector.hpp" +#include "raptor/core/types.hpp" +#include "raptor/gallery/par_stencil.hpp" +#include "raptor/gallery/laplacian27pt.hpp" +#include "raptor/gallery/diffusion.hpp" +#include "raptor/gallery/par_matrix_IO.hpp" +#include "raptor/ruge_stuben/par_ruge_stuben_solver.hpp" +#include "raptor/external/hypre_wrapper.hpp" +#include "raptor/krylov/par_cg.hpp" #ifdef USING_MFEM - #include "external/mfem_wrapper.hpp" + #include "raptorexternal/mfem_wrapper.hpp" #endif -//using namespace raptor; -// +using namespace raptor; + void form_hypre_weights(std::vector& weights, int n_rows) { diff --git a/examples/benchmark_setup.cpp b/examples/benchmark_setup.cpp index 0404e924..410d6c56 100644 --- a/examples/benchmark_setup.cpp +++ b/examples/benchmark_setup.cpp @@ -8,18 +8,19 @@ #include "clear_cache.hpp" -#include "core/par_matrix.hpp" -#include "core/par_vector.hpp" -#include "core/types.hpp" -#include "gallery/par_stencil.hpp" -#include "gallery/laplacian27pt.hpp" -#include "gallery/diffusion.hpp" -#include "gallery/par_matrix_IO.hpp" -#include "ruge_stuben/par_ruge_stuben_solver.hpp" +#include "raptor/core/par_matrix.hpp" +#include "raptor/core/par_vector.hpp" +#include "raptor/core/types.hpp" +#include "raptor/gallery/par_stencil.hpp" +#include "raptor/gallery/laplacian27pt.hpp" +#include "raptor/gallery/diffusion.hpp" +#include "raptor/gallery/par_matrix_IO.hpp" +#include "raptor/ruge_stuben/par_ruge_stuben_solver.hpp" #define eager_cutoff 8000 #define short_cutoff 496 +using namespace raptor; int main(int argc, char *argv[]) { diff --git a/examples/benchmark_setup_sweeps.cpp b/examples/benchmark_setup_sweeps.cpp index 85b1e2e1..7ba0ae6f 100644 --- a/examples/benchmark_setup_sweeps.cpp +++ b/examples/benchmark_setup_sweeps.cpp @@ -9,6 +9,7 @@ #include "clear_cache.hpp" #include "raptor/raptor.hpp" +using namespace raptor; int main(int argc, char* argv[]) { diff --git a/examples/benchmark_solve.cpp b/examples/benchmark_solve.cpp index 7e8ce414..6a5b8714 100644 --- a/examples/benchmark_solve.cpp +++ b/examples/benchmark_solve.cpp @@ -8,18 +8,20 @@ #include "clear_cache.hpp" -#include "core/par_matrix.hpp" -#include "core/par_vector.hpp" -#include "core/types.hpp" -#include "gallery/par_stencil.hpp" -#include "gallery/laplacian27pt.hpp" -#include "gallery/diffusion.hpp" -#include "gallery/par_matrix_IO.hpp" -#include "ruge_stuben/par_ruge_stuben_solver.hpp" +#include "raptor/core/par_matrix.hpp" +#include "raptor/core/par_vector.hpp" +#include "raptor/core/types.hpp" +#include "raptor/gallery/par_stencil.hpp" +#include "raptor/gallery/laplacian27pt.hpp" +#include "raptor/gallery/diffusion.hpp" +#include "raptor/gallery/par_matrix_IO.hpp" +#include "raptor/ruge_stuben/par_ruge_stuben_solver.hpp" #define eager_cutoff 8000 #define short_cutoff 496 +using namespace raptor; + int main(int argc, char *argv[]) { diff --git a/examples/benchmark_spgemm_overlap.cpp b/examples/benchmark_spgemm_overlap.cpp index 5ca9cdba..374d9aa2 100644 --- a/examples/benchmark_spgemm_overlap.cpp +++ b/examples/benchmark_spgemm_overlap.cpp @@ -10,6 +10,8 @@ #include "raptor/raptor.hpp" +using namespace raptor; + int main(int argc, char* argv[]) { MPI_Init(&argc, &argv); diff --git a/examples/benchmark_spmv.cpp b/examples/benchmark_spmv.cpp index f8028daa..ae9f40f4 100644 --- a/examples/benchmark_spmv.cpp +++ b/examples/benchmark_spmv.cpp @@ -7,15 +7,15 @@ #include "clear_cache.hpp" #include -#include "core/matrix.hpp" -#include "core/vector.hpp" -#include "core/types.hpp" -#include "gallery/stencil.hpp" -#include "gallery/laplacian27pt.hpp" -#include "gallery/diffusion.hpp" -#include "gallery/matrix_IO.hpp" - -//using namespace raptor; +#include "raptor/core/matrix.hpp" +#include "raptor/core/vector.hpp" +#include "raptor/core/types.hpp" +#include "raptor/gallery/stencil.hpp" +#include "raptor/gallery/laplacian27pt.hpp" +#include "raptor/gallery/diffusion.hpp" +#include "raptor/gallery/matrix_IO.hpp" + +using namespace raptor; double wtime() { diff --git a/examples/benchmark_spmv_overlap.cpp b/examples/benchmark_spmv_overlap.cpp index a48efb6b..f96184e2 100644 --- a/examples/benchmark_spmv_overlap.cpp +++ b/examples/benchmark_spmv_overlap.cpp @@ -10,6 +10,8 @@ #include "raptor/raptor.hpp" +using namespace raptor; + int main(int argc, char* argv[]) { MPI_Init(&argc, &argv); diff --git a/examples/benchmark_tap_amg.cpp b/examples/benchmark_tap_amg.cpp index 32b2ec7e..0efe259c 100644 --- a/examples/benchmark_tap_amg.cpp +++ b/examples/benchmark_tap_amg.cpp @@ -10,6 +10,8 @@ #include "raptor/raptor.hpp" +using namespace raptor; + void form_hypre_weights(double** weight_ptr, int n_rows) { int rank; diff --git a/examples/benchmark_tap_spgemm.cpp b/examples/benchmark_tap_spgemm.cpp index cd44bcf6..b9d4bcd6 100644 --- a/examples/benchmark_tap_spgemm.cpp +++ b/examples/benchmark_tap_spgemm.cpp @@ -8,23 +8,25 @@ #include "clear_cache.hpp" -#include "core/par_matrix.hpp" -#include "core/par_vector.hpp" -#include "core/types.hpp" -#include "gallery/par_stencil.hpp" -#include "gallery/laplacian27pt.hpp" -#include "gallery/diffusion.hpp" -#include "gallery/par_matrix_IO.hpp" -#include "multilevel/par_multilevel.hpp" -#include "ruge_stuben/par_ruge_stuben_solver.hpp" +#include "raptor/core/par_matrix.hpp" +#include "raptor/core/par_vector.hpp" +#include "raptor/core/types.hpp" +#include "raptor/gallery/par_stencil.hpp" +#include "raptor/gallery/laplacian27pt.hpp" +#include "raptor/gallery/diffusion.hpp" +#include "raptor/gallery/par_matrix_IO.hpp" +#include "raptor/multilevel/par_multilevel.hpp" +#include "raptor/ruge_stuben/par_ruge_stuben_solver.hpp" #ifdef USING_MFEM -#include "external/mfem_wrapper.hpp" +#include "raptor/external/mfem_wrapper.hpp" #endif #define eager_cutoff 1000 #define short_cutoff 62 +using namespace raptor; + void print_times(double time, double time_comm, const char* name) { int rank; diff --git a/examples/benchmark_tap_spmv.cpp b/examples/benchmark_tap_spmv.cpp index 442a791f..cfbb08f9 100644 --- a/examples/benchmark_tap_spmv.cpp +++ b/examples/benchmark_tap_spmv.cpp @@ -8,24 +8,25 @@ #include "clear_cache.hpp" -#include "core/par_matrix.hpp" -#include "core/par_vector.hpp" -#include "core/types.hpp" -#include "gallery/par_stencil.hpp" -#include "gallery/laplacian27pt.hpp" -#include "gallery/diffusion.hpp" -#include "gallery/par_matrix_IO.hpp" -#include "multilevel/par_multilevel.hpp" -#include "ruge_stuben/par_ruge_stuben_solver.hpp" +#include "raptor/core/par_matrix.hpp" +#include "raptor/core/par_vector.hpp" +#include "raptor/core/types.hpp" +#include "raptor/gallery/par_stencil.hpp" +#include "raptor/gallery/laplacian27pt.hpp" +#include "raptor/gallery/diffusion.hpp" +#include "raptor/gallery/par_matrix_IO.hpp" +#include "raptor/multilevel/par_multilevel.hpp" +#include "raptor/ruge_stuben/par_ruge_stuben_solver.hpp" #ifdef USING_MFEM - #include "external/mfem_wrapper.hpp" + #include "raptor/external/mfem_wrapper.hpp" #endif #define eager_cutoff 1000 #define short_cutoff 62 +using namespace raptor; int main(int argc, char *argv[]) { diff --git a/examples/clear_cache.hpp b/examples/clear_cache.hpp index 45eaea5b..0812fb4b 100644 --- a/examples/clear_cache.hpp +++ b/examples/clear_cache.hpp @@ -7,7 +7,7 @@ #include #include #include -#include "core/types.hpp" +#include "raptor/core/types.hpp" using namespace raptor; diff --git a/examples/coo_example.cpp b/examples/coo_example.cpp index 8fc02126..a4712b6b 100644 --- a/examples/coo_example.cpp +++ b/examples/coo_example.cpp @@ -9,6 +9,8 @@ // Include raptor #include "raptor/raptor.hpp" +using namespace raptor; + // This example creates a random ParCSRMatrix // All values are added into COO format and then converted. // The example then performs a SpMV on this matrix diff --git a/examples/csr_example.cpp b/examples/csr_example.cpp index 82078779..b653e387 100644 --- a/examples/csr_example.cpp +++ b/examples/csr_example.cpp @@ -9,6 +9,7 @@ // Include raptor #include "raptor/raptor.hpp" +using namespace raptor; // This example creates a random ParCSRMatrix // All values are added directly into ParCSR format. // The example then performs a SpMV on this matrix diff --git a/examples/example.cpp b/examples/example.cpp index 1e36687a..a901c3aa 100644 --- a/examples/example.cpp +++ b/examples/example.cpp @@ -9,6 +9,8 @@ // Include raptor #include "raptor/raptor.hpp" +using namespace raptor; + // This is a basic use case. int main(int argc, char *argv[]) { diff --git a/examples/matop_example.cpp b/examples/matop_example.cpp index 7e483c73..ca2d4517 100644 --- a/examples/matop_example.cpp +++ b/examples/matop_example.cpp @@ -9,6 +9,8 @@ // Include raptor #include "raptor/raptor.hpp" +using namespace raptor; + // This is a basic use case. int main(int argc, char *argv[]) { diff --git a/examples/model_tap_steps.cpp b/examples/model_tap_steps.cpp index 8b9360d3..29142a01 100644 --- a/examples/model_tap_steps.cpp +++ b/examples/model_tap_steps.cpp @@ -9,7 +9,7 @@ #include "clear_cache.hpp" #include "raptor/raptor.hpp" - +using namespace raptor; void time_AP(ParCSRMatrix* A, ParCSRMatrix* P, int n_tests, bool tap, const char* name) { diff --git a/examples/profile_amg.cpp b/examples/profile_amg.cpp index fb2c65e8..9434ef82 100644 --- a/examples/profile_amg.cpp +++ b/examples/profile_amg.cpp @@ -10,6 +10,7 @@ #include "raptor/raptor.hpp" +using namespace raptor; int main(int argc, char* argv[]) { MPI_Init(&argc, &argv); diff --git a/examples/profile_rss.cpp b/examples/profile_rss.cpp index cd21f0ff..474c10fd 100644 --- a/examples/profile_rss.cpp +++ b/examples/profile_rss.cpp @@ -8,18 +8,18 @@ #include "clear_cache.hpp" -#include "core/par_matrix.hpp" -#include "core/par_vector.hpp" -#include "core/types.hpp" -#include "gallery/par_stencil.hpp" -#include "gallery/laplacian27pt.hpp" -#include "gallery/diffusion.hpp" -#include "gallery/par_matrix_IO.hpp" -#include "multilevel/par_multilevel.hpp" -#include "ruge_stuben/par_ruge_stuben_solver.hpp" +#include "raptor/core/par_matrix.hpp" +#include "raptor/core/par_vector.hpp" +#include "raptor/core/types.hpp" +#include "raptor/gallery/par_stencil.hpp" +#include "raptor/gallery/laplacian27pt.hpp" +#include "raptor/gallery/diffusion.hpp" +#include "raptor/gallery/par_matrix_IO.hpp" +#include "raptor/multilevel/par_multilevel.hpp" +#include "raptor/ruge_stuben/par_ruge_stuben_solver.hpp" #ifdef USING_MFEM -#include "external/mfem_wrapper.hpp" +#include "raptor/external/mfem_wrapper.hpp" #endif using namespace raptor; diff --git a/examples/profile_tap_amg.cpp b/examples/profile_tap_amg.cpp index 32734124..66fffa96 100644 --- a/examples/profile_tap_amg.cpp +++ b/examples/profile_tap_amg.cpp @@ -10,6 +10,7 @@ #include "raptor/raptor.hpp" +using namespace raptor; int main(int argc, char* argv[]) { diff --git a/examples/profile_tap_rss.cpp b/examples/profile_tap_rss.cpp index bd2a1cd2..e31103e4 100644 --- a/examples/profile_tap_rss.cpp +++ b/examples/profile_tap_rss.cpp @@ -10,6 +10,8 @@ #include "raptor/raptor.hpp" +using namespace raptor; + int main(int argc, char* argv[]) { MPI_Init(&argc, &argv); diff --git a/examples/profile_tap_sas.cpp b/examples/profile_tap_sas.cpp index 7589a8be..e9c3c3cb 100644 --- a/examples/profile_tap_sas.cpp +++ b/examples/profile_tap_sas.cpp @@ -10,6 +10,8 @@ #include "raptor/raptor.hpp" +using namespace raptor; + int main(int argc, char* argv[]) { MPI_Init(&argc, &argv); diff --git a/examples/profile_tap_spgemm.cpp b/examples/profile_tap_spgemm.cpp index c791dd34..79e70cfc 100644 --- a/examples/profile_tap_spgemm.cpp +++ b/examples/profile_tap_spgemm.cpp @@ -8,24 +8,26 @@ #include "clear_cache.hpp" -#include "core/par_matrix.hpp" -#include "core/par_vector.hpp" -#include "core/types.hpp" -#include "gallery/par_stencil.hpp" -#include "gallery/laplacian27pt.hpp" -#include "gallery/diffusion.hpp" -#include "gallery/par_matrix_IO.hpp" -#include "multilevel/par_multilevel.hpp" -#include "ruge_stuben/par_ruge_stuben_solver.hpp" +#include "raptor/core/par_matrix.hpp" +#include "raptor/core/par_vector.hpp" +#include "raptor/core/types.hpp" +#include "raptor/gallery/par_stencil.hpp" +#include "raptor/gallery/laplacian27pt.hpp" +#include "raptor/gallery/diffusion.hpp" +#include "raptor/gallery/par_matrix_IO.hpp" +#include "raptor/multilevel/par_multilevel.hpp" +#include "raptor/ruge_stuben/par_ruge_stuben_solver.hpp" #ifdef USING_MFEM - #include "external/mfem_wrapper.hpp" + #include "raptor/external/mfem_wrapper.hpp" #endif #define eager_cutoff 1000 #define short_cutoff 62 +using namespace raptor; + int main(int argc, char *argv[]) { MPI_Init(&argc, &argv); diff --git a/examples/profile_tap_steps.cpp b/examples/profile_tap_steps.cpp index f8f6aff8..9bbbfc9a 100644 --- a/examples/profile_tap_steps.cpp +++ b/examples/profile_tap_steps.cpp @@ -10,6 +10,7 @@ #include "raptor/raptor.hpp" +using namespace raptor; void time_AP(ParCSRMatrix* A, ParCSRMatrix* P, int n_tests, bool tap, const char* name) { diff --git a/examples/test_tap.cpp b/examples/test_tap.cpp index 22c16d93..2bcf5168 100644 --- a/examples/test_tap.cpp +++ b/examples/test_tap.cpp @@ -8,19 +8,19 @@ #include "clear_cache.hpp" -#include "core/par_matrix.hpp" -#include "core/par_vector.hpp" -#include "core/types.hpp" -#include "gallery/par_stencil.hpp" -#include "gallery/laplacian27pt.hpp" -#include "gallery/diffusion.hpp" -#include "gallery/par_matrix_IO.hpp" +#include "raptor/core/par_matrix.hpp" +#include "raptor/core/par_vector.hpp" +#include "raptor/core/types.hpp" +#include "raptor/gallery/par_stencil.hpp" +#include "raptor/gallery/laplacian27pt.hpp" +#include "raptor/gallery/diffusion.hpp" +#include "raptor/gallery/par_matrix_IO.hpp" #ifdef USING_MFEM -#include "external/mfem_wrapper.hpp" +#include "raptor/external/mfem_wrapper.hpp" #endif -//using namespace raptor; +using namespace raptor; int main(int argc, char *argv[]) { MPI_Init(&argc, &argv); diff --git a/raptor/aggregation/aggregate.cpp b/raptor/aggregation/aggregate.cpp index 7fab0933..0829d918 100644 --- a/raptor/aggregation/aggregate.cpp +++ b/raptor/aggregation/aggregate.cpp @@ -2,6 +2,7 @@ // License: Simplified BSD, http://opensource.org/licenses/BSD-2-Clause #include "aggregate.hpp" +namespace raptor { int aggregate(CSRMatrix* A, CSRMatrix* S, std::vector& states, std::vector& aggregates, double* rand_vals) { @@ -93,3 +94,4 @@ int aggregate(CSRMatrix* A, CSRMatrix* S, std::vector& states, return n_aggs; } +} diff --git a/raptor/aggregation/aggregate.hpp b/raptor/aggregation/aggregate.hpp index 856c607b..1c8754e1 100644 --- a/raptor/aggregation/aggregate.hpp +++ b/raptor/aggregation/aggregate.hpp @@ -7,11 +7,10 @@ #include "raptor/core/matrix.hpp" #include "mis.hpp" -using namespace raptor; +namespace raptor { int aggregate(CSRMatrix* A, CSRMatrix* S, std::vector& states, std::vector& aggregates, double* rand_vals = NULL); +} #endif - - diff --git a/raptor/aggregation/candidates.cpp b/raptor/aggregation/candidates.cpp index e9a09f91..a2bde24b 100644 --- a/raptor/aggregation/candidates.cpp +++ b/raptor/aggregation/candidates.cpp @@ -2,6 +2,8 @@ // License: Simplified BSD, http://opensource.org/licenses/BSD-2-Clause #include "candidates.hpp" +namespace raptor { + CSRMatrix* fit_candidates(const int n_aggs, const std::vector& aggregates, const std::vector& B, std::vector& R, int num_candidates, double tol) @@ -135,3 +137,5 @@ CSRMatrix* fit_candidates(const int n_aggs, const std::vector& aggregates, return T; } + +} diff --git a/raptor/aggregation/candidates.hpp b/raptor/aggregation/candidates.hpp index 06581471..d0e79ef1 100644 --- a/raptor/aggregation/candidates.hpp +++ b/raptor/aggregation/candidates.hpp @@ -6,10 +6,10 @@ #include "raptor/core/types.hpp" #include "raptor/core/matrix.hpp" -using namespace raptor; - +namespace raptor { // TODO -- currently only accepts constant vector CSRMatrix* fit_candidates(const int n_aggs, const std::vector& aggregates, const std::vector& B, std::vector& R, int num_candidates, double tol = 1e-10); +} #endif diff --git a/raptor/aggregation/mis.cpp b/raptor/aggregation/mis.cpp index c9f5c6d0..bb435a25 100644 --- a/raptor/aggregation/mis.cpp +++ b/raptor/aggregation/mis.cpp @@ -2,6 +2,8 @@ // License: Simplified BSD, http://opensource.org/licenses/BSD-2-Clause #include "mis.hpp" +namespace raptor { + void mis2(CSRMatrix* A, std::vector& states, double* rand_vals) { @@ -217,3 +219,4 @@ void mis2(CSRMatrix* A, std::vector& states, delete A_csc; } +} diff --git a/raptor/aggregation/mis.hpp b/raptor/aggregation/mis.hpp index 9d3e6f8a..a9417211 100644 --- a/raptor/aggregation/mis.hpp +++ b/raptor/aggregation/mis.hpp @@ -6,9 +6,10 @@ #include "raptor/core/types.hpp" #include "raptor/core/matrix.hpp" -using namespace raptor; +namespace raptor { void mis2(CSRMatrix* A, std::vector& states, double* rand_vals = NULL); +} #endif diff --git a/raptor/aggregation/par_aggregate.cpp b/raptor/aggregation/par_aggregate.cpp index b9e5f38a..ced848be 100644 --- a/raptor/aggregation/par_aggregate.cpp +++ b/raptor/aggregation/par_aggregate.cpp @@ -2,6 +2,8 @@ // License: Simplified BSD, http://opensource.org/licenses/BSD-2-Clause #include "par_aggregate.hpp" +namespace raptor { + int aggregate(ParCSRMatrix* A, ParCSRMatrix* S, std::vector& states, std::vector& off_proc_states, std::vector& aggregates, bool tap_comm, double* rand_vals) @@ -166,7 +168,7 @@ int aggregate(ParCSRMatrix* A, ParCSRMatrix* S, std::vector& states, max_agg = off_proc_aggregates[col]; } } - + aggregates[i] = - (max_agg + 1); } } @@ -182,3 +184,4 @@ int aggregate(ParCSRMatrix* A, ParCSRMatrix* S, std::vector& states, return n_aggs; } +} diff --git a/raptor/aggregation/par_aggregate.hpp b/raptor/aggregation/par_aggregate.hpp index 5ee3b32c..9a5ada41 100644 --- a/raptor/aggregation/par_aggregate.hpp +++ b/raptor/aggregation/par_aggregate.hpp @@ -7,12 +7,13 @@ #include "raptor/core/par_matrix.hpp" #include "par_mis.hpp" -using namespace raptor; +namespace raptor { int aggregate(ParCSRMatrix* A, ParCSRMatrix* S, std::vector& states, std::vector& off_proc_states, std::vector& aggregates, bool tap_comm = false, double* rand_vals = NULL); +} #endif diff --git a/raptor/aggregation/par_candidates.cpp b/raptor/aggregation/par_candidates.cpp index 498981dc..4f0602e1 100644 --- a/raptor/aggregation/par_candidates.cpp +++ b/raptor/aggregation/par_candidates.cpp @@ -2,6 +2,7 @@ // License: Simplified BSD, http://opensource.org/licenses/BSD-2-Clause #include "par_candidates.hpp" +namespace raptor { // TODO -- currently assumes B with single candidate ParCSRMatrix* fit_candidates(ParCSRMatrix* A, const int n_aggs, const std::vector& aggregates, @@ -206,8 +207,4 @@ ParCSRMatrix* fit_candidates(ParCSRMatrix* A, return T; } - - - - - +} diff --git a/raptor/aggregation/par_candidates.hpp b/raptor/aggregation/par_candidates.hpp index 54e8a4db..d033acae 100644 --- a/raptor/aggregation/par_candidates.hpp +++ b/raptor/aggregation/par_candidates.hpp @@ -6,11 +6,11 @@ #include "raptor/core/types.hpp" #include "raptor/core/par_matrix.hpp" -using namespace raptor; - +namespace raptor { // TODO -- currently only accepts constant vector ParCSRMatrix* fit_candidates(ParCSRMatrix* A, const int n_aggs, const std::vector& aggregates, const std::vector& B, std::vector& R, int num_candidates, bool tag_comm = false, double tol = 1e-10); +} #endif diff --git a/raptor/aggregation/par_mis.cpp b/raptor/aggregation/par_mis.cpp index bad5e388..71f29193 100644 --- a/raptor/aggregation/par_mis.cpp +++ b/raptor/aggregation/par_mis.cpp @@ -2,6 +2,7 @@ // License: Simplified BSD, http://opensource.org/licenses/BSD-2-Clause #include "par_mis.hpp" +namespace raptor { // Declare Private Methods void comm_states(const ParCSRMatrix* A, CommPkg* comm, const std::vector& states, std::vector& recv_indices, @@ -651,3 +652,4 @@ int mis2(const ParCSRMatrix* A, std::vector& states, return iterate; } +} diff --git a/raptor/aggregation/par_mis.hpp b/raptor/aggregation/par_mis.hpp index 5dd03b86..33f854eb 100644 --- a/raptor/aggregation/par_mis.hpp +++ b/raptor/aggregation/par_mis.hpp @@ -6,10 +6,11 @@ #include "raptor/core/types.hpp" #include "raptor/core/par_matrix.hpp" -using namespace raptor; +namespace raptor { int mis2(const ParCSRMatrix* A, std::vector& states, std::vector& off_proc_states, bool tap_comm = false, double* rand_vals = NULL); +} #endif diff --git a/raptor/aggregation/par_prolongation.cpp b/raptor/aggregation/par_prolongation.cpp index ba79c153..ea670d3e 100644 --- a/raptor/aggregation/par_prolongation.cpp +++ b/raptor/aggregation/par_prolongation.cpp @@ -3,6 +3,7 @@ #include "par_prolongation.hpp" +namespace raptor { // Assuming weighting = local (not getting approx spectral radius) ParCSRMatrix* jacobi_prolongation(ParCSRMatrix* A, ParCSRMatrix* T, bool tap_comm, double omega, int num_smooth_steps) @@ -102,3 +103,4 @@ ParCSRMatrix* jacobi_prolongation(ParCSRMatrix* A, ParCSRMatrix* T, bool tap_com return P; } +} diff --git a/raptor/aggregation/par_prolongation.hpp b/raptor/aggregation/par_prolongation.hpp index 6c2a142c..c349faa5 100644 --- a/raptor/aggregation/par_prolongation.hpp +++ b/raptor/aggregation/par_prolongation.hpp @@ -7,9 +7,9 @@ #include "raptor/core/par_matrix.hpp" #include "raptor/core/par_vector.hpp" -using namespace raptor; - +namespace raptor { ParCSRMatrix* jacobi_prolongation(ParCSRMatrix* A, ParCSRMatrix* T, bool tap_comm = false, double omega = 4.0/3, int num_smooth_steps = 1); +} #endif diff --git a/raptor/aggregation/prolongation.cpp b/raptor/aggregation/prolongation.cpp index 859bfc69..34eaf4be 100644 --- a/raptor/aggregation/prolongation.cpp +++ b/raptor/aggregation/prolongation.cpp @@ -3,6 +3,7 @@ #include "prolongation.hpp" +namespace raptor { // Assuming weighting = local (not getting approx spectral radius) CSRMatrix* jacobi_prolongation(CSRMatrix* A, CSRMatrix* T, double omega, int num_smooth_steps) @@ -52,3 +53,4 @@ CSRMatrix* jacobi_prolongation(CSRMatrix* A, CSRMatrix* T, double omega, return P; } +} diff --git a/raptor/aggregation/prolongation.hpp b/raptor/aggregation/prolongation.hpp index aa4610e4..8394b565 100644 --- a/raptor/aggregation/prolongation.hpp +++ b/raptor/aggregation/prolongation.hpp @@ -7,8 +7,8 @@ #include "raptor/core/matrix.hpp" #include "raptor/core/vector.hpp" -using namespace raptor; - +namespace raptor { CSRMatrix* jacobi_prolongation(CSRMatrix* A, CSRMatrix* T, double omega = 4.0/3, int num_smooth_steps = 1); +} #endif diff --git a/raptor/core/types.hpp b/raptor/core/types.hpp index 5408b2b6..850a4627 100644 --- a/raptor/core/types.hpp +++ b/raptor/core/types.hpp @@ -21,8 +21,6 @@ #include #include -using namespace std; - #define zero_tol 1e-16 #define RAPtor_MPI_INDEX_T MPI_INT #define RAPtor_MPI_DATA_T MPI_DOUBLE @@ -38,7 +36,7 @@ using namespace std; // Global Timing Variables -struct PairData +struct PairData { double val; int index; @@ -56,7 +54,7 @@ namespace raptor enum prolong_t {JacobiProlongation}; enum relax_t {Jacobi, SOR, SSOR}; - template + template U sum_func(const U& a, const T&b) { return a + b; diff --git a/raptor/external/hypre_wrapper.cpp b/raptor/external/hypre_wrapper.cpp index fca760af..39e52867 100644 --- a/raptor/external/hypre_wrapper.cpp +++ b/raptor/external/hypre_wrapper.cpp @@ -4,6 +4,8 @@ #include "hypre_wrapper.hpp" +using namespace raptor; + HYPRE_IJVector convert(raptor::ParVector& x_rap, RAPtor_MPI_Comm comm_mat) { int num_procs, rank; diff --git a/raptor/external/hypre_wrapper.hpp b/raptor/external/hypre_wrapper.hpp index b38090d0..ae354d0c 100644 --- a/raptor/external/hypre_wrapper.hpp +++ b/raptor/external/hypre_wrapper.hpp @@ -12,8 +12,6 @@ #include "_hypre_parcsr_mv.h" #include "_hypre_parcsr_ls.h" -using namespace raptor; - HYPRE_IJVector convert(raptor::ParVector& x_rap, RAPtor_MPI_Comm comm_mat = RAPtor_MPI_COMM_WORLD); HYPRE_IJMatrix convert(raptor::ParCSRMatrix* A_rap, diff --git a/raptor/external/mfem_wrapper.hpp b/raptor/external/mfem_wrapper.hpp index c09f8146..b8eeae1b 100644 --- a/raptor/external/mfem_wrapper.hpp +++ b/raptor/external/mfem_wrapper.hpp @@ -4,49 +4,47 @@ #ifndef RAPTOR_MFEM_WRAPPER_H #define RAPTOR_MFEM_WRAPPER_H -#include "external/hypre_wrapper.hpp" -#include "core/types.hpp" -#include "core/par_matrix.hpp" -#include "core/par_vector.hpp" +#include "raptor/external/hypre_wrapper.hpp" +#include "raptor/core/types.hpp" +#include "raptor/core/par_matrix.hpp" +#include "raptor/core/par_vector.hpp" #include "mfem.hpp" #include #include -using namespace std; - -raptor::ParCSRMatrix* mfem_linear_elasticity(raptor::ParVector& x_raptor, +raptor::ParCSRMatrix* mfem_linear_elasticity(raptor::ParVector& x_raptor, raptor::ParVector& b_raptor, int* num_variables, - const char* mesh_file, + const char* mesh_file, int order = 3, int seq_n_refines = 2, int par_n_refines = 2, RAPtor_MPI_Comm comm_mat = RAPtor_MPI_COMM_WORLD); -raptor::ParCSRMatrix* mfem_dg_elasticity(raptor::ParVector& x_raptor, +raptor::ParCSRMatrix* mfem_dg_elasticity(raptor::ParVector& x_raptor, raptor::ParVector& b_raptor, int* num_variables, - const char* mesh_file, + const char* mesh_file, int order = 3, int seq_n_refines = 2, int par_n_refines = 2, RAPtor_MPI_Comm comm_mat = RAPtor_MPI_COMM_WORLD); -raptor::ParCSRMatrix* mfem_grad_div(raptor::ParVector& x_raptor, +raptor::ParCSRMatrix* mfem_grad_div(raptor::ParVector& x_raptor, raptor::ParVector& b_raptor, - const char* mesh_file, + const char* mesh_file, int order = 3, int seq_n_refines = 2, int par_n_refines = 2, RAPtor_MPI_Comm comm_mat = RAPtor_MPI_COMM_WORLD); -raptor::ParCSRMatrix* mfem_adaptive_laplacian(raptor::ParVector& x_raptor, +raptor::ParCSRMatrix* mfem_adaptive_laplacian(raptor::ParVector& x_raptor, raptor::ParVector& b_raptor, - const char* mesh_file, + const char* mesh_file, int order = 3, int max_dofs = 1000000, RAPtor_MPI_Comm comm_mat = RAPtor_MPI_COMM_WORLD); -raptor::ParCSRMatrix* mfem_dg_diffusion(raptor::ParVector& x_raptor, +raptor::ParCSRMatrix* mfem_dg_diffusion(raptor::ParVector& x_raptor, raptor::ParVector& b_raptor, - const char* mesh_file, + const char* mesh_file, int order = 3, int seq_n_refines = 2, int par_n_refines = 2, RAPtor_MPI_Comm comm_mat = RAPtor_MPI_COMM_WORLD); -raptor::ParCSRMatrix* mfem_laplacian(raptor::ParVector& x_raptor, +raptor::ParCSRMatrix* mfem_laplacian(raptor::ParVector& x_raptor, raptor::ParVector& b_raptor, - const char* mesh_file, + const char* mesh_file, int order = 3, int seq_n_refines = 2, int par_n_refines = 2, RAPtor_MPI_Comm comm_mat = RAPtor_MPI_COMM_WORLD); diff --git a/raptor/gallery/diffusion.cpp b/raptor/gallery/diffusion.cpp index 88da3414..470fd626 100644 --- a/raptor/gallery/diffusion.cpp +++ b/raptor/gallery/diffusion.cpp @@ -3,6 +3,7 @@ #include "diffusion.hpp" +namespace raptor { // diffusion_stencil_2d // // Generate a diffusion stencil @@ -79,3 +80,4 @@ data_t* diffusion_stencil_2d(data_t eps, data_t theta) return stencil; } +} diff --git a/raptor/gallery/diffusion.hpp b/raptor/gallery/diffusion.hpp index dea7385e..bc49904a 100644 --- a/raptor/gallery/diffusion.hpp +++ b/raptor/gallery/diffusion.hpp @@ -6,8 +6,7 @@ #include "raptor/core/types.hpp" -using namespace raptor; - +namespace raptor { // diffusion_stencil_2d // // Generate a diffusion stencil @@ -57,5 +56,6 @@ using namespace raptor; // data_t* diffusion_stencil_2d(data_t eps = 1.0, data_t theta = 0.0); +} #endif diff --git a/raptor/gallery/laplacian27pt.cpp b/raptor/gallery/laplacian27pt.cpp index 263e958b..012037a3 100644 --- a/raptor/gallery/laplacian27pt.cpp +++ b/raptor/gallery/laplacian27pt.cpp @@ -3,6 +3,7 @@ #include "laplacian27pt.hpp" +namespace raptor { // 27 Point Laplacian Stencil // // Generate a 27-point laplacian stencil @@ -32,3 +33,4 @@ data_t* laplace_stencil_27pt() return stencil; } +} diff --git a/raptor/gallery/laplacian27pt.hpp b/raptor/gallery/laplacian27pt.hpp index e1366d17..3a843ec2 100644 --- a/raptor/gallery/laplacian27pt.hpp +++ b/raptor/gallery/laplacian27pt.hpp @@ -7,7 +7,7 @@ #include "raptor/core/types.hpp" #include -using namespace raptor; +namespace raptor { // 27 Point Laplacian Stencil // @@ -26,4 +26,5 @@ using namespace raptor; data_t* laplace_stencil_27pt(); +} #endif diff --git a/raptor/gallery/matrix_IO.cpp b/raptor/gallery/matrix_IO.cpp index e8a9a827..e1eb166c 100644 --- a/raptor/gallery/matrix_IO.cpp +++ b/raptor/gallery/matrix_IO.cpp @@ -23,6 +23,7 @@ void endian_swap(T *objp) } } +namespace raptor { CSRMatrix* readMatrix(const char* filename) { CSRMatrix* A; @@ -88,7 +89,7 @@ CSRMatrix* readMatrix(const char* filename) ifs.read(reinterpret_cast(&idx), sizeof_int32); displ += idx; A->idx1[i+1] = displ; - } + } for (int32_t i = 0; i < nnz; i++) { ifs.read(reinterpret_cast(&idx), sizeof_int32); @@ -106,7 +107,6 @@ CSRMatrix* readMatrix(const char* filename) ifs.close(); return A; - -} - +} +} diff --git a/raptor/gallery/matrix_IO.hpp b/raptor/gallery/matrix_IO.hpp index 807f52f5..b48e1578 100644 --- a/raptor/gallery/matrix_IO.hpp +++ b/raptor/gallery/matrix_IO.hpp @@ -15,9 +15,10 @@ #include "raptor/core/matrix.hpp" #include "raptor/core/types.hpp" -using namespace raptor; +namespace raptor { CSRMatrix* readMatrix(const char* filename); +} #endif diff --git a/raptor/gallery/matrix_market.cpp b/raptor/gallery/matrix_market.cpp index 9454408f..822ac102 100644 --- a/raptor/gallery/matrix_market.cpp +++ b/raptor/gallery/matrix_market.cpp @@ -13,7 +13,7 @@ #include "matrix_market.hpp" -using namespace raptor; +namespace raptor { // Declare Private Methods char *mm_strdup(const char *s); @@ -535,3 +535,4 @@ char *mm_typecode_to_str(MM_typecode matcode) } +} diff --git a/raptor/gallery/matrix_market.hpp b/raptor/gallery/matrix_market.hpp index b8c9bd38..93791036 100644 --- a/raptor/gallery/matrix_market.hpp +++ b/raptor/gallery/matrix_market.hpp @@ -11,7 +11,8 @@ #include "raptor/core/types.hpp" #include "raptor/core/matrix.hpp" -using namespace raptor; + +namespace raptor { #define MM_MAX_LINE_LENGTH 1025 #define MatrixMarketBanner "%%MatrixMarket" @@ -119,7 +120,6 @@ int mm_is_valid(MM_typecode matcode); /* too complex for a macro */ #define MM_SKEW_STR "skew-symmetric" #define MM_PATTERN_STR "pattern" - /* high level routines */ int mm_write_mtx_crd(char fname[], int M, int N, int nz, int I[], int J[], @@ -132,7 +132,6 @@ int mm_read_mtx_crd_entry(FILE *f, int *I, int *J, double *real, double *img, CSRMatrix* read_mm(const char* fname); void write_mm(CSRMatrix* A, const char* fname); +} #endif - - diff --git a/raptor/gallery/par_matrix_IO.cpp b/raptor/gallery/par_matrix_IO.cpp index 7d80d131..1b96d750 100644 --- a/raptor/gallery/par_matrix_IO.cpp +++ b/raptor/gallery/par_matrix_IO.cpp @@ -21,6 +21,7 @@ void endian_swap(T *objp) } } +namespace raptor { ParCSRMatrix* readParMatrix(const char* filename, int local_num_rows, int local_num_cols, int first_local_row, int first_local_col, @@ -183,3 +184,4 @@ ParCSRMatrix* readParMatrix(const char* filename, return A; } +} diff --git a/raptor/gallery/par_matrix_IO.hpp b/raptor/gallery/par_matrix_IO.hpp index 25fa7fef..a5ea6ef2 100644 --- a/raptor/gallery/par_matrix_IO.hpp +++ b/raptor/gallery/par_matrix_IO.hpp @@ -15,12 +15,12 @@ #include "raptor/core/par_matrix.hpp" #include "raptor/core/types.hpp" -using namespace raptor; +namespace raptor { ParCSRMatrix* readParMatrix(const char* filename, int local_num_rows = -1, int local_num_cols = -1, int first_local_row = -1, int first_local_col = -1, RAPtor_MPI_Comm comm = RAPtor_MPI_COMM_WORLD); +} #endif - diff --git a/raptor/gallery/par_matrix_market.cpp b/raptor/gallery/par_matrix_market.cpp index 7f9830cf..eabcd962 100644 --- a/raptor/gallery/par_matrix_market.cpp +++ b/raptor/gallery/par_matrix_market.cpp @@ -1,4 +1,4 @@ -/* +/* * Matrix Market I/O library for ANSI C * * See http://math.nist.gov/MatrixMarket for details. @@ -13,7 +13,7 @@ #include "par_matrix_market.hpp" -using namespace raptor; +namespace raptor { // Declare Private Methods void write_par_data(FILE* f, int n, int* rowptr, int* col_idx, @@ -28,19 +28,19 @@ ParCSRMatrix* read_par_mm(const char *fname) int row, col; int n_items_read; double val; - + if ((f = fopen(fname, "r")) == NULL) return NULL; - - + + if (mm_read_banner(f, &matcode) != 0) { printf("mm_read_unsymetric: Could not process Matrix Market banner "); printf(" in file [%s]\n", fname); return NULL; } - - + + if ( !(mm_is_real(matcode) && mm_is_matrix(matcode) && mm_is_sparse(matcode))) { @@ -49,15 +49,15 @@ ParCSRMatrix* read_par_mm(const char *fname) mm_typecode_to_str(matcode)); return NULL; } - + /* find out size of sparse matrix: M, N, nz .... */ - + if (mm_read_mtx_crd_size(f, &M, &N, &nz) !=0) { fprintf(stderr, "read_unsymmetric_sparse(): could not parse matrix size.\n"); return NULL; } - + int row_nnz = nz / M; ParCOOMatrix* A = new ParCOOMatrix(M, N); A->on_proc->vals.reserve(row_nnz); @@ -66,7 +66,7 @@ ParCSRMatrix* read_par_mm(const char *fname) /* NOTE: when reading in doubles, ANSI C requires the use of the "l" */ /* specifier as in "%lg", "%lf", "%le", otherwise errors will occur */ /* (ANSI C X3.159-1989, Sec. 4.9.6.2, p. 136 lines 13-15) */ - + bool symmetric = mm_is_symmetric(matcode); bool row_local; bool col_local; @@ -84,7 +84,7 @@ ParCSRMatrix* read_par_mm(const char *fname) else { row_local = false; - if (!symmetric) + if (!symmetric) continue; } if (col >= A->partition->first_local_col && col <= A->partition->last_local_col) @@ -95,7 +95,7 @@ ParCSRMatrix* read_par_mm(const char *fname) else { col_local = false; - if (!row_local) + if (!row_local) continue; } @@ -132,7 +132,7 @@ ParCSRMatrix* read_par_mm(const char *fname) delete A; fclose(f); - + return A_csr; } @@ -148,7 +148,7 @@ void write_par_data(FILE* f, int n, int* rowptr, int* col_idx, end = rowptr[i+1]; for (int j = start; j < end; j++) { - fprintf(f, "%d %d %2.15e\n", global_row + 1, + fprintf(f, "%d %d %2.15e\n", global_row + 1, col_map[col_idx[j]] + 1, vals[j]); } } @@ -178,7 +178,7 @@ void write_par_mm(ParCSRMatrix* A, const char *fname) int dims[5]; dims[0] = A->local_num_rows + 1; dims[1] = A->on_proc_num_cols; - dims[2] = A->off_proc_num_cols; + dims[2] = A->off_proc_num_cols; dims[3] = A->on_proc->nnz; dims[4] = A->off_proc->nnz; RAPtor_MPI_Gather(dims, 5, RAPtor_MPI_INT, proc_dims.data(), 5, RAPtor_MPI_INT, 0, RAPtor_MPI_COMM_WORLD); @@ -212,7 +212,7 @@ void write_par_mm(ParCSRMatrix* A, const char *fname) std::vector idx2; std::vector vals; std::vector row_map; - std::vector col_map; + std::vector col_map; for (int i = 1; i < num_procs; i++) { // Calculate comm_size and allocate recv_buf @@ -252,7 +252,7 @@ void write_par_mm(ParCSRMatrix* A, const char *fname) RAPtor_MPI_INT, RAPtor_MPI_COMM_WORLD); RAPtor_MPI_Unpack(buffer.data(), comm_size, &pos, vals.data(), i_dims[3], RAPtor_MPI_DOUBLE, RAPtor_MPI_COMM_WORLD); - write_par_data(f, i_dims[0] - 1, idx1.data(), idx2.data(), + write_par_data(f, i_dims[0] - 1, idx1.data(), idx2.data(), vals.data(), first_row, col_map.data()); RAPtor_MPI_Unpack(buffer.data(), comm_size, &pos, col_map.data(), i_dims[2], @@ -263,7 +263,7 @@ void write_par_mm(ParCSRMatrix* A, const char *fname) RAPtor_MPI_INT, RAPtor_MPI_COMM_WORLD); RAPtor_MPI_Unpack(buffer.data(), comm_size, &pos, vals.data(), i_dims[4], RAPtor_MPI_DOUBLE, RAPtor_MPI_COMM_WORLD); - write_par_data(f, i_dims[0] - 1, idx1.data(), idx2.data(), + write_par_data(f, i_dims[0] - 1, idx1.data(), idx2.data(), vals.data(), first_row, col_map.data()); first_row += i_dims[0] - 1; @@ -283,17 +283,17 @@ void write_par_mm(ParCSRMatrix* A, const char *fname) // Pack Data pos = 0; - RAPtor_MPI_Pack(A->on_proc_column_map.data(), dims[1], RAPtor_MPI_INT, buffer.data(), comm_size, - &pos, RAPtor_MPI_COMM_WORLD); + RAPtor_MPI_Pack(A->on_proc_column_map.data(), dims[1], RAPtor_MPI_INT, buffer.data(), comm_size, + &pos, RAPtor_MPI_COMM_WORLD); RAPtor_MPI_Pack(A->on_proc->idx1.data(), dims[0], RAPtor_MPI_INT, buffer.data(), comm_size, &pos, RAPtor_MPI_COMM_WORLD); RAPtor_MPI_Pack(A->on_proc->idx2.data(), dims[3], RAPtor_MPI_INT, buffer.data(), comm_size, &pos, RAPtor_MPI_COMM_WORLD); RAPtor_MPI_Pack(A->on_proc->vals.data(), dims[3], RAPtor_MPI_DOUBLE, buffer.data(), comm_size, &pos, RAPtor_MPI_COMM_WORLD); - - RAPtor_MPI_Pack(A->off_proc_column_map.data(), dims[2], RAPtor_MPI_INT, buffer.data(), comm_size, - &pos, RAPtor_MPI_COMM_WORLD); + + RAPtor_MPI_Pack(A->off_proc_column_map.data(), dims[2], RAPtor_MPI_INT, buffer.data(), comm_size, + &pos, RAPtor_MPI_COMM_WORLD); RAPtor_MPI_Pack(A->off_proc->idx1.data(), dims[0], RAPtor_MPI_INT, buffer.data(), comm_size, &pos, RAPtor_MPI_COMM_WORLD); RAPtor_MPI_Pack(A->off_proc->idx2.data(), dims[4], RAPtor_MPI_INT, buffer.data(), comm_size, @@ -306,3 +306,4 @@ void write_par_mm(ParCSRMatrix* A, const char *fname) } } +} diff --git a/raptor/gallery/par_matrix_market.hpp b/raptor/gallery/par_matrix_market.hpp index 38cc8b94..5a7af8d5 100644 --- a/raptor/gallery/par_matrix_market.hpp +++ b/raptor/gallery/par_matrix_market.hpp @@ -13,13 +13,11 @@ #include "raptor/core/types.hpp" #include "raptor/core/par_matrix.hpp" -using namespace raptor; +namespace raptor { /* high level routines */ ParCSRMatrix* read_par_mm(const char *fname); void write_par_mm(ParCSRMatrix* A, const char *fname); - +} #endif - - diff --git a/raptor/gallery/par_random.cpp b/raptor/gallery/par_random.cpp index 19fbc10c..bb49d5ce 100644 --- a/raptor/gallery/par_random.cpp +++ b/raptor/gallery/par_random.cpp @@ -2,6 +2,7 @@ // License: Simplified BSD, http://opensource.org/licenses/BSD-2-Clause #include "par_random.hpp" +namespace raptor { ParCSRMatrix* par_random(int global_rows, int global_cols, int nnz_per_row) { int rank, num_procs; @@ -10,7 +11,7 @@ ParCSRMatrix* par_random(int global_rows, int global_cols, int nnz_per_row) ParCOOMatrix* A_coo; double val = 1.0; - + A_coo = new ParCOOMatrix(global_rows, global_cols); int local_nnz = nnz_per_row * A_coo->local_num_rows; for (int i = 0; i < local_nnz; i++) @@ -26,3 +27,4 @@ ParCSRMatrix* par_random(int global_rows, int global_cols, int nnz_per_row) } +} diff --git a/raptor/gallery/par_random.hpp b/raptor/gallery/par_random.hpp index 2f16a228..1a93a128 100644 --- a/raptor/gallery/par_random.hpp +++ b/raptor/gallery/par_random.hpp @@ -12,8 +12,8 @@ #include "raptor/core/par_matrix.hpp" #include "raptor/core/types.hpp" -using namespace raptor; +namespace raptor { ParCSRMatrix* par_random(int global_rows, int global_cols, int nnz_per_row); - +} #endif diff --git a/raptor/gallery/par_stencil.cpp b/raptor/gallery/par_stencil.cpp index de801bae..ab18f3a3 100644 --- a/raptor/gallery/par_stencil.cpp +++ b/raptor/gallery/par_stencil.cpp @@ -2,6 +2,7 @@ // License: Simplified BSD, http://opensource.org/licenses/BSD-2-Clause #include "par_stencil.hpp" +namespace raptor { ParCSRMatrix* par_stencil_grid(data_t* stencil, int* grid, int dim) { // Get MPI Information @@ -19,7 +20,7 @@ ParCSRMatrix* par_stencil_grid(data_t* stencil, int* grid, int dim) int N_v; // Number of rows (and cols) in matrix int N_s; // Number of nonzero stencil entries int n_v; // Local number of rows (and cols) - + int init_step, idx; int len, step, current_step; int col; @@ -101,7 +102,7 @@ ParCSRMatrix* par_stencil_grid(data_t* stencil, int* grid, int dim) { diags[j] += strides[i] * indices[j][dim-i-1]; } - } + } //Initial data array data.resize(N_s*n_v); @@ -126,7 +127,7 @@ ParCSRMatrix* par_stencil_grid(data_t* stencil, int* grid, int dim) //Zero boundary conditions for (index_t i = 0; i < N_s; i++) { - //get correct chunk of data + //get correct chunk of data //(corresponding to single stencil entry) init_step = i*n_v; for (index_t j = 0; j < dim; j++) @@ -204,7 +205,7 @@ ParCSRMatrix* par_stencil_grid(data_t* stencil, int* grid, int dim) { for (index_t d = 0; d < N_s; d++) { - //add data[i] if nonzero + //add data[i] if nonzero col = diags[d] + i + first_local_row; value = data[(N_s-d-1)*n_v+i]; if (col >= 0 && col < N_v && fabs(value) > zero_tol) @@ -218,10 +219,10 @@ ParCSRMatrix* par_stencil_grid(data_t* stencil, int* grid, int dim) A->on_proc->nnz = A->on_proc->idx2.size(); A->off_proc->nnz = A->off_proc->idx2.size(); - + A->finalize(); return A; -} - +} +} diff --git a/raptor/gallery/par_stencil.hpp b/raptor/gallery/par_stencil.hpp index 72227743..407734b4 100644 --- a/raptor/gallery/par_stencil.hpp +++ b/raptor/gallery/par_stencil.hpp @@ -11,10 +11,9 @@ #include "raptor/core/types.hpp" #include "raptor/core/par_matrix.hpp" -using namespace raptor; +namespace raptor { ParCSRMatrix* par_stencil_grid(data_t* stencil, int* grid, int dim); +} #endif - - diff --git a/raptor/gallery/random.cpp b/raptor/gallery/random.cpp index 1a9ea0aa..878ce332 100644 --- a/raptor/gallery/random.cpp +++ b/raptor/gallery/random.cpp @@ -3,6 +3,7 @@ #include "random.hpp" +namespace raptor { CSRMatrix* random(int rows, int cols, int nnz_per_row) { CSRMatrix* A; @@ -24,3 +25,4 @@ CSRMatrix* random(int rows, int cols, int nnz_per_row) } +} diff --git a/raptor/gallery/random.hpp b/raptor/gallery/random.hpp index 3ad8177f..166a150f 100644 --- a/raptor/gallery/random.hpp +++ b/raptor/gallery/random.hpp @@ -12,8 +12,8 @@ #include "raptor/core/matrix.hpp" #include "raptor/core/types.hpp" -using namespace raptor; +namespace raptor { CSRMatrix* random(int rows, int cols, int nnz_per_row); - +} #endif diff --git a/raptor/gallery/stencil.cpp b/raptor/gallery/stencil.cpp index 7eaa04a0..863ec797 100644 --- a/raptor/gallery/stencil.cpp +++ b/raptor/gallery/stencil.cpp @@ -3,6 +3,7 @@ #include "stencil.hpp" +namespace raptor { // Stencils are symmetric, so A could be CSR or CSC CSRMatrix* stencil_grid(data_t* stencil, int* grid, int dim) { @@ -192,3 +193,4 @@ CSRMatrix* stencil_grid(data_t* stencil, int* grid, int dim) return A; } +} diff --git a/raptor/gallery/stencil.hpp b/raptor/gallery/stencil.hpp index debca1f3..4f0c643b 100644 --- a/raptor/gallery/stencil.hpp +++ b/raptor/gallery/stencil.hpp @@ -11,10 +11,10 @@ #include "raptor/core/types.hpp" #include "raptor/core/matrix.hpp" -using namespace raptor; +namespace raptor { // Stencils are symmetric, so A could be CSR or CSC CSRMatrix* stencil_grid(data_t* stencil, int* grid, int dim); - +} #endif diff --git a/raptor/krylov/bicgstab.cpp b/raptor/krylov/bicgstab.cpp index 66b3700f..553bb3e6 100644 --- a/raptor/krylov/bicgstab.cpp +++ b/raptor/krylov/bicgstab.cpp @@ -2,7 +2,7 @@ // License: Simplified BSD, http://opensource.org/licenses/BSD-2-Clause #include "bicgstab.hpp" -using namespace raptor; +namespace raptor { void BiCGStab(CSRMatrix* A, Vector& x, Vector& b, std::vector& res, double tol, int max_iter) { @@ -12,7 +12,7 @@ void BiCGStab(CSRMatrix* A, Vector& x, Vector& b, std::vector& res, doub Vector s; Vector Ap; Vector As; - + int iter; data_t alpha, beta, omega; data_t rrstar_inner, next_rrstar_inner, As_inner, AsAs_inner; @@ -53,7 +53,7 @@ void BiCGStab(CSRMatrix* A, Vector& x, Vector& b, std::vector& res, doub } iter = 0; - + // Main BiCGStab Loop while (true) { @@ -76,7 +76,7 @@ void BiCGStab(CSRMatrix* A, Vector& x, Vector& b, std::vector& res, doub x.axpy(s, omega); // r_{i+1} = s_i - omega_i * As_i - r.copy(s); + r.copy(s); r.axpy(As, -1.0*omega); // beta_i = (r_{i+1}, rstar) / (r_i, rstar) @@ -99,7 +99,7 @@ void BiCGStab(CSRMatrix* A, Vector& x, Vector& b, std::vector& res, doub return; } - + if (iter == max_iter) { printf("Max Iterations Reached.\n"); @@ -110,5 +110,4 @@ void BiCGStab(CSRMatrix* A, Vector& x, Vector& b, std::vector& res, doub iter++; } } - - +} diff --git a/raptor/krylov/bicgstab.hpp b/raptor/krylov/bicgstab.hpp index 907e2d83..a0487fea 100644 --- a/raptor/krylov/bicgstab.hpp +++ b/raptor/krylov/bicgstab.hpp @@ -7,7 +7,7 @@ #include "raptor/core/matrix.hpp" #include "raptor/core/vector.hpp" -using namespace raptor; +namespace raptor { void BiCGStab(CSRMatrix* A, Vector& x, Vector& b, std::vector& res, double tol = 1e-05, int max_iter = -1); @@ -21,5 +21,5 @@ void Test_BiCGStab(CSRMatrix* A, Vector& x, Vector& b, std::vector& res, std::vector& omega_list, std::vector& rr_list, std::vector& beta_list, std::vector& norm_list, double tol = 1e-05, int max_iter = -1); +} #endif - diff --git a/raptor/krylov/cg.cpp b/raptor/krylov/cg.cpp index 36e07fdb..fe8de902 100644 --- a/raptor/krylov/cg.cpp +++ b/raptor/krylov/cg.cpp @@ -2,14 +2,14 @@ // License: Simplified BSD, http://opensource.org/licenses/BSD-2-Clause #include "cg.hpp" -using namespace raptor; +namespace raptor { void CG(CSRMatrix* A, Vector& x, Vector& b, std::vector& res, double tol, int max_iter) { Vector r; Vector p; Vector Ap; - + int iter, recompute_r; data_t alpha, beta; data_t rr_inner, next_inner, App_inner; @@ -58,7 +58,7 @@ void CG(CSRMatrix* A, Vector& x, Vector& b, std::vector& res, double tol exit(-1); } alpha = rr_inner / App_inner; - + x.axpy(p, alpha); // x_{i+1} = x_i + alpha_i * p_i @@ -101,3 +101,4 @@ void CG(CSRMatrix* A, Vector& x, Vector& b, std::vector& res, double tol return; } +} diff --git a/raptor/krylov/cg.hpp b/raptor/krylov/cg.hpp index a0296bb0..737d64ac 100644 --- a/raptor/krylov/cg.hpp +++ b/raptor/krylov/cg.hpp @@ -7,8 +7,9 @@ #include "raptor/core/matrix.hpp" #include "raptor/core/vector.hpp" -using namespace raptor; +namespace raptor { void CG(CSRMatrix* A, Vector& x, Vector& b, std::vector& res, double tol = 1e-05, int max_iter = -1); +} #endif diff --git a/raptor/krylov/par_bicgstab.cpp b/raptor/krylov/par_bicgstab.cpp index 51484e82..eab6d1a9 100644 --- a/raptor/krylov/par_bicgstab.cpp +++ b/raptor/krylov/par_bicgstab.cpp @@ -3,7 +3,7 @@ #include "par_bicgstab.hpp" #include "partial_inner.hpp" -using namespace raptor; +namespace raptor { /************************************************************************************** BiCGStab @@ -892,3 +892,4 @@ void PrePI_BiCGStab(ParCSRMatrix* A, ParVector& x, ParVector& b, std::vector& res, double tol = 1e-05, int max_iter = -1); @@ -29,4 +29,5 @@ void PI_BiCGStab(ParCSRMatrix* A, ParVector& x, ParVector& b, std::vector& res, RAPtor_MPI_Comm &inner_comm, RAPtor_MPI_Comm &root_comm, double frac, int inner_color, int root_color, int inner_root, int procs_in_group, int part_global, double tol = 1e-05, int max_iter = -1); +} #endif diff --git a/raptor/krylov/par_cg.cpp b/raptor/krylov/par_cg.cpp index 3289ab57..cea333a7 100644 --- a/raptor/krylov/par_cg.cpp +++ b/raptor/krylov/par_cg.cpp @@ -3,7 +3,7 @@ #include "par_cg.hpp" #include "raptor/multilevel/par_multilevel.hpp" -using namespace raptor; +namespace raptor { void CG(ParCSRMatrix* A, ParVector& x, ParVector& b, std::vector& res, double tol, int max_iter, double* comm_t) { @@ -262,3 +262,4 @@ if (comm_t) *comm_t += RAPtor_MPI_Wtime(); return; } +} diff --git a/raptor/krylov/par_cg.hpp b/raptor/krylov/par_cg.hpp index 25cf928a..5a667671 100644 --- a/raptor/krylov/par_cg.hpp +++ b/raptor/krylov/par_cg.hpp @@ -8,7 +8,7 @@ #include "raptor/core/par_vector.hpp" #include "raptor/multilevel/par_multilevel.hpp" -using namespace raptor; +namespace raptor { void CG(ParCSRMatrix* A, ParVector& x, ParVector& b, std::vector& res, double tol = 1e-05, int max_iter = -1, double* comm_t = NULL); @@ -16,4 +16,5 @@ void PCG(ParCSRMatrix* A, ParMultilevel* ml, ParVector& x, ParVector& b, std::vector& res, double tol = 1e-05, int max_iter = -1, double* precond_t = NULL, double* comm_t = NULL); +} #endif diff --git a/raptor/krylov/partial_inner.cpp b/raptor/krylov/partial_inner.cpp index 6443a866..3adf7e85 100644 --- a/raptor/krylov/partial_inner.cpp +++ b/raptor/krylov/partial_inner.cpp @@ -2,9 +2,9 @@ // License: Simplified BSD, http://opensource.org/licenses/BSD-2-Clause #include "partial_inner.hpp" -using namespace raptor; +namespace raptor { -/********************************************************************** +/********************************************************************** Performs approximate inner product using contiguous half of processes *********************************************************************/ data_t half_inner_contig(ParVector &x, ParVector &y, int half, int part_global){ @@ -46,7 +46,7 @@ data_t half_inner_contig(ParVector &x, ParVector &y, int half, int part_global){ inner_root = half_procs; recv_root = 0; } - else{ + else{ if (rank < half_procs) color = 0; else color = 1; inner_root = 0; @@ -97,8 +97,8 @@ data_t half_inner_contig(ParVector &x, ParVector &y, int half, int part_global){ } -/***************************************************************** - Performs sequential inner product for testing reproducibility +/***************************************************************** + Performs sequential inner product for testing reproducibility ****************************************************************/ data_t sequential_inner(ParVector &x, ParVector &y){ int rank, num_procs; @@ -137,8 +137,8 @@ data_t sequential_inner(ParVector &x, ParVector &y){ } -/***************************************************************** - Performs sequential vector norm with parallel vector +/***************************************************************** + Performs sequential vector norm with parallel vector ****************************************************************/ data_t sequential_norm(ParVector &x, index_t p){ int rank, num_procs; @@ -171,16 +171,16 @@ void create_partial_inner_comm(RAPtor_MPI_Comm &inner_comm, RAPtor_MPI_Comm &roo RAPtor_MPI_Comm_rank(RAPtor_MPI_COMM_WORLD, &rank); RAPtor_MPI_Comm_size(RAPtor_MPI_COMM_WORLD, &num_procs); - if (num_procs <= 1) + if (num_procs <= 1) { inner_comm = RAPtor_MPI_COMM_NULL; root_comm = RAPtor_MPI_COMM_NULL; part_global = x.local_n; - return; + return; } // Calculate number of processes in group - procs_in_group = num_procs * frac; + procs_in_group = num_procs * frac; if (num_procs % 2) procs_in_group++; // Split into contigous groups by color and get root for each group @@ -202,15 +202,15 @@ void create_partial_inner_comm(RAPtor_MPI_Comm &inner_comm, RAPtor_MPI_Comm &roo return; } -/***************************************************************** +/***************************************************************** Performs approximate inner product using half of the processes ****************************************************************/ data_t half_inner(RAPtor_MPI_Comm &inner_comm, ParVector &x, ParVector &y, int &my_color, int send_color, int &inner_root, int &recv_root, int part_global) { - /* inner_comm : MPI communicator containing the processes to use in the inner product + /* inner_comm : MPI communicator containing the processes to use in the inner product * x : ParVector for calculating inner product * y : ParVector for calculating inner product - * my_color : color corresponding to the procs communicator + * my_color : color corresponding to the procs communicator * send_color : color calculating the inner product and sending to the other half of processes * inner_root : root of inner_comm * recv_root : root of recv_comm @@ -234,7 +234,7 @@ data_t half_inner(RAPtor_MPI_Comm &inner_comm, ParVector &x, ParVector &y, int & inner_prod = x.local.inner_product(y.local); return inner_prod; } - + // Get communicator sizes RAPtor_MPI_Comm_size(inner_comm, &inner_comm_size); //MPI_Comm_size(recv_comm, &recv_comm_size); @@ -275,16 +275,16 @@ data_t half_inner(RAPtor_MPI_Comm &inner_comm, ParVector &x, ParVector &y, int & return inner_prod; } -/***************************************************************** +/***************************************************************** Performs approximate inner product using part of the processes ****************************************************************/ data_t partial_inner(RAPtor_MPI_Comm &inner_comm, RAPtor_MPI_Comm &root_comm, ParVector &x, ParVector &y, int my_color, int send_color, int inner_root, int procs_in_group, int part_global) { - /* inner_comm : MPI communicator containing the processes to use in the inner product + /* inner_comm : MPI communicator containing the processes to use in the inner product * root_comm : MPI communicator containing the root processes for each inner_comm communicator * x : ParVector for calculating inner product * y : ParVector for calculating inner product - * my_color : color corresponding to the processes' communicator + * my_color : color corresponding to the processes' communicator * send_color : color calculating the inner product and sending to the other processes * inner_root : root of the processes' inner_comm * procs_in_group : average number of processes in group - rounded up if uneven @@ -299,9 +299,9 @@ data_t partial_inner(RAPtor_MPI_Comm &inner_comm, RAPtor_MPI_Comm &root_comm, Pa // Check if single process or inner_comm undefined - then default to full inner product if (num_procs <= 1 || inner_comm == RAPtor_MPI_COMM_NULL){ - return y.inner_product(x); + return y.inner_product(x); } - + // Get communicator sizes RAPtor_MPI_Comm_size(inner_comm, &inner_comm_size); @@ -334,3 +334,4 @@ data_t partial_inner(RAPtor_MPI_Comm &inner_comm, RAPtor_MPI_Comm &root_comm, Pa // Return partial inner_prod scaled by global percentage return inner_prod; } +} diff --git a/raptor/krylov/partial_inner.hpp b/raptor/krylov/partial_inner.hpp index cbd47f13..36f7ba02 100644 --- a/raptor/krylov/partial_inner.hpp +++ b/raptor/krylov/partial_inner.hpp @@ -6,7 +6,7 @@ #include "raptor/core/types.hpp" #include "raptor/core/par_vector.hpp" -using namespace raptor; +namespace raptor { data_t half_inner_contig(ParVector &x, ParVector &y, int half, int part_global); @@ -22,4 +22,5 @@ data_t partial_inner(RAPtor_MPI_Comm &inner_comm, RAPtor_MPI_Comm &root_comm, Pa data_t sequential_inner(ParVector &x, ParVector &y); data_t sequential_norm(ParVector &x, index_t p); +} #endif diff --git a/raptor/multilevel/par_sparsify.hpp b/raptor/multilevel/par_sparsify.hpp index 268b41b6..014f14a3 100644 --- a/raptor/multilevel/par_sparsify.hpp +++ b/raptor/multilevel/par_sparsify.hpp @@ -6,9 +6,10 @@ #include "raptor/core/types.hpp" #include "raptor/core/par_matrix.hpp" -using namespace raptor; +namespace raptor { void sparsify(ParCSRMatrix* A, ParCSRMatrix* P, ParCSRMatrix* I, ParCSRMatrix* AP, ParCSRMatrix* Ac, const double theta = 0.1); +} #endif diff --git a/raptor/ruge_stuben/cf_splitting.cpp b/raptor/ruge_stuben/cf_splitting.cpp index 65d9311f..a5742081 100644 --- a/raptor/ruge_stuben/cf_splitting.cpp +++ b/raptor/ruge_stuben/cf_splitting.cpp @@ -4,7 +4,7 @@ // TODO - parts of cf_splitting were taken from pyamg... how to cite this? -using namespace raptor; +namespace raptor { // Declare Private Methods void transpose(const CSRMatrix* S, std::vector& col_ptr, std::vector& col_indices); @@ -723,3 +723,4 @@ void split_pmis(CSRMatrix* S, std::vector& states, double* rand_vals) } +} diff --git a/raptor/ruge_stuben/cf_splitting.hpp b/raptor/ruge_stuben/cf_splitting.hpp index d3e7e98c..2d478fa5 100644 --- a/raptor/ruge_stuben/cf_splitting.hpp +++ b/raptor/ruge_stuben/cf_splitting.hpp @@ -6,7 +6,7 @@ #include "raptor/core/types.hpp" #include "raptor/core/matrix.hpp" -using namespace raptor; +namespace raptor { void cljp_update_weights(CSRMatrix* S, std::vector& col_ptr, std::vector& col_indices, std::vector& edgemark, @@ -16,4 +16,5 @@ void split_rs(CSRMatrix* S, std::vector& states, bool has_states = false, b void split_cljp(CSRMatrix* S, std::vector& states, double* rand_vals = NULL); void split_pmis(CSRMatrix* S, std::vector& states, double* rand_vals = NULL); +} #endif diff --git a/raptor/ruge_stuben/interpolation.cpp b/raptor/ruge_stuben/interpolation.cpp index 4a460da7..a1a3501b 100644 --- a/raptor/ruge_stuben/interpolation.cpp +++ b/raptor/ruge_stuben/interpolation.cpp @@ -4,7 +4,7 @@ #include "raptor/core/types.hpp" #include "interpolation.hpp" -using namespace raptor; +namespace raptor { CSRMatrix* extended_interpolation(CSRMatrix* A, CSRMatrix* S, const std::vector& states, int num_variables, int* variables) @@ -593,6 +593,5 @@ CSRMatrix* direct_interpolation(CSRMatrix* A, return P; - - +} } diff --git a/raptor/ruge_stuben/interpolation.hpp b/raptor/ruge_stuben/interpolation.hpp index 3b413643..e9d24392 100644 --- a/raptor/ruge_stuben/interpolation.hpp +++ b/raptor/ruge_stuben/interpolation.hpp @@ -6,7 +6,7 @@ #include "raptor/core/types.hpp" #include "raptor/core/matrix.hpp" -using namespace raptor; +namespace raptor { CSRMatrix* direct_interpolation(CSRMatrix* A, CSRMatrix* S, const std::vector& states); @@ -19,5 +19,5 @@ CSRMatrix* extended_interpolation(CSRMatrix* A, CSRMatrix* S, const std::vector& states, int num_variables = 1, int* variables = NULL); +} #endif - diff --git a/raptor/ruge_stuben/par_cf_splitting.cpp b/raptor/ruge_stuben/par_cf_splitting.cpp index 3ef5dee4..a8b5685d 100644 --- a/raptor/ruge_stuben/par_cf_splitting.cpp +++ b/raptor/ruge_stuben/par_cf_splitting.cpp @@ -2,7 +2,7 @@ // License: Simplified BSD, http://opensource.org/licenses/BSD-2-Clause #include "par_cf_splitting.hpp" -using namespace raptor; +namespace raptor { // Declare Private Methods void transpose(const ParCSRMatrix* S, std::vector& on_col_ptr, @@ -1638,3 +1638,4 @@ void cljp_main_loop(ParCSRMatrix* S, delete[] part_to_col; } +} diff --git a/raptor/ruge_stuben/par_cf_splitting.hpp b/raptor/ruge_stuben/par_cf_splitting.hpp index 59741148..420b375c 100644 --- a/raptor/ruge_stuben/par_cf_splitting.hpp +++ b/raptor/ruge_stuben/par_cf_splitting.hpp @@ -7,7 +7,7 @@ #include "raptor/core/par_matrix.hpp" #include "cf_splitting.hpp" -using namespace raptor; +namespace raptor { void set_initial_states(ParCSRMatrix* S, std::vector& states); void reset_boundaries(ParCSRMatrix* S, std::vector& states); @@ -37,4 +37,5 @@ void split_pmis(ParCSRMatrix* S, std::vector& states, void split_hmis(ParCSRMatrix* S, std::vector& states, std::vector& off_proc_states, bool tap_cf = false, double* rand_vals = NULL); +} #endif diff --git a/raptor/ruge_stuben/par_interpolation.cpp b/raptor/ruge_stuben/par_interpolation.cpp index 1d3da2fe..a77a5355 100644 --- a/raptor/ruge_stuben/par_interpolation.cpp +++ b/raptor/ruge_stuben/par_interpolation.cpp @@ -4,7 +4,7 @@ #include "raptor/core/types.hpp" #include "raptor/core/par_matrix.hpp" -using namespace raptor; +namespace raptor { // Declare Private Methods CSRMatrix* communicate(ParCSRMatrix* A, ParCSRMatrix* S, const std::vector& states, @@ -1773,3 +1773,4 @@ ParCSRMatrix* direct_interpolation(ParCSRMatrix* A, return P; } +} diff --git a/raptor/ruge_stuben/par_interpolation.hpp b/raptor/ruge_stuben/par_interpolation.hpp index 364a86b2..ac546954 100644 --- a/raptor/ruge_stuben/par_interpolation.hpp +++ b/raptor/ruge_stuben/par_interpolation.hpp @@ -6,7 +6,7 @@ #include "raptor/core/types.hpp" #include "raptor/core/par_matrix.hpp" -using namespace raptor; +namespace raptor { ParCSRMatrix* direct_interpolation(ParCSRMatrix* A, ParCSRMatrix* S, const std::vector& states, @@ -24,4 +24,5 @@ ParCSRMatrix* extended_interpolation(ParCSRMatrix* A, const double filter_threshold = 0.3, bool tap_amg = false, int num_variables = 1, int* variables = NULL); +} #endif diff --git a/raptor/ruge_stuben/tests/CMakeLists.txt b/raptor/ruge_stuben/tests/CMakeLists.txt index fc50a66b..31b32240 100644 --- a/raptor/ruge_stuben/tests/CMakeLists.txt +++ b/raptor/ruge_stuben/tests/CMakeLists.txt @@ -49,35 +49,35 @@ if (WITH_MPI) endif() if (WITH_HYPRE) - add_executable(test_hypre test_hypre.cpp) - target_link_libraries(test_hypre raptor ${MPI_LIBRARIES} googletest pthread) - add_test(TestHypre ${MPIRUN} -n 1 ./test_hypre) - add_test(TestHypre ${MPIRUN} -n 2 ./test_hypre) - - add_executable(test_hypre_agg test_hypre_agg.cpp) - target_link_libraries(test_hypre_agg raptor ${MPI_LIBRARIES} googletest pthread) - add_test(TestHypreAgg ${MPIRUN} -n 1 ./test_hypre_agg) - add_test(TestHypreAgg ${MPIRUN} -n 2 ./test_hypre_agg) - - add_executable(test_hypre_strength test_hypre_strength.cpp) - target_link_libraries(test_hypre_strength raptor ${MPI_LIBRARIES} googletest pthread) - add_test(TestHypreStr ${MPIRUN} -n 1 ./test_hypre_strength) - add_test(TestHypreStr ${MPIRUN} -n 2 ./test_hypre_strength) - - add_executable(test_hypre_splitting test_hypre_splitting.cpp) - target_link_libraries(test_hypre_splitting raptor ${MPI_LIBRARIES} googletest pthread) - add_test(TestHypreSplit ${MPIRUN} -n 1 ./test_hypre_splitting) - add_test(TestHypreSplit ${MPIRUN} -n 2 ./test_hypre_splitting) - - add_executable(test_hypre_interpolation test_hypre_interpolation.cpp) - target_link_libraries(test_hypre_interpolation raptor ${MPI_LIBRARIES} googletest pthread) - add_test(TestHypreInterp ${MPIRUN} -n 1 ./test_hypre_interpolation) - add_test(TestHypreInterp ${MPIRUN} -n 2 ./test_hypre_interpolation) - - add_executable(test_hypre_unknown test_hypre_unknown.cpp) - target_link_libraries(test_hypre_unknown raptor ${MPI_LIBRARIES} googletest pthread) - add_test(TestHypreUnknown ${MPIRUN} -n 1 ./test_hypre_unknown) - add_test(TestHypreUnknown ${MPIRUN} -n 2 ./test_hypre_unknown) + # add_executable(test_hypre test_hypre.cpp) + # target_link_libraries(test_hypre raptor ${MPI_LIBRARIES} googletest pthread) + # add_test(TestHypre ${MPIRUN} -n 1 ./test_hypre) + # add_test(TestHypre ${MPIRUN} -n 2 ./test_hypre) + + # add_executable(test_hypre_agg test_hypre_agg.cpp) + # target_link_libraries(test_hypre_agg raptor ${MPI_LIBRARIES} googletest pthread) + # add_test(TestHypreAgg ${MPIRUN} -n 1 ./test_hypre_agg) + # add_test(TestHypreAgg ${MPIRUN} -n 2 ./test_hypre_agg) + + # add_executable(test_hypre_strength test_hypre_strength.cpp) + # target_link_libraries(test_hypre_strength raptor ${MPI_LIBRARIES} googletest pthread) + # add_test(TestHypreStr ${MPIRUN} -n 1 ./test_hypre_strength) + # add_test(TestHypreStr ${MPIRUN} -n 2 ./test_hypre_strength) + + # add_executable(test_hypre_splitting test_hypre_splitting.cpp) + # target_link_libraries(test_hypre_splitting raptor ${MPI_LIBRARIES} googletest pthread) + # add_test(TestHypreSplit ${MPIRUN} -n 1 ./test_hypre_splitting) + # add_test(TestHypreSplit ${MPIRUN} -n 2 ./test_hypre_splitting) + + # add_executable(test_hypre_interpolation test_hypre_interpolation.cpp) + # target_link_libraries(test_hypre_interpolation raptor ${MPI_LIBRARIES} googletest pthread) + # add_test(TestHypreInterp ${MPIRUN} -n 1 ./test_hypre_interpolation) + # add_test(TestHypreInterp ${MPIRUN} -n 2 ./test_hypre_interpolation) + + # add_executable(test_hypre_unknown test_hypre_unknown.cpp) + # target_link_libraries(test_hypre_unknown raptor ${MPI_LIBRARIES} googletest pthread) + # add_test(TestHypreUnknown ${MPIRUN} -n 1 ./test_hypre_unknown) + # add_test(TestHypreUnknown ${MPIRUN} -n 2 ./test_hypre_unknown) endif() if (WITH_MFEM) diff --git a/raptor/tests/compare.hpp b/raptor/tests/compare.hpp index bebcf8e8..bfb0cf10 100644 --- a/raptor/tests/compare.hpp +++ b/raptor/tests/compare.hpp @@ -12,6 +12,7 @@ #include "raptor/core/types.hpp" #include "raptor/core/matrix.hpp" +namespace raptor { void compare(CSRMatrix* A, CSRMatrix* A_rap) { int start, end; @@ -66,5 +67,5 @@ void compare_pattern(CSRMatrix* A, CSRMatrix* A_rap) } } } - +} #endif diff --git a/raptor/tests/par_compare.hpp b/raptor/tests/par_compare.hpp index 31480acc..6b1256e1 100644 --- a/raptor/tests/par_compare.hpp +++ b/raptor/tests/par_compare.hpp @@ -11,6 +11,7 @@ #include "raptor/core/types.hpp" #include "raptor/core/par_matrix.hpp" +namespace raptor { void compare(ParCSRMatrix* A, ParCSRMatrix* A_rap) { int start, end; @@ -117,4 +118,5 @@ void remove_empty_cols(ParCSRMatrix* S) } } +} #endif diff --git a/raptor/util/linalg/par_diag_scale.cpp b/raptor/util/linalg/par_diag_scale.cpp index 8c3848fc..b47388b0 100644 --- a/raptor/util/linalg/par_diag_scale.cpp +++ b/raptor/util/linalg/par_diag_scale.cpp @@ -2,6 +2,8 @@ // License: Simplified BSD, http://opensource.org/licenses/BSD-2-Clause #include "par_diag_scale.hpp" +namespace raptor { + void row_scale(ParCSRMatrix* A, ParVector& rhs) { int start, end; @@ -78,4 +80,4 @@ void diagonally_unscale(ParVector& sol, const std::vector& row_scales) } } - +} diff --git a/raptor/util/linalg/par_diag_scale.hpp b/raptor/util/linalg/par_diag_scale.hpp index 67a91233..f734118d 100644 --- a/raptor/util/linalg/par_diag_scale.hpp +++ b/raptor/util/linalg/par_diag_scale.hpp @@ -9,14 +9,12 @@ #include "raptor/core/par_vector.hpp" #include "raptor/core/par_matrix.hpp" -using namespace raptor; +namespace raptor { void row_scale(ParCSRMatrix* A, ParVector& rhs); void diagonally_scale(ParCSRMatrix* A, ParVector& rhs, std::vector& row_scales); void diagonally_unscale(ParVector& sol, const std::vector& row_scales); - - +} #endif - diff --git a/raptor/util/linalg/par_relax.cpp b/raptor/util/linalg/par_relax.cpp index 5402a8d8..2cc253a8 100644 --- a/raptor/util/linalg/par_relax.cpp +++ b/raptor/util/linalg/par_relax.cpp @@ -5,6 +5,7 @@ #include "par_relax.hpp" #include "raptor/core/par_matrix.hpp" +namespace raptor { // Declare Private Methods void SOR_forward(ParCSRMatrix* A, ParVector& x, const ParVector& y, const std::vector& dist_x, double omega); @@ -289,8 +290,4 @@ void ssor(ParCSRMatrix* A, ParVector& x, ParVector& b, ParVector& tmp, } - - - - - +} diff --git a/raptor/util/linalg/par_relax.hpp b/raptor/util/linalg/par_relax.hpp index 57311101..24cfc8f9 100644 --- a/raptor/util/linalg/par_relax.hpp +++ b/raptor/util/linalg/par_relax.hpp @@ -10,7 +10,7 @@ #include "raptor/core/par_matrix.hpp" #include "raptor/multilevel/par_level.hpp" -using namespace raptor; +namespace raptor { void jacobi(ParCSRMatrix* A, ParVector& x, ParVector& b, ParVector& tmp, int num_sweeps = 1, double omega = 1.0, bool tap = false); @@ -19,6 +19,6 @@ void sor(ParCSRMatrix* A, ParVector& x, ParVector& b, ParVector& tmp, void ssor(ParCSRMatrix* A, ParVector& x, ParVector& b, ParVector& tmp, int num_sweeps = 1, double omega = 1.0, bool tap = false); - +} #endif diff --git a/raptor/util/linalg/relax.cpp b/raptor/util/linalg/relax.cpp index 5498c6c1..d421c382 100644 --- a/raptor/util/linalg/relax.cpp +++ b/raptor/util/linalg/relax.cpp @@ -5,7 +5,7 @@ #include "raptor/core/vector.hpp" #include "relax.hpp" -using namespace raptor; +namespace raptor { void jacobi(CSRMatrix* A, Vector& b, Vector& x, Vector& tmp, int num_sweeps, double omega) @@ -112,5 +112,4 @@ void ssor(CSRMatrix* A, Vector& b, Vector& x, Vector& tmp, int num_sweeps, } } - - +} diff --git a/raptor/util/linalg/relax.hpp b/raptor/util/linalg/relax.hpp index d821f7d9..6707748f 100644 --- a/raptor/util/linalg/relax.hpp +++ b/raptor/util/linalg/relax.hpp @@ -8,7 +8,7 @@ #include "raptor/core/matrix.hpp" #include "raptor/multilevel/level.hpp" -using namespace raptor; +namespace raptor { void jacobi(CSRMatrix* A, Vector& b, Vector& x, Vector& tmp, int num_sweeps = 1, double omega = 1.0); @@ -17,6 +17,5 @@ void sor(CSRMatrix* A, Vector& b, Vector& x, Vector& tmp, void ssor(CSRMatrix* A, Vector& b, Vector& x, Vector& tmp, int num_sweeps = 1, double omega = 1.0); - +} #endif - diff --git a/raptor/util/linalg/repartition.cpp b/raptor/util/linalg/repartition.cpp index a0584c48..82312331 100644 --- a/raptor/util/linalg/repartition.cpp +++ b/raptor/util/linalg/repartition.cpp @@ -2,6 +2,7 @@ // License: Simplified BSD, http://opensource.org/licenses/BSD-2-Clause #include "repartition.hpp" +namespace raptor { void make_contiguous(ParCSRMatrix* A, std::vector& off_proc_part_map) { int rank, num_procs; @@ -388,4 +389,4 @@ ParCSRMatrix* repartition_matrix(ParCSRMatrix* A, int* partition, std::vector& new_local_rows); void make_contiguous(ParCSRMatrix* A); +} #endif -