Alphaharrius / Zipper.jl

Implementation of Zipper Entanglement Renormalization on Julia platform.
GNU General Public License v3.0
1 stars 0 forks source link

Memorized API fails when memorized function is called by multiple threads. #13

Closed Alphaharrius closed 8 months ago

Alphaharrius commented 8 months ago

The memorized API uses Zipper.MEMORIZED::Dict which is not thread safe by default, error will be thrown when a memorized function is called since there will be concurrent write attempts to Zipper.MEMORIZED.

Detailed error message: AssertionError: Multiple concurrent writes to Dict detected!.

Alphaharrius commented 8 months ago

Another issue during checking if Mode is memoizable, it seems k points from different MomentumSpace will be hashed to the same value if vec(k) is the same even if getspace(k) is not.

Alphaharrius commented 8 months ago

We cannot add @memoize to Mode(::Dict) because Offset from different RealSpace of the same euclidean point currently hash to the same value and equals to each other, thus some Mode will be degenerate and the memoization will give a 'different' Mode for a given input value.

Alphaharrius commented 8 months ago

We will leave the @memoization application issues to later fixes, but the issue about the Momentum is included within this fix as it is crucial for some memoized method to work properly.