From 1505062cbb5064eacdc5b8c3f2fa0d00f3980f61 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 2 Apr 2024 11:54:42 +0200 Subject: [PATCH] Implementation details --- Manuscript/stochastic_triples.tex | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Manuscript/stochastic_triples.tex b/Manuscript/stochastic_triples.tex index 72add4c..6c09f13 100644 --- a/Manuscript/stochastic_triples.tex +++ b/Manuscript/stochastic_triples.tex @@ -176,7 +176,7 @@ multiplications,\cite{form_w_abc} which are among the most efficient operations executed on modern CPUs and accelerators.\cite{ma_2011,haidar_2015,dinapoli_2014,springer_2018} -In the algorithm proposed by Rendell\cite{rendell_1991}, for each given triplet $(abc)$, the sub-tensors $W_{ijk}(abc)$ and $V_{ijk}(abc)$ are computed and immediately utilized to calculate their contribution to $E_{ijk}(abc)$. Here, we propose a similar approach but introduce a semi-stochastic algorithm to randomly select the triplets $(abc)$, circumventing the need to compute all contributions. +In the algorithm proposed by Rendell\cite{rendell_1991}, for each given triplet $(abc)$, the sub-tensors $W^{abc}$ and $V^{abc}$ are computed and immediately utilized to calculate their contribution to $E^{abc}$. Here, we propose a similar approach but introduce a semi-stochastic algorithm to randomly select the triplets $(abc)$, circumventing the need to compute all contributions. %=================================================================% \section{Semi-Stochastic Algorithm} @@ -206,6 +206,23 @@ In the algorithm proposed by Rendell\cite{rendell_1991}, for each given triplet The algorithm was implemented in the \textsc{Quantum Package} software. \cite{garniron_2019} +The stochastic algorithm is implemented using OpenMP tasks, where each task +consists in the computation of a single component $E^{abc}$. +The computation of the running average and statistical error is executed every second, +for printing or for exiting when the statistical error gets below a given threshold. + +The number of samples $N^{abc}$ of each triplet $(abc)$ is initialized to $-1$, to identify +the contributions that have not been already computed. +An outer \emph{for} loop runs over the maximum number of iteration, equal to +$N_{abc}$, the number of different triplets $(abc)$. + +Within a loop iteration, the index of the first non-computed triplet $(abc)$ is identified, and the task associated with its computation is sent to the task queue. +As this triplet has never been drawn, $N^{abc}$ is set to zero. +Then, a triplet $(abc)$ is drawn randomly. +If the $E^{abc}$ has not been computed (identified by $N^{abc}=-1$), the number of samples is set to zero and the task for the computation of this contribution is enqueued. +In any case, $N^{abc}$ is then incremented. + + %a. Description of the computational framework and software used %b. Discussion of any specific optimizations or parallelization techniques employed