Y padawan/149 refactoring mpsbackendimpl#184
Y padawan/149 refactoring mpsbackendimpl#184YPadawan wants to merge 15 commits intopasqal-io:mainfrom
Conversation
…tter to separate these functions from the mps_backend_impl.py, so that the latter could only contain necessary classes for the effective implementation of the MPS backend.
…hods. It seems that the methods defined in original MPSBackEndImpl were thos of TDVP. But it is not clearly stated. Documentation is lacking
…it_initial_state_default
…or2 is explicitly uploaded in the cpu, because it seems to be on the gpu by default. Still need to investigate
|
Of course all comments and constructive criticism is welcome. There are probably some changes to make. |
|
Another question, I have opened the PR to merge with the main branch, maybe there is another one where merging usually happens ? Before merging with the main branch ? |
There was a problem hiding this comment.
I'm going to keep this open for the time-being, since the work done is good, but I don't think it is finished. The entire point of issue #149 is that the DMRG and TDVP algorithms have significant overlap in terms of their logic. Currently DMRGBackendImpl and TDVPBackendImpl do not share any code in their progress method, and the point was to implement the current class structure, and then share as much of the logic in the respective progress methods in MPSBackendImpl, which requires refactoring mainly of the logic in TDVPBackendImpl.
|
Ok. I was waiting for an aswer on this. I can keep working on this issue. I can move all common behaviors to the base class. I will make the changes and commit them. Until the code is good for merging. |
…f_update are in the base class and these methods are used in all child classes, tests in test_mps_backend_impl.py pass
…Impl (they were temporary...)
|
Hello ! |
This PR is being opened in order to solve issue #149. Several of the required refactoring has been done. But there are still some doubts and there are still some details to check before eventually merging.
MPSBackendImplBaseis now an abstract base class wheresweep_completeandprogressare abstract methodsTDVPBackendImplhas been implemented with the sweep_complete and progress methods that were previously inMPSBackendImplBase. Comments indicated that it was TDVP, but it needs to be confirmedNoisyMPSBackendImplhas becomeNoisyTDVPBackendImpl, inheriting fromTDVPBackendImpland overriding sweep_completeIn addition to this a new module named permutators.py has been created where all functions making permutations were transferred for clarity purposes. Only backend classes remain in mps_backend_impl.py. Maybe more refactoring should be considered.
Documentation is still lacking, but can be done before merging.
Tests of test_mps_backend_impl.py are running and all of them pass. But a change has been made in L307 of this file, because the two tensors that were being compared were located in different places, one was in the cpu the second in the gpu. In L307, the relevant tensor is explicitly sent to the cpu (for now). This might be a local problem, or it might have something to do with the test itself. It needs investigating.
When testing all other test files, apart from those that took too long to run almost all of them passed for emu_mps. There was one failure that should be mentioned in here:
test_solver_utils.py::test_evolve_pair
the torch.allclose failed. (It should be out of scope of the issue).