From cd9afeba15984fccc18e326aa01b6e2c06ddb12d Mon Sep 17 00:00:00 2001 From: Pietro Incardona <incardon@mpi-cbg.de> Date: Tue, 11 Jul 2017 01:08:34 +0200 Subject: [PATCH] Latest modules --- CHANGELOG.md | 3 +- example/Grid/0_simple/main.cpp | 58 ++++---- example/Grid/1_stencil/main.cpp | 26 ++-- example/Grid/2_solve_eq/main.cpp | 42 +++--- example/Grid/3_gray_scott/main.cpp | 18 +-- example/Grid/3_gray_scott_3d/main.cpp | 6 +- .../0_2D_incompressible/main_eigen.cpp | 2 +- .../0_2D_incompressible/main_petsc.cpp | 8 +- .../1_3D_incompressible/main_eigen.cpp | 2 +- .../1_3D_incompressible/main_petsc.cpp | 2 +- example/Vector/7_SPH_dlb/main.cpp | 117 +++++++++++++++- install | 17 ++- openfpm_numerics | 2 +- script/install_MPI.sh | 12 +- script/install_PETSC.sh | 125 ++++++++++++------ script/install_Parmetis.sh | 12 ++ script/install_SUITESPARSE.sh | 41 +++--- script/remove_old | 74 ++++++++++- script/show_solutions | 29 ++++ src/Grid/grid_dist_id.hpp | 2 +- src/Vector/vector_dist.hpp | 2 +- 21 files changed, 440 insertions(+), 160 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1538ddad3..443ecd0d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,7 +34,8 @@ All notable changes to this project will be documented in this file. become CellList<3, double, Mem_fast<3, double>, shift<3, double>> - getIterator in CellList changed getCellIterator -- Gris iterator types has changes (one additional template parameter) +- Grid iterator types has changes (one additional template parameter) +- FDScheme the constructor now has one parameter less (Parameter number 4 has been removed) (see Stokes_Flow examples in Numerics) ## [0.8.0] 28 February 2016 diff --git a/example/Grid/0_simple/main.cpp b/example/Grid/0_simple/main.cpp index 64411b39e..30ae5a947 100644 --- a/example/Grid/0_simple/main.cpp +++ b/example/Grid/0_simple/main.cpp @@ -4,13 +4,15 @@ /*! \page grid Grid * * \subpage grid_0_simple + * \subpage grid_1_save_load * \subpage Grid_1_stencil * \subpage Grid_2_solve_eq * \subpage Grid_3_gs + * \subpage Grid_3_gs_3D * */ -/*! \page grid_0_simple Grid 0 simple +/*! \page grid_0_simple Simple usage [TOC] @@ -29,7 +31,7 @@ int main(int argc, char* argv[]) { - /*! \page grid_0_simple Grid 0 simple + /*! \page grid_0_simple Simple usage * * ## Initialization ## {#e0_s_initialization} * @@ -55,18 +57,18 @@ int main(int argc, char* argv[]) size_t sz[3] = {100,100,100}; // Ghost part - Ghost<3,float> g(0.01); + Ghost<3,float> g(0.1); //! \cond [initialization] \endcond - /*! \page grid_0_simple Grid 0 simple + /*! \page grid_0_simple Simple usage * * ## Grid instantiation ## {#e0_s_grid_inst} * - * Here we are creating a distributed grid in defined by the following parameters + * Here we are creating a distributed grid defined by the following parameters * * * 3 dimensionality of the grid - * * float Type used for the spatial coordinates + * * float type used for the spatial coordinates * * each grid point contain a vector of dimension 3 (float[3]), * * float[3] is the information stored by each grid point a float[3] * the list of properties must be put into an aggregate data structure aggregate<prop1,prop2,prop3, ... > @@ -88,13 +90,12 @@ int main(int argc, char* argv[]) //! \cond [grid instantiation] \endcond /*! - * \page grid_0_simple Grid 0 simple + * \page grid_0_simple Simple usage * * ## Loop over grid points ## {#e0_s_loop_gp} * * Get an iterator that go through all the grid points. In this - * example we use iterators. Iterators are convenient way to explore/iterate data-structures in an - * convenient and easy way. + * example we use iterators. Iterators are convenient way to explore/iterate data-structures. * * \snippet Grid/0_simple/main.cpp get iterator * \snippet Grid/0_simple/main.cpp get iterator2 @@ -115,7 +116,7 @@ int main(int argc, char* argv[]) //! \cond [get iterator] \endcond /*! - * \page grid_0_simple Grid 0 simple + * \page grid_0_simple Simple usage * * ## Grid coordinates ## {#e0_s_grid_coord} * @@ -135,7 +136,7 @@ int main(int argc, char* argv[]) //! \cond [local grid] \endcond /*! - * \page grid_0_simple Grid 0 simple + * \page grid_0_simple Simple usage * * **Short explanation** * @@ -144,7 +145,7 @@ int main(int argc, char* argv[]) */ /*! * - * \page grid_0_simple Grid 0 simple + * \page grid_0_simple Simple usage * \htmlonly <a href="#" onclick="if (document.getElementById('long-explanation-div').style.display == 'none') {document.getElementById('long-explanation-div').style.display = 'block'} else {document.getElementById('long-explanation-div').style.display = 'none'}" >Long Explanation</a> \endhtmlonly * @@ -185,7 +186,7 @@ int main(int argc, char* argv[]) PX,Y Processor X, sub-domain Y</pre><p>The point # has</p> <ul> -<li>Global/Real coordinates are (3,2)</li> +<li>Global/Real coordinates (3,2)</li> <li>Local grid coordinates are Sub-domain = 0, grid position = (0,0)</li> </ul> <p>Here we convert the local grid coordinates, into global coordinates. key_g internally store 3 integers that identify the position of the grid point in global coordinates</p> @@ -193,7 +194,7 @@ PX,Y Processor X, sub-domain Y</pre><p>The point # has</p> </div> \endhtmlonly */ - /*! \page grid_0_simple Grid 0 simple + /*! \page grid_0_simple Simple usage * * \snippet Grid/0_simple/main.cpp global coord * @@ -206,7 +207,7 @@ PX,Y Processor X, sub-domain Y</pre><p>The point # has</p> //! \cond [global coord] \endcond /*! - * \page grid_0_simple Grid 0 simple + * \page grid_0_simple Simple usage * * ## Assign properties ## {#grid_assign} * @@ -230,8 +231,6 @@ PX,Y Processor X, sub-domain Y</pre><p>The point # has</p> //! \cond [get iterator2] \endcond - //! ... - // next point ++dom; } @@ -239,7 +238,7 @@ PX,Y Processor X, sub-domain Y</pre><p>The point # has</p> //! \cond [get iterator2] \endcond /*! - * \page grid_0_simple Grid 0 simple + * \page grid_0_simple Simple usage * * Each sub-domain has an extended part, that is materially contained in * another processor. The function ghost_get guarantee (after return) that this extended part @@ -256,7 +255,7 @@ PX,Y Processor X, sub-domain Y</pre><p>The point # has</p> //! \cond [ghost get] \endcond /*! - * \page grid_0_simple Grid 0 simple + * \page grid_0_simple Simple usage * * count contain the number of points the local processor contain, if we are interested to count the total number across the processor * we can use the function sum, to sum numbers across processors. First we have to get an instance of Vcluster, queue an operation of sum with @@ -285,7 +284,7 @@ PX,Y Processor X, sub-domain Y</pre><p>The point # has</p> //! \cond [reduce] \endcond /*! - * \page grid_0_simple Grid 0 simple + * \page grid_0_simple Simple usage * * ## VTK and visualization ## {#e0_s_VTK_vis} * @@ -293,6 +292,10 @@ PX,Y Processor X, sub-domain Y</pre><p>The point # has</p> * The function write by default produce VTK files. One for each processor that can be visualized * with the programs like paraview * + * \htmlonly + * <img src="http://ppmcore.mpi-cbg.de/web/images/examples/0_simple_grid/0_simple_grid_init.jpg"/> + * \endhtmlonly + * * \snippet Grid/0_simple/main.cpp write * */ @@ -304,7 +307,7 @@ PX,Y Processor X, sub-domain Y</pre><p>The point # has</p> //! \cond [write] \endcond /*! - * \page grid_0_simple Grid 0 simple + * \page grid_0_simple Simple usage * * ## Decomposition ## {#grid_dec} * @@ -313,6 +316,15 @@ PX,Y Processor X, sub-domain Y</pre><p>The point # has</p> * * \snippet Grid/0_simple/main.cpp out_dec * + * \htmlonly + * <img src="http://ppmcore.mpi-cbg.de/web/images/examples/0_simple_grid/0_simple_grid_dec.jpg"/> + * \endhtmlonly + * + * Here we see the decomposition in 3D for 2 processors. The red box in wire-frame is the processor 0 + * subdomain. The blu one is the processor 1 sub-domain. The red solid box is the extended part for processor 0 + * the blu solid part is the extended part for processor 1 + * + * */ //! \cond [out_dec] \endcond @@ -322,7 +334,7 @@ PX,Y Processor X, sub-domain Y</pre><p>The point # has</p> //! \cond [out_dec] \endcond /*! - * \page grid_0_simple Grid 0 simple + * \page grid_0_simple Simple usage * * ## Finalize ## {#finalize} * @@ -339,7 +351,7 @@ PX,Y Processor X, sub-domain Y</pre><p>The point # has</p> //! \cond [finalize] \endcond /*! - * \page grid_0_simple Grid 0 simple + * \page grid_0_simple Simple usage * * # Full code # {#code} * diff --git a/example/Grid/1_stencil/main.cpp b/example/Grid/1_stencil/main.cpp index b91d2f113..551e0dccd 100644 --- a/example/Grid/1_stencil/main.cpp +++ b/example/Grid/1_stencil/main.cpp @@ -3,7 +3,7 @@ #include "Decomposition/CartDecomposition.hpp" /*! - * \page Grid_1_stencil Grid 1 stencil + * \page Grid_1_stencil Stencil example * * * # Stencil example and ghost # {#e1_st} @@ -15,7 +15,7 @@ */ /*! - * \page Grid_1_stencil Grid 1 stencil + * \page Grid_1_stencil Stencil example * * Define some convenient constants and types * @@ -37,7 +37,7 @@ constexpr size_t B = 0; int main(int argc, char* argv[]) { /*! - * \page Grid_1_stencil Grid 1 stencil + * \page Grid_1_stencil Stencil example * * ## Initialization ## {#e1_st_init} * @@ -66,7 +66,7 @@ int main(int argc, char* argv[]) //! \cond [parameters] \endcond /*! - * \page Grid_1_stencil Grid 1 stencil + * \page Grid_1_stencil Stencil example * * ## Grid create ## {#e1_st_inst} * @@ -89,7 +89,7 @@ int main(int argc, char* argv[]) //! \cond [grid] \endcond /*! - * \page Grid_1_stencil Grid 1 stencil + * \page Grid_1_stencil Stencil example * * ## Loop over grid points ## {#e1_s_loop_gp} * @@ -112,7 +112,7 @@ int main(int argc, char* argv[]) //! \cond [iterator] \endcond /*! - * \page Grid_1_stencil Grid 1 stencil + * \page Grid_1_stencil Stencil example * * Inside the cycle we get the local grid key * @@ -129,7 +129,7 @@ int main(int argc, char* argv[]) //! \cond [local key] \endcond /*! - * \page Grid_1_stencil Grid 1 stencil + * \page Grid_1_stencil Stencil example * * We convert the local grid position, into global position, key_g contain 3 integers that identify the position * of the grid point in global coordinates @@ -147,7 +147,7 @@ int main(int argc, char* argv[]) //! \cond [global key] \endcond /*! - * \page Grid_1_stencil Grid 1 stencil + * \page Grid_1_stencil Stencil example * * we write on the grid point of position (i,j,k) the value i*i + j*j + k*k on the property A. * Mathematically is equivalent to the function @@ -172,7 +172,7 @@ int main(int argc, char* argv[]) //! \cond [iterator2] \endcond /*! - * \page Grid_1_stencil Grid 1 stencil + * \page Grid_1_stencil Stencil example * * ## Ghost ## {#e1_s_ghost} * @@ -191,7 +191,7 @@ int main(int argc, char* argv[]) //! \cond [ghost] \endcond /*! - * \page Grid_1_stencil Grid 1 stencil + * \page Grid_1_stencil Stencil example * * Get again another iterator, iterate across all the domain points, calculating a Laplace stencil. Write the * result on B @@ -220,7 +220,7 @@ int main(int argc, char* argv[]) //! \cond [laplacian] \endcond /*! - * \page Grid_1_stencil Grid 1 stencil + * \page Grid_1_stencil Stencil example * * * Finally we want a nice output to visualize the information stored by the distributed grid @@ -238,7 +238,7 @@ int main(int argc, char* argv[]) //! \cond [output] \endcond /*! - * \page Grid_1_stencil Grid 1 stencil + * \page Grid_1_stencil Stencil example * * Deinitialize the library * @@ -253,7 +253,7 @@ int main(int argc, char* argv[]) //! \cond [finalize] \endcond /*! - * \page Grid_1_stencil Grid 1 stencil + * \page Grid_1_stencil Stencil example * * # Full code # {#code} * diff --git a/example/Grid/2_solve_eq/main.cpp b/example/Grid/2_solve_eq/main.cpp index cfa128458..743cf7253 100644 --- a/example/Grid/2_solve_eq/main.cpp +++ b/example/Grid/2_solve_eq/main.cpp @@ -2,7 +2,7 @@ #include "data_type/aggregate.hpp" /*! - * \page Grid_2_solve_eq Grid 2 solve eq + * \page Grid_2_solve_eq Solve equation * * [TOC] * @@ -14,7 +14,11 @@ * * \f$u(x,y) = 0 \f$ * - * at the boundary + * at the boundary. This lead to the solution shown in the picture + * + * \htmlonly + * <img src="http://ppmcore.mpi-cbg.de/web/images/examples/2_solve_eq/solution.jpg"/> + * \endhtmlonly * * * ## Field initialization ## {#e2_se_finit} @@ -26,7 +30,7 @@ void init(grid_dist_id<2,double,aggregate<double> > & g_dist, const size_t (& sz)[2]) { /*! - * \page Grid_2_solve_eq Grid 2 solve eq + * \page Grid_2_solve_eq Solve equation * * In order to initialize the field U, first we get an iterator that cover * domain + Ghost to iterate all the grid points. @@ -47,7 +51,7 @@ void init(grid_dist_id<2,double,aggregate<double> > & g_dist, const size_t (& sz //! \cond [iterator] \endcond /*! - * \page Grid_2_solve_eq Grid 2 solve eq + * \page Grid_2_solve_eq Solve equation * * Get the local grid key * @@ -64,7 +68,7 @@ void init(grid_dist_id<2,double,aggregate<double> > & g_dist, const size_t (& sz //! \cond [local key] \endcond /*! - * \page Grid_2_solve_eq Grid 2 solve eq + * \page Grid_2_solve_eq Solve equation * * * Here we convert the local grid position, into global position. @@ -84,7 +88,7 @@ void init(grid_dist_id<2,double,aggregate<double> > & g_dist, const size_t (& sz //! \cond [global key] \endcond /*! - * \page Grid_2_solve_eq Grid 2 solve eq + * \page Grid_2_solve_eq Solve equation * * Initialize to 0, domain + boundary * @@ -129,7 +133,7 @@ constexpr int y = 1; int main(int argc, char* argv[]) { /*! - * \page Grid_2_solve_eq Grid 2 solve eq + * \page Grid_2_solve_eq Solve equation * * ## Initialization ## * @@ -148,7 +152,7 @@ int main(int argc, char* argv[]) //! \cond [ofp_init] \endcond /*! - * \page Grid_2_solve_eq Grid 2 solve eq + * \page Grid_2_solve_eq Solve equation * * ## Grid instantiation and initialization ## * @@ -174,7 +178,7 @@ int main(int argc, char* argv[]) //! \cond [ofp_par] \endcond /*! - * \page Grid_2_solve_eq Grid 2 solve eq + * \page Grid_2_solve_eq Solve equation * * Create a distributed grid in 2D (1° template parameter) space in with double precision (2° template parameter) * each grid point contain a scalar (double), @@ -202,7 +206,7 @@ int main(int argc, char* argv[]) //! \cond [grid inst] \endcond /*! - * \page Grid_2_solve_eq Grid 2 solve eq + * \page Grid_2_solve_eq Solve equation * * Initialize U and fill the boundary conditions * @@ -219,7 +223,7 @@ int main(int argc, char* argv[]) //! \cond [grid init] \endcond /*! - * \page Grid_2_solve_eq Grid 2 solve eq + * \page Grid_2_solve_eq Solve equation * * ## %Ghost synchronization ## * @@ -238,7 +242,7 @@ int main(int argc, char* argv[]) //! \cond [ghost sync] \endcond /*! - * \page Grid_2_solve_eq Grid 2 solve eq + * \page Grid_2_solve_eq Solve equation * * ## Red-Black alghorithm ## * @@ -257,7 +261,7 @@ int main(int argc, char* argv[]) for (size_t i = 0 ; i < 10000 ; i++) { /*! - * \page Grid_2_solve_eq Grid 2 solve eq + * \page Grid_2_solve_eq Solve equation * * Get an iterator that go through the points of the grid (No ghost) * To compute one iteration. @@ -312,7 +316,7 @@ int main(int argc, char* argv[]) //! \cond [gs_it] \endcond /*! - * \page Grid_2_solve_eq Grid 2 solve eq + * \page Grid_2_solve_eq Solve equation * * * Once an iteration is done we have to synchronize the ghosts @@ -336,7 +340,7 @@ int main(int argc, char* argv[]) } /*! - * \page Grid_2_solve_eq Grid 2 solve eq + * \page Grid_2_solve_eq Solve equation * * The full Algorithm look like this * @@ -400,7 +404,7 @@ int main(int argc, char* argv[]) //! \cond [sol stat] \endcond /*! - * \page Grid_2_solve_eq Grid 2 solve eq + * \page Grid_2_solve_eq Solve equation * * ## VTK Write and visualization ## * @@ -422,7 +426,7 @@ int main(int argc, char* argv[]) /*! - * \page Grid_2_solve_eq Grid 2 solve eq + * \page Grid_2_solve_eq Solve equation * * ## Finalize ## * @@ -439,9 +443,9 @@ int main(int argc, char* argv[]) //! \cond [finalize] \endcond /*! - * \page Grid_2_solve_eq Grid 2 solve eq + * \page Grid_2_solve_eq Solve equation * - * # Full code # {#code} + * # Full code # {#e2_solve_eq_code} * * \include Grid/2_solve_eq/main.cpp * diff --git a/example/Grid/3_gray_scott/main.cpp b/example/Grid/3_gray_scott/main.cpp index 180d9c95c..0cded15e3 100644 --- a/example/Grid/3_gray_scott/main.cpp +++ b/example/Grid/3_gray_scott/main.cpp @@ -3,7 +3,7 @@ #include "timer.hpp" /*! - * \page Grid_3_gs Grid 3 Gray Scott + * \page Grid_3_gs Gray Scott 2D * * # Solving a gray scott-system # {#e3_gs_gray_scott} * @@ -34,7 +34,7 @@ constexpr int y = 1; //! \cond [constants] \endcond /*! - * \page Grid_3_gs Grid 3 Gray Scott + * \page Grid_3_gs Gray Scott 2D * * We also define an init function. This function initialize the species U and V. In the following we are going into the * detail of this function @@ -52,7 +52,7 @@ void init(grid_dist_id<2,double,aggregate<double,double> > & Old, grid_dist_id<2 //! \cond [init fun] \endcond /*! - * \page Grid_3_gs Grid 3 Gray Scott + * \page Grid_3_gs Gray Scott 2D * * Here we initialize for the full domain. U and V itarating across the grid points. For the calculation * We are using 2 grids one Old and New. We initialize Old with the initial condition concentration of the @@ -86,7 +86,7 @@ void init(grid_dist_id<2,double,aggregate<double,double> > & Old, grid_dist_id<2 //! \cond [init uv] \endcond /*! - * \page Grid_3_gs Grid 3 Gray Scott + * \page Grid_3_gs Gray Scott 2D * * After we initialized the full grid, we create a perturbation in the domain with different values. * We do in the part of space: 1.55 < x < 1.85 and 1.55 < y < 1.85. Or more precisely on the points included @@ -125,7 +125,7 @@ void init(grid_dist_id<2,double,aggregate<double,double> > & Old, grid_dist_id<2 int main(int argc, char* argv[]) { /*! - * \page Grid_3_gs Grid 3 Gray Scott + * \page Grid_3_gs Gray Scott 2D * * ## Initialization ## * @@ -185,7 +185,7 @@ int main(int argc, char* argv[]) //! \cond [init lib] \endcond /*! - * \page Grid_3_gs Grid 3 Gray Scott + * \page Grid_3_gs Gray Scott 2D * * Here we create 2 distributed grid in 2D Old and New. In particular because we want that * the second grid is distributed across processors in the same way we pass the decomposition @@ -210,7 +210,7 @@ int main(int argc, char* argv[]) //! \cond [init grid] \endcond /*! - * \page Grid_3_gs Grid 3 Gray Scott + * \page Grid_3_gs Gray Scott 2D * * We use the function init to initialize U and V on the grid Old * @@ -225,7 +225,7 @@ int main(int argc, char* argv[]) //! \cond [init uvc] \endcond /*! - * \page Grid_3_gs Grid 3 Gray Scott + * \page Grid_3_gs Gray Scott 2D * * ## Time stepping ## * @@ -323,7 +323,7 @@ int main(int argc, char* argv[]) //! \cond [time stepping] \endcond /*! - * \page Grid_3_gs Grid 3 Gray Scott + * \page Grid_3_gs Gray Scott 2D * * ## Finalize ## * diff --git a/example/Grid/3_gray_scott_3d/main.cpp b/example/Grid/3_gray_scott_3d/main.cpp index 22249b10c..e6cb92350 100644 --- a/example/Grid/3_gray_scott_3d/main.cpp +++ b/example/Grid/3_gray_scott_3d/main.cpp @@ -3,7 +3,7 @@ #include "timer.hpp" /*! - * \page Grid_3_gs Grid 3 Gray Scott in 3D + * \page Grid_3_gs_3D Grid 3 Gray Scott in 3D * * # Solving a gray scott-system in 3D # {#e3_gs_gray_scott} * @@ -107,7 +107,7 @@ int main(int argc, char* argv[]) //! \cond [init lib] \endcond /*! - * \page Grid_3_gs Grid 3 Gray Scott + * \page Grid_3_gs_3D Grid 3 Gray Scott * * Here we create 2 distributed grid in 2D Old and New. In particular because we want that * the second grid is distributed across processors in the same way we pass the decomposition @@ -208,7 +208,7 @@ int main(int argc, char* argv[]) //! \cond [time stepping] \endcond /*! - * \page Grid_3_gs Grid 3 Gray Scott + * \page Grid_3_gs_3D Grid 3 Gray Scott * * ## Finalize ## * diff --git a/example/Numerics/Stoke_flow/0_2D_incompressible/main_eigen.cpp b/example/Numerics/Stoke_flow/0_2D_incompressible/main_eigen.cpp index ce342fd20..d75754c39 100644 --- a/example/Numerics/Stoke_flow/0_2D_incompressible/main_eigen.cpp +++ b/example/Numerics/Stoke_flow/0_2D_incompressible/main_eigen.cpp @@ -300,7 +300,7 @@ int main(int argc, char* argv[]) Ghost<2,long int> stencil_max(1); // Finite difference scheme - FDScheme<lid_nn> fd(pd, stencil_max, domain, g_dist.getGridInfo(), g_dist); + FDScheme<lid_nn> fd(pd, stencil_max, domain, g_dist); //! \cond [fd scheme] \endcond diff --git a/example/Numerics/Stoke_flow/0_2D_incompressible/main_petsc.cpp b/example/Numerics/Stoke_flow/0_2D_incompressible/main_petsc.cpp index 6f5ae88b6..96ce2eded 100644 --- a/example/Numerics/Stoke_flow/0_2D_incompressible/main_petsc.cpp +++ b/example/Numerics/Stoke_flow/0_2D_incompressible/main_petsc.cpp @@ -291,7 +291,7 @@ int main(int argc, char* argv[]) Ghost<2,long int> stencil_max(1); // Finite difference scheme - FDScheme<lid_nn> fd(pd, stencil_max, domain, g_dist.getGridInfo(), g_dist); + FDScheme<lid_nn> fd(pd, stencil_max, domain, g_dist); //! \cond [fd scheme] \endcond @@ -383,17 +383,13 @@ int main(int argc, char* argv[]) // Create a PETSC solver petsc_solver<double> solver; - // Warning try many solver and collect statistics require a lot of time - // To just solve you can comment this line - solver.best_solve(); - // Set the maxumum nunber if iterations solver.setMaxIter(1000); solver.setRestart(200); // Give to the solver A and b, return x, the solution - auto x = solver.solve(fd.getA(),fd.getB()); + auto x = solver.try_solve(fd.getA(),fd.getB()); //! \cond [solver] \endcond diff --git a/example/Numerics/Stoke_flow/1_3D_incompressible/main_eigen.cpp b/example/Numerics/Stoke_flow/1_3D_incompressible/main_eigen.cpp index 79e55d6d5..5b66ef69a 100644 --- a/example/Numerics/Stoke_flow/1_3D_incompressible/main_eigen.cpp +++ b/example/Numerics/Stoke_flow/1_3D_incompressible/main_eigen.cpp @@ -318,7 +318,7 @@ int main(int argc, char* argv[]) Ghost<3,long int> stencil_max(1); // Finite difference scheme - FDScheme<lid_nn> fd(pd, stencil_max, domain, g_dist.getGridInfo(), g_dist); + FDScheme<lid_nn> fd(pd, stencil_max, domain, g_dist); //! \cond [fd scheme] \endcond diff --git a/example/Numerics/Stoke_flow/1_3D_incompressible/main_petsc.cpp b/example/Numerics/Stoke_flow/1_3D_incompressible/main_petsc.cpp index 58d08d63f..6b4bc29b1 100644 --- a/example/Numerics/Stoke_flow/1_3D_incompressible/main_petsc.cpp +++ b/example/Numerics/Stoke_flow/1_3D_incompressible/main_petsc.cpp @@ -319,7 +319,7 @@ int main(int argc, char* argv[]) Ghost<3,long int> stencil_max(1); // Finite difference scheme - FDScheme<lid_nn> fd(pd, stencil_max, domain, g_dist.getGridInfo(), g_dist); + FDScheme<lid_nn> fd(pd, stencil_max, domain, g_dist); //! \cond [fd scheme] \endcond diff --git a/example/Vector/7_SPH_dlb/main.cpp b/example/Vector/7_SPH_dlb/main.cpp index a3dbb163c..25485a1f5 100644 --- a/example/Vector/7_SPH_dlb/main.cpp +++ b/example/Vector/7_SPH_dlb/main.cpp @@ -876,6 +876,107 @@ void euler_int(particles & vd, double dt) /*! \cond [verlet_int] \endcond */ +/*! + * + * \page Vector_7_sph_dlb Vector 7 SPH Dam break simulation with Dynamic load balancing + * + * ### Probes/sensors {#e7_sph_prob_sens} + * + * This function show how to create a pressure sensor/probe on a set of specified points. To do this + * from the cell-list we just get an iterator across the neighborhood points of the sensors and we + * calculate the pressure profile. On the other hand because the sensor is in the processor domain + * of only one processor, only one processor must do this calculation. We will use the function isLocal + * to determine which processor contain the probe and only such processor will do the calculation. + * + * \warning This type of calculation is suitable if the number of probes is small (like 10) and pressure is not + * calculated every time step. In case the number of + * probes is comparable to the number of particles or the pressure is calculated every time-step than we suggest + * to create a set of "probe" particles + * + * + * \snippet Vector/7_SPH_dlb/main.cpp sens_press + * + * + */ + +/*! \cond [sens_press] \endcond */ + +template<typename Vector, typename CellList> +inline void sensor_pressure(Vector & vd, + CellList & NN, + openfpm::vector<openfpm::vector<double>> & press_t, + openfpm::vector<Point<3,double>> & probes) +{ + Vcluster & v_cl = create_vcluster(); + + press_t.add(); + + for (size_t i = 0 ; i < probes.size() ; i++) + { + float press_tmp = 0.0f; + float tot_ker = 0.0; + + // if the probe is inside the processor domain + if (vd.getDecomposition().isLocal(probes.get(i)) == true) + { + // Get the position of the probe i + Point<3,double> xp = probes.get(i); + + // get the iterator over the neighbohood particles of the probes position + auto itg = NN.template getNNIterator<NO_CHECK>(NN.getCell(probes.get(i))); + while (itg.isNext()) + { + auto q = itg.get(); + + // Only the fluid particles are importants + if (vd.template getProp<type>(q) != FLUID) + { + ++itg; + continue; + } + + // Get the position of the neighborhood particle q + Point<3,double> xq = vd.template getPos(q); + + // Calculate the contribution of the particle to the pressure + // of the probe + double r = sqrt(norm2(xp - xq)); + + double ker = Wab(r) * (MassFluid / rho_zero); + + // Also keep track of the calculation of the summed + // kernel + tot_ker += ker; + + // Add the total pressure contribution + press_tmp += vd.template getProp<Pressure>(q) * ker; + + // next neighborhood particle + ++itg; + } + + // We calculate the pressure normalizing the + // sum over all kernels + if (tot_ker == 0.0) + press_tmp = 0.0; + else + press_tmp = 1.0 / tot_ker * press_tmp; + + } + + // This is not necessary in principle, but if you + // want to make all processor aware of the history of the calculated + // pressure we have to execute this + v_cl.sum(press_tmp); + v_cl.execute(); + + // We add the calculated pressure into the history + press_t.last().add(press_tmp); + } +} + +/*! \cond [sens_press] \endcond */ + int main(int argc, char* argv[]) { /*! @@ -884,7 +985,8 @@ int main(int argc, char* argv[]) * * ## Main function {#e7_sph_main} * - * Here we Initialize the library, we create a Box that define our domain, boundary conditions and ghost + * Here we Initialize the library, we create a Box that define our domain, boundary conditions and ghost. We also create + * a vector that contain two probes to measure pressure * * \see \ref e0_s_init * @@ -897,6 +999,13 @@ int main(int argc, char* argv[]) // initialize the library openfpm_init(&argc,&argv); + // It contain for each time-step the value detected by the probes + openfpm::vector<openfpm::vector<double>> press_t; + openfpm::vector<Point<3,double>> probes; + + probes.add({0.8779,0.3,0.02}); + probes.add({0.754,0.31,0.02}); + // Here we define our domain a 2D box with internals from 0 to 1.0 for x and y Box<3,double> domain({-0.05,-0.05,-0.05},{1.7010,0.7065,0.5025}); size_t sz[3] = {207,90,66}; @@ -1254,8 +1363,8 @@ int main(int argc, char* argv[]) * * The main loop do time integration. It calculate the pressure based on the * density, than calculate the forces, than we calculate delta time, and finally update position - * and velocity. After 200 time-step we do a rebalancing. And we save the configuration - * every 0.01 seconds + * and velocity. After 200 time-step we do a re-balancing. We save the configuration + * and we calculate the pressure on the probe position every 0.01 seconds * * \snippet Vector/7_SPH_dlb/main.cpp main loop * @@ -1320,6 +1429,8 @@ int main(int argc, char* argv[]) if (write < t*100) { + // calculate the pressure at the sensor points + sensor_pressure(vd,NN,press_t,probes); vd.write("Geometry",write); write++; diff --git a/install b/install index 3a6b2fcf5..9c2dd0071 100755 --- a/install +++ b/install @@ -23,7 +23,7 @@ nomake=0 update_openfpm=0 upgrade_openfpm=0 -while getopts :di:smhc:nu FLAG; do +while getopts di:smhc:nu FLAG; do case $FLAG in d) echo "Disable depencencies installation" @@ -197,6 +197,21 @@ if [ ! -d "$i_dir/PETSC" -o ! -d "$i_dir/EIGEN" ]; then fi fi +#### License and Copyright disclamer + +echo -e "\033[1;34m Licenses \033[0m" +echo -e "\033[1;34m OpenFPM install several dependencies automatically. Some of them impose restriction and the user must explicitly accept it \033[0m" +echo -e "\033[1;33m PARMETIS: \033[0m \033[1m http://glaros.dtc.umn.edu/gkhome/metis/parmetis/download (Copyright and License) \033[0m" +echo -e "" + +if [ $sq -eq 0 ]; then + unset commands + commands[0]="Accept and continue" + possible_solutions_no_continue "${commands[@]}" +fi + +#### + lin_alg_dir="" lin_alg_lib="" lin_alg_inc="" diff --git a/openfpm_numerics b/openfpm_numerics index 173b92abc..408a41dd8 160000 --- a/openfpm_numerics +++ b/openfpm_numerics @@ -1 +1 @@ -Subproject commit 173b92abc7585e0a3099b69301b21c2b0accc362 +Subproject commit 408a41dd88bfb703c09ab031e2210047582a8e1c diff --git a/script/install_MPI.sh b/script/install_MPI.sh index 36f0c7e47..d7f4d4e96 100755 --- a/script/install_MPI.sh +++ b/script/install_MPI.sh @@ -6,11 +6,11 @@ if [ -d "$1/MPI" ]; then echo "MPI already installed" exit 0 fi -rm -rf openmpi-1.10.2 -rm openmpi-1.10.2.tar.bz2 -wget http://ppmcore.mpi-cbg.de/upload/openmpi-1.10.2.tar.bz2 -tar -xvf openmpi-1.10.2.tar.bz2 -cd openmpi-1.10.2 +rm -rf openmpi-2.1.1 +rm openmpi-2.1.1.tar.bz2 +wget http://ppmcore.mpi-cbg.de/upload/openmpi-2.1.1.tar.bz2 +tar -xvf openmpi-2.1.1.tar.bz2 +cd openmpi-2.1.1 # # --disable-mca-dso \ @@ -30,5 +30,5 @@ make -j $2 make install # Mark the installation -echo 1 > $1/MPI/version +echo 2 > $1/MPI/version diff --git a/script/install_PETSC.sh b/script/install_PETSC.sh index 16ba425d5..c01bc4b2a 100755 --- a/script/install_PETSC.sh +++ b/script/install_PETSC.sh @@ -96,15 +96,15 @@ else fi if [ ! -d "$1/TRILINOS" ]; then - rm trilinos-12.6.1-Source.tar.gz - rm -rf trilinos-12.6.1-Source - wget http://ppmcore.mpi-cbg.de/upload/trilinos-12.6.1-Source.tar.gz + rm trilinos-12.10.1-Source.tar.bz2 + rm -rf trilinos-12.10.1-Source + wget http://ppmcore.mpi-cbg.de/upload/trilinos-12.10.1-Source.tar.bz2 if [ $? -ne 0 ]; then echo -e "\033[91;5;1m FAILED Installation require an Internet connection \033[0m" exit 1 fi - tar -xf trilinos-12.6.1-Source.tar.gz - cd trilinos-12.6.1-Source + tar -xf trilinos-12.10.1-Source.tar.bz2 + cd trilinos-12.10.1-Source mkdir build cd build @@ -125,6 +125,8 @@ if [ ! -d "$1/TRILINOS" ]; then make -j $2 if [ $? -eq 0 ]; then make install + # Mark the installation + echo 1 > $1/TRILINOS/version configure_options="$configure_options --with-trilinos=yes -with-trilinos-dir=$1/TRILINOS" fi else @@ -215,48 +217,57 @@ fi ## SuperLU installation if [ ! -d "$1/SUPERLU_DIST" ]; then - rm superlu_dist_4.3.tar.gz - rm -rf SuperLU_DIST_4.3 - wget http://ppmcore.mpi-cbg.de/upload/superlu_dist_4.3.tar.gz + rm superlu_dist_5.1.3.tar.gz + rm -rf SuperLU_DIST_5.1.3 + wget http://ppmcore.mpi-cbg.de/upload/superlu_dist_5.1.3.tar.gz if [ $? -ne 0 ]; then echo -e "\033[91;5;1m FAILED Installation require an Internet connection \033[0m" exit 1 fi - tar -xf superlu_dist_4.3.tar.gz - cd SuperLU_DIST_4.3 + tar -xf superlu_dist_5.1.3.tar.gz + cd SuperLU_DIST_5.1.3 + + mkdir build + cd build + + cmake .. -DCMAKE_C_FLAGS="-fPIC" -DCMAKE_INSTALL_PREFIX="$1/SUPERLU_DIST" -DCMAKE_EXE_LINKER_FLAGS="-L$1/METIS/lib -lmetis" -DTPL_PARMETIS_INCLUDE_DIRS="$1/PARMETIS/include/;$1/METIS/include/" -DTPL_PARMETIS_LIBRARIES="$1/PARMETIS/lib/libparmetis.a" # Installation for linux - $sed_command -i "/DSuperLUroot\s\+=\s\${HOME}\/Release_Codes\/SuperLU_DIST_4.3/c\DSuperLUroot = ../" make.inc - $sed_command -i "/BLASLIB\s\+=/c\BLASLIB = $1/OPENBLAS/lib/libopenblas.a" make.inc - $sed_command -i "/LOADOPTS\s\+=\s-openmp/c\LOADOPTS = -fopenmp" make.inc - $sed_command -i "/PARMETIS_DIR\s\+=\/project\/projectdirs\/mp127\/parmetis-4.0.3-g/c\PARMETIS_DIR := $1/PARMETIS" make.inc +# $sed_command -i "/DSuperLUroot\s\+=\s\${HOME}\/Release_Codes\/SuperLU_DIST_4.3/c\DSuperLUroot = ../" make.inc +# $sed_command -i "/BLASLIB\s\+=/c\BLASLIB = $1/OPENBLAS/lib/libopenblas.a" make.inc +# $sed_command -i "/LOADOPTS\s\+=\s-openmp/c\LOADOPTS = -fopenmp" make.inc +# $sed_command -i "/PARMETIS_DIR\s\+=\/project\/projectdirs\/mp127\/parmetis-4.0.3-g/c\PARMETIS_DIR := $1/PARMETIS" make.inc - $sed_command -i "/METISLIB\s:=\s-L\${PARMETIS_DIR}\/build\/Linux-x86_64\/libmetis\s-lmetis/c\METISLIB := -L$1/METIS/lib -lmetis" make.inc - $sed_command -i "/PARMETISLIB\s:=\s-L\${PARMETIS_DIR}\/build\/Linux-x86_64\/libparmetis\s-lparmetis/c\PARMETISLIB := -L$1/PARMETIS/lib -lparmetis" make.inc +# $sed_command -i "/METISLIB\s:=\s-L\${PARMETIS_DIR}\/build\/Linux-x86_64\/libmetis\s-lmetis/c\METISLIB := -L$1/METIS/lib -lmetis" make.inc +# $sed_command -i "/PARMETISLIB\s:=\s-L\${PARMETIS_DIR}\/build\/Linux-x86_64\/libparmetis\s-lparmetis/c\PARMETISLIB := -L$1/PARMETIS/lib -lparmetis" make.inc - $sed_command -i "/I_PARMETIS\s:=\s-I\${PARMETIS_DIR}\/include\s-I\${PARMETIS_DIR}\/metis\/include/c\I_PARMETIS := -I$1/PARMETIS/include -I$1/METIS/include" make.inc - $sed_command -i "/CC\s\+=\scc/c\CC = mpicc" make.inc - $sed_command -i "/FORTRAN\s\+=\sftn/c\FORTRAN = mpif90" make.inc +# $sed_command -i "/I_PARMETIS\s:=\s-I\${PARMETIS_DIR}\/include\s-I\${PARMETIS_DIR}\/metis\/include/c\I_PARMETIS := -I$1/PARMETIS/include -I$1/METIS/include" make.inc +# $sed_command -i "/CC\s\+=\scc/c\CC = mpicc" make.inc +# $sed_command -i "/FORTRAN\s\+=\sftn/c\FORTRAN = mpif90" make.inc - if [ x"$CXX" == x"clang++" ]; then - $sed_command -i "/CFLAGS\s\+=\s-fast\s-m64\s-std=c99\s-Wall\s-openmp\s\\\/c\CFLAGS =-fpic -O3 -m64 -std=c99 -Wall \$(I_PARMETIS) -DDEBUGlevel=0 -DPRNTlevel=0 -DPROFlevel=0" make.inc - else - $sed_command -i "/CFLAGS\s\+=\s-fast\s-m64\s-std=c99\s-Wall\s-openmp\s\\\/c\CFLAGS =-fpic -O3 -m64 -std=c99 -Wall -fopenmp \$(I_PARMETIS) -DDEBUGlevel=0 -DPRNTlevel=0 -DPROFlevel=0" make.inc - fi - $sed_command -i "/\s\$(I_PARMETIS)\s-DDEBUGlevel=0\s-DPRNTlevel=0\s-DPROFlevel=0\s\\\/c\ " make.inc +# if [ x"$CXX" == x"clang++" ]; then +# $sed_command -i "/CFLAGS\s\+=\s-fast\s-m64\s-std=c99\s-Wall\s-openmp\s\\\/c\CFLAGS =-fpic -O3 -m64 -std=c99 -Wall \$(I_PARMETIS) -DDEBUGlevel=0 -DPRNTlevel=0 -DPROFlevel=0" make.inc +# else +# $sed_command -i "/CFLAGS\s\+=\s-fast\s-m64\s-std=c99\s-Wall\s-openmp\s\\\/c\CFLAGS =-fpic -O3 -m64 -std=c99 -Wall -fopenmp \$(I_PARMETIS) -DDEBUGlevel=0 -DPRNTlevel=0 -DPROFlevel=0" make.inc +# fi +# $sed_command -i "/\s\$(I_PARMETIS)\s-DDEBUGlevel=0\s-DPRNTlevel=0\s-DPROFlevel=0\s\\\/c\ " make.inc make if [ $? -eq 0 ]; then - mkdir $1/SUPERLU_DIST - mkdir $1/SUPERLU_DIST/include - cp -r lib $1/SUPERLU_DIST - cp SRC/*.h $1/SUPERLU_DIST/include + + make install + echo 1 > $1/SUPERLU_DIST/version + +# mkdir $1/SUPERLU_DIST +# mkdir $1/SUPERLU_DIST/include +# cp -r lib $1/SUPERLU_DIST +# cp SRC/*.h $1/SUPERLU_DIST/include if [ x"$CXX" == x"icpc" ]; then configure_options="$configure_options" else - configure_options="$configure_options --with-superlu_dist=yes --with-superlu_dist-lib=$1/SUPERLU_DIST/lib/libsuperlu_dist_4.3.a --with-superlu_dist-include=$1/SUPERLU_DIST/include/" + configure_options="$configure_options --with-superlu_dist=yes --with-superlu_dist-lib=$1/SUPERLU_DIST/lib/libsuperlu_dist.a --with-superlu_dist-include=$1/SUPERLU_DIST/include/" fi fi @@ -265,22 +276,22 @@ else if [ x"$CXX" == x"icpc" ]; then configure_options="$configure_options" else - configure_options="$configure_options --with-superlu_dist=yes --with-superlu_dist-lib=$1/SUPERLU_DIST/lib/libsuperlu_dist_4.3.a --with-superlu_dist-include=$1/SUPERLU_DIST/include/" + configure_options="$configure_options --with-superlu_dist=yes --with-superlu_dist-lib=$1/SUPERLU_DIST/lib/libsuperlu_dist.a --with-superlu_dist-include=$1/SUPERLU_DIST/include/" fi fi ## HYPRE installation if [ ! -d "$1/HYPRE" ]; then - rm hypre-2.11.0.tar.gz - rm -rf hypre-2.11.0 - wget http://ppmcore.mpi-cbg.de/upload/hypre-2.11.0.tar.gz + rm hypre-2.11.2.tar.gz + rm -rf hypre-2.11.2 + wget http://ppmcore.mpi-cbg.de/upload/hypre-2.11.2.tar.gz if [ $? -ne 0 ]; then echo -e "\033[91;5;1m FAILED Installation require an Internet connection \033[0m" exit 1 fi - tar -xf hypre-2.11.0.tar.gz - cd hypre-2.11.0 + tar -xf hypre-2.11.2.tar.gz + cd hypre-2.11.2 cd src @@ -289,6 +300,7 @@ if [ ! -d "$1/HYPRE" ]; then if [ $? -eq 0 ]; then make install + echo 1 > $1/HYPRE/version configure_options="$configure_options --with-hypre=yes -with-hypre-dir=$1/HYPRE" fi @@ -296,21 +308,46 @@ else echo "HYPRE already installed" configure_options="$configure_options --with-hypre=yes -with-hypre-dir=$1/HYPRE" fi - -rm petsc-lite-3.6.4.tar.gz -rm -rf petsc-3.6.4 -wget http://ppmcore.mpi-cbg.de/upload/petsc-lite-3.6.4.tar.gz +# Install NETCFD + +if [ ! -d "$1/NETCDF" ]; then + rm netcdf-4.4.1.1.tar.gz + rm -rf netcdf-4.4.1.1 + wget http://ppmcore.mpi-cbg.de/upload/netcdf-4.4.1.1.tar.gz + if [ $? -ne 0 ]; then + echo -e "\033[91;5;1m FAILED Installation require an Internet connection \033[0m" + exit 1 + fi + tar -xf netcdf-4.4.1.1.tar.gz + cd netcdf-4.4.1.1 + + ./configure CC=mpicc CPPFLAGS=-I$1/HDF5/include LDFLAGS=-L$1/HDF5/lib --disable-shared --prefix=$1/NETCDF + make -j $2 + + if [ $? -eq 0 ]; then + make install + configure_options="$configure_options --with-netcdf=yes -with-netcdf-dir=$1/NETCDF --with-hdf5=yes --with-hdf5-dir=$1/HDF5" + fi + +else + echo "NETCDF already installed" + configure_options="$configure_options --with-netcdf=yes -with-netcdf-dir=$1/NETCDF --with-hdf5=yes --with-hdf5-dir=$1/HDF5" +fi + +rm petsc-lite-3.7.6.tar.gz +rm -rf petsc-3.7.6 +wget http://ppmcore.mpi-cbg.de/upload/petsc-lite-3.7.6.tar.gz if [ $? -ne 0 ]; then echo -e "\033[91;5;1m FAILED Installation require an Internet connection \033[0m" exit 1 fi -tar -xf petsc-lite-3.6.4.tar.gz -cd petsc-3.6.4 +tar -xf petsc-lite-3.7.6.tar.gz +cd petsc-3.7.6 -echo "./configure --with-cxx-dialect=C++11 $petsc_openmp --with-mpi-dir=$mpi_dir $configure_options --with-mumps-lib="$MUMPS_extra_lib" --prefix=$1/PETSC --with-debugging=0" +echo "./configure COPTFLAGS="-O3 -g" CXXOPTFLAGS="-O3 -g" FOPTFLAGS="-O3 -g" --with-cxx-dialect=C++11 $petsc_openmp --with-mpi-dir=$mpi_dir $configure_options --with-mumps-lib="$MUMPS_extra_lib" --prefix=$1/PETSC --with-debugging=0" -./configure --with-cxx-dialect=C++11 $petsc_openmp --with-mpi-dir=$mpi_dir $configure_options --with-mumps-lib="$MUMPS_extra_lib" --prefix=$1/PETSC --with-debugging=0 +python2 configure COPTFLAGS="-O3 -g" CXXOPTFLAGS="-O3 -g" FOPTFLAGS="-O3 -g" --with-cxx-dialect=C++11 $petsc_openmp --with-mpi-dir=$mpi_dir $configure_options --with-mumps-lib="$MUMPS_extra_lib" --prefix=$1/PETSC --with-debugging=0 make all test make install diff --git a/script/install_Parmetis.sh b/script/install_Parmetis.sh index f1b425993..17cd3a99d 100755 --- a/script/install_Parmetis.sh +++ b/script/install_Parmetis.sh @@ -13,6 +13,18 @@ rm -rf parmetis-4.0.3 wget http://glaros.dtc.umn.edu/gkhome/fetch/sw/parmetis/parmetis-4.0.3.tar.gz tar -xf parmetis-4.0.3.tar.gz cd parmetis-4.0.3 +# Change to 64 bit parmetis + +if [ x"$platform" == x"osx" ]; then + sed_command=gsed +else + sed_command=sed +fi + +$sed_command -i "/#define\sIDXTYPEWIDTH\s32/c\#define IDXTYPEWIDTH 64" metis/include/metis.h + +sed #define IDXTYPEWIDTH 32 + make config prefix=$1/PARMETIS make -j $2 if [ $? -ne 0 ]; then diff --git a/script/install_SUITESPARSE.sh b/script/install_SUITESPARSE.sh index d2a4500f8..94ad89608 100755 --- a/script/install_SUITESPARSE.sh +++ b/script/install_SUITESPARSE.sh @@ -12,9 +12,9 @@ if [ -d "$1/SUITESPARSE" ]; then exit 0 fi -wget http://ppmcore.mpi-cbg.de/upload/SuiteSparse-4.4.5.tar.gz +wget http://ppmcore.mpi-cbg.de/upload/SuiteSparse-4.5.5.tar.gz rm -rf SuiteSparse -tar -xf SuiteSparse-4.4.5.tar.gz +tar -xf SuiteSparse-4.5.5.tar.gz if [ $? != 0 ]; then echo "Fail to download SuiteSparse" exit 1 @@ -26,10 +26,8 @@ cd SuiteSparse if [ x"$platform" = x"osx" ]; then # installation for OSX - sed -i "" -e "s|INSTALL_LIB = \/usr\/local\/lib|INSTALL_LIB = "$1"\/SUITESPARSE\/lib|" SuiteSparse_config/SuiteSparse_config_Mac.mk - sed -i "" -e "s|INSTALL_INCLUDE = \/usr\/local\/include|INSTALL_INCLUDE = "$1"\/SUITESPARSE\/include|" SuiteSparse_config/SuiteSparse_config_Mac.mk - sed -i "" -e "s| LAPACK = -llapack|LAPACK = |" SuiteSparse_config/SuiteSparse_config_Mac.mk - sed -i "" -e "s| BLAS = -lopenblas|BLAS = -L"$1"/OPENBLAS/lib -lopenblas|" SuiteSparse_config/SuiteSparse_config_Mac.mk +# sed -i "" -e "s| LAPACK = -llapack|LAPACK = |" SuiteSparse_config/SuiteSparse_config_Mac.mk +# sed -i "" -e "s| BLAS = -lopenblas|BLAS = -L"$1"/OPENBLAS/lib -lopenblas|" SuiteSparse_config/SuiteSparse_config_Mac.mk ### Overwrite SuiteSparse_config.mk @@ -37,34 +35,33 @@ if [ x"$platform" = x"osx" ]; then mv SuiteSparse_config/SuiteSparse_config_Mac.mk SuiteSparse_config/SuiteSparse_config.mk else + # Installation for linux if [ x"$CXX" == x"icpc" ]; then export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/$1/OPENBLAS/lib" - sed -i "/\sLIB\s=\s-lm\s-lrt/c\LIB = -shared-intel -lm -lrt -lifcore" SuiteSparse_config/SuiteSparse_config.mk - sed -i "/INSTALL_LIB\s=\s\/usr\/local\/lib/c\INSTALL_LIB = $1\/SUITESPARSE\/lib" SuiteSparse_config/SuiteSparse_config.mk - sed -i "/INSTALL_INCLUDE\s=\s\/usr\/local\/include/c\INSTALL_INCLUDE = $1\/SUITESPARSE\/include" SuiteSparse_config/SuiteSparse_config.mk - sed -i "/\sLAPACK\s=\s-llapack/c\LAPACK = " SuiteSparse_config/SuiteSparse_config.mk - sed -i "/\sBLAS\s=\s\-lopenblas/c\BLAS = -L$1/OPENBLAS/lib -lopenblas -lpthread" SuiteSparse_config/SuiteSparse_config.mk - else - sed -i "/INSTALL_LIB\s=\s\/usr\/local\/lib/c\INSTALL_LIB = $1\/SUITESPARSE\/lib" SuiteSparse_config/SuiteSparse_config.mk - sed -i "/INSTALL_INCLUDE\s=\s\/usr\/local\/include/c\INSTALL_INCLUDE = $1\/SUITESPARSE\/include" SuiteSparse_config/SuiteSparse_config.mk - sed -i "/\sLAPACK\s=\s-llapack/c\LAPACK = " SuiteSparse_config/SuiteSparse_config.mk - sed -i "/\sBLAS\s=\s\-lopenblas/c\BLAS = -L$1/OPENBLAS/lib -lopenblas -lpthread" SuiteSparse_config/SuiteSparse_config.mk + STS_LIB="-shared-intel -lrt -lifcore" fi +# sed -i "/\sLIB\s=\s-lm\s-lrt/c\LIB = -shared-intel -lm -lrt -lifcore" SuiteSparse_config/SuiteSparse_config.mk +# sed -i "/\sLAPACK\s=\s-llapack/c\LAPACK = " SuiteSparse_config/SuiteSparse_config.mk +# sed -i "/\sBLAS\s=\s\-lopenblas/c\BLAS = -L$1/OPENBLAS/lib -lopenblas -lpthread" SuiteSparse_config/SuiteSparse_config.mk +# else +# sed -i "/\sLAPACK\s=\s-llapack/c\LAPACK = " SuiteSparse_config/SuiteSparse_config.mk +# sed -i "/\sBLAS\s=\s\-lopenblas/c\BLAS = -L$1/OPENBLAS/lib -lopenblas -lpthread" SuiteSparse_config/SuiteSparse_config.mk +# fi fi export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$1/OPENBLAS/lib" -make +echo "Compiling SuiteSparse without CUDA (old variable $CUDA)" +make "CUDA=no" "BLAS=-L$1/OPENBLAS/lib -lopenblas" "LAPACK=" if [ $? != 0 ]; then echo "Fail to compile SuiteSparse" exit 1 fi -mkdir $1/SUITESPARSE -mkdir $1/SUITESPARSE/lib -mkdir $1/SUITESPARSE/include -make install +make install "CUDA=no" "INSTALL=$1/SUITESPARSE" "INSTALL_LIB=$1/SUITESPARSE/lib" "INSTALL_INCLUDE=$1/SUITESPARSE/include" "BLAS=-L$1/OPENBLAS/lib -lopenblas" "LAPACK=" +# Mark the installation +echo 1 > $1/SUITESPARSE/version rm -rf SuiteSparse -rm SuiteSparse-4.4.5.tar.gz +rm SuiteSparse-4.5.5.tar.gz diff --git a/script/remove_old b/script/remove_old index 1159c8654..4d9e78f4d 100755 --- a/script/remove_old +++ b/script/remove_old @@ -117,12 +117,71 @@ function remove_old() fi fi + if [ -d $1/TRILINOS ]; then + version=$(cat $1/TRILINOS/version) + if [ x"$version" != x"1" ]; then + echo -e "\033[1;34;5m ------------------------------------------------------------------------------------------- \033[0m" + echo -e "\033[1;34;5m Trilinos has been updated to version 12.10.1, the component will be updated automatically \033[0m" + echo -e "\033[1;34;5m ------------------------------------------------------------------------------------------- \033[0m" + sleep 5 + rm -rf $1/TRILINOS + rm -rf $1/PETSC + fi + fi + + if [ -d $1/SUITESPARSE ]; then + version=$(cat $1/SUITESPARSE/version) + if [ x"$version" != x"1" ]; then + echo -e "\033[1;34;5m ------------------------------------------------------------------------------------------- \033[0m" + echo -e "\033[1;34;5m SuiteSparse has been updated to version 4.5.5, the component will be updated automatically \033[0m" + echo -e "\033[1;34;5m ------------------------------------------------------------------------------------------- \033[0m" + sleep 5 + rm -rf $1/SUITESPARSE + rm -rf $1/PETSC + fi + fi + + if [ -d $1/SUPERLU_DIST ]; then + version=$(cat $1/SUPERLU_DIST/version) + if [ x"$version" != x"1" ]; then + echo -e "\033[1;34;5m ---------------------------------------------------------------------------------------------------------- \033[0m" + echo -e "\033[1;34;5m SuperLU (Distributed) has been updated to version 5.2.1, the component will be updated automatically \033[0m" + echo -e "\033[1;34;5m ---------------------------------------------------------------------------------------------------------- \033[0m" + sleep 5 + rm -rf $1/SUPERLU_DIST + rm -rf $1/PETSC + fi + fi + + if [ -d $1/HYPRE ]; then + version=$(cat $1/HYPRE/version) + if [ x"$version" != x"1" ]; then + echo -e "\033[1;34;5m ------------------------------------------------------------------------------------------- \033[0m" + echo -e "\033[1;34;5m HYPRE has been updated to version 2.11.2, the component will be updated automatically \033[0m" + echo -e "\033[1;34;5m ------------------------------------------------------------------------------------------- \033[0m" + sleep 5 + rm -rf $1/HYPRE + rm -rf $1/PETSC + fi + fi + + if [ -d $1/PETSC ]; then + version=$(cat $1/PETSC/version) + if [ x"$version" != x"1" ]; then + echo -e "\033[1;34;5m -------------------------------------------------------------------------------------- \033[0m" + echo -e "\033[1;34;5m PETSC has been updated to version 3.7.6, the component will be updated automatically \033[0m" + echo -e "\033[1;34;5m -------------------------------------------------------------------------------------- \033[0m" + sleep 5 + rm -rf $1/PETSC + fi + fi + if [ -d $1/MPI ]; then version=$(cat $1/MPI/version) - if [ x"$version" != x"1" ]; then - echo -e "\033[1;34;5m ---------------------------------------------------------------------- \033[0m" - echo -e "\033[1;34;5m MPI has been updated, the component will be updated automatically \033[0m" - echo -e "\033[1;34;5m ---------------------------------------------------------------------- \033[0m" + if [ x"$version" != x"2" ]; then + echo -e "\033[1;34;5m -------------------------------------------------------------------------------------- \033[0m" + echo -e "\033[1;34;5m MPI has been updated to version 2.1.1, the component will be updated automatically \033[0m" + echo -e "\033[1;34;5m -------------------------------------------------------------------------------------- \033[0m" sleep 5 rm -rf $1/MPI/include rm -rf $1/MPI/lib @@ -132,9 +191,16 @@ function remove_old() rm -rf $1/MPI rm -rf $1/HDF5 + rm -rf $1/PARMETIS + rm -rf $1/PETSC + rm -rf $1/TRILINOS + rm -rf $1/HYPRE + rm -rf $1/MUMPS + rm -rf $1/SUPERLU_DIST fi fi + if [ -d $1/EIGEN ]; then version=$(cat $1/EIGEN/version) if [ x"$version" != x"1" ]; then diff --git a/script/show_solutions b/script/show_solutions index 74b1c333e..aaa14302e 100755 --- a/script/show_solutions +++ b/script/show_solutions @@ -35,3 +35,32 @@ function possible_solutions { possible_solutions_command=${commands[$possible_solutions_ret]} } +function possible_solutions_no_continue { + + if [ $sq -eq 1 ]; then + return + fi + + sol=1 + echo "Possible solutions:" + for com in "$@" + do + echo "$sol $com" + sol=`expr $sol + 1` + done + echo "$sol exit the script" + echo -e "\033[1;34;5mChoose the solution:\033[0m" + read choose + if [ x"$choose" = x"$sol" ]; then + exit 1 + fi + possible_solutions_ret=`expr $choose - 1` + echo "Executing: ${command[$possible_solutions_ret]}" + if [ -a input_install ]; then + eval ${commands[$possible_solutions_ret]} < input_install + else + eval ${commands[$possible_solutions_ret]} + fi + possible_solutions_command=${commands[$possible_solutions_ret]} +} + diff --git a/src/Grid/grid_dist_id.hpp b/src/Grid/grid_dist_id.hpp index 0c48616d6..d78cd80d1 100644 --- a/src/Grid/grid_dist_id.hpp +++ b/src/Grid/grid_dist_id.hpp @@ -1491,7 +1491,7 @@ public: Point<dim,St> offset = getOffset(i); vtk_g.add(loc_grid.get(i),offset,cd_sm.getCellBox().getP2(),gdb_ext.get(i).Dbox); } - vtk_g.write(output + "_" + std::to_string(v_cl.getProcessUnitID()) + "_" + std::to_string(i) + ".vtk","grids",ft); + vtk_g.write(output + "_" + std::to_string(v_cl.getProcessUnitID()) + "_" + std::to_string(i) + ".vtk",prp_names,"grids",ft); return true; } diff --git a/src/Vector/vector_dist.hpp b/src/Vector/vector_dist.hpp index 9e291e5d9..84cc89cda 100644 --- a/src/Vector/vector_dist.hpp +++ b/src/Vector/vector_dist.hpp @@ -844,7 +844,7 @@ public: #ifdef SE_CLASS1 if ((opt & BIND_DEC_TO_GHOST)) { - if (ghost.getLow(dim-1) == 0.0) + if (getDecomposition().getGhost().getLow(dim-1) == 0.0) { std::cerr << __FILE__ << ":" << __LINE__ << " Error the vector has been constructed without BIND_DEC_TO_GHOST, If you construct a vector without BIND_DEC_TO_GHOST the ghost must be full without reductions " << std::endl; ACTION_ON_ERROR(VECTOR_DIST_ERROR_OBJECT); -- GitLab