diff --git a/modules/plugins/hypre/test/AlienTestModule.cc b/modules/plugins/hypre/test/AlienTestModule.cc index 282c53a..2b5549b 100644 --- a/modules/plugins/hypre/test/AlienTestModule.cc +++ b/modules/plugins/hypre/test/AlienTestModule.cc @@ -1,6 +1,6 @@ #include -#include +#include #include #include @@ -320,7 +320,7 @@ AlienTestModule::test() for (Integer loop = 0; loop < options()->repeatLoop(); ++loop) { info() << "Filling #" << loop; Alien::DirectMatrixBuilder builder( - std::move(matrixA), Alien::DirectMatrixOptions::eResetValues); + matrixA, Alien::DirectMatrixOptions::eResetValues); if (loop == 0) { profile_stat.start(); builder.reserve(indexSetU.getOwnIndexes(), 30); @@ -342,17 +342,15 @@ AlienTestModule::test() .finalize(); // process extra work after filling (squeeze, non-local...) // optional if used with out-of-scope dtor inserter_stats.back().stop(); - matrixA = builder.release(); } } break; case AlienTestOptionTypes::ProfiledBuilder: { profile_stat.start(); { - Alien::MatrixProfiler profiler(std::move(matrixA)); + Alien::MatrixProfiler profiler(matrixA); profileMatrix( cell_cell_connection, areaP, allPIndex, allUIndex, allXIndex, profiler); profiler.allocate(); // optional if used with out-of-scope dtor - matrixA = profiler.release(); } profile_stat.stop(); @@ -364,14 +362,12 @@ AlienTestModule::test() } else if (m_vect_size == 1) { Alien::ProfiledMatrixBuilder builder( - std::move(matrixA), Alien::ProfiledMatrixOptions::eResetValues); + matrixA, Alien::ProfiledMatrixOptions::eResetValues); fillInMatrix( cell_cell_connection, areaP, allPIndex, allUIndex, allXIndex, builder); builder .finalize(); // process extra work after filling (squeeze, non-local...) // optional if used with out-of-scope dtor - matrixA = builder.release(); - { SimpleCSRLinearAlgebra alg; Alien::VectorData vectorR(space, m_vdist); @@ -382,13 +378,12 @@ AlienTestModule::test() info() << "CSR RES : " << res; } } else if (m_vect_size > 1) { - Alien::ProfiledBlockMatrixBuilder builder(std::move(matrixA), + Alien::ProfiledBlockMatrixBuilder builder(matrixA, Alien::ProfiledBlockMatrixBuilderOptions::eResetValues); profiledFillInMatrix( cell_cell_connection, areaP, allPIndex, allUIndex, allXIndex, builder); builder .finalize(); // process extra work after filling (squeeze, non-local...) - matrixA = builder.release(); } inserter_stats.back().stop(); } @@ -512,7 +507,7 @@ void AlienTestModule::buildAndFillInBlockVector(Alien::VectorData& vectorB, ConstArrayView allXIndex, ConstArrayView value) { - Alien::LocalBlockVectorWriter b(std::move(vectorB)); + Alien::LocalBlockVectorWriter b(vectorB); ENUMERATE_CELL (icell, m_areaT.own()) { const Integer id = allXIndex[icell->localId()]; b[id][0] = value[0]; @@ -523,7 +518,6 @@ AlienTestModule::buildAndFillInBlockVector(Alien::VectorData& vectorB, for (Integer i = 1; i < value.size(); ++i) b[id][i] = value[i]; } - vectorB = b.release(); } void @@ -531,7 +525,7 @@ AlienTestModule::buildAndFillInBlockVector(Alien::VectorData& vectorB, ConstArrayView allUIndex, ConstArray2View allPIndex, ConstArrayView allXIndex ALIEN_UNUSED_PARAM, ConstArrayView value) { - Alien::LocalBlockVectorWriter b(std::move(vectorB)); + Alien::LocalBlockVectorWriter b(vectorB); ENUMERATE_CELL (icell, m_areaT.own()) { const Integer id = allUIndex[icell->localId()]; b[id][0] = value[0]; @@ -549,18 +543,16 @@ AlienTestModule::buildAndFillInBlockVector(Alien::VectorData& vectorB, const Integer id1 = allPIndex[inode->localId()][1]; b[id1][0] = value[0]; } - vectorB = b.release(); } void AlienTestModule::buildAndFillInVector(Alien::VectorData& vectorB, const double& value) { const Alien::VectorDistribution& dist = vectorB.distribution(); - Alien::LocalVectorWriter v(std::move(vectorB)); + Alien::LocalVectorWriter v(vectorB); info() << "Vector local size= " << v.size(); for (Integer i = 0; i < dist.localSize(); ++i) v[i] = value; - vectorB = v.release(); } void @@ -569,13 +561,12 @@ AlienTestModule::buildAndFillInBlockVector( { const Alien::VectorDistribution& dist = vectorB.distribution(); const Alien::Block* block = vectorB.block(); - Alien::LocalBlockVectorWriter v(std::move(vectorB)); + Alien::LocalBlockVectorWriter v(vectorB); for (Integer i = 0; i < dist.localSize(); ++i) { ArrayView values = v[i]; for (Integer j = 0; j < block->size(); ++j) values[j] = value; } - vectorB = v.release(); } /*---------------------------------------------------------------------------*/ @@ -708,10 +699,9 @@ AlienTestModule::solve(Alien::ILinearSolver* solver, Alien::MatrixData& matrixA, AlienTestOptionTypes::eBuilderType builderType) { { // Réinitialisation de vectorX - Alien::LocalVectorWriter v(std::move(vectorX)); + Alien::LocalVectorWriter v(vectorX); for (Integer i = 0; i < v.size(); ++i) v[i] = 0; - vectorX = v.release(); } solver->solve(matrixA, vectorB, vectorX); @@ -812,7 +802,6 @@ AlienTestModule::vectorVariableUpdate(Alien::VectorData& vectorB, // // VECTOR / VARIABLE // - // jmg Alien::ItemVectorAccessor v(std::move(vectorB)); { Alien::ArcaneTools::ItemVectorAccessor v(vectorB); if (m_vect_size == 1) { @@ -828,7 +817,6 @@ AlienTestModule::vectorVariableUpdate(Alien::VectorData& vectorB, v(indexSetU) = 0.; v(indexSetU) = Alien::ArcaneTools::Variable(m_w); } - // jmg vectorB = v.release(); } } diff --git a/test/AlienTest/AlienTestModule.cc b/test/AlienTest/AlienTestModule.cc index 7c804f2..1a5dff7 100644 --- a/test/AlienTest/AlienTestModule.cc +++ b/test/AlienTest/AlienTestModule.cc @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -23,18 +24,10 @@ #include -#include -#include -#include -#include #include #include #include #include -#include -#include -#include -#include #include #ifdef ALIEN_USE_PETSC #include @@ -219,8 +212,8 @@ AlienTestModule::test() Alien::ArcaneTools::createIndexSet(space, &index_manager, "P", traceMng()); Alien::ArcaneTools::createIndexSet(space, &index_manager, "Q", traceMng()); - Alien::Move::VectorData vectorB(space, m_vdist); - Alien::Move::VectorData vectorX(space, m_vdist); + Alien::VectorData vectorB(space, m_vdist); + Alien::VectorData vectorX(space, m_vdist); std::unique_ptr block_builder(nullptr); std::unique_ptr vblock(nullptr); @@ -326,7 +319,7 @@ AlienTestModule::test() Arcane::XmlNode rootXmlBuilderNode = options()->builder.rootElement(); Arcane::XmlNodeList builderNodeList = rootXmlBuilderNode.children("builder"); - Alien::Move::MatrixData matrixA(space, m_mdist); // local matrix for exact measure without + Alien::MatrixData matrixA(space, m_mdist); // local matrix for exact measure without // side effect (however, you can reuse a // matrix with several builder) if (m_vect_size == 0) { @@ -359,8 +352,8 @@ AlienTestModule::test() if (m_vect_size == 1) for (Integer loop = 0; loop < options()->repeatLoop(); ++loop) { info() << "Filling #" << loop; - Alien::Move::DirectMatrixBuilder builder( - std::move(matrixA), Alien::DirectMatrixOptions::eResetValues); + Alien::DirectMatrixBuilder builder( + matrixA, Alien::DirectMatrixOptions::eResetValues); if (loop == 0) { profile_stat.start(); builder.reserve(indexSetU.getOwnIndexes(), 30); @@ -382,17 +375,15 @@ AlienTestModule::test() .finalize(); // process extra work after filling (squeeze, non-local...) // optional if used with out-of-scope dtor inserter_stats.back().stop(); - matrixA = builder.release(); } } break; case AlienTestOptionTypes::ProfiledBuilder: { profile_stat.start(); { - Alien::Move::MatrixProfiler profiler(std::move(matrixA)); + Alien::MatrixProfiler profiler(matrixA); profileMatrix( cell_cell_connection, areaP, allPIndex, allUIndex, allXIndex, profiler); profiler.allocate(); // optional if used with out-of-scope dtor - matrixA = profiler.release(); } profile_stat.stop(); @@ -403,18 +394,17 @@ AlienTestModule::test() if (m_vect_size == 0) { } else if (m_vect_size == 1) { - Alien::Move::ProfiledMatrixBuilder builder( - std::move(matrixA), Alien::ProfiledMatrixOptions::eResetValues); + Alien::ProfiledMatrixBuilder builder( + matrixA, Alien::ProfiledMatrixOptions::eResetValues); fillInMatrix( cell_cell_connection, areaP, allPIndex, allUIndex, allXIndex, builder); builder .finalize(); // process extra work after filling (squeeze, non-local...) // optional if used with out-of-scope dtor - matrixA = builder.release(); { SimpleCSRLinearAlgebra alg; - Alien::Move::VectorData vectorR(space, m_vdist); + Alien::VectorData vectorR(space, m_vdist); vectorR.setBlockInfos(vectorX.block()); alg.mult(matrixA, vectorX, vectorR); alg.axpy(-1., vectorB, vectorR); @@ -424,7 +414,7 @@ AlienTestModule::test() #ifdef ALIEN_USE_MTL4 if (m_parallel_mng->commSize() == 1) { Alien::MTLLinearAlgebra alg; - Alien::Move::VectorData vectorR(space, m_vdist); + Alien::VectorData vectorR(space, m_vdist); vectorR.setBlockInfos(vectorX.block()); alg.mult(matrixA, vectorX, vectorR); alg.axpy(-1., vectorB, vectorR); @@ -433,13 +423,12 @@ AlienTestModule::test() } #endif } else if (m_vect_size > 1) { - Alien::Move::ProfiledBlockMatrixBuilder builder(std::move(matrixA), + Alien::ProfiledBlockMatrixBuilder builder(matrixA, Alien::ProfiledBlockMatrixBuilderOptions::eResetValues); profiledFillInMatrix( cell_cell_connection, areaP, allPIndex, allUIndex, allXIndex, builder); builder .finalize(); // process extra work after filling (squeeze, non-local...) - matrixA = builder.release(); } inserter_stats.back().stop(); } @@ -451,8 +440,6 @@ AlienTestModule::test() profile_stat.start(); if(m_vect_size==0) { - //jmg Alien::StreamBlockMatrixBuilder stream_builder(std::move(matrixA), - block_builder.get()); Alien::StreamBlockMatrixBuilder stream_builder(matrixA, block_builder.get()); // stream_builder.init() ; // optional : already done by ctor (only used by multiple usage of MatrixBuilder) @@ -477,7 +464,6 @@ AlienTestModule::test() // NOT optional ! (since this object is usually used in a loop) inserter_stats.back().stop(); } - //jmg matrixA = stream_builder.release(); } else if(m_vect_size==1) { @@ -505,7 +491,6 @@ AlienTestModule::test() // NOT optional ! (since this object is usually used in a loop) inserter_stats.back().stop(); } - //matrixA = stream_builder.release(); } else if(m_vect_size>1) { @@ -533,7 +518,6 @@ AlienTestModule::test() // NOT optional ! (since this object is usually used in a loop) inserter_stats.back().stop(); } - //matrixA = stream_builder.release(); } // stream_builder.end(); // optional : already done by dtor @@ -556,8 +540,8 @@ AlienTestModule::test() if (m_vect_size == 0) { Alien::SimpleCSRLinearAlgebra testAlg; - Alien::Move::VectorData vectorY(space, m_vdist); - Alien::Move::VectorData vectorRes(space, m_vdist); + Alien::VectorData vectorY(space, m_vdist); + Alien::VectorData vectorRes(space, m_vdist); vectorY.setBlockInfos(vectorX.block()); vectorRes.setBlockInfos(vectorX.block()); @@ -599,7 +583,7 @@ AlienTestModule::test() if (status.succeeded && options()->builder[ibuilder] != AlienTestOptionTypes::DirectBuilder) { SimpleCSRLinearAlgebra alg; - Alien::Move::VectorData vectorR(space, m_vdist); + Alien::VectorData vectorR(space, m_vdist); vectorR.setBlockInfos(vectorX.block()); alg.mult(matrixA, vectorX, vectorR); alg.axpy(-1., vectorB, vectorR); @@ -658,10 +642,10 @@ AlienTestModule::test() /*---------------------------------------------------------------------------*/ void -AlienTestModule::buildAndFillInBlockVector(Alien::Move::VectorData& vectorB, +AlienTestModule::buildAndFillInBlockVector(Alien::VectorData& vectorB, ConstArrayView allXIndex, ConstArrayView value) { - Alien::Move::LocalBlockVectorWriter b(std::move(vectorB)); + Alien::LocalBlockVectorWriter b(vectorB); ENUMERATE_CELL (icell, m_areaT.own()) { const Integer id = allXIndex[icell->localId()]; b[id][0] = value[0]; @@ -672,15 +656,14 @@ AlienTestModule::buildAndFillInBlockVector(Alien::Move::VectorData& vectorB, for (Integer i = 1; i < value.size(); ++i) b[id][i] = value[i]; } - vectorB = b.release(); } void -AlienTestModule::buildAndFillInBlockVector(Alien::Move::VectorData& vectorB, +AlienTestModule::buildAndFillInBlockVector(Alien::VectorData& vectorB, ConstArrayView allUIndex, ConstArray2View allPIndex, ConstArrayView allXIndex ALIEN_UNUSED_PARAM, ConstArrayView value) { - Alien::Move::LocalBlockVectorWriter b(std::move(vectorB)); + Alien::LocalBlockVectorWriter b(vectorB); ENUMERATE_CELL (icell, m_areaT.own()) { const Integer id = allUIndex[icell->localId()]; b[id][0] = value[0]; @@ -698,33 +681,30 @@ AlienTestModule::buildAndFillInBlockVector(Alien::Move::VectorData& vectorB, const Integer id1 = allPIndex[inode->localId()][1]; b[id1][0] = value[0]; } - vectorB = b.release(); } void -AlienTestModule::buildAndFillInVector(Alien::Move::VectorData& vectorB, const double& value) +AlienTestModule::buildAndFillInVector(Alien::VectorData& vectorB, const double& value) { const Alien::VectorDistribution& dist = vectorB.distribution(); - Alien::Move::LocalVectorWriter v(std::move(vectorB)); + Alien::LocalVectorWriter v(vectorB); info() << "Vector local size= " << v.size(); for (Integer i = 0; i < dist.localSize(); ++i) v[i] = value; - vectorB = v.release(); } void AlienTestModule::buildAndFillInBlockVector( - Alien::Move::VectorData& vectorB, const double& value) + Alien::VectorData& vectorB, const double& value) { const Alien::VectorDistribution& dist = vectorB.distribution(); const Alien::Block* block = vectorB.block(); - Alien::Move::LocalBlockVectorWriter v(std::move(vectorB)); + Alien::LocalBlockVectorWriter v(vectorB); for (Integer i = 0; i < dist.localSize(); ++i) { ArrayView values = v[i]; for (Integer j = 0; j < block->size(); ++j) values[j] = value; } - vectorB = v.release(); } /*---------------------------------------------------------------------------*/ @@ -1074,15 +1054,14 @@ AlienTestModule::fillInMatrix(const CellCellGroup& cell_cell_connection, /*---------------------------------------------------------------------------*/ Alien::SolverStatus -AlienTestModule::solve(Alien::ILinearSolver* solver, Alien::Move::MatrixData& matrixA, - Alien::Move::VectorData& vectorB, Alien::Move::VectorData& vectorX, - AlienTestOptionTypes::eBuilderType builderType) +AlienTestModule::solve(Alien::ILinearSolver* solver, Alien::MatrixData& matrixA, + Alien::VectorData& vectorB, Alien::VectorData& vectorX, + AlienTestOptionTypes::eBuilderType builderType) { { // Réinitialisation de vectorX - Alien::Move::LocalVectorWriter v(std::move(vectorX)); + Alien::LocalVectorWriter v(vectorX); for (Integer i = 0; i < v.size(); ++i) v[i] = 0; - vectorX = v.release(); } solver->solve(matrixA, vectorB, vectorX); @@ -1101,8 +1080,8 @@ AlienTestModule::solve(Alien::ILinearSolver* solver, Alien::Move::MatrixData& ma const VBlock* vblock = vectorB.vblock(); std::shared_ptr alg = solver->algebra(); if (alg) { - Alien::Move::VectorData vectorY(col_space, m_vdist); - Alien::Move::VectorData vectorRes(row_space, m_vdist); + Alien::VectorData vectorY(col_space, m_vdist); + Alien::VectorData vectorRes(row_space, m_vdist); vectorY.setBlockInfos(block); vectorRes.setBlockInfos(block); @@ -1122,8 +1101,8 @@ AlienTestModule::solve(Alien::ILinearSolver* solver, Alien::Move::MatrixData& ma { if (builderType != AlienTestOptionTypes::DirectBuilder) { Alien::SimpleCSRLinearAlgebra testAlg; - Alien::Move::VectorData vectorY(col_space, m_vdist); - Alien::Move::VectorData vectorRes(row_space, m_vdist); + Alien::VectorData vectorY(col_space, m_vdist); + Alien::VectorData vectorRes(row_space, m_vdist); vectorY.setBlockInfos(block); vectorRes.setBlockInfos(block); @@ -1141,8 +1120,8 @@ AlienTestModule::solve(Alien::ILinearSolver* solver, Alien::Move::MatrixData& ma #ifdef ALIEN_USE_PETSC { Alien::PETScLinearAlgebra testAlg; - Alien::Move::VectorData vectorY(col_space, m_vdist); - Alien::Move::VectorData vectorRes(row_space, m_vdist); + Alien::VectorData vectorY(col_space, m_vdist); + Alien::VectorData vectorRes(row_space, m_vdist); vectorY.setBlockInfos(block); vectorRes.setBlockInfos(block); @@ -1171,9 +1150,9 @@ AlienTestModule::checkVectorValues(Alien::IVector& vectorX, const double& value) // const VectorDistribution& dist = vectorX.distribution(); const Block* block = vectorX.impl()->block(); const VBlock* vblock = vectorX.impl()->vblock(); - auto& vx = dynamic_cast(vectorX); + auto& vx = dynamic_cast(vectorX); if (block) { - const Alien::Move::LocalBlockVectorReader v(vx); + const Alien::LocalBlockVectorReader v(vx); for (Integer i = 0; i < m_vdist.localSize(); ++i) { ConstArrayView values = v[i]; for (Integer j = 0; j < block->size(); ++j) { @@ -1184,7 +1163,7 @@ AlienTestModule::checkVectorValues(Alien::IVector& vectorX, const double& value) } else if (vblock) throw FatalErrorException(A_FUNCINFO, "Not implemented yet"); else { - const Alien::Move::LocalVectorReader v(vx); + const Alien::LocalVectorReader v(vx); for (Integer i = 0; i < m_vdist.localSize(); ++i) if (v[i] != value) fatal() << "Incorrect value (" << v[i] << " vs expected 2.)"; @@ -1195,14 +1174,13 @@ AlienTestModule::checkVectorValues(Alien::IVector& vectorX, const double& value) /*---------------------------------------------------------------------------*/ void -AlienTestModule::vectorVariableUpdate(Alien::Move::VectorData& vectorB, +AlienTestModule::vectorVariableUpdate(Alien::VectorData& vectorB, Alien::ArcaneTools::IIndexManager::ScalarIndexSet indexSetU) { /////////////////////////////////////////////////////////////////////////// // // VECTOR / VARIABLE // - // jmg Alien::ItemVectorAccessor v(std::move(vectorB)); { Alien::ArcaneTools::ItemVectorAccessor v(vectorB); if (m_vect_size == 1) { @@ -1218,7 +1196,6 @@ AlienTestModule::vectorVariableUpdate(Alien::Move::VectorData& vectorB, v(indexSetU) = 0.; v(indexSetU) = Alien::ArcaneTools::Variable(m_w); } - // jmg vectorB = v.release(); } } diff --git a/test/AlienTest/AlienTestModule.h b/test/AlienTest/AlienTestModule.h index db21aea..3eb9fef 100644 --- a/test/AlienTest/AlienTestModule.h +++ b/test/AlienTest/AlienTestModule.h @@ -31,13 +31,13 @@ class AlienTestModule : public ArcaneAlienTestObject void test(); private: - void buildAndFillInVector(Alien::Move::VectorData& vectorB, const double& value); + void buildAndFillInVector(Alien::VectorData& vectorB, const double& value); - void buildAndFillInBlockVector(Alien::Move::VectorData& vectorB, const double& value); + void buildAndFillInBlockVector(Alien::VectorData& vectorB, const double& value); - void buildAndFillInBlockVector(Alien::Move::VectorData& vectorB, + void buildAndFillInBlockVector(Alien::VectorData& vectorB, ConstArrayView allXIndex, ConstArrayView value); - void buildAndFillInBlockVector(Alien::Move::VectorData& vectorB, + void buildAndFillInBlockVector(Alien::VectorData& vectorB, ConstArrayView allUIndex, ConstArray2View allPIndex, ConstArrayView allXIndex, ConstArrayView value); @@ -89,12 +89,12 @@ class AlienTestModule : public ArcaneAlienTestObject const Arccore::UniqueArray& allUIndex, const Arccore::UniqueArray& allXIndex, Builder& builder); - Alien::SolverStatus solve(Alien::ILinearSolver* solver, Alien::Move::MatrixData& matrixA, - Alien::Move::VectorData& vectorB, Alien::Move::VectorData& vectorX, + Alien::SolverStatus solve(Alien::ILinearSolver* solver, Alien::MatrixData& matrixA, + Alien::VectorData& vectorB, Alien::VectorData& vectorX, AlienTestOptionTypes::eBuilderType builderType); void vectorVariableUpdate( - Alien::Move::VectorData& vectorB, Alien::ArcaneTools::IIndexManager::Entry indexSetU); + Alien::VectorData& vectorB, Alien::ArcaneTools::IIndexManager::Entry indexSetU); void checkVectorValues(Alien::IVector& VectorX, const double& value); diff --git a/test/Tests/CMakeLists.txt b/test/Tests/CMakeLists.txt index 462ed9c..561bc1f 100644 --- a/test/Tests/CMakeLists.txt +++ b/test/Tests/CMakeLists.txt @@ -1,9 +1,5 @@ add_subdirectory(GTestUnitary) -if (TARGET Alien::alien_semantic_move) - add_subdirectory(MoveSemantic) -endif () - if (TARGET Alien::alien_semantic_ref) add_subdirectory(RefSemantic) endif () diff --git a/test/Tests/MoveSemantic/AlienTest/CMakeLists.txt b/test/Tests/MoveSemantic/AlienTest/CMakeLists.txt deleted file mode 100644 index f48f496..0000000 --- a/test/Tests/MoveSemantic/AlienTest/CMakeLists.txt +++ /dev/null @@ -1,143 +0,0 @@ -find_package(Boost COMPONENTS program_options REQUIRED) - -createExecutable(alien_test.exe) - -addSources(alien_test.exe main.cpp) - -if (TARGET intel) - linkLibraries(alien_test.exe intel) -endif () - -linkLibraries(alien_test.exe - Boost::program_options - Alien::alien_core - Alien::alien_semantic_move - ) - -if (TARGET alien_external_packages) - linkLibraries(alien_test.exe - alien_external_packages - ) -endif () - -if (TARGET alien_ifpen_solvers) - linkLibraries(alien_test.exe - alien_ifpen_solvers - ) -endif () - -target_include_directories(alien_test.exe - PUBLIC ${PROJECT_SOURCE_DIR}/test) - -commit(alien_test.exe) - -install( - TARGETS alien_test.exe - RUNTIME DESTINATION bin -) - -if (TARGET petsc) - alien_test( - BENCH alien.test - NAME petsc - COMMAND alien_test.exe - PROCS 4 - OPTIONS - --nx=10 - --ny=10 - --solver-package=petsc - --solver=bicgs - --precond=bjacobi - --tol=1.e-10 - --max-iter=100 - --builder=1 - ) -endif () - -if (TARGET hypre) - alien_test( - BENCH alien.test - NAME hypre - PROCS 4 - COMMAND alien_test.exe - OPTIONS - --nx=10 - --ny=10 - --solver-package=hypre - --solver=bicgstab - --precond=euclid - --tol=1.e-10 - --max-iter=100 - --builder=1 - ) - alien_test( - BENCH alien.test - NAME hypre.diag - PROCS 4 - COMMAND alien_test.exe - OPTIONS - --nx=10 - --ny=10 - --solver-package=hypre - --solver=bicgstab - --precond=diag - --tol=1.e-10 - --max-iter=100 - --builder=1 - ) -endif () - -if (TARGET ifpsolver) - alien_test( - BENCH alien.test - NAME ifpsolver - PROCS 4 - COMMAND alien_test.exe - OPTIONS - --nx=10 - --ny=10 - --solver-package=ifpsolver - --solver=bicgs - --precond=ilu0 - --tol=1.e-10 - --max-iter=100 - --output-level=1 - --builder=1 - ) -endif () - -if (TARGET mcgsolver) - alien_test( - BENCH alien.test - NAME mcgsolver - PROCS 4 - COMMAND alien_test.exe - OPTIONS - --nx=10 - --ny=10 - --solver-package=mcgsolver - --solver=bicgstab - --precond=none - --tol=1.e-10 - --max-iter=1000 - --kernel=cpu_cblas_bcsr - --output-level=2 - ) -endif () - -if (TARGET mtl) - alien_test( - BENCH alien.test - NAME mtl - COMMAND alien_test.exe - OPTIONS - --nx=10 - --ny=10 - --solver-package=mtlsolver - --solver=bicgstab - --precond=ilu0 - --tol=1.e-10 - --max-iter=100 - --output-level=1 - ) -endif () diff --git a/test/Tests/MoveSemantic/AlienTest/main.cpp b/test/Tests/MoveSemantic/AlienTest/main.cpp deleted file mode 100644 index fbbbb3b..0000000 --- a/test/Tests/MoveSemantic/AlienTest/main.cpp +++ /dev/null @@ -1,224 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include - -int -main(int argc, char** argv) -{ - return Environment::execute(argc, argv, [&] { - - using namespace boost::program_options; - options_description desc; - desc.add_options()("help", "produce help")("file", - value()->default_value("SystemFile.txt"), - "system imput file")("nrows", value()->default_value(0), "nrow")("nx", - value()->default_value(10), "nx")("ny", value()->default_value(10), - "ny")("nbth", value()->default_value(1), "number of threads")( - "solver-package", value()->default_value("petsc"), - "solver package name")("solver", value()->default_value("bicgs"), - "solver algo name")("precond", value()->default_value("none"), - "preconditioner id diag ilu ddml poly")( - "max-iter", value()->default_value(1000), "max iterations")( - "tol", value()->default_value(1.e-10), "solver tolerance")( - "niter", value()->default_value(1), "nb of tests for perf measure")( - "sym", value()->default_value(1), "0->nsym, 1->sym")("kernel", - value()->default_value("mcgkernel"), - "mcgsolver kernel name")("builder", value()->default_value(0), - "matrix builder type 0->direct 1->profile 2->stream")( - "output-level", value()->default_value(0), "output level"); - variables_map vm; - store(parse_command_line(argc, argv, desc), vm); - notify(vm); - - if (vm.count("help")) { - std::cout << desc << "\n"; - return 1; - } - - std::string filename = vm["file"].as(); - int nrows = vm["nrows"].as(); - int nx = vm["nx"].as(); - int ny = vm["ny"].as(); - // int nb_threads = vm["nbth"].as(); - // bool sym = vm["sym"].as() == 1; - int builder_type = vm["builder"].as(); - - auto* trace_mng = Environment::traceMng(); - auto* parallel_mng = Environment::parallelMng(); - - const int comm_rank = parallel_mng->commRank(); - const int comm_size = parallel_mng->commSize(); - - Alien::setTraceMng(trace_mng); - - nrows = nx * ny; - - Alien::VectorDistribution vdist(nrows, parallel_mng); - Alien::MatrixDistribution mdist(nrows, nrows, parallel_mng); - - Alien::Space space(nrows, "TestSpace"); - - Alien::Move::VectorData vectorB(space, vdist); - Alien::Move::VectorData vectorX(space, vdist); - - Alien::Move::MatrixData matrixA(space, mdist); - - int bd = 2; - double fii = 1; - double fij = 1; - double diag = fii + 2 * bd * fij; - double offdiag = fij; - int offset = vdist.offset(); - int local_size = vdist.localSize(); - switch (builder_type) { - case 0: { - Alien::Move::DirectMatrixBuilder builder( - std::move(matrixA), Alien::DirectMatrixOptions::eResetValues); - builder.reserve(5); - builder.allocate(); - for (int irow = offset; irow < offset + local_size; ++irow) { - builder.setData(irow, irow, diag); - for (int j = 1; j < bd; ++j) { - if (irow - j >= 0) - builder.setData(irow, irow - j, -offdiag / j); - if (irow + j < nrows) - builder.setData(irow, irow + j, -offdiag / j); - } - } - builder.finalize(); - matrixA = builder.release(); - } break; - case 1: - default: { - // DEFINE MATRIX PROFILE - Alien::Move::MatrixProfiler profile(std::move(matrixA)); - for (int irow = offset; irow < offset + local_size; ++irow) { - profile.addMatrixEntry(irow, irow); - for (int j = 1; j < bd; ++j) { - if (irow - j >= 0) - profile.addMatrixEntry(irow, irow - j); - if (irow + j < nrows) - profile.addMatrixEntry(irow, irow + j); - } - } - profile.allocate(); - matrixA = profile.release(); - - // FILL MATRIX - Alien::Move::ProfiledMatrixBuilder matrix( - std::move(matrixA), Alien::ProfiledMatrixOptions::eResetValues); - for (int irow = offset; irow < offset + local_size; ++irow) { - matrix(irow, irow) = diag; - for (int j = 1; j < bd; ++j) { - if (irow - j >= 0) - matrix(irow, irow - j) = -offdiag / j; - if (irow + j < nrows) - matrix(irow, irow + j) = -offdiag / j; - } - } - matrix.finalize(); - matrixA = matrix.release(); - } break; - } - - { - Alien::Move::LocalVectorWriter v(std::move(vectorX)); - for (int i = 0; i < vdist.localSize(); ++i) - v[i] = 1; - vectorX = v.release(); - } - double normx_ref = 0; - if (!(builder_type == 0) || comm_size == 1) // le direct builder ne permet pas de - // faire des produits matrix vector en - // parallel - { - Alien::SimpleCSRLinearAlgebra alg; - alg.mult(matrixA, vectorX, vectorB); - double normb = alg.norm2(vectorB); - normx_ref = alg.norm2(vectorX); - if (comm_rank == 0) { - std::cout << "Norme de X : " << normx_ref << std::endl; - std::cout << "Norme de B = A * x : " << normb << std::endl; - std::cout << "CHECK ERROR " << std::abs(normb - 30.2324) << std::endl; - } - assert(std::abs(normb - 30.2324) < 1.e-4); - } else { - Alien::Move::LocalVectorWriter v(std::move(vectorB)); - for (int i = 0; i < vdist.localSize(); ++i) - v[i] = 1; - vectorB = v.release(); - } - - { - Alien::Move::LocalVectorWriter v(std::move(vectorX)); - for (int i = 0; i < vdist.localSize(); ++i) - v[i] = 0; - vectorX = v.release(); - } - - std::shared_ptr solver = Environment::createSolver(vm); - if (solver.get()) { - solver->init(); - solver->solve(matrixA, vectorB, vectorX); - const auto& status = solver->getStatus(); - if (status.succeeded) { - if (comm_rank == 0) { - std::cout << "Solver succeed " << status.succeeded << std::endl; - std::cout << " residual " << status.residual << std::endl; - std::cout << " nb iters " << status.iteration_count << std::endl; - std::cout << " error " << status.error << std::endl; - } - - if (!(builder_type == 0) || comm_size == 1) // le direct builder ne permet pas de - // faire des produits matrix vector en - // parallel - { - Alien::SimpleCSRLinearAlgebra alg; - double normx = alg.norm2(vectorX); - if (comm_rank == 0) { - std::cout << "Norme de X : " << normx << std::endl; - } - - Alien::Move::LocalVectorWriter v(std::move(vectorX)); - for (int i = 0; i < vdist.localSize(); ++i) - v[i] -= 1.; - vectorX = v.release(); - - normx = alg.norm2(vectorX); - double err = normx / normx_ref; - if (comm_rank == 0) { - std::cout << "Relative Error : " << err << std::endl; - } - assert(err < 1.e-10); - } - } else { - if (comm_rank == 0) { - std::cout << "Solver failed " << status.succeeded << std::endl; - std::cout << " error " << status.error << std::endl; - } - } - } else - std::cout << "No solver provided\n"; - - return 0; - }); -} diff --git a/test/Tests/MoveSemantic/CMakeLists.txt b/test/Tests/MoveSemantic/CMakeLists.txt deleted file mode 100644 index b883ea3..0000000 --- a/test/Tests/MoveSemantic/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(AlienTest)