From 4e6660978ba8f615b436b34430b942c089b7281c Mon Sep 17 00:00:00 2001 From: Pietro Incardona <incardon@mpi-cbg.de> Date: Sat, 21 Oct 2017 22:15:11 +0200 Subject: [PATCH] Small fix for Metis installation --- example/Grid/3_gray_scott/main.cpp | 2 +- example/Grid/3_gray_scott_3d/main.cpp | 65 ++++++++++++------- install | 4 +- script/detect_gcc | 2 +- .../grid_dist_id_iterators_unit_tests.hpp | 8 +++ 5 files changed, 53 insertions(+), 28 deletions(-) diff --git a/example/Grid/3_gray_scott/main.cpp b/example/Grid/3_gray_scott/main.cpp index c7d1f6b79..b597d5ef0 100644 --- a/example/Grid/3_gray_scott/main.cpp +++ b/example/Grid/3_gray_scott/main.cpp @@ -321,7 +321,7 @@ int main(int argc, char* argv[]) // visualization if (i % 100 == 0) { - Old.write("output",count); + Old.write_frame("output",count); count++; } } diff --git a/example/Grid/3_gray_scott_3d/main.cpp b/example/Grid/3_gray_scott_3d/main.cpp index eab4ebc8d..88e814cba 100644 --- a/example/Grid/3_gray_scott_3d/main.cpp +++ b/example/Grid/3_gray_scott_3d/main.cpp @@ -107,8 +107,8 @@ int main(int argc, char* argv[]) size_t timeSteps = 5000; // K and F (Physical constant in the equation) - double K = 0.014; - double F = 0.053; + double K = 0.053; + double F = 0.014; //! \cond [init lib] \endcond @@ -149,41 +149,58 @@ int main(int argc, char* argv[]) timer tot_sim; tot_sim.start(); + static grid_key_dx<3> star_stencil_3D[7] = {{0,0,0}, + {0,0,-1}, + {0,0,1}, + {0,-1,0}, + {0,1,0}, + {-1,0,0}, + {1,0,0}}; + for (size_t i = 0; i < timeSteps; ++i) { if (i % 300 == 0) std::cout << "STEP: " << i << std::endl; - auto it = Old.getDomainIterator(); + auto it = Old.getDomainIteratorStencil(star_stencil_3D); while (it.isNext()) { - auto key = it.get(); + // center point + auto Cp = it.getStencil<0>(); + + // plus,minus X,Y,Z + auto mx = it.getStencil<1>(); + auto px = it.getStencil<2>(); + auto my = it.getStencil<3>(); + auto py = it.getStencil<4>(); + auto mz = it.getStencil<5>(); + auto pz = it.getStencil<6>(); // update based on Eq 2 - New.get<U>(key) = Old.get<U>(key) + uFactor * ( - Old.get<U>(key.move(x,1)) + - Old.get<U>(key.move(x,-1)) + - Old.get<U>(key.move(y,1)) + - Old.get<U>(key.move(y,-1)) + - Old.get<U>(key.move(z,1)) + - Old.get<U>(key.move(z,-1)) - - 6.0*Old.get<U>(key)) + - - deltaT * Old.get<U>(key) * Old.get<V>(key) * Old.get<V>(key) + - - deltaT * F * (Old.get<U>(key) - 1.0); + New.get<U>(Cp) = Old.get<U>(Cp) + uFactor * ( + Old.get<U>(mz) + + Old.get<U>(pz) + + Old.get<U>(my) + + Old.get<U>(py) + + Old.get<U>(mx) + + Old.get<U>(px) - + 6.0*Old.get<U>(Cp)) + + - deltaT * Old.get<U>(Cp) * Old.get<V>(Cp) * Old.get<V>(Cp) + + - deltaT * F * (Old.get<U>(Cp) - 1.0); // update based on Eq 2 - New.get<V>(key) = Old.get<V>(key) + vFactor * ( - Old.get<V>(key.move(x,1)) + - Old.get<V>(key.move(x,-1)) + - Old.get<V>(key.move(y,1)) + - Old.get<V>(key.move(y,-1)) + - Old.get<V>(key.move(z,1)) + - Old.get<V>(key.move(z,-1)) - - 6*Old.get<V>(key)) + - deltaT * Old.get<U>(key) * Old.get<V>(key) * Old.get<V>(key) + - - deltaT * (F+K) * Old.get<V>(key); + New.get<V>(Cp) = Old.get<V>(Cp) + vFactor * ( + Old.get<V>(mz) + + Old.get<V>(pz) + + Old.get<V>(my) + + Old.get<V>(py) + + Old.get<V>(mx) + + Old.get<V>(px) - + 6*Old.get<V>(Cp)) + + deltaT * Old.get<U>(Cp) * Old.get<V>(Cp) * Old.get<V>(Cp) + + - deltaT * (F+K) * Old.get<V>(Cp); // Next point in the grid ++it; diff --git a/install b/install index 699235374..a96a564ea 100755 --- a/install +++ b/install @@ -296,7 +296,7 @@ set_mpi $i_dir $ncore $CC $CXX $F77 $FC ./script/install_Parmetis.sh $i_dir $ncore configure_options=" $configure_options --with-parmetis=$i_dir/PARMETIS " -./script/install_Metis.sh $i_dir $compiler_gcc $compiler_gpp $ncore +./script/install_Metis.sh $i_dir $CC $CXX $ncore configure_options=" $configure_options --with-metis=$i_dir/METIS " MPI_installed=0 @@ -343,7 +343,7 @@ else echo "Error the installation of METIS failed" exit 1 fi - ./script/install_Metis.sh $i_dir $compiler_gcc $compiler_gpp + ./script/install_Metis.sh $i_dir $CC $CXX METIS_installed=1 configure_options=" $configure_options --with-metis=$i_dir/METIS " elif [ $conf_err -eq 202 ]; then diff --git a/script/detect_gcc b/script/detect_gcc index 591ec6871..14383febf 100755 --- a/script/detect_gcc +++ b/script/detect_gcc @@ -193,7 +193,7 @@ function detect_compiler() dgc_ret=1 icpc_found=1 elif [ $dgc_major -lt 17 ]; then - echo -e "icpc $dgc_major.$dgc_middle.$dgc_minor \033[91;5;1m FAILED \033[0m your icpc version is too old intel 16.0.2 at least required" + echo -e "icpc $dgc_major.$dgc_middle.$dgc_minor \033[91;5;1m FAILED \033[0m your icpc version is too old intel 17.0.X at least required" dgc_ret=0 icpc_found=0 elif [ $dgc_middle -gt 0 ]; then diff --git a/src/Grid/Iterators/grid_dist_id_iterators_unit_tests.hpp b/src/Grid/Iterators/grid_dist_id_iterators_unit_tests.hpp index f955e062d..bab53f284 100644 --- a/src/Grid/Iterators/grid_dist_id_iterators_unit_tests.hpp +++ b/src/Grid/Iterators/grid_dist_id_iterators_unit_tests.hpp @@ -344,6 +344,8 @@ void Test3D_stencil(const Box<3,float> & domain, long int k) while (st_it.isNext()) { + auto key = st_it.get(); + // center point auto Cp = st_it.getStencil<0>(); @@ -365,6 +367,12 @@ void Test3D_stencil(const Box<3,float> & domain, long int k) ret &= (sum == 0); + // get the local grid info + + grid_sm<3,void> info = g_dist.get_loc_grid(key.getSub()).getGrid(); + + ret &= info.LinId(key.getKey()) == (long int)Cp.getKey(); + ++st_it; } -- GitLab