tnl-dev issueshttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues2021-12-09T02:00:34Zhttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/93Refactor parameters for linear solvers2021-12-09T02:00:34ZJakub KlinkovskýRefactor parameters for linear solvers- It is not sufficient to create an empty `ParameterContainer`, set a few parameters and pass it to some class -- the user also needs to create a `ConfigDescription` and call `configSetup` on all classes where they want to pass the conta...- It is not sufficient to create an empty `ParameterContainer`, set a few parameters and pass it to some class -- the user also needs to create a `ConfigDescription` and call `configSetup` on all classes where they want to pass the container.
- The user should not be forced to deal with default values. Default values should be taken implicitly when the parameter is missing in the `ParameterContainer`. There are functions like `checkParameter`, `checkParameters` and `checkParameterType`, but they are sparsely used. Most often `getParameter` is called and the program crashes if the parameter is missing.
- The `configSetup` functions are not intuitive, they cannot be used to build a hierarchy. For example, `GMRES::configSetup` does not call `configSetup` from its base class, and even the base class does not call `configSetup` from its base-base-class, so the user needs to call `configSetup` from 3 levels manually, even if they just want to configure _one_ linear solver.
- The parameter `convergence-residue` is set to 0 by default, so the linear solvers will practically never converge by default.Jakub KlinkovskýJakub Klinkovskýhttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/26Code revision2021-12-08T23:24:11ZTomáš OberhuberCode revisionTODO list for the code revison:
* renaming _impl.h files to .hpp
* change boolean return type to exception throwing
- [x] fix exception catching by-reference: #29
- [x] use `ASSERT_NO_THROW( map.save( "multimap-test.tnl" ) );` ins...TODO list for the code revison:
* renaming _impl.h files to .hpp
* change boolean return type to exception throwing
- [x] fix exception catching by-reference: #29
- [x] use `ASSERT_NO_THROW( map.save( "multimap-test.tnl" ) );` instead of `ASSERT_TRUE( map.save( "multimap-test.tnl" ) );` etc. in tests (see https://github.com/google/googletest/blob/master/googletest/docs/advanced.md#exception-assertions)
* change boolean flag style parameters into enum class
* use operators << and >> insteal of File.read and File.write where it makes sense
* [x] add exception `NotImplementedError` and use it instead of codes like this:
```cpp
std::cerr << "Type conversion during saving is not implemented for MIC." << std::endl;
abort();
```
Or this:
```cpp
TNL_ASSERT( false, std::cerr << "TODO: implement" );
```
* [x] Documentation: indicate which functions/methods throw which exceptions
* Remove useless types from the public interface of classes:
- [x] `ThisType` - useless for the outside of the class, and the implementation of methods can simply use the class name
* [x] switch to C++14
----
- [x] String
- [x] Timer
- [x] Object
- [x] change bool save and load to void
- [x] File
- [x] Update examples, add data conversion.
- [x] use TransferBufferSize from Devices::Cuda
- [x] Remove `File::Mode` enum, use [std::ios_base::openmode](https://en.cppreference.com/w/cpp/io/ios_base/openmode) directly
- [x] Remove specific exceptions (`ArrayWrongSize`, `MeshFunctionDataMismatch`, `NotTNLFile`, `ObjectTypeDetectionFailure`, `ObjectTypeMismatch`) - all `save`/`load` methods should throw only `FileSerializationError`/`FileDeserializationError`
- [x] FileName
- [x] Array
- [x] Add method for setting array elements using lambda function
- [x] Copy constructor have to make deep copy - DOES NOT WORK with MultiMap yet
- [x] Add copy constructors from `std::list`, `std::vector` and `std::initializer_list`
- [x] Replace bind methods with ArrayView - after refactoring MeshFunction
- [x] Avoid binding in `Array( const Array&, const Index begin, const Index size );`
- [x] Remove `boundLoad` (used only in `Array` and derived objects, loading via `ArrayView` can be used instead: `array.getView().load( file );`)
- [x] Use `operator<<` and `operator>>` instead of `save` and `load` methods
- [x] Delete `operator bool ()`
- [x] ArrayView
- [x] what about `__cuda_callable__` ArrayView assignment?
- [x] Use `operator<<` and `operator>>` instead of `save` and `load` methods
- [x] StaticVector
- [x] Replace all for loops with static loops, i.e. templated for
- [x] u * v should not be dot product but element-wisi multiplication
- [x] use (u,v) for dot product
- [x] Vector
- [x] `Vector` should have the same serialization type as `Array` so that arrays can be loaded into vectors and vice versa
- [x] Delete methods for vector operations which are used in linear solvers - the replacement in the solvers must be tested carefuly
- [x] Implement DistributedVectorExpressions and DistributedVectorViewExpressions
- [x] On some places the method getView() is used because DistributedVectorExpressions are not implemented yet (mainly linear solvers and BLAS benchmark) - all occurences can be deleted later
- [x] Add constructor from expression template
- [x] Remove MultiVector and MultiArray - after refactoring Cameo - summer 2019
- [x] Parallel reduction
- [x] Use auto in lambdas to avoid volatileReduction - it does not work with CUDA 10.0
- [x] Rewrite multi-reduction with lambdas
- [x] ConfigDescription
- [x] ParameterContainer
- allow any types (currently only `int`, `double`, `bool`, `String`)
- allow easy instantiation without the command-line parser (e.g. to pass a dict from python)
- exceptions when accessing unknown parameters
- [x] Logger
- moved to https://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/98
- [x] Pointers
- moved to https://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/97
- [x] Matrices
- [x] fix getSerializationType the same way as in Array
- [x] rename the method setCompressedRowLengths to setRowCapacities
- [x] implement sparse matrices using Segments
- [x] implement CSR matrix and Ellpack matrix using the Segments, use existing unit tests for debugging
- [ ] implement set/addRow using VectorView and lambda functions
- [x] implement "Lambda matrix" - the element values are given by a lambda function
- [x] implement constructor from initializer list to DenseMatrix
- [x] implement method for setting elements from initializer list to sparse matrix
- [x] implement constructor and method for setting elements from std::map similar to initializer list to sparse matrix
- [ ] update dense matrix multiplication with the new dense matrix implementation
- [ ] update dense matrix transposition with the new dense matrix implementation
- [x] move methods for matrux coloring outside the matrices
- [ ] finish DenseMatrixView::getRowVectorProduct
- [x] implement opertor == for matrices
- [x] Add constructor of matrix views from vector views
- [x] Allocators
- moved to !33https://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/86PyTNL works with legacy matrix implementation2021-10-01T12:20:07ZTomáš OberhuberPyTNL works with legacy matrix implementationJakub KlinkovskýJakub Klinkovskýhttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/87Scan only allows vector type2021-08-11T17:13:50ZXuan Thang NguyenScan only allows vector typeScan< Devices::Cuda, Type >::perform only allows vector types but not array.
The main issue seems to be mismatch of type alias, in scan `using RealType = typename Vector::RealType;` is declared.
vector uses the alias `using RealType = ...Scan< Devices::Cuda, Type >::perform only allows vector types but not array.
The main issue seems to be mismatch of type alias, in scan `using RealType = typename Vector::RealType;` is declared.
vector uses the alias `using RealType = Real;`
but
array uses the alias `using ValueType = Value;`
For usage, both mean the same thing but are named differently.
Refactoring of internal type alias should solve the problem.Jakub KlinkovskýJakub Klinkovskýhttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/72Simplify interface of loadDistributedMesh and distributeMesh2021-07-01T06:55:30ZJakub KlinkovskýSimplify interface of loadDistributedMesh and distributeMeshThe `loadDistributedMesh` and `distributeMesh` functions were written specifically for the distributed grid, but they don't match the interface of the general distributed mesh.
- only the distributed mesh should be passed to `loadDistri...The `loadDistributedMesh` and `distributeMesh` functions were written specifically for the distributed grid, but they don't match the interface of the general distributed mesh.
- only the distributed mesh should be passed to `loadDistributedMesh`, the local mesh can be obtained with `mesh.getLocalMesh()` (at least for the distributed mesh, distributed grid has an inverse relation with the local grid)
- `distributeMesh` should not be used at all with a general distributed mesh (decomposition is done by `tnl-decompose-mesh`, then it is loaded with `PVTUReader`). Try to merge `distributeMesh` for grids with the overload of `loadDistributedMesh` for grids.Jakub KlinkovskýJakub Klinkovskýhttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/52Meshes todo list2020-07-30T12:54:42ZJakub KlinkovskýMeshes todo list- [x] write tests for `Mesh` traverser
- [x] rewrite `Traverser` using `ParallelFor`
- [x] writer for the XML-based VTK format: see #6
- [x] big mesh refactoring
- mesh pointer added to `MeshEntity`, all topology accessors redirected...- [x] write tests for `Mesh` traverser
- [x] rewrite `Traverser` using `ParallelFor`
- [x] writer for the XML-based VTK format: see #6
- [x] big mesh refactoring
- mesh pointer added to `MeshEntity`, all topology accessors redirected through it to the mesh
- storage of points and subentity orientations moved from `MeshEntity` to `Mesh`
- removed `MeshEntityIndex` - `MeshEntity` always stores its index as the `GlobalIndexType`
- removed entity storage from Mesh - mesh entities can be generated on the fly
- some minor related simplifications, mainly in the mesh initializer
- remove `entityStorage` from the mesh configuration
- [x] `TypeResolver`: `resolveMeshType`, `loadMesh`, `decomposeMesh`:
- [x] better detection of the format (currently based on the file name suffix) (solved by the manual override option)
- [x] file detection is done twice: once for `resolveMeshType`, then again for `loadMesh`
- [x] refactor `MeshFunction` - implement `MeshFunctionView`
- [x] implement `tnl-decompose-mesh` (wrapper tool using Metis)
- [x] output `.pvtu` file
- [x] generate overlaps (ghost cells) for use in `DistributedMesh`
- [x] mesh entity tags
- we need to store at least boundary and ghost entity tags - use bitfield array similar to VTK
- if possible, implement a general interface for user tags (could be stored in the same array, but users would have to respect the boundary and ghost bits)
- [x] implement `PVTUReader`
- [x] implement `DistributedMesh`
- wrapper around `Mesh` - includes local and ghost entities, which are differentiated by a tag
- mapping from local to global indices is easy - separate index arrays (or just for ghost entities, if they are ordered after the local entities - then rank offsets is sufficient for local entities)
- the local mesh should be worked with using local indices (`getEntity`, `getSubentityIndex`, `getSuperentityIndex` etc.), because mapping from global indices to local indices is not easy (ghost entities may be discontinuous, mapping by rank offsets is impossible)
- local index mappings (index arrays for efficient iteration):
- `ghosts`
- `local`
- `ghostNeighbours` (entities which are ghosts on other ranks - for synchronization)
- `localInternal` (not ghosts on any ranks)
- `boundary` (boundary of the local mesh (including overlaps))
- `interior` (interior of the local mesh (including overlaps))
- local mesh decompositions: `all = local + ghosts`, `local = ghostNeighbours + localInternal`, `all = boundary + interior`
- [x] write tests
- [x] implement `DistributedMeshSynchronizer`
- [x] write tests
- [x] implement `forAll`, `forBoundary`, `forInterior` methods like in `NDArray`; also `forLocal`, `forGhost` (lambda function takes just the index, mesh access has to be handled manually)Jakub KlinkovskýJakub Klinkovskýhttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/10MPI todo list2020-03-28T09:16:19ZJakub KlinkovskýMPI todo listGeneral:
- [x] runtime detection of CUDA-aware MPI
- [x] detection of MPI in cmake using FindMPI (and make it work nice with CUDA...)
- [ ] check that MPI implementation is thread-safe: https://stackoverflow.com/a/11074516
- ~~build con...General:
- [x] runtime detection of CUDA-aware MPI
- [x] detection of MPI in cmake using FindMPI (and make it work nice with CUDA...)
- [ ] check that MPI implementation is thread-safe: https://stackoverflow.com/a/11074516
- ~~build config tags for communicators?~~ (no, communicators will be eventually polymorphic types and their instances will be passed to the data structures)
JK:
- see how `DistributedMesh` is used - correctly it should have a `Communicator` template parameter, but it would propagate to `Grid` (due to its `distrGrid` pointer) and specializations involving grids
- `PDEProblem.h` has `CommunicatorType` and `DistributedMeshType` (they should be combined)Jakub KlinkovskýJakub Klinkovskýhttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/11Refactor VectorFieldVTKWriter and VectorFieldGnuplotWriter2019-11-08T14:49:40ZJakub KlinkovskýRefactor VectorFieldVTKWriter and VectorFieldGnuplotWriterThe [VectorFieldVTKWriter](https://jlk.fjfi.cvut.cz/gitlab/mmg/tnl-dev/blob/develop/src/TNL/Functions/VectorFieldVTKWriter.h) and [VectorFieldGnuplotWriter](https://jlk.fjfi.cvut.cz/gitlab/mmg/tnl-dev/blob/develop/src/TNL/Functions/Vecto...The [VectorFieldVTKWriter](https://jlk.fjfi.cvut.cz/gitlab/mmg/tnl-dev/blob/develop/src/TNL/Functions/VectorFieldVTKWriter.h) and [VectorFieldGnuplotWriter](https://jlk.fjfi.cvut.cz/gitlab/mmg/tnl-dev/blob/develop/src/TNL/Functions/VectorFieldGnuplotWriter.h) classes should be refactored analogically to [MeshFunctionVTKWriter](https://jlk.fjfi.cvut.cz/gitlab/mmg/tnl-dev/blob/develop/src/TNL/Functions/MeshFunctionVTKWriter.h) and [MeshFunctionGnuplotWriter](https://jlk.fjfi.cvut.cz/gitlab/mmg/tnl-dev/blob/develop/src/TNL/Functions/MeshFunctionGnuplotWriter.h).Jakub KlinkovskýJakub Klinkovskýhttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/46Remove getType() methods2019-11-08T14:49:39ZJakub KlinkovskýRemove getType() methodsThey are not necessary, because `std::type_info::name` either returns a human-readable string (MSVC, IBM, Oracle) or can be demangled (GCC, Clang). See https://en.cppreference.com/w/cpp/types/type_info/nameThey are not necessary, because `std::type_info::name` either returns a human-readable string (MSVC, IBM, Oracle) or can be demangled (GCC, Clang). See https://en.cppreference.com/w/cpp/types/type_info/nameJakub KlinkovskýJakub Klinkovskýhttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/49Rename prefix sum methods in vectors to scan2019-11-08T14:49:39ZJakub KlinkovskýRename prefix sum methods in vectors to scanThe former `PrefixSum` class was renamed to `Scan`, but the methods in vector classes (`Vector`, `VectorView`, `DistributedVector` and `DistributedVectorView`) stayed as `prefixSum` and `segmentedPrefixSum` - see e.g. https://mmg-gitlab....The former `PrefixSum` class was renamed to `Scan`, but the methods in vector classes (`Vector`, `VectorView`, `DistributedVector` and `DistributedVectorView`) stayed as `prefixSum` and `segmentedPrefixSum` - see e.g. https://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/blob/develop/src/TNL/Containers/Vector.h#L269
While we're renaming things, `exclusiveScan` method should be added as a shortcut for `vector.template scan< TNL::Containers::Algorithms::ScanType::Exclusive >()`. Both methods should be used in the [tutorial](https://mmg-gitlab.fjfi.cvut.cz/doc/tnl/tutorial_03_reduction.html#flexible_scan).Jakub KlinkovskýJakub Klinkovskýhttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/14Rename Timer::stop() to Timer::pause()2019-03-04T20:49:05ZTomáš OberhuberRename Timer::stop() to Timer::pause()Changing the method name from stop() to pause() might be more intuitive.Changing the method name from stop() to pause() might be more intuitive.https://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/15Fix neighbors directions in distributed grid2019-01-25T08:59:54ZTomáš OberhuberFix neighbors directions in distributed gridChange directions for referring neighbors in distributed grid as:
- x -> Left, Right
- y -> Bottom,Top
- z -> Rear, FrontChange directions for referring neighbors in distributed grid as:
- x -> Left, Right
- y -> Bottom,Top
- z -> Rear, FrontVít HanousekVít Hanousekhttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/7Fixed Bug in DistributedGridSynchronizer2018-12-24T13:10:49ZVít HanousekFixed Bug in DistributedGridSynchronizerAfter Tomas's refactorization in commit:
https://jlk.fjfi.cvut.cz/gitlab/mmg/tnl-dev/commit/b373967c9f8d108cd12b61a39d502ecbad8403c1#4e57955fa29093af7da385587705802a7e1c7f81
Test GPUDistributedGridIOTest cannot be compiled (nvcc).
It ...After Tomas's refactorization in commit:
https://jlk.fjfi.cvut.cz/gitlab/mmg/tnl-dev/commit/b373967c9f8d108cd12b61a39d502ecbad8403c1#4e57955fa29093af7da385587705802a7e1c7f81
Test GPUDistributedGridIOTest cannot be compiled (nvcc).
It was fixed by partial revert of refactorization in commit:
https://jlk.fjfi.cvut.cz/gitlab/mmg/tnl-dev/commit/68d3e703452944a5d08d1cb0dc8336eb02e90722
Issue is to find why nvcc has in this Test (only) problem with Tomas's code.https://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/18Templated constructor of String should be deleted2018-12-20T20:44:06ZJakub KlinkovskýTemplated constructor of String should be deletedThe following discussions from !10 should be addressed:
- [x] @klinkovsky started a [discussion](https://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/merge_requests/10#note_124): (+1 comment)
> This should be a free function, not a ...The following discussions from !10 should be addressed:
- [x] @klinkovsky started a [discussion](https://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/merge_requests/10#note_124): (+1 comment)
> This should be a free function, not a constructor (note that there is already `convertToString` which is overloaded for `bool`). At the very least the constructor should be explicit.
- [x] @klinkovsky started a [discussion](https://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/merge_requests/10#note_125): (+1 comment)
> The recursion should be avoided by deleting the templated constructor and using the free function `convertToString` explicitly instead. It can be renamed to `toString` or something like that to make it shorter, c.f. [std::to_string](https://en.cppreference.com/w/cpp/string/basic_string/to_string).Jakub KlinkovskýJakub Klinkovskýhttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/23Probably useless parameter in benchmarkArrayOperations2018-12-20T19:51:12ZTomáš OberhuberProbably useless parameter in benchmarkArrayOperationsThe parameter ```loops``` in Benchmarks/array-operations.h:26
```C++
benchmarkArrayOperations( Benchmark & benchmark,
const int & loops,
const long & size )
```
seems to be useless.The parameter ```loops``` in Benchmarks/array-operations.h:26
```C++
benchmarkArrayOperations( Benchmark & benchmark,
const int & loops,
const long & size )
```
seems to be useless.Jakub KlinkovskýJakub Klinkovskýhttps://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/20Using RealType (int, long, float, double, ...) when dividing2018-12-13T21:48:44ZLukáš Matthew ČejkaUsing RealType (int, long, float, double, ...) when dividingIn [ChunkedEllpack_imlp.h](https://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/blob/develop/src/TNL/Matrices/ChunkedEllpack_impl.h) on lines 177 - 186:
```c
/****
* Compute the chunk size
*/
IndexType maxChunkInSlice( 0 );
...In [ChunkedEllpack_imlp.h](https://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/blob/develop/src/TNL/Matrices/ChunkedEllpack_impl.h) on lines 177 - 186:
```c
/****
* Compute the chunk size
*/
IndexType maxChunkInSlice( 0 );
for( IndexType i = sliceBegin; i < sliceEnd; i++ )
maxChunkInSlice = max( maxChunkInSlice,
ceil( ( RealType ) rowLengths[ i ] /
( RealType ) this->rowToChunkMapping[ i ] ) );
TNL_ASSERT( maxChunkInSlice > 0,
std::cerr << " maxChunkInSlice = " << maxChunkInSlice << std::endl );
```
Casting to RealType is used in the ceil function and then the variables are divided.
In the case of RealType being int, this will cause **integer division**, and could possibly return 0, even though ceil() is type double.
Should the variables be cast to Double instead to avoid this?https://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/3Delete TypeInfo.h2018-09-19T09:31:03ZJakub KlinkovskýDelete TypeInfo.hThe [TypeInfo.h](https://jlk.fjfi.cvut.cz/gitlab/mmg/tnl-dev/blob/develop/src/TNL/TypeInfo.h) file is completely useless, use [std::numeric_limits](http://en.cppreference.com/w/cpp/types/numeric_limits) instead.The [TypeInfo.h](https://jlk.fjfi.cvut.cz/gitlab/mmg/tnl-dev/blob/develop/src/TNL/TypeInfo.h) file is completely useless, use [std::numeric_limits](http://en.cppreference.com/w/cpp/types/numeric_limits) instead.Tomáš OberhuberTomáš Oberhuber