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

\begin{document}
\def\axisdefaultwidth{10cm}
\def\axisdefaultheight{7cm}
% y axis transformation: linear up to 0.001, then logarithmic
\pgfmathdeclarefunction{hybridY}{1}{%
  \pgfmathparse{(#1 <= 0.001) ? (#1) : (log10(#1/0.001) + 0.001)}%
}
%% read data
\pgfplotstableread[col sep=comma, header=true, read completely=true]{outputs_runtime_parallel.csv}\outputsTable
\begin{tikzpicture}
  \begin{axis}[
      grid=both,
      table/x=num-threads,
      ymode=log,
      xmode=linear,
      xlabel=Number of Cores/Number of Threads (\num{32} Inputs per Core),
      ylabel=Run Time per Inference Step,
      y unit=\si{\second},
      ymin=0.0003,
      ymax=0.1,
      xmin=1,
      xmax=48,
      mark=none,
      legend pos=north east,
    ]
    % \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={deeprleddy-intel-mkl-pytorch}] {\outputsTable};\label{plot:pytorch}
    \addlegendentry{\torchpython};
    \addplot[libtorch] table[y={deeprleddy-intel-open-libtorch}] {\outputsTable};\label{plot:libtorch}
    \addlegendentry{\torchcpp};
    % \addplot[dnnl-open] table[y expr=(\thisrow{deeprleddy-intel-open-dnnl})] {\outputsTable};\label{plot:onednnopen}
    % \addlegendentry{\onednnopen};
    \addplot[dnnl-mkl] table[y={deeprleddy-intel-mkl-dnnl}] {\outputsTable};\label{plot:onednnmkl}
    \addlegendentry{\onednnmkl};
    \addplot[fortran-only] table[y={deeprleddy-intel-open-fortran}] {\outputsTable};\label{plot:fortran}
    \addlegendentry{\fortran};
    % have a function plot for linear slope
    \addplot+ [linear,domain=1:48] {0.00035};
    \addlegendentry{Ideal Scaling};
  \coordinate[xshift=10ex](legendpos) at (9, 0.003);
  % % --- add axis break marker ---
  % \draw [thick] (axis cs:0.8,0.001) -- ++(0.1,0.002) -- ++(-0.1,0.002);
\end{axis}
  \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:onednnmkl} \ref{plot:fortran} & with \dalotia{}           & [5pt]\\
    };
\end{tikzpicture}
\end{document}
