\documentclass[]{standalone}
\input{config-gfx}

% deeprleddy-gcc-open-dnnl,deeprleddy-gcc-open-libtorch,deeprleddy-gcc-open-pytorch,deeprleddy-gcc-mkl-dnnl
% subgridles-gcc-open-cpp,subgridles-gcc-open-fortran,subgridles-gcc-open-libtorch,subgridles-gcc-open-pytorch,subgridles-gcc-mkl-cpp,subgridles-gcc-mkl-fortran

\begin{document}
\def\axisdefaultwidth{10cm}
\def\axisdefaultheight{7cm}
%% read data
\pgfplotstableread[col sep=comma, header=true, read completely=true]{outputs_runtime_measurement.csv}\outputsTable  %cf. _nonpinned
\begin{tikzpicture}
  \begin{loglogaxis}[
      scalingplot,
      xlabel=Number of Input Elements (10 input features per element),
      ylabel=Run Time per Inference Step,
      y unit=\si{\second},
      ymin=1e-6,
      ymax=7,
      xmax=2097152,
    ]
    % \foreach \c [count=\x from 0] in { subgridles-gcc-open-cpp,subgridles-gcc-open-fortran,subgridles-gcc-open-libtorch,subgridles-gcc-open-pytorch,subgridles-gcc-mkl-cpp,subgridles-gcc-mkl-fortran}
    %     {\addplot+ table[y expr=\thisrow{\c}] {\outputsTable};\addlegendentry{\c{}};}
    \addplot[pytorch] table[y expr=\thisrow{subgridles-intel-mkl-pytorch}] {\outputsTable};\label{plot:pytorch}
    \addlegendentry{\torchpython};
    \addplot[libtorch] table[y expr=\thisrow{subgridles-intel-open-libtorch}] {\outputsTable};\label{plot:libtorch}
    \addlegendentry{\torchcpp};
    \addplot[cpp-open] table[y expr=\thisrow{subgridles-intel-open-cpp}] {\outputsTable};\label{plot:opencpp}
    \addlegendentry{\opencpp};
    \addplot[fortran-open] table[y expr=\thisrow{subgridles-intel-open-fortran}] {\outputsTable};\label{plot:openfortran}
    \addlegendentry{\openfortran};
    \addplot[cpp-mkl] table[y expr=\thisrow{subgridles-intel-mkl-cpp}] {\outputsTable};\addlegendentry{\mklcpp};\label{plot:mklcpp}
    \addplot[fortran-mkl] table[y expr=\thisrow{subgridles-intel-mkl-fortran}] {\outputsTable};\addlegendentry{\mklfortran};\label{plot:mklfortran}
    % have a function plot for linear slope
    \addplot+ [linear,domain=1:2097152] {x/10000000};
  \coordinate[xshift=10ex](legendpos) at (470, 0.0000045);
\end{loglogaxis}
  \matrix[
    matrix of nodes,
    % anchor=west,
    draw,
    inner sep=0.2em,
    nodes={font=\footnotesize},
    fill=white,
  ]at(legendpos)
  {
    \ref{plot:pytorch} \ref{plot:libtorch} & without \dalotia{}         & [5pt]\\
    \ref{plot:opencpp} \ref{plot:openfortran} \ref{plot:mklcpp} \ref{plot:mklfortran} & with \dalotia{}           & [5pt]\\
    };
\end{tikzpicture}
\end{document}
