From f94c71e644d0e7a36c86185174da186a2b352b3b Mon Sep 17 00:00:00 2001 From: Pietro Incardona <i-bird@localhost.localdomain> Date: Thu, 14 Apr 2016 00:22:33 +0200 Subject: [PATCH] Changing vcluster initialization --- src/FiniteDifference/FDScheme.hpp | 2 +- src/FiniteDifference/eq_unit_test.hpp | 5 +---- src/FiniteDifference/eq_unit_test_3d.hpp | 5 +---- src/Matrix/SparseMatrix_Eigen.hpp | 4 ++-- src/Matrix/SparseMatrix_unit_tests.hpp | 2 +- src/PSE/Kernels_unit_tests.hpp | 2 +- src/Solvers/umfpack_solver.hpp | 2 +- src/Vector/Vector_eigen.hpp | 4 ++-- src/Vector/Vector_unit_tests.hpp | 2 +- src/unit_test_init_cleanup.hpp | 4 ++-- 10 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/FiniteDifference/FDScheme.hpp b/src/FiniteDifference/FDScheme.hpp index 32b12e3c..9fe06bde 100644 --- a/src/FiniteDifference/FDScheme.hpp +++ b/src/FiniteDifference/FDScheme.hpp @@ -474,7 +474,7 @@ public: */ template<typename T> void impose(const T & op , typename Sys_eqs::stype num ,long int id ,grid_dist_iterator_sub<Sys_eqs::dims,typename g_map_type::d_grid> it_d, bool skip_first = false) { - Vcluster & v_cl = *global_v_cluster; + Vcluster & v_cl = create_vcluster(); openfpm::vector<triplet> & trpl = A.getMatrixTriplets(); diff --git a/src/FiniteDifference/eq_unit_test.hpp b/src/FiniteDifference/eq_unit_test.hpp index 511e5d01..4daba5a4 100644 --- a/src/FiniteDifference/eq_unit_test.hpp +++ b/src/FiniteDifference/eq_unit_test.hpp @@ -140,7 +140,7 @@ typedef Avg<y,v_x,lid_nn,FORWARD> avg_vx_f; BOOST_AUTO_TEST_CASE(lid_driven_cavity) { - Vcluster & v_cl = *global_v_cluster; + Vcluster & v_cl = create_vcluster(); if (v_cl.getProcessingUnits() > 3) return; @@ -169,9 +169,6 @@ BOOST_AUTO_TEST_CASE(lid_driven_cavity) // and cannot be discussed here Padding<2> pd({1,1},{0,0}); - // Initialize openfpm - init_global_v_cluster(&boost::unit_test::framework::master_test_suite().argc,&boost::unit_test::framework::master_test_suite().argv); - // Distributed grid that store the solution grid_dist_id<2,float,aggregate<float[2],float>,CartDecomposition<2,float>> g_dist(szu,domain,g); diff --git a/src/FiniteDifference/eq_unit_test_3d.hpp b/src/FiniteDifference/eq_unit_test_3d.hpp index cb6defb1..2acac414 100644 --- a/src/FiniteDifference/eq_unit_test_3d.hpp +++ b/src/FiniteDifference/eq_unit_test_3d.hpp @@ -130,7 +130,7 @@ typedef Avg<x,v_z,lid_nn_3d,FORWARD> avg_x_vz_f; BOOST_AUTO_TEST_CASE(lid_driven_cavity) { - Vcluster & v_cl = *global_v_cluster; + Vcluster & v_cl = create_vcluster(); if (v_cl.getProcessingUnits() > 3) return; @@ -149,9 +149,6 @@ BOOST_AUTO_TEST_CASE(lid_driven_cavity) Padding<3> pd({1,1,1},{0,0,0}); - // Initialize the global VCluster - init_global_v_cluster(&boost::unit_test::framework::master_test_suite().argc,&boost::unit_test::framework::master_test_suite().argv); - // velocity in the grid is the property 0, pressure is the property 1 constexpr int velocity = 0; constexpr int pressure = 1; diff --git a/src/Matrix/SparseMatrix_Eigen.hpp b/src/Matrix/SparseMatrix_Eigen.hpp index 87f18d6b..beb758c2 100644 --- a/src/Matrix/SparseMatrix_Eigen.hpp +++ b/src/Matrix/SparseMatrix_Eigen.hpp @@ -96,7 +96,7 @@ private: */ void assemble() { - Vcluster & vcl = *global_v_cluster; + Vcluster & vcl = create_vcluster(); ////// On Master and only here // we assemble the Matrix from the collected data @@ -116,7 +116,7 @@ private: */ void collect() { - Vcluster & vcl = *global_v_cluster; + Vcluster & vcl = create_vcluster(); trpl_recv.clear(); diff --git a/src/Matrix/SparseMatrix_unit_tests.hpp b/src/Matrix/SparseMatrix_unit_tests.hpp index c75a7b12..4c915463 100644 --- a/src/Matrix/SparseMatrix_unit_tests.hpp +++ b/src/Matrix/SparseMatrix_unit_tests.hpp @@ -18,7 +18,7 @@ BOOST_AUTO_TEST_SUITE( sparse_matrix_test_suite ) BOOST_AUTO_TEST_CASE(sparse_matrix_eigen_parallel) { - Vcluster & vcl = *global_v_cluster; + Vcluster & vcl = create_vcluster(); if (vcl.getProcessingUnits() != 3) return; diff --git a/src/PSE/Kernels_unit_tests.hpp b/src/PSE/Kernels_unit_tests.hpp index 3029d253..bc0df97c 100644 --- a/src/PSE/Kernels_unit_tests.hpp +++ b/src/PSE/Kernels_unit_tests.hpp @@ -17,7 +17,7 @@ BOOST_AUTO_TEST_SUITE( pse_kernels_unit_tests ) BOOST_AUTO_TEST_CASE( pse_ker ) { - Vcluster & v_cl = *global_v_cluster; + Vcluster & v_cl = create_vcluster(); // This test is not made to run in parallel if (v_cl.getProcessingUnits() > 1) diff --git a/src/Solvers/umfpack_solver.hpp b/src/Solvers/umfpack_solver.hpp index 2d5f67d3..c7690a89 100644 --- a/src/Solvers/umfpack_solver.hpp +++ b/src/Solvers/umfpack_solver.hpp @@ -46,7 +46,7 @@ public: */ template<typename impl> static Vector<double> solve(SparseMatrix<double,int,impl> & A, const Vector<double> & b, size_t opt = UMFPACK_NONE) { - Vcluster & vcl = *global_v_cluster; + Vcluster & vcl = create_vcluster(); Vector<double> x; diff --git a/src/Vector/Vector_eigen.hpp b/src/Vector/Vector_eigen.hpp index b0d161e7..439f70f4 100644 --- a/src/Vector/Vector_eigen.hpp +++ b/src/Vector/Vector_eigen.hpp @@ -94,7 +94,7 @@ class Vector<T,Eigen::Matrix<T, Eigen::Dynamic, 1>> */ void collect() const { - Vcluster & vcl = *global_v_cluster; + Vcluster & vcl = create_vcluster(); row_val_recv.clear(); @@ -313,7 +313,7 @@ public: void scatter() { row_val_recv.clear(); - Vcluster & vcl = *global_v_cluster; + Vcluster & vcl = create_vcluster(); vcl.SScatter(row_val,row_val_recv,prc,sz,0); diff --git a/src/Vector/Vector_unit_tests.hpp b/src/Vector/Vector_unit_tests.hpp index 0af5ad73..bc9c01f8 100644 --- a/src/Vector/Vector_unit_tests.hpp +++ b/src/Vector/Vector_unit_tests.hpp @@ -14,7 +14,7 @@ BOOST_AUTO_TEST_SUITE( vector_test_suite ) BOOST_AUTO_TEST_CASE(vector_eigen_parallel) { - Vcluster & vcl = *global_v_cluster; + Vcluster & vcl = create_vcluster(); if (vcl.getProcessingUnits() != 3) return; diff --git a/src/unit_test_init_cleanup.hpp b/src/unit_test_init_cleanup.hpp index 12b98f01..ca73aa35 100644 --- a/src/unit_test_init_cleanup.hpp +++ b/src/unit_test_init_cleanup.hpp @@ -11,8 +11,8 @@ #include "VCluster.hpp" struct ut_start { - ut_start() { BOOST_TEST_MESSAGE("Initialize global VCluster"); init_global_v_cluster(&boost::unit_test::framework::master_test_suite().argc,&boost::unit_test::framework::master_test_suite().argv); } - ~ut_start() { BOOST_TEST_MESSAGE("Delete global VClster");delete_global_v_cluster(); } + ut_start() { BOOST_TEST_MESSAGE("Initialize global VCluster"); openfpm_init(&boost::unit_test::framework::master_test_suite().argc,&boost::unit_test::framework::master_test_suite().argv); } + ~ut_start() { BOOST_TEST_MESSAGE("Delete global VClster"); openfpm_finalize(); } }; //____________________________________________________________________________// -- GitLab