Commit b17c3010 authored by MIJIEUX Thomas's avatar MIJIEUX Thomas

Add check for nb mvp done are positive during one restart

infinite loop was possible when enough space for restart but not for first iteration
parent f8be2c67
......@@ -7,8 +7,8 @@ project(fabulous C CXX Fortran)
#Trouver un moyen de tester que le compilateur support la norme 2011
#(regarder éventuellement Simgrid/boost etc)
set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wextra")
set(CMAKE_C_FLAGS "-std=c99 -Wall -Wextra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Wall -Wextra")
#Ajout à la liste des repertoires dans lesquels CMAKE cherche ses modules.
set(MORSE_CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/morse_cmake/modules/")
......@@ -16,8 +16,8 @@ list(APPEND CMAKE_MODULE_PATH "${MORSE_CMAKE_MODULE_PATH}")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/")
include(MorseInit)
find_package(CBLAS REQUIRED COMPONENTS BLASEXT REQUIRED)
find_package(LAPACKE REQUIRED COMPONENTS LAPACKEXT REQUIRED)
find_package(CBLAS REQUIRED COMPONENTS BLASEXT)
find_package(LAPACKE REQUIRED COMPONENTS LAPACKEXT)
find_package(Sanitizers)
include_directories(${CBLAS_INCLUDE_DIRS})
......@@ -42,9 +42,9 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
endif()
option(FABULOUS_DEBUG_MODE "Set to On to compile with debug info" OFF)
option(FABULOUS_BUILD_SHARED_LIBS "Build shared libraries" OFF)
option(FABULOUS_BUILD_DOC "Set to ON to build the Doxygen documentation " OFF )
option(FABULOUS_LAPACKE_NANCHECK "Set to ON to use top level LAPACKE interface " OFF )
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
if (FABULOUS_LAPACKE_NANCHECK)
add_definitions( -DFABULOUS_LAPACKE_NANCHECK )
......
......@@ -64,6 +64,9 @@ done
#+end_src
*** plot the graphic
This graphic seems to indicate than a larger restart parameter help to speed up the convergence
(but this is not necessarily true, a collection of references in IB-BGMRES-DR,
Section 4.5, show that the contrary is possible)
#+begin_src R :results output graphics :file (org-babel-temp-file "figure" ".png") :exports both :width 600 :height 400 :session *R*
library(ggplot2)
df <- read.table("./build/src/data/res/r=200.res", header=T)
......@@ -82,18 +85,17 @@ ggplot(df, aes(x=nb_mvp, y=maxRes, color=name)) +
#+begin_src sh :session *TEST* :results silent
cd ${WORKDIR}/build/src/test_core/
mkdir -p ../data/res
./testMatrixMarketChoice -t BLOCK -s CGS -m 900 -A STDDR -u -o "Basic_GELS"
./testMatrixMarketChoice -t BLOCK -s CGS -m 900 -A QR -u -o "QR_factorization"
./testMatrixMarketChoice -t BLOCK -s CGS -m 900 -A STDDR -u -o "Full_GELS"
./testMatrixMarketChoice -t BLOCK -s CGS -m 900 -A QR -u -o "GELS_with_Incremental_QR_factorization"
#+end_src
*** plot the graphic
#+begin_src R :results output graphics :file (org-babel-temp-file "figure" ".png") :exports both :width 600 :height 400 :session *R*
library(ggplot2)
df <- read.table("./build/src/data/res/Basic_GELS.res", header=T)
df <- rbind(df, read.table("./build/src/data/res/QR_factorization.res", header=T))
df <- read.table("./build/src/data/res/Full_GELS.res", header=T)
df <- rbind(df, read.table("./build/src/data/res/GELS_with_Incremental_QR_factorization.res", header=T))
ggplot(df, aes(x=global_iteration, y=least_square_time, color=name)) +
geom_line() + ggtitle("Least Square duration (young1c)")
#+end_src
** Influence of the Algorithm
*** run test case
#+begin_src sh :session *TEST* :results silent
......@@ -117,7 +119,6 @@ ggplot(df, aes(x=nb_mvp)) +
scale_y_log10() +
ggtitle("coneSphere problem with CGS RUHE (STD, STD+DR and IB algorithm)")
#+end_src
** young1c (nrhs=6, m=90, k=5)
*** run test case
#+begin_src sh :session *TEST* :results silent
......@@ -130,6 +131,14 @@ mkdir -p ../data/res
./testMatrixMarketChoice -n 6 -t RUHE -s MGS -m 90 -e 1e-6 -A IBDR -r DEFLATED -p 5 -u -o "IB-BGMRES-DR"
#+end_src
*** plot the graphic
In this experience, I try to mimic the parameters of section 4.2, example 8.
The experience results are different because the right hand side are generated randomly
with different random number generator, the kernels used may be different and some
algorithms may differ a little.
For IB versions, the algorithms do differ:
the experience presented here implement an extension computing 'Inexact breakdown on R0',
while the result presented in the article do not (Figure 2, Example 8, left side)
#+begin_src R :results output graphics :file (org-babel-temp-file "figure" ".png") :exports both :width 600 :height 400 :session *R*
library(ggplot2)
library(latex2exp)
......
......@@ -191,14 +191,19 @@ public:
int size_to_span = std::min(max_krylov_space_size, max_mvp-_mvp);
size_to_span = std::max(size_to_span, nbRHS);
print_iteration_start_info(size_to_span);
if (nbRHS + nb_eigen_pair > size_to_span)
if (nbRHS + nb_eigen_pair > size_to_span) {
break;
}
using Arnoldi = typename Algo::template algo<S>;
Arnoldi arnoldi{_logger, restarter, dim, nbRHS, size_to_span};
convergence = arnoldi.run( A, X, B, size_to_span, epsilon,
restarter, ortho );
_nb_iteration += arnoldi.get_nb_iteration();
_mvp += arnoldi.get_nb_mvp();
int mvp = arnoldi.get_nb_mvp();
_mvp += mvp;
if (mvp == 0) {
break;
}
++ _nb_restart;
print_iteration_end_info(arnoldi.get_krylov_space_size());
}
......
......@@ -246,7 +246,7 @@ public:
bool convergence = initial_iteration(A, X, B, epsilon, restarter);
while (!convergence && // Main Loop
_size_krylov_space + _nbRHS < max_krylov_space_size)
_size_krylov_space + _nbRHS <= max_krylov_space_size)
{
++ _iteration_count;
_logger.notify_iteration_begin(_iteration_count, _size_krylov_space);
......
......@@ -421,7 +421,7 @@ public:
bool convergence = initial_iteration(A, X, B, epsilon, inv_epsilon);
while (!convergence && // Main Loop
_size_krylov_space + _nb_direction_kept < max_krylov_space_size)
_size_krylov_space + _nb_direction_kept <= max_krylov_space_size)
{
++ _iteration_count;
_logger.notify_iteration_begin(_iteration_count, _size_krylov_space);
......
......@@ -434,7 +434,7 @@ public:
bool convergence = initial_iteration(A, X, B, restarter, epsilon, inv_epsilon);
while (!convergence && // Main Loop
_size_krylov_space+_nb_direction_kept < max_krylov_space_size)
_size_krylov_space+_nb_direction_kept <= max_krylov_space_size)
{
++ _iteration_count;
_logger.notify_iteration_begin(_iteration_count, _size_krylov_space);
......
......@@ -9,12 +9,7 @@ set(FABULOUS_SRC
${FABULOUS_HEADERS}
)
if(FABULOUS_BUILD_SHARED_LIBS)
add_library(fabulous SHARED ${FABULOUS_SRC})
else()
add_library(fabulous STATIC ${FABULOUS_SRC})
endif()
add_library(fabulous ${FABULOUS_SRC})
target_link_libraries(
fabulous
......
......@@ -17,12 +17,13 @@ int main(int argc, char *argv[])
nbRHS = std::stoi(args[1]);
if (args.size()>2)
nbBlock = std::stoi(args[2]);
max_space = nbRHS*nbBlock;
int dim = nbRHS*nbBlock;
max_space = dim+nbRHS;
if (args.size()>3)
max_space = std::stoi(args[3]);
int dim = nbBlock*nbRHS;
using Primary = double;
using Scalar = std::complex<Primary>;
using Matrix = UserInputMatrix<Scalar>;
......
......@@ -26,7 +26,7 @@ int main(int argc, char *argv[])
miwl.LoadMatrix(mat, "../data/matrices_BEM/MatconeSpherePC_MAIN_MAIN_0");
int dim = mat.size();
int max_ite = 10000;
int max_mvp = 10000;
int max_space = 600;
int nb_eigen_pair = 5;
......@@ -43,13 +43,12 @@ int main(int argc, char *argv[])
// for (int i = 0; i < nbRHS; ++i)
// XExact.at(i, i) = S{1.0};
// mat.MatBlockVect(XExact, RHS);
//mat.display_first_block(nbRHS);
// mat.display_first_block(nbRHS);
auto r1 = run_test_BGMRES_filelog(
"STD",
mat, RHS, XExact, epsilon,
arnoldi_std(), max_ite, max_space,
arnoldi_std(), max_mvp, max_space,
orthogonalization() + OrthoScheme::CGS + OrthoType::RUHE,
classic_restart(), false
);
......@@ -57,7 +56,7 @@ int main(int argc, char *argv[])
auto r2 = run_test_BGMRES_filelog(
"STD+DR",
mat, RHS, XExact, epsilon,
arnoldi_std(), max_ite, max_space,
arnoldi_std(), max_mvp, max_space,
orthogonalization() + OrthoScheme::CGS + OrthoType::RUHE,
deflated_restart(nb_eigen_pair, S{0.0}), false
);
......@@ -65,7 +64,7 @@ int main(int argc, char *argv[])
auto r3 = run_test_BGMRES_filelog(
"IB",
mat, RHS, XExact, epsilon,
arnoldi_ib(), max_ite, max_space,
arnoldi_ib(), max_mvp, max_space,
orthogonalization() + OrthoScheme::CGS + OrthoType::RUHE,
classic_restart(), false
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment